summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-01-19 11:00:39 +0000
committerMartin Peres <martin.peres@linux.intel.com>2015-06-08 11:01:23 +0300
commitb45529093122e3fb8dd04a1ff9077c0a6a0fa693 (patch)
treefaeee8d56fb12fd23dcf1766f9900fd3c96f8d90
parent781fec1c5739d4b9131a7da25b05db26f47d9860 (diff)
dri2: Pass swap-interval=0 ScheduleSwap requests to the ddx
Allow the DDXes to opt-in and handle swap-interval=0 requests for themselves, for example by using asynchronous pageflips, rather than forcing a blit. This has the important side-effect of also disambiguating CopyRegion calls to always be client requests. References: http://lists.x.org/archives/xorg-devel/2011-June/023102.html References: http://lists.x.org/archives/xorg-devel/2012-February/029336.html Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--hw/xfree86/dri2/dri2.c14
-rw-r--r--hw/xfree86/dri2/dri2.h5
2 files changed, 14 insertions, 5 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 6feac5673..226d77cc2 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -114,6 +114,7 @@ typedef struct _DRI2Screen {
int fd;
unsigned int lastSequence;
int prime_id;
+ int scheduleSwap0;
DRI2CreateBufferProcPtr CreateBuffer;
DRI2DestroyBufferProcPtr DestroyBuffer;
@@ -1113,8 +1114,8 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
return BadDrawable;
}
- /* Old DDX or no swap interval, just blit */
- if (!ds->ScheduleSwap || !pPriv->swap_interval || pPriv->prime_id) {
+ /* Old DDX or PRIME, just blit */
+ if (!ds->scheduleSwap0 || pPriv->prime_id) {
BoxRec box;
RegionRec region;
@@ -1136,7 +1137,9 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
* In the simple glXSwapBuffers case, all params will be 0, and we just
* need to schedule a swap for the last swap target + the swap interval.
*/
- if (target_msc == 0 && divisor == 0 && remainder == 0) {
+ if (pPriv->swap_interval == 0) {
+ target_msc = 0;
+ } else if (target_msc == 0 && divisor == 0 && remainder == 0) {
/* If the current vblank count of the drawable's crtc is lower
* than the count stored in last_swap_target from a previous swap
* then reinitialize last_swap_target to the current crtc's msc,
@@ -1159,7 +1162,6 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
* number of pending swaps.
*/
target_msc = pPriv->last_swap_target + pPriv->swap_interval;
-
}
pPriv->swapsPending++;
@@ -1555,6 +1557,10 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
ds->CopyRegion2 = info->CopyRegion2;
}
+ if (info->version >= 10) {
+ ds->scheduleSwap0 = info->scheduleSwap0;
+ }
+
/*
* if the driver doesn't provide an AuthMagic function or the info struct
* version is too low, call through LegacyAuthMagic
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index 1e7afddbd..1cf428828 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -205,7 +205,7 @@ typedef int (*DRI2GetParamProcPtr) (ClientPtr client,
/**
* Version of the DRI2InfoRec structure defined in this header
*/
-#define DRI2INFOREC_VERSION 9
+#define DRI2INFOREC_VERSION 10
typedef struct {
unsigned int version; /**< Version of this struct */
@@ -252,6 +252,9 @@ typedef struct {
DRI2CreateBuffer2ProcPtr CreateBuffer2;
DRI2DestroyBuffer2ProcPtr DestroyBuffer2;
DRI2CopyRegion2ProcPtr CopyRegion2;
+
+ /* added in version 10 */
+ int scheduleSwap0;
} DRI2InfoRec, *DRI2InfoPtr;
extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info);