diff options
author | Mykola Ostrovskyy <mykola@ti.com> | 2012-07-10 15:24:29 +0530 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-28 21:16:23 +0200 |
commit | 2836188fad2021c64f9f21a46257c9b5926474e3 (patch) | |
tree | 847ccefc95f2c49c5e70840aeb2032e03d05b282 /hwc/hwc.c | |
parent | 033920e004e7fb8edd948b569c8edb1bf39d1617 (diff) | |
download | hardware_ti_omap4-2836188fad2021c64f9f21a46257c9b5926474e3.zip hardware_ti_omap4-2836188fad2021c64f9f21a46257c9b5926474e3.tar.gz hardware_ti_omap4-2836188fad2021c64f9f21a46257c9b5926474e3.tar.bz2 |
hwc: Support HDMI as primary display
This patch disables mirroring/docking logic when HDMI display
is used as primary instead of LCD panel.
Based on patch from Mark Tyler.
Rebased from p-ics-mr1:
9dd8ccd Support HDMI as primary display
Change-Id: Idd239a562bfc486e128b268fa31ced53412bba3a
Signed-off-by: Mykola Ostrovskyy <mykola@ti.com>
Signed-off-by: Muralidhar Dixit <murali.dixit@ti.com>
Signed-off-by: Tony Lofthouse <a0741364@ti.com>
Diffstat (limited to 'hwc/hwc.c')
-rw-r--r-- | hwc/hwc.c | 57 |
1 files changed, 46 insertions, 11 deletions
@@ -168,6 +168,7 @@ struct omap4_hwc_device { int flags_nv12_only; float upscaled_nv12_limit; + int on_tv; /* using a tv */ int force_sgx; omap4_hwc_ext_t ext; /* external mirroring data */ int idle; @@ -913,10 +914,11 @@ static __u32 add_scaling_score(__u32 score, static int omap4_hwc_set_best_hdmi_mode(omap4_hwc_device_t *hwc_dev, __u32 xres, __u32 yres, float xpy) { + int dis_ix = hwc_dev->on_tv ? 0 : 1; struct _qdis { struct dsscomp_display_info dis; struct dsscomp_videomode modedb[32]; - } d = { .dis = { .ix = 1 } }; + } d = { .dis = { .ix = dis_ix } }; omap4_hwc_ext_t *ext = &hwc_dev->ext; d.dis.modedb_len = sizeof(d.modedb) / sizeof(*d.modedb); @@ -996,7 +998,7 @@ static int omap4_hwc_set_best_hdmi_mode(omap4_hwc_device_t *hwc_dev, __u32 xres, } } if (~best) { - struct dsscomp_setup_display_data sdis = { .ix = 1, }; + struct dsscomp_setup_display_data sdis = { .ix = dis_ix }; sdis.mode = d.dis.modedb[best]; ALOGD("picking #%d", best); /* only reconfigure on change */ @@ -1122,7 +1124,7 @@ static void decide_supported_cloning(omap4_hwc_device_t *hwc_dev, struct counts static int can_dss_render_all(omap4_hwc_device_t *hwc_dev, struct counts *num) { omap4_hwc_ext_t *ext = &hwc_dev->ext; - int on_tv = ext->on_tv && ext->current.enabled; + int on_tv = hwc_dev->on_tv || (ext->on_tv && ext->current.enabled); int tform = ext->current.enabled && (ext->current.rotation || ext->current.hflip); return !hwc_dev->force_sgx && @@ -1148,7 +1150,7 @@ static inline int can_dss_render_layer(omap4_hwc_device_t *hwc_dev, omap4_hwc_ext_t *ext = &hwc_dev->ext; int cloning = ext->current.enabled && (!ext->current.docking || (handle!=NULL ? dockable(layer) : 0)); - int on_tv = ext->on_tv && cloning; + int on_tv = hwc_dev->on_tv || (ext->on_tv && cloning); int tform = cloning && (ext->current.rotation || ext->current.hflip); return omap4_hwc_is_valid_layer(hwc_dev, layer, handle) && @@ -1948,6 +1950,28 @@ static void handle_hotplug(omap4_hwc_device_t *hwc_dev) omap4_hwc_ext_t *ext = &hwc_dev->ext; __u8 state = ext->hdmi_state; + /* Ignore external HDMI logic if the primary display is HDMI */ + if (hwc_dev->on_tv) { + ALOGI("Primary display is HDMI - skip clone/dock logic"); + + if (state) { + __u32 xres = hwc_dev->fb_dev->base.width; + __u32 yres = hwc_dev->fb_dev->base.height; + if (omap4_hwc_set_best_hdmi_mode(hwc_dev, xres, yres, ext->lcd_xpy)) { + ALOGE("Failed to set HDMI mode"); + } + + ioctl(hwc_dev->fb_fd, FBIOBLANK, FB_BLANK_UNBLANK); + + if (hwc_dev->procs && hwc_dev->procs->invalidate) { + hwc_dev->procs->invalidate(hwc_dev->procs); + } + } else + ext->last_mode = 0; + + return; + } + pthread_mutex_lock(&hwc_dev->lock); ext->dock.enabled = ext->mirror.enabled = 0; if (state) { @@ -2240,13 +2264,6 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name, goto done; } - hwc_dev->hdmi_fb_fd = open("/dev/graphics/fb1", O_RDWR); - if (hwc_dev->hdmi_fb_fd < 0) { - ALOGE("failed to open hdmi fb (%d)", errno); - err = -errno; - goto done; - } - int ret = ioctl(hwc_dev->dsscomp_fd, DSSCIOC_QUERY_PLATFORM, &limits); if (ret) { ALOGE("failed to get platform limits (%d): %m", errno); @@ -2298,6 +2315,24 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name, hwc_dev->fb_dis.height_in_mm * hwc_dev->fb_dis.timings.y_res; } + if (hwc_dev->fb_dis.channel == OMAP_DSS_CHANNEL_DIGIT) { + ALOGI("Primary display is HDMI"); + hwc_dev->on_tv = 1; + /* + * For the moment use s/w vsync until kernel supports + * vsync for HDMI + */ + ALOGI("Revert to legacy HWC API for fake vsync"); + hwc_dev->base.common.version = HWC_DEVICE_API_VERSION_0_2; + } else { + hwc_dev->hdmi_fb_fd = open("/dev/graphics/fb1", O_RDWR); + if (hwc_dev->hdmi_fb_fd < 0) { + ALOGE("failed to open hdmi fb (%d)", errno); + err = -errno; + goto done; + } + } + if (pipe(hwc_dev->pipe_fds) == -1) { ALOGE("failed to event pipe (%d): %m", errno); err = -errno; |