diff options
author | Lajos Molnar <molnar@ti.com> | 2011-09-12 17:08:16 -0500 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-09-14 18:42:02 -0700 |
commit | 7f2cbf97908a26e0b463d4fa20040b129216f86e (patch) | |
tree | 86d86c0d8dd330bc706033385ed9c5259d470b03 /hwc/hwc.c | |
parent | ae5ccc208800debb41acfc45096d318847e8db50 (diff) | |
download | hardware_ti_omap4xxx-7f2cbf97908a26e0b463d4fa20040b129216f86e.zip hardware_ti_omap4xxx-7f2cbf97908a26e0b463d4fa20040b129216f86e.tar.gz hardware_ti_omap4xxx-7f2cbf97908a26e0b463d4fa20040b129216f86e.tar.bz2 |
hwc: call wait-for-vsync in set if eglSwapBuffers is not called.
This adds a rate-limiting similar to when eglSwapBuffer is called,
so that DSS-only compositions do not complete instantly.
Change-Id: I5b6ea7f5b258d6b0c35068ba1bdc91f342227e4a
Signed-off-by: Lajos Molnar <molnar@ti.com>
Diffstat (limited to 'hwc/hwc.c')
-rw-r--r-- | hwc/hwc.c | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -77,6 +77,7 @@ struct omap4_hwc_device { pthread_t hdmi_thread; pthread_mutex_t lock; int dsscomp_fd; + int fb_fd; int hdmi_fb_fd; __u16 ext_width; @@ -948,8 +949,16 @@ static int omap4_hwc_set(struct hwc_composer_device *dev, hwc_display_t dpy, hwc_dev->buffers, hwc_dev->post2_layers, dsscomp, sizeof(*dsscomp)); - } + if (!hwc_dev->use_sgx) { + __u32 crt = 0; + int err2 = ioctl(hwc_dev->fb_fd, FBIO_WAITFORVSYNC, &crt); + if (err2) { + LOGE("failed to wait for vsync (%d)", errno); + err = err ? : -errno; + } + } + } hwc_dev->last_ext_ovls = hwc_dev->ext_ovls; hwc_dev->last_int_ovls = hwc_dev->post2_layers; if (err) @@ -1011,6 +1020,8 @@ static int omap4_hwc_device_close(hw_device_t* device) close(hwc_dev->dsscomp_fd); if (hwc_dev->hdmi_fb_fd >= 0) close(hwc_dev->hdmi_fb_fd); + if (hwc_dev->fb_fd >= 0) + close(hwc_dev->fb_fd); /* pthread will get killed when parent process exits */ pthread_mutex_destroy(&hwc_dev->lock); free(hwc_dev); @@ -1250,8 +1261,25 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name, *device = &hwc_dev->base.common; hwc_dev->dsscomp_fd = open("/dev/dsscomp", O_RDWR); + if (hwc_dev->dsscomp_fd < 0) { + LOGE("failed to open dsscomp (%d)", errno); + err = -errno; + goto done; + } hwc_dev->hdmi_fb_fd = open("/dev/graphics/fb1", O_RDWR); + if (hwc_dev->hdmi_fb_fd < 0) { + LOGE("failed to open hdmi fb (%d)", errno); + err = -errno; + goto done; + } + + hwc_dev->fb_fd = open("/dev/graphics/fb0", O_RDWR); + if (hwc_dev->fb_fd < 0) { + LOGE("failed to open fb (%d)", errno); + err = -errno; + goto done; + } hwc_dev->buffers = malloc(sizeof(buffer_handle_t) * MAX_HW_OVERLAYS); if (!hwc_dev->buffers) { @@ -1307,6 +1335,8 @@ done: close(hwc_dev->dsscomp_fd); if (hwc_dev->hdmi_fb_fd >= 0) close(hwc_dev->hdmi_fb_fd); + if (hwc_dev->fb_fd >= 0) + close(hwc_dev->fb_fd); pthread_mutex_destroy(&hwc_dev->lock); free(hwc_dev->buffers); free(hwc_dev); |