aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Barnish <dave.barnish@arm.com>2013-08-12 17:13:46 +0100
committerDave Barnish <dave.barnish@arm.com>2013-08-12 17:25:20 +0100
commite762b12a21d46f45937aa2140c26293a286e5ee9 (patch)
tree41f7e2b0fe824c1b418a8f7b6a1a3c6e675960d0
parentb4299f81bc02f7c8536aa5d49f47e5d73f517ce0 (diff)
downloadxf86-video-armsoc-e762b12a21d46f45937aa2140c26293a286e5ee9.tar.gz
Added a platform specific flag for vsync timestamp query support.
If the target platform's DRM driver supports the vsync timestamp query the vblank_query_supported flag should be set to 1. drmWaitVBlank() will then be used in ARMSOCDRI2GetMSC(), otherwise this function always returns FALSE. Change-Id: I0d9610c58d6b246d19a1308f950ecfa0d5b12b54
-rw-r--r--src/armsoc_dri2.c30
-rw-r--r--src/drmmode_display.c15
-rw-r--r--src/drmmode_driver.h4
-rw-r--r--src/drmmode_exynos/drmmode_exynos.c3
-rw-r--r--src/drmmode_pl111/drmmode_pl111.c1
-rw-r--r--src/drmmode_template/drmmode_template.c7
6 files changed, 35 insertions, 25 deletions
diff --git a/src/armsoc_dri2.c b/src/armsoc_dri2.c
index ae8b05e..1290b92 100644
--- a/src/armsoc_dri2.c
+++ b/src/armsoc_dri2.c
@@ -359,14 +359,12 @@ ARMSOCDRI2GetMSC(DrawablePtr pDraw, CARD64 *ust, CARD64 *msc)
} };
int ret;
+ if (!pARMSOC->drmmode_interface->vblank_query_supported)
+ return FALSE;
+
ret = drmWaitVBlank(pARMSOC->drmFD, &vbl);
if (ret) {
- static int limit = 5;
- if (limit) {
- ERROR_MSG("get vblank counter failed: %s",
- strerror(errno));
- limit--;
- }
+ ERROR_MSG("get vblank counter failed: %s", strerror(errno));
return FALSE;
}
@@ -663,16 +661,20 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
do_flip = src_fb_id && dst_fb_id && canflip(pDraw);
- /* After a resolution change the back buffer (src) will still be of the original size.
- * We can't sensibly flip to a framebuffer of a different size to the current resolution
- * (it will look corrupted), so we must do a copy for this frame (which will clip the
- * contents as expected).
+ /* After a resolution change the back buffer (src) will still be
+ * of the original size. We can't sensibly flip to a framebuffer of
+ * a different size to the current resolution (it will look corrupted)
+ * so we must do a copy for this frame (which will clip the contents
+ * as expected).
*
- * Once the client calls DRI2GetBuffers again, it will receive a new back buffer of the
- * same size as the new resolution, and subsequent DRI2SwapBuffers will result in a flip.
+ * Once the client calls DRI2GetBuffers again, it will receive a new
+ * back buffer of the same size as the new resolution, and subsequent
+ * DRI2SwapBuffers will result in a flip.
*/
- do_flip = do_flip && (armsoc_bo_width(src_bo) == armsoc_bo_width(dst_bo));
- do_flip = do_flip && (armsoc_bo_height(src_bo) == armsoc_bo_height(dst_bo));
+ do_flip = do_flip &&
+ (armsoc_bo_width(src_bo) == armsoc_bo_width(dst_bo));
+ do_flip = do_flip &&
+ (armsoc_bo_height(src_bo) == armsoc_bo_height(dst_bo));
if (do_flip) {
DEBUG_MSG("can flip: %d -> %d", src_fb_id, dst_fb_id);
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index ba6d439..19e1ce8 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1211,14 +1211,15 @@ drmmode_xf86crtc_resize(ScrnInfoPtr pScrn, int width, int height)
pScrn->depth, pScrn->bitsPerPixel, pitch,
armsoc_bo_map(pARMSOC->scanout));
- /* Bump the serial number to ensure that all existing DRI2 buffers
- * are invalidated.
+ /* Bump the serial number to ensure that all existing DRI2
+ * buffers are invalidated.
*
- * This is particularly required for when the resolution is changed
- * and then reverted to the original size without a DRI2 client/s
- * getting a new buffer. Without this, the drawable is the same
- * size and serial number so the old DRI2Buffer will be returned,
- * even though the backing buffer has been deleted.
+ * This is particularly required for when the resolution is
+ * changed and then reverted to the original size without a
+ * DRI2 client/s getting a new buffer. Without this, the
+ * drawable is the same size and serial number so the old
+ * DRI2Buffer will be returned, even though the backing buffer
+ * has been deleted.
*/
rootPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
}
diff --git a/src/drmmode_driver.h b/src/drmmode_driver.h
index f6b996b..eb49483 100644
--- a/src/drmmode_driver.h
+++ b/src/drmmode_driver.h
@@ -86,6 +86,10 @@ struct drmmode_interface {
*/
void (*set_cursor_image)(xf86CrtcPtr crtc, uint32_t *d, CARD32 *s);
+ /* Boolean value indicating whether the DRM supports
+ * vblank timestamp query
+ */
+ int vblank_query_supported;
};
struct drmmode_interface *drmmode_interface_get_implementation(int drm_fd);
diff --git a/src/drmmode_exynos/drmmode_exynos.c b/src/drmmode_exynos/drmmode_exynos.c
index 9c9de7c..a5a98d2 100644
--- a/src/drmmode_exynos/drmmode_exynos.c
+++ b/src/drmmode_exynos/drmmode_exynos.c
@@ -92,7 +92,8 @@ struct drmmode_interface exynos_interface = {
CURSORH /* cursor_height */,
CURSORPAD /* cursor padding */,
init_plane_for_cursor /* init_plane_for_cursor */,
- set_cursor_image /* set cursor image */
+ set_cursor_image /* set cursor image */,
+ 0 /* vblank_query_supported */,
};
struct drmmode_interface *drmmode_interface_get_implementation(int drm_fd)
diff --git a/src/drmmode_pl111/drmmode_pl111.c b/src/drmmode_pl111/drmmode_pl111.c
index d8a16a5..2cd5e4a 100644
--- a/src/drmmode_pl111/drmmode_pl111.c
+++ b/src/drmmode_pl111/drmmode_pl111.c
@@ -141,6 +141,7 @@ struct drmmode_interface pl111_interface = {
CURSORPAD /* cursor padding */,
NULL /* init_plane_for_cursor */,
set_cursor_image /* set cursor image */,
+ 0 /* vblank_query_supported */,
};
struct drmmode_interface *drmmode_interface_get_implementation(int drm_fd)
diff --git a/src/drmmode_template/drmmode_template.c b/src/drmmode_template/drmmode_template.c
index d8cdafe..550848c 100644
--- a/src/drmmode_template/drmmode_template.c
+++ b/src/drmmode_template/drmmode_template.c
@@ -49,14 +49,15 @@ static void set_cursor_image(xf86CrtcPtr crtc, uint32_t *d, CARD32 *s)
}
struct drmmode_interface template_interface = {
- 0x00000000 /* dumb_scanout_flags */,
- 0x00000000 /* dumb_no_scanout_flags */,
- 1 /* use_page_flip_events */,
+ 0x00000000 /* dumb_scanout_flags */,
+ 0x00000000 /* dumb_no_scanout_flags */,
+ 1 /* use_page_flip_events */,
CURSORW /* cursor width */,
CURSORH /* cursor_height */,
CURSORPAD /* cursor padding */,
init_plane_for_cursor /* init_plane_for_cursor */,
set_cursor_image /* set cursor image */,
+ 0 /* vblank_query_supported */,
};
struct drmmode_interface *drmmode_interface_get_implementation(int drm_fd)