summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcodeworkx <codeworkx@cyanogenmod.org>2012-12-02 19:39:25 +0100
committercodeworkx <codeworkx@cyanogenmod.org>2012-12-02 20:05:26 +0100
commit39aefd0fc48ae60b7db526887ce216e82c8f3ce2 (patch)
tree7ed4f64c3f491b9ccc891c9e94fa27eadc54ba98
parent8b9deaf74eba92bac8725666c2f99e51412a5b6f (diff)
downloadhardware_samsung-39aefd0fc48ae60b7db526887ce216e82c8f3ce2.zip
hardware_samsung-39aefd0fc48ae60b7db526887ce216e82c8f3ce2.tar.gz
hardware_samsung-39aefd0fc48ae60b7db526887ce216e82c8f3ce2.tar.bz2
libhwcomposer: keep window 2 open
Window 2 is used to query global info about the LCD. Kanged from patch for aries by Greg Hackmann <ghackmann@google.com> Change-Id: Idf754d4536337d6c06652c1d0c744dc7c0936b15
-rw-r--r--exynos4/hal/libhwcomposer/SecHWC.cpp31
-rw-r--r--exynos4/hal/libhwcomposer/SecHWCUtils.cpp27
-rw-r--r--exynos4/hal/libhwcomposer/SecHWCUtils.h4
3 files changed, 49 insertions, 13 deletions
diff --git a/exynos4/hal/libhwcomposer/SecHWC.cpp b/exynos4/hal/libhwcomposer/SecHWC.cpp
index 9f32226..d439216 100644
--- a/exynos4/hal/libhwcomposer/SecHWC.cpp
+++ b/exynos4/hal/libhwcomposer/SecHWC.cpp
@@ -927,7 +927,7 @@ static int hwc_eventControl(struct hwc_composer_device_1* dev, int dpy,
switch (event) {
case HWC_EVENT_VSYNC:
int val = !!enabled;
- int err = ioctl(ctx->win[0].fd, S3CFB_SET_VSYNC_INT, &val);
+ int err = ioctl(ctx->global_lcd_win.fd, S3CFB_SET_VSYNC_INT, &val);
if (err < 0)
return -errno;
@@ -1022,6 +1022,11 @@ static int hwc_device_close(struct hw_device_t *dev)
ret = -1;
}
+ if (window_close(&ctx->global_lcd_win) < 0) {
+ SEC_HWC_Log(HWC_LOG_ERROR, "%s::window_close() fail", __func__);
+ ret = -1;
+ }
+
for (i = 0; i < NUM_OF_WIN; i++) {
if (window_close(&ctx->win[i]) < 0)
SEC_HWC_Log(HWC_LOG_DEBUG, "%s::window_close() fail", __func__);
@@ -1061,7 +1066,7 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
dev->device.prepare = hwc_prepare;
dev->device.set = hwc_set;
dev->device.eventControl = hwc_eventControl;
- dev->device.blank = hwc_blank;
+ dev->device.blank = hwc_blank;
dev->device.query = hwc_query;
dev->device.registerProcs = hwc_registerProcs;
*device = &dev->device.common;
@@ -1069,17 +1074,24 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
//initializing
memset(&(dev->fimc), 0, sizeof(s5p_fimc_t));
- /* open WIN0 & WIN1 here */
- for (int i = 0; i < NUM_OF_WIN; i++) {
+ /* open WIN0 & WIN1 here */
+ for (int i = 0; i < NUM_OF_WIN; i++) {
if (window_open(&(dev->win[i]), i) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR,
"%s:: Failed to open window %d device ", __func__, i);
- status = -EINVAL;
- goto err;
+ status = -EINVAL;
+ goto err;
}
- }
+ }
+
+ /* open window 2, used to query global LCD info */
+ if (window_open(&dev->global_lcd_win, 2) < 0) {
+ SEC_HWC_Log(HWC_LOG_ERROR, "%s:: Failed to open window 2 device ", __func__);
+ status = -EINVAL;
+ goto err;
+ }
- if (window_get_global_lcd_info(dev->win[0].fd, &dev->lcd_info) < 0) {
+ if (window_get_global_lcd_info(dev) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR,
"%s::window_get_global_lcd_info is failed : %s",
__func__, strerror(errno));
@@ -1152,6 +1164,9 @@ err:
if (destroyFimc(&dev->fimc) < 0)
SEC_HWC_Log(HWC_LOG_ERROR, "%s::destroyFimc() fail", __func__);
+ if (window_close(&dev->global_lcd_win) < 0)
+ SEC_HWC_Log(HWC_LOG_ERROR, "%s::window_close() fail", __func__);
+
for (int i = 0; i < NUM_OF_WIN; i++) {
if (window_close(&dev->win[i]) < 0)
SEC_HWC_Log(HWC_LOG_DEBUG, "%s::window_close() fail", __func__);
diff --git a/exynos4/hal/libhwcomposer/SecHWCUtils.cpp b/exynos4/hal/libhwcomposer/SecHWCUtils.cpp
index 6351bbf..d210dfd 100644
--- a/exynos4/hal/libhwcomposer/SecHWCUtils.cpp
+++ b/exynos4/hal/libhwcomposer/SecHWCUtils.cpp
@@ -105,6 +105,15 @@ int window_open(struct hwc_win_info_t *win, int id)
case 1:
real_id = 4;
break;
+ case 2:
+ real_id = 0;
+ break;
+ case 3:
+ real_id = 1;
+ break;
+ case 4:
+ real_id = 2;
+ break;
default:
SEC_HWC_Log(HWC_LOG_ERROR, "%s::id(%d) is weird", __func__, id);
goto error;
@@ -272,16 +281,26 @@ int window_hide(struct hwc_win_info_t *win)
return 0;
}
-int window_get_global_lcd_info(int fd, struct fb_var_screeninfo *lcd_info)
+int window_get_global_lcd_info(struct hwc_context_t *ctx)
{
- if (ioctl(fd, FBIOGET_VSCREENINFO, lcd_info) < 0) {
+ if (ioctl(ctx->global_lcd_win.fd, FBIOGET_VSCREENINFO, &ctx->lcd_info) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR, "FBIOGET_VSCREENINFO failed : %s",
strerror(errno));
return -1;
}
- SEC_HWC_Log(HWC_LOG_DEBUG, "%s:: Default LCD x(%d),y(%d)",
- __func__, lcd_info->xres, lcd_info->yres);
+ if (ctx->lcd_info.xres == 0) {
+ SEC_HWC_Log(HWC_LOG_ERROR, "ATTENTION: XRES IS 0");
+ }
+
+ if (ctx->lcd_info.yres == 0) {
+ SEC_HWC_Log(HWC_LOG_ERROR, "ATTENTION: YRES IS 0");
+ }
+
+ if (ctx->lcd_info.bits_per_pixel == 0) {
+ SEC_HWC_Log(HWC_LOG_ERROR, "ATTENTION: BPP IS 0");
+ }
+
return 0;
}
diff --git a/exynos4/hal/libhwcomposer/SecHWCUtils.h b/exynos4/hal/libhwcomposer/SecHWCUtils.h
index ac1c9ef..812a400 100644
--- a/exynos4/hal/libhwcomposer/SecHWCUtils.h
+++ b/exynos4/hal/libhwcomposer/SecHWCUtils.h
@@ -78,6 +78,7 @@
#ifdef SAMSUNG_EXYNOS4210
#define PP_DEVICE_DEV_NAME "/dev/video1"
#endif
+
/* cacheable configuration */
#define V4L2_CID_CACHEABLE (V4L2_CID_BASE+40)
@@ -156,6 +157,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;
#ifdef SKIP_DUMMY_UI_LAY_DRAWING
struct hwc_ui_lay_info win_virt[NUM_OF_DUMMY_WIN];
int fb_lay_skip_initialized;
@@ -278,7 +280,7 @@ int window_get_info (struct hwc_win_info_t *win, int win_num);
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(int fd, 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);