summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/egl_dri2.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2013-11-15 13:50:50 +0000
committerKristian Høgsberg <krh@bitplanet.net>2013-12-07 22:36:02 -0800
commit992a2dbba80aba35efe83202e1013bd6143f0dba (patch)
treea8d82551496d3d5cec9173570dcb91ce85718d91 /src/egl/drivers/dri2/egl_dri2.h
parent25cc889004aad6d1cab9edd76db898658e347b97 (diff)
downloadexternal_mesa3d-992a2dbba80aba35efe83202e1013bd6143f0dba.zip
external_mesa3d-992a2dbba80aba35efe83202e1013bd6143f0dba.tar.gz
external_mesa3d-992a2dbba80aba35efe83202e1013bd6143f0dba.tar.bz2
wayland: Add support for eglSwapInterval
The Wayland EGL platform now respects the eglSwapInterval value. The value is clamped to either 0 or 1 because it is difficult (and probably not useful) to sync to more than 1 redraw. The main change is that if the swap interval is 0 then Mesa won't install a frame callback so that eglSwapBuffers can be executed as often as necessary. Instead it will do a sync request after the swap buffers. It will block for sync complete event in get_back_bo instead of the frame callback. The compositor is likely to send a release event while processing the new buffer attach and this makes sure we will receive that before deciding whether to allocate a new buffer. If there are no buffers available then instead of returning with an error, get_back_bo will now poll the compositor by repeatedly sending sync requests every 10ms. This is a last resort and in theory this shouldn't happen because there should be no reason for the compositor to hold on to more than three buffers. That means whenever we attach the fourth buffer we should always get an immediate release event which should come in with the notification for the first sync request that we are throttled to. When the compositor is directly scanning out from the application's buffer it may end up holding on to three buffers. These are the one that is is currently scanning out from, one that has been given to DRM as the next buffer to flip to, and one that has been attached and will be given to DRM as soon as the previous flip completes. When we attach a fourth buffer to the compositor it should replace that third buffer so we should get a release event immediately after that. This patch therefore also changes the number of buffer slots to 4 so that we can accomodate that situation. If DRM eventually gets a way to cancel a pending page flip then the compositors can be changed to only need to hold on to two buffers and this value can be put back to 3. This also moves the vblank configuration defines from platform_x11.c to the common egl_dri2.h header so they can be shared by both platforms.
Diffstat (limited to 'src/egl/drivers/dri2/egl_dri2.h')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index bbe5602..522a0fd 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -175,7 +175,7 @@ struct dri2_egl_surface
struct wl_egl_window *wl_win;
int dx;
int dy;
- struct wl_callback *frame_callback;
+ struct wl_callback *throttle_callback;
int format;
#endif
@@ -195,7 +195,7 @@ struct dri2_egl_surface
#endif
int locked;
int age;
- } color_buffers[3], *back, *current;
+ } color_buffers[4], *back, *current;
#endif
#ifdef HAVE_ANDROID_PLATFORM
@@ -221,6 +221,12 @@ struct dri2_egl_image
__DRIimage *dri_image;
};
+/* From xmlpool/options.h, user exposed so should be stable */
+#define DRI_CONF_VBLANK_NEVER 0
+#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
+#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
+#define DRI_CONF_VBLANK_ALWAYS_SYNC 3
+
/* standard typecasts */
_EGL_DRIVER_STANDARD_TYPECASTS(dri2_egl)
_EGL_DRIVER_TYPECAST(dri2_egl_image, _EGLImage, obj)