diff options
author | Greg Hackmann <ghackmann@google.com> | 2012-04-09 16:15:15 -0700 |
---|---|---|
committer | Greg Hackmann <ghackmann@google.com> | 2012-04-25 16:33:27 -0700 |
commit | cb3eb57bb1aebf46521fba6d1fba57d8602551d3 (patch) | |
tree | acfd6e37a35e1233c117e52381f49eb626f4fe49 /libhwcomposer | |
parent | e63af0afc43a5c88064df122aee66c59e8cd7dfa (diff) | |
download | device_samsung_crespo-cb3eb57bb1aebf46521fba6d1fba57d8602551d3.zip device_samsung_crespo-cb3eb57bb1aebf46521fba6d1fba57d8602551d3.tar.gz device_samsung_crespo-cb3eb57bb1aebf46521fba6d1fba57d8602551d3.tar.bz2 |
crespo libhwcomposer: keep window 2 open
Window 2 is used to query global info about the LCD.
Change-Id: I190aa1495d73802009a07409f720f1234e53152e
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Diffstat (limited to 'libhwcomposer')
-rw-r--r-- | libhwcomposer/SecHWC.cpp | 17 | ||||
-rw-r--r-- | libhwcomposer/SecHWCUtils.cpp | 34 | ||||
-rw-r--r-- | libhwcomposer/SecHWCUtils.h | 3 |
3 files changed, 30 insertions, 24 deletions
diff --git a/libhwcomposer/SecHWC.cpp b/libhwcomposer/SecHWC.cpp index e63558b..b7c3790 100644 --- a/libhwcomposer/SecHWC.cpp +++ b/libhwcomposer/SecHWC.cpp @@ -436,6 +436,11 @@ static int hwc_device_close(struct hw_device_t *dev) ret = -1; } + if (window_close(&ctx->global_lcd_win) < 0) { + ALOGE("%s::window_close() fail", __func__); + ret = -1; + } + for (i = 0; i < NUM_OF_WIN; i++) { if (window_close(&ctx->win[i]) < 0) { ALOGE("%s::window_close() fail", __func__); @@ -494,8 +499,15 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name, } } + /* open window 2, used to query global LCD info */ + if (window_open(&dev->global_lcd_win, 2) < 0) { + ALOGE("%s:: Failed to open window 2 device ", __func__); + status = -EINVAL; + goto err; + } + /* get default window config */ - if (window_get_global_lcd_info(&dev->lcd_info) < 0) { + if (window_get_global_lcd_info(dev) < 0) { ALOGE("%s::window_get_global_lcd_info is failed : %s", __func__, strerror(errno)); status = -EINVAL; @@ -558,6 +570,9 @@ err: if (destroyFimc(&dev->fimc) < 0) ALOGE("%s::destroyFimc() fail", __func__); + if (window_close(&dev->global_lcd_win) < 0) + ALOGE("%s::window_close() fail", __func__); + for (int i = 0; i < NUM_OF_WIN; i++) { if (window_close(&dev->win[i]) < 0) ALOGE("%s::window_close() fail", __func__); diff --git a/libhwcomposer/SecHWCUtils.cpp b/libhwcomposer/SecHWCUtils.cpp index e933985..2b3f09f 100644 --- a/libhwcomposer/SecHWCUtils.cpp +++ b/libhwcomposer/SecHWCUtils.cpp @@ -166,40 +166,30 @@ int window_hide(struct hwc_win_info_t *win) return 0; } -int window_get_global_lcd_info(struct fb_var_screeninfo *lcd_info) +int window_get_global_lcd_info(struct hwc_context_t *ctx) { struct hwc_win_info_t win; int ret = 0; - if (window_open(&win, 2) < 0) { - ALOGE("%s:: Failed to open window 2 device ", __func__); - return -1; - } - - if (ioctl(win.fd, FBIOGET_VSCREENINFO, lcd_info) < 0) { + if (ioctl(ctx->global_lcd_win.fd, FBIOGET_VSCREENINFO, &ctx->lcd_info) < 0) { ALOGE("FBIOGET_VSCREENINFO failed : %s", strerror(errno)); - ret = -1; - goto fun_err; + return -1; } - if (lcd_info->xres == 0) { - lcd_info->xres = DEFAULT_LCD_WIDTH; - lcd_info->xres_virtual = DEFAULT_LCD_WIDTH; + if (ctx->lcd_info.xres == 0) { + ctx->lcd_info.xres = DEFAULT_LCD_WIDTH; + ctx->lcd_info.xres_virtual = DEFAULT_LCD_WIDTH; } - if (lcd_info->yres == 0) { - lcd_info->yres = DEFAULT_LCD_HEIGHT; - lcd_info->yres_virtual = DEFAULT_LCD_HEIGHT * NUM_OF_WIN_BUF; + if (ctx->lcd_info.yres == 0) { + ctx->lcd_info.yres = DEFAULT_LCD_HEIGHT; + ctx->lcd_info.yres_virtual = DEFAULT_LCD_HEIGHT * NUM_OF_WIN_BUF; } - if (lcd_info->bits_per_pixel == 0) - lcd_info->bits_per_pixel = DEFAULT_LCD_BPP; - -fun_err: - if (window_close(&win) < 0) - ALOGE("%s::window2 close fail", __func__); + if (ctx->lcd_info.bits_per_pixel == 0) + ctx->lcd_info.bits_per_pixel = DEFAULT_LCD_BPP; - return ret; + return 0; } int fimc_v4l2_set_src(int fd, unsigned int hw_ver, s5p_fimc_img_info *src) diff --git a/libhwcomposer/SecHWCUtils.h b/libhwcomposer/SecHWCUtils.h index 21d6598..41172b4 100644 --- a/libhwcomposer/SecHWCUtils.h +++ b/libhwcomposer/SecHWCUtils.h @@ -113,6 +113,7 @@ struct hwc_context_t { /* our private state goes below here */ struct hwc_win_info_t win[NUM_OF_WIN]; + struct hwc_win_info_t global_lcd_win; struct fb_var_screeninfo lcd_info; s5p_fimc_t fimc; unsigned int num_of_fb_layer; @@ -127,7 +128,7 @@ int window_get_info(struct hwc_win_info_t *win); int window_pan_display(struct hwc_win_info_t *win); int window_show(struct hwc_win_info_t *win); int window_hide(struct hwc_win_info_t *win); -int window_get_global_lcd_info(struct fb_var_screeninfo *lcd_info); +int window_get_global_lcd_info(struct hwc_context_t *ctx); int createFimc(s5p_fimc_t *fimc); int destroyFimc(s5p_fimc_t *fimc); |