dri: Disable page-flip between a tiled buffer and a linear scanout

Keith Packard pointed out a loophole that could cause the DDX to end up
with a tiled scanout even if the user required a linear framebuffer;
that is by using page-flipping we could replace the scanout pixmap with
another of our choosing, and not necessarily tiled.

Close that loophole by only allowing an exchange of buffers between
identical tiling modes. For the common case, this is fine since they
will indeed be allocated with the same tiling. For the linear
framebuffer case with mesa using a tiled pixmap, we force it to blit
onto the scanout instead.

Reported-by: Keith Packard <keith.packard@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-03-09 17:10:50 +00:00
parent 049ce4397d
commit 014fc7abb7
1 changed files with 6 additions and 0 deletions

View File

@ -674,6 +674,8 @@ can_exchange(DRI2BufferPtr front, DRI2BufferPtr back)
I830DRI2BufferPrivatePtr back_priv = back->driverPrivate;
PixmapPtr front_pixmap = front_priv->pixmap;
PixmapPtr back_pixmap = back_priv->pixmap;
struct intel_pixmap *front_intel = intel_get_pixmap_private(front_pixmap);
struct intel_pixmap *back_intel = intel_get_pixmap_private(back_pixmap);
if (front_pixmap->drawable.width != back_pixmap->drawable.width)
return FALSE;
@ -690,6 +692,10 @@ can_exchange(DRI2BufferPtr front, DRI2BufferPtr back)
return FALSE;
#endif
/* prevent an implicit tiling mode change */
if (front_intel->tiling != back_intel->tiling)
return FALSE;
return TRUE;
}