diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-01-19 11:00:40 +0000 |
---|---|---|
committer | Martin Peres <martin.peres@linux.intel.com> | 2015-06-11 10:52:23 +0300 |
commit | 97efabfd70153f60ab81dd392e8fd0b26ab524f3 (patch) | |
tree | d4a9f695366f197b1a20f525170acbac0afeac0b /hw/xfree86 | |
parent | b45529093122e3fb8dd04a1ff9077c0a6a0fa693 (diff) |
Allow mesa/dri2 to implement GLX_EXT_buffer_age by reporting the sbc of
when the current back buffer was defined. As this may require ddx
support, only set the value if enabled by the ddx and report the new
semantics via a DRI2GetParam request.
v2: From Martin Peres
- Fix a NULL-pointer dereference
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'hw/xfree86')
-rw-r--r-- | hw/xfree86/dri2/dri2.c | 25 | ||||
-rw-r--r-- | hw/xfree86/dri2/dri2.h | 1 |
2 files changed, 22 insertions, 4 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 226d77cc2..a3b3fb47c 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -49,6 +49,8 @@ #include "damage.h" #include "xf86.h" +#include <X11/extensions/dri2proto.h> /* for parameter names */ + CARD8 dri2_major; /* version of DRI2 supported by DDX */ CARD8 dri2_minor; @@ -115,6 +117,7 @@ typedef struct _DRI2Screen { unsigned int lastSequence; int prime_id; int scheduleSwap0; + int bufferAge; DRI2CreateBufferProcPtr CreateBuffer; DRI2DestroyBufferProcPtr DestroyBuffer; @@ -1114,6 +1117,9 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, return BadDrawable; } + if (ds->bufferAge) + pSrcBuffer->flags = *swap_target; + /* Old DDX or PRIME, just blit */ if (!ds->scheduleSwap0 || pPriv->prime_id) { BoxRec box; @@ -1559,6 +1565,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) if (info->version >= 10) { ds->scheduleSwap0 = info->scheduleSwap0; + ds->bufferAge = info->bufferAge; } /* @@ -1681,10 +1688,20 @@ DRI2GetParam(ClientPtr client, switch (high_byte) { case 0: - /* Parameter names whose high_byte is 0 are reserved for the X - * server. The server currently recognizes no parameters. - */ - goto not_recognized; + /* Parameter names whose high_byte is 0 are reserved for the X + * server. + */ + switch (param) { + case DRI2ParamXHasBufferAge: + *value = ds->bufferAge; + break; + default: + goto not_recognized; + } + + *is_param_recognized = TRUE; + return Success; + case 1: /* Parameter names whose high byte is 1 are reserved for the DDX. */ if (ds->GetParam) diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index 1cf428828..e76f7a8ad 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -255,6 +255,7 @@ typedef struct { /* added in version 10 */ int scheduleSwap0; + int bufferAge; } DRI2InfoRec, *DRI2InfoPtr; extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info); |