diff options
author | Chad Versace <chad@chad-versace.us> | 2011-06-05 19:48:19 -0700 |
---|---|---|
committer | Chad Versace <chad@chad-versace.us> | 2011-06-08 10:08:33 -0700 |
commit | 263daba7e6afb37bd471fdc8dd8e4458da0a45ff (patch) | |
tree | 4b27e014293c97ab34411af02e11266d1ed541c8 /src/intel_dri.c | |
parent | 038f29c259c1463c0bff12f5f8f0b228c02e45b3 (diff) |
dri: Do not create DRI2 buffers for unrecognized DRI2 buffer tokens
Before this commit, if a client were to request an unrecognized DRI2
buffer, such as DRI2BufferStencil, then I830DRI2CreateBuffer() allocated
and returned an X-tiled buffer by accident. The problem was that
unrecognized tokens were caught by the default case of a switch statement.
Now, when given unrecognized DRI2 tokens, I830DRI2CreateBuffers() returns
null.
This shouldn't break older Mesa versions, because they never query (via
DRI2GetBuffersWithFormat) for the drawable's DRI2BufferStencil.
CC: Eric Anholt <eric@anholt.net>
CC: Ian Romanick <idr@freedesktop.org>
CC: Kenneth Graunke <kenneth@whitecape.org>
CC: Kristian Høgsberg <krh@bitplanet.net
Signed-off-by: Chad Versace <chad@chad-versace.us>
Diffstat (limited to 'src/intel_dri.c')
-rw-r--r-- | src/intel_dri.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/intel_dri.c b/src/intel_dri.c index 48d0f566..4571d075 100644 --- a/src/intel_dri.c +++ b/src/intel_dri.c @@ -338,10 +338,20 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, hint |= INTEL_CREATE_PIXMAP_TILING_Y; break; } - default: + case DRI2BufferAccum: + case DRI2BufferBackLeft: + case DRI2BufferBackRight: + case DRI2BufferFakeFrontLeft: + case DRI2BufferFakeFrontRight: + case DRI2BufferFrontLeft: + case DRI2BufferFrontRight: hint |= INTEL_CREATE_PIXMAP_TILING_X; break; - } + default: + free(privates); + free(buffer); + return NULL; + } } pixmap = screen->CreatePixmap(screen, |