xf86-video-intel: 2 commits - src/intel.h src/intel_uxa.c src/intel_video.c src/sna/sna_video_textured.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Aug 29 02:48:56 PDT 2011


 src/intel.h                  |    6 ++++++
 src/intel_uxa.c              |    3 +--
 src/intel_video.c            |    3 +++
 src/sna/sna_video_textured.c |    3 +++
 4 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 0ac4b974b90a5614d1114d5e211cb4b986a89454
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Aug 29 10:46:46 2011 +0100

    sna/video: Defend against PutImage to a broken screen
    
    Similar to the previous commit, check that the Screen Pixmap is bound to
    a bo before proceeding.
    
    [Note that in this case, the absence of the bo would have been picked
    up much later after doing all of the setup...]
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c
index 46b95ee..0e7a291 100644
--- a/src/sna/sna_video_textured.c
+++ b/src/sna/sna_video_textured.c
@@ -240,6 +240,9 @@ sna_video_textured_put_image(ScrnInfoPtr scrn,
 	int top, left, npixels, nlines;
 	Bool flush = false;
 
+	if (!sna_pixmap(pixmap))
+		return BadAlloc;
+
 	if (!sna_video_clip_helper(scrn, video, &crtc, &dstBox,
 				   src_x, src_y, drw_x, drw_y,
 				   src_w, src_h, drw_w, drw_h,
commit 0a74cd77a3f462d5d2707bf1f35663279bcb9be5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Aug 29 10:41:26 2011 +0100

    video: check that the pixmap exists before use
    
    Now, the pixmap being used is meant to the Screen pixmap and by rights
    that has to exists in a GPU buffer! Evidence contrary to the above
    exists and so we had better check that we have a bo before using...
    
    Reported-by: Toralf Förster <toralf.foerster at gmx.de>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40439
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel.h b/src/intel.h
index 42afaf4..899d250 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -737,4 +737,10 @@ Bool intel_get_aperture_space(ScrnInfoPtr scrn, drm_intel_bo ** bo_table,
 void intel_shadow_blt(intel_screen_private *intel);
 void intel_shadow_create(struct intel_screen_private *intel);
 
+static inline Bool intel_pixmap_is_offscreen(PixmapPtr pixmap)
+{
+	struct intel_pixmap *priv = intel_get_pixmap_private(pixmap);
+	return priv && priv->offscreen;
+}
+
 #endif /* _I830_H_ */
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index df3adcb..30717d0 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -689,8 +689,7 @@ void intel_set_pixmap_bo(PixmapPtr pixmap, dri_bo * bo)
 
 static Bool intel_uxa_pixmap_is_offscreen(PixmapPtr pixmap)
 {
-	struct intel_pixmap *priv = intel_get_pixmap_private(pixmap);
-	return priv && priv->offscreen;
+	return intel_pixmap_is_offscreen(pixmap);
 }
 
 static Bool intel_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access)
diff --git a/src/intel_video.c b/src/intel_video.c
index 021ca5f..34206d1 100644
--- a/src/intel_video.c
+++ b/src/intel_video.c
@@ -1530,6 +1530,9 @@ I830PutImageTextured(ScrnInfoPtr scrn,
 	xf86CrtcPtr crtc;
 	int top, left, npixels, nlines;
 
+	if (!intel_pixmap_is_offscreen(pixmap))
+		return BadAlloc;
+
 #if 0
 	ErrorF("I830PutImage: src: (%d,%d)(%d,%d), dst: (%d,%d)(%d,%d)\n"
 	       "width %d, height %d\n", src_x, src_y, src_w, src_h, drw_x,


More information about the xorg-commit mailing list