diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-01-19 11:00:38 +0000 |
---|---|---|
committer | Martin Peres <martin.peres@linux.intel.com> | 2015-06-08 11:01:23 +0300 |
commit | 781fec1c5739d4b9131a7da25b05db26f47d9860 (patch) | |
tree | 7a8a6ee60e6086b35c25715260fc1d713cae94c6 | |
parent | fa12f2c150b2f50de9dac4a2b09265f13af353af (diff) |
dri2: Allow GetBuffers to match any format
Since the introduction of DRI2GetBuffersWithFormat, the old
DRI2GetBuffers interface would always recreate all buffers all the time
as it was no longer agnostic to the format value being set by the DDXes.
This causes an issue with clients intermixing the two requests,
rendering any sharing or caching of buffers (e.g. for triple buffering)
void.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | hw/xfree86/dri2/dri2.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 60ea6dd93..6feac5673 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -467,14 +467,16 @@ find_attachment(DRI2DrawablePtr pPriv, unsigned attachment) static Bool allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds, DRI2DrawablePtr pPriv, - unsigned int attachment, unsigned int format, + unsigned int attachment, + int has_format, unsigned int format, int dimensions_match, DRI2BufferPtr * buffer) { int old_buf = find_attachment(pPriv, attachment); if ((old_buf < 0) || attachment == DRI2BufferFrontLeft - || !dimensions_match || (pPriv->buffers[old_buf]->format != format)) { + || !dimensions_match + || (has_format && pPriv->buffers[old_buf]->format != format)) { *buffer = create_buffer(ds, pDraw, attachment, format); return TRUE; @@ -552,7 +554,8 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, const unsigned format = (has_format) ? *(attachments++) : 0; if (allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment, - format, dimensions_match, &buffers[i])) + has_format, format, dimensions_match, + &buffers[i])) buffers_changed = 1; if (buffers[i] == NULL) @@ -587,7 +590,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, if (need_real_front > 0) { if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFrontLeft, - front_format, dimensions_match, + has_format, front_format, dimensions_match, &buffers[i])) buffers_changed = 1; @@ -598,7 +601,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, if (need_fake_front > 0) { if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFakeFrontLeft, - front_format, dimensions_match, + has_format, front_format, dimensions_match, &buffers[i])) buffers_changed = 1; |