From edc5b7f741a4bb8e9a58b5eb2201fa9304f94ef7 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 27 Sep 2012 13:27:20 +0100 Subject: [PATCH] uxa/dri: Confirm Drawable is still attached to an active pipe before flipping If we schedule a flip to happen on a far distant vblank, it is possible for us to disable the pipes with a modeset, whilst maintaining the fb size, or with a DPMS command. If the pipe is disabled and we still try to flip, then we trigger an EINVAL error from the kernel. Signed-off-by: Chris Wilson --- src/intel_dri.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/intel_dri.c b/src/intel_dri.c index 8cab73f5..ccb10d11 100644 --- a/src/intel_dri.c +++ b/src/intel_dri.c @@ -455,7 +455,7 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion, BoxPtr box; BoxRec crtcbox; int y1, y2; - int pipe = -1, event, load_scan_lines_pipe; + int event, load_scan_lines_pipe; xf86CrtcPtr crtc; Bool full_height = FALSE; @@ -467,7 +467,7 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion, * buffer */ if (crtc != NULL && !crtc->rotatedData) { - pipe = intel_crtc_to_pipe(crtc); + int pipe = intel_crtc_to_pipe(crtc); /* * Make sure we don't wait for a scanline that will @@ -932,6 +932,9 @@ can_exchange(DrawablePtr drawable, DRI2BufferPtr front, DRI2BufferPtr back) struct intel_pixmap *front_intel = intel_get_pixmap_private(front_pixmap); struct intel_pixmap *back_intel = intel_get_pixmap_private(back_pixmap); + if (I830DRI2DrawablePipe(draw) < 0) + return FALSE; + if (!DRI2CanFlip(drawable)) return FALSE;