blob: ca11beae65f48466e7a8de2bd4f53bda0ccc6525 [file] [log] [blame]
Iliyan Malchev202a77d2012-06-11 14:41:12 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
Arun Kumar K.R6c85f052014-01-21 21:47:41 -08003 * Copyright (c) 2010-2014 The Linux Foundation. All rights reserved.
Iliyan Malchev202a77d2012-06-11 14:41:12 -07004 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#include <sys/mman.h>
19
Iliyan Malchev202a77d2012-06-11 14:41:12 -070020#include <cutils/log.h>
21#include <cutils/properties.h>
Naseer Ahmed29a26812012-06-14 00:56:20 -070022#include <dlfcn.h>
Iliyan Malchev202a77d2012-06-11 14:41:12 -070023
24#include <hardware/hardware.h>
Iliyan Malchev202a77d2012-06-11 14:41:12 -070025
26#include <fcntl.h>
27#include <errno.h>
28#include <sys/ioctl.h>
29#include <string.h>
30#include <stdlib.h>
31#include <pthread.h>
Iliyan Malchev202a77d2012-06-11 14:41:12 -070032#include <cutils/atomic.h>
33
34#include <linux/fb.h>
35#include <linux/msm_mdp.h>
36
37#include <GLES/gl.h>
38
39#include "gralloc_priv.h"
Naseer Ahmed29a26812012-06-14 00:56:20 -070040#include "fb_priv.h"
Iliyan Malchev202a77d2012-06-11 14:41:12 -070041#include "gr.h"
Iliyan Malchev202a77d2012-06-11 14:41:12 -070042#include <cutils/properties.h>
Naseer Ahmeda87da602012-07-01 23:54:19 -070043#include <profiler.h>
Iliyan Malchev202a77d2012-06-11 14:41:12 -070044
Iliyan Malchev202a77d2012-06-11 14:41:12 -070045#define EVEN_OUT(x) if (x & 0x0001) {x--;}
Iliyan Malchev202a77d2012-06-11 14:41:12 -070046/** min of int a, b */
47static inline int min(int a, int b) {
48 return (a<b) ? a : b;
49}
50/** max of int a, b */
51static inline int max(int a, int b) {
52 return (a>b) ? a : b;
53}
Iliyan Malchev202a77d2012-06-11 14:41:12 -070054
Iliyan Malchev202a77d2012-06-11 14:41:12 -070055enum {
56 PAGE_FLIP = 0x00000001,
Iliyan Malchev202a77d2012-06-11 14:41:12 -070057};
58
59struct fb_context_t {
60 framebuffer_device_t device;
61};
62
Iliyan Malchev202a77d2012-06-11 14:41:12 -070063
64static int fb_setSwapInterval(struct framebuffer_device_t* dev,
Naseer Ahmed29a26812012-06-14 00:56:20 -070065 int interval)
Iliyan Malchev202a77d2012-06-11 14:41:12 -070066{
Naseer Ahmed30621ab2012-06-25 15:37:21 -070067 //XXX: Get the value here and implement along with
68 //single vsync in HWC
Iliyan Malchev202a77d2012-06-11 14:41:12 -070069 char pval[PROPERTY_VALUE_MAX];
Naseer Ahmed29a26812012-06-14 00:56:20 -070070 property_get("debug.egl.swapinterval", pval, "-1");
Iliyan Malchev202a77d2012-06-11 14:41:12 -070071 int property_interval = atoi(pval);
72 if (property_interval >= 0)
73 interval = property_interval;
74
Iliyan Malchev202a77d2012-06-11 14:41:12 -070075 private_module_t* m = reinterpret_cast<private_module_t*>(
Naseer Ahmed29a26812012-06-14 00:56:20 -070076 dev->common.module);
Iliyan Malchev202a77d2012-06-11 14:41:12 -070077 if (interval < dev->minSwapInterval || interval > dev->maxSwapInterval)
78 return -EINVAL;
79
80 m->swapInterval = interval;
81 return 0;
82}
83
Iliyan Malchev202a77d2012-06-11 14:41:12 -070084static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
85{
Naseer Ahmed00fd6a52012-07-03 21:23:12 -070086 private_module_t* m =
87 reinterpret_cast<private_module_t*>(dev->common.module);
Naseer Ahmed47aa15e2013-04-10 21:27:09 -040088 private_handle_t *hnd = static_cast<private_handle_t*>
89 (const_cast<native_handle_t*>(buffer));
Saurabh Shah8f0ea6f2014-05-19 16:48:53 -070090 const unsigned int offset = (unsigned int) (hnd->base -
91 m->framebuffer->base);
Naseer Ahmed47aa15e2013-04-10 21:27:09 -040092 m->info.activate = FB_ACTIVATE_VBL;
Arun Kumar K.R6c85f052014-01-21 21:47:41 -080093 m->info.yoffset = (int)(offset / m->finfo.line_length);
Naseer Ahmed47aa15e2013-04-10 21:27:09 -040094 if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1) {
95 ALOGE("%s: FBIOPUT_VSCREENINFO for primary failed, str: %s",
Saurabh Shah43333302013-02-06 13:30:27 -080096 __FUNCTION__, strerror(errno));
97 return -errno;
Iliyan Malchev202a77d2012-06-11 14:41:12 -070098 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -070099 return 0;
100}
101
102static int fb_compositionComplete(struct framebuffer_device_t* dev)
103{
104 // TODO: Properly implement composition complete callback
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800105 if(!dev) {
106 return -1;
107 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700108 glFinish();
109
110 return 0;
111}
112
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700113int mapFrameBufferLocked(struct private_module_t* module)
114{
115 // already initialized...
116 if (module->framebuffer) {
117 return 0;
118 }
119 char const * const device_template[] = {
Naseer Ahmed29a26812012-06-14 00:56:20 -0700120 "/dev/graphics/fb%u",
121 "/dev/fb%u",
122 0 };
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700123
124 int fd = -1;
125 int i=0;
126 char name[64];
127 char property[PROPERTY_VALUE_MAX];
128
129 while ((fd==-1) && device_template[i]) {
130 snprintf(name, 64, device_template[i], 0);
131 fd = open(name, O_RDWR, 0);
132 i++;
133 }
134 if (fd < 0)
135 return -errno;
136
Naseer Ahmed32aa90f2012-10-01 18:45:13 -0400137 memset(&module->commit, 0, sizeof(struct mdp_display_commit));
138
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700139 struct fb_fix_screeninfo finfo;
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800140 if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1) {
141 close(fd);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700142 return -errno;
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800143 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700144
145 struct fb_var_screeninfo info;
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800146 if (ioctl(fd, FBIOGET_VSCREENINFO, &info) == -1) {
147 close(fd);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700148 return -errno;
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800149 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700150
151 info.reserved[0] = 0;
152 info.reserved[1] = 0;
153 info.reserved[2] = 0;
154 info.xoffset = 0;
155 info.yoffset = 0;
156 info.activate = FB_ACTIVATE_NOW;
157
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700158 /* Interpretation of offset for color fields: All offsets are from the
159 * right, inside a "pixel" value, which is exactly 'bits_per_pixel' wide
160 * (means: you can use the offset as right argument to <<). A pixel
161 * afterwards is a bit stream and is written to video memory as that
162 * unmodified. This implies big-endian byte order if bits_per_pixel is
163 * greater than 8.
Naseer Ahmed29a26812012-06-14 00:56:20 -0700164 */
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700165
166 if(info.bits_per_pixel == 32) {
167 /*
168 * Explicitly request RGBA_8888
169 */
170 info.bits_per_pixel = 32;
171 info.red.offset = 24;
172 info.red.length = 8;
173 info.green.offset = 16;
174 info.green.length = 8;
175 info.blue.offset = 8;
176 info.blue.length = 8;
177 info.transp.offset = 0;
178 info.transp.length = 8;
179
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700180 /* Note: the GL driver does not have a r=8 g=8 b=8 a=0 config, so if we
181 * do not use the MDP for composition (i.e. hw composition == 0), ask
182 * for RGBA instead of RGBX. */
183 if (property_get("debug.sf.hw", property, NULL) > 0 &&
184 atoi(property) == 0)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700185 module->fbFormat = HAL_PIXEL_FORMAT_RGBX_8888;
Naseer Ahmed29a26812012-06-14 00:56:20 -0700186 else if(property_get("debug.composition.type", property, NULL) > 0 &&
187 (strncmp(property, "mdp", 3) == 0))
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700188 module->fbFormat = HAL_PIXEL_FORMAT_RGBX_8888;
189 else
190 module->fbFormat = HAL_PIXEL_FORMAT_RGBA_8888;
191 } else {
192 /*
193 * Explicitly request 5/6/5
194 */
195 info.bits_per_pixel = 16;
196 info.red.offset = 11;
197 info.red.length = 5;
198 info.green.offset = 5;
199 info.green.length = 6;
200 info.blue.offset = 0;
201 info.blue.length = 5;
202 info.transp.offset = 0;
203 info.transp.length = 0;
204 module->fbFormat = HAL_PIXEL_FORMAT_RGB_565;
205 }
206
207 //adreno needs 4k aligned offsets. Max hole size is 4096-1
Saurabh Shah8f0ea6f2014-05-19 16:48:53 -0700208 unsigned int size = roundUpToPageSize(info.yres * info.xres *
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800209 (info.bits_per_pixel/8));
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700210
211 /*
Naseer Ahmed29a26812012-06-14 00:56:20 -0700212 * Request NUM_BUFFERS screens (at least 2 for page flipping)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700213 */
214 int numberOfBuffers = (int)(finfo.smem_len/size);
215 ALOGV("num supported framebuffers in kernel = %d", numberOfBuffers);
216
217 if (property_get("debug.gr.numframebuffers", property, NULL) > 0) {
218 int num = atoi(property);
219 if ((num >= NUM_FRAMEBUFFERS_MIN) && (num <= NUM_FRAMEBUFFERS_MAX)) {
220 numberOfBuffers = num;
221 }
222 }
223 if (numberOfBuffers > NUM_FRAMEBUFFERS_MAX)
224 numberOfBuffers = NUM_FRAMEBUFFERS_MAX;
225
226 ALOGV("We support %d buffers", numberOfBuffers);
227
228 //consider the included hole by 4k alignment
229 uint32_t line_length = (info.xres * info.bits_per_pixel / 8);
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800230 info.yres_virtual = (uint32_t) ((size * numberOfBuffers) / line_length);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700231
232 uint32_t flags = PAGE_FLIP;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700233
234 if (info.yres_virtual < ((size * 2) / line_length) ) {
235 // we need at least 2 for page-flipping
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800236 info.yres_virtual = (int)(size / line_length);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700237 flags &= ~PAGE_FLIP;
238 ALOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
Naseer Ahmed29a26812012-06-14 00:56:20 -0700239 info.yres_virtual, info.yres*2);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700240 }
241
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800242 if (ioctl(fd, FBIOGET_VSCREENINFO, &info) == -1) {
243 close(fd);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700244 return -errno;
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800245 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700246
247 if (int(info.width) <= 0 || int(info.height) <= 0) {
248 // the driver doesn't return that information
249 // default to 160 dpi
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800250 info.width = (uint32_t)(((float)(info.xres) * 25.4f)/160.0f + 0.5f);
251 info.height = (uint32_t)(((float)(info.yres) * 25.4f)/160.0f + 0.5f);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700252 }
253
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800254 float xdpi = ((float)(info.xres) * 25.4f) / (float)info.width;
255 float ydpi = ((float)(info.yres) * 25.4f) / (float)info.height;
256
Ken Zhang6e6f9a92013-01-08 15:09:27 -0500257#ifdef MSMFB_METADATA_GET
258 struct msmfb_metadata metadata;
259 memset(&metadata, 0 , sizeof(metadata));
260 metadata.op = metadata_op_frame_rate;
261 if (ioctl(fd, MSMFB_METADATA_GET, &metadata) == -1) {
262 ALOGE("Error retrieving panel frame rate");
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800263 close(fd);
Ken Zhang6e6f9a92013-01-08 15:09:27 -0500264 return -errno;
265 }
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800266 float fps = (float)metadata.data.panel_frame_rate;
Ken Zhang6e6f9a92013-01-08 15:09:27 -0500267#else
268 //XXX: Remove reserved field usage on all baselines
choongryeol.lee26145b82012-06-26 23:41:00 -0700269 //The reserved[3] field is used to store FPS by the driver.
Naseer Ahmed9edd17c2012-08-15 18:16:50 -0700270 float fps = info.reserved[3] & 0xFF;
Ken Zhang6e6f9a92013-01-08 15:09:27 -0500271#endif
Naseer Ahmed29a26812012-06-14 00:56:20 -0700272 ALOGI("using (fd=%d)\n"
273 "id = %s\n"
274 "xres = %d px\n"
275 "yres = %d px\n"
276 "xres_virtual = %d px\n"
277 "yres_virtual = %d px\n"
278 "bpp = %d\n"
279 "r = %2u:%u\n"
280 "g = %2u:%u\n"
281 "b = %2u:%u\n",
282 fd,
283 finfo.id,
284 info.xres,
285 info.yres,
286 info.xres_virtual,
287 info.yres_virtual,
288 info.bits_per_pixel,
289 info.red.offset, info.red.length,
290 info.green.offset, info.green.length,
291 info.blue.offset, info.blue.length
292 );
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700293
Naseer Ahmed29a26812012-06-14 00:56:20 -0700294 ALOGI("width = %d mm (%f dpi)\n"
295 "height = %d mm (%f dpi)\n"
296 "refresh rate = %.2f Hz\n",
297 info.width, xdpi,
298 info.height, ydpi,
299 fps
300 );
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700301
302
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800303 if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1) {
304 close(fd);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700305 return -errno;
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800306 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700307
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800308 if (finfo.smem_len <= 0) {
309 close(fd);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700310 return -errno;
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800311 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700312
313 module->flags = flags;
314 module->info = info;
315 module->finfo = finfo;
316 module->xdpi = xdpi;
317 module->ydpi = ydpi;
318 module->fps = fps;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700319 module->swapInterval = 1;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700320
321 CALC_INIT();
322
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700323 /*
324 * map the framebuffer
325 */
326
Naseer Ahmed47aa15e2013-04-10 21:27:09 -0400327 module->numBuffers = info.yres_virtual / info.yres;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700328 module->bufferMask = 0;
329 //adreno needs page aligned offsets. Align the fbsize to pagesize.
Saurabh Shah8f0ea6f2014-05-19 16:48:53 -0700330 unsigned int fbSize = roundUpToPageSize(finfo.line_length * info.yres)*
Naseer Ahmed29a26812012-06-14 00:56:20 -0700331 module->numBuffers;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700332 module->framebuffer = new private_handle_t(fd, fbSize,
Naseer Ahmedd7f84272012-12-13 13:09:53 -0500333 private_handle_t::PRIV_FLAGS_USES_ION,
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700334 BUFFER_TYPE_UI,
335 module->fbFormat, info.xres, info.yres);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700336 void* vaddr = mmap(0, fbSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
337 if (vaddr == MAP_FAILED) {
338 ALOGE("Error mapping the framebuffer (%s)", strerror(errno));
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800339 close(fd);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700340 return -errno;
341 }
Saurabh Shah8f0ea6f2014-05-19 16:48:53 -0700342 module->framebuffer->base = uint64_t(vaddr);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700343 memset(vaddr, 0, fbSize);
Naseer Ahmed47aa15e2013-04-10 21:27:09 -0400344 //Enable vsync
345 int enable = 1;
346 ioctl(module->framebuffer->fd, MSMFB_OVERLAY_VSYNC_CTRL,
347 &enable);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700348 return 0;
349}
350
351static int mapFrameBuffer(struct private_module_t* module)
352{
Naseer Ahmed473986c2013-07-16 12:47:21 -0400353 int err = -1;
Naseer Ahmed499ab3d2013-07-04 15:24:31 -0400354 char property[PROPERTY_VALUE_MAX];
355 if((property_get("debug.gralloc.map_fb_memory", property, NULL) > 0) &&
356 (!strncmp(property, "1", PROPERTY_VALUE_MAX ) ||
357 (!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) {
358 pthread_mutex_lock(&module->lock);
359 err = mapFrameBufferLocked(module);
360 pthread_mutex_unlock(&module->lock);
361 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700362 return err;
363}
364
365/*****************************************************************************/
366
367static int fb_close(struct hw_device_t *dev)
368{
369 fb_context_t* ctx = (fb_context_t*)dev;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700370 if (ctx) {
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700371 //Hack until fbdev is removed. Framework could close this causing hwc a
372 //pain.
373 //free(ctx);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700374 }
375 return 0;
376}
377
378int fb_device_open(hw_module_t const* module, const char* name,
Naseer Ahmed29a26812012-06-14 00:56:20 -0700379 hw_device_t** device)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700380{
381 int status = -EINVAL;
382 if (!strcmp(name, GRALLOC_HARDWARE_FB0)) {
383 alloc_device_t* gralloc_device;
384 status = gralloc_open(module, &gralloc_device);
385 if (status < 0)
386 return status;
387
388 /* initialize our state here */
389 fb_context_t *dev = (fb_context_t*)malloc(sizeof(*dev));
Ramkumar Radhakrishnan36bd5272014-01-31 20:03:01 -0800390 if(dev == NULL) {
391 gralloc_close(gralloc_device);
392 return status;
393 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700394 memset(dev, 0, sizeof(*dev));
395
396 /* initialize the procs */
Naseer Ahmed29a26812012-06-14 00:56:20 -0700397 dev->device.common.tag = HARDWARE_DEVICE_TAG;
398 dev->device.common.version = 0;
399 dev->device.common.module = const_cast<hw_module_t*>(module);
400 dev->device.common.close = fb_close;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700401 dev->device.setSwapInterval = fb_setSwapInterval;
402 dev->device.post = fb_post;
Naseer Ahmed29a26812012-06-14 00:56:20 -0700403 dev->device.setUpdateRect = 0;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700404 dev->device.compositionComplete = fb_compositionComplete;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700405
406 private_module_t* m = (private_module_t*)module;
407 status = mapFrameBuffer(m);
408 if (status >= 0) {
409 int stride = m->finfo.line_length / (m->info.bits_per_pixel >> 3);
410 const_cast<uint32_t&>(dev->device.flags) = 0;
411 const_cast<uint32_t&>(dev->device.width) = m->info.xres;
412 const_cast<uint32_t&>(dev->device.height) = m->info.yres;
413 const_cast<int&>(dev->device.stride) = stride;
414 const_cast<int&>(dev->device.format) = m->fbFormat;
415 const_cast<float&>(dev->device.xdpi) = m->xdpi;
416 const_cast<float&>(dev->device.ydpi) = m->ydpi;
417 const_cast<float&>(dev->device.fps) = m->fps;
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -0700418 const_cast<int&>(dev->device.minSwapInterval) =
419 PRIV_MIN_SWAP_INTERVAL;
420 const_cast<int&>(dev->device.maxSwapInterval) =
421 PRIV_MAX_SWAP_INTERVAL;
Naseer Ahmed00fd6a52012-07-03 21:23:12 -0700422 const_cast<int&>(dev->device.numFramebuffers) = m->numBuffers;
Naseer Ahmed6f8ca312013-01-15 16:55:06 -0500423 dev->device.setUpdateRect = 0;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700424
425 *device = &dev->device.common;
426 }
427
428 // Close the gralloc module
429 gralloc_close(gralloc_device);
430 }
431 return status;
432}