xf86-video-intel: src/sna/sna_dri.c
Chris Wilson
ickle at kemper.freedesktop.org
Mon Nov 12 06:48:54 PST 2012
src/sna/sna_dri.c | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
New commits:
commit 66eb0adffa63ef8ece7621ba90dc96af91549612
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Nov 12 14:45:56 2012 +0000
sna/dri: Apply the can_blit() check for CopyRegion
CopyRegion() also needs to check for stale bo in case the pixmap
dimensions have changed size and so may cause out-of-bounds read/writes.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 17e3db1..880e9f6 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -808,6 +808,22 @@ sna_dri_copy(struct sna *sna, DrawablePtr draw, RegionPtr region,
pixman_region_fini(&clip);
}
+static bool
+can_blit(struct sna * sna,
+ DrawablePtr draw,
+ DRI2BufferPtr front,
+ DRI2BufferPtr back)
+{
+ PixmapPtr pixmap;
+
+ if (draw->type == DRAWABLE_PIXMAP)
+ return true;
+
+ pixmap = get_drawable_pixmap(draw);
+ return (get_private(front)->serial == pixmap->drawable.serialNumber &&
+ get_private(back)->serial == pixmap->drawable.serialNumber);
+}
+
static void
sna_dri_copy_region(DrawablePtr draw,
RegionPtr region,
@@ -820,6 +836,9 @@ sna_dri_copy_region(DrawablePtr draw,
void (*copy)(struct sna *, DrawablePtr, RegionPtr,
struct kgem_bo *, struct kgem_bo *, bool) = sna_dri_copy;
+ if (!can_blit(sna, draw, dst_buffer, src_buffer))
+ return;
+
if (dst_buffer->attachment == DRI2BufferFrontLeft) {
dst = sna_pixmap_get_bo(pixmap);
copy = (void *)sna_dri_copy_to_front;
@@ -1179,22 +1198,6 @@ can_exchange(struct sna * sna,
return true;
}
-static bool
-can_blit(struct sna * sna,
- DrawablePtr draw,
- DRI2BufferPtr front,
- DRI2BufferPtr back)
-{
- PixmapPtr pixmap;
-
- if (draw->type == DRAWABLE_PIXMAP)
- return true;
-
- pixmap = get_drawable_pixmap(draw);
- return (get_private(front)->serial == pixmap->drawable.serialNumber &&
- get_private(back)->serial == pixmap->drawable.serialNumber);
-}
-
inline static uint32_t pipe_select(int pipe)
{
/* The third pipe was introduced with IvyBridge long after
More information about the xorg-commit
mailing list