All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chad Versace <chad@chad-versace.us>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/3] dri: Do not create DRI2 buffers for unrecognized DRI2 buffer tokens
Date: Sun,  5 Jun 2011 20:36:06 -0700	[thread overview]
Message-ID: <1307331367-524-3-git-send-email-chad@chad-versace.us> (raw)
In-Reply-To: <1307331367-524-1-git-send-email-chad@chad-versace.us>

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: Kristian Høgsberg <krh@bitplanet.net>
CC: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
---
 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 48d0f56..4571d07 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,
-- 
1.7.5.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2011-06-06  3:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-06  3:36 [PATCH 0/3] [RESUBMIT] ddx/dri: Add support for hiz and separate stencil buffers Chad Versace
2011-06-06  3:36 ` [PATCH] Add attachment token DRI2BufferHiz Chad Versace
2011-06-06  3:36 ` Chad Versace [this message]
2011-06-06  3:36 ` [PATCH 3/3] dri: Add support for DRI2BufferStencil and DRI2BufferHiz Chad Versace

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1307331367-524-3-git-send-email-chad@chad-versace.us \
    --to=chad@chad-versace.us \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.