[PATCH] radeon: fix exa texture setup

j.glisse at gmail.com j.glisse at gmail.com
Mon Nov 12 09:57:23 PST 2012


From: Jerome Glisse <jglisse at redhat.com>

exa state that we should use the pixmap to get the width, height and
pitch to use when setting up texture (see exa.h). This fix a rare case
where picture->pDrawable->(width|height) > pixmap->drawable.(width|height)

Signed-off-by: Jerome Glisse <jglisse at redhat.com>
---
 src/evergreen_exa.c     |   13 +++----------
 src/r600_exa.c          |   12 +++---------
 src/radeon_exa_render.c |   36 +++++++++---------------------------
 3 files changed, 15 insertions(+), 46 deletions(-)

diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c
index 883fa5c..a79d9b2 100644
--- a/src/evergreen_exa.c
+++ b/src/evergreen_exa.c
@@ -843,16 +843,9 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, PixmapPtr pPix,
     }
 
     /* Texture */
-    if (pPict->pDrawable) {
-	tex_res.w               = pPict->pDrawable->width;
-	tex_res.h               = pPict->pDrawable->height;
-	repeatType              = pPict->repeat ? pPict->repeatType : RepeatNone;
-    } else {
-	tex_res.w               = 1;
-	tex_res.h               = 1;
-	repeatType              = RepeatNormal;
-    }
-
+    tex_res.w                   = pPix->drawable.width;
+    tex_res.h                   = pPix->drawable.height;
+    repeatType                  = pPict->repeat ? pPict->repeatType : RepeatNone;
     tex_res.id                  = unit;
     tex_res.pitch               = accel_state->src_obj[unit].pitch;
     tex_res.depth               = 0;
diff --git a/src/r600_exa.c b/src/r600_exa.c
index 21df084..d45615b 100644
--- a/src/r600_exa.c
+++ b/src/r600_exa.c
@@ -860,15 +860,9 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix,
     }
 
     /* Texture */
-    if (pPict->pDrawable) {
-	tex_res.w               = pPict->pDrawable->width;
-	tex_res.h               = pPict->pDrawable->height;
-	repeatType              = pPict->repeat ? pPict->repeatType : RepeatNone;
-    } else {
-	tex_res.w               = 1;
-	tex_res.h               = 1;
-	repeatType              = RepeatNormal;
-    }
+    tex_res.w                   = pPix->drawable.width;
+    tex_res.h                   = pPix->drawable.height;
+    repeatType                  = pPict->repeat ? pPict->repeatType : RepeatNone;
     tex_res.id                  = unit;
     tex_res.pitch               = accel_state->src_obj[unit].pitch;
     tex_res.depth               = 0;
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
index c673f2c..885e751 100644
--- a/src/radeon_exa_render.c
+++ b/src/radeon_exa_render.c
@@ -359,15 +359,9 @@ static Bool R100TextureSetup(PicturePtr pPict, PixmapPtr pPix,
     int i, w, h;
     struct radeon_exa_pixmap_priv *driver_priv;
 
-    if (pPict->pDrawable) {
-	w = pPict->pDrawable->width;
-	h = pPict->pDrawable->height;
-	repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
-    } else {
-	w = h = 1;
-	repeatType = RepeatNormal;
-    }
-
+    w = pPix->drawable.width;
+    h = pPix->drawable.height;
+    repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
     repeat = (repeatType == RepeatNormal || repeatType == RepeatReflect) &&
 	!(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y));
 
@@ -756,15 +750,9 @@ static Bool R200TextureSetup(PicturePtr pPict, PixmapPtr pPix,
     int i, w, h;
     struct radeon_exa_pixmap_priv *driver_priv;
 
-    if (pPict->pDrawable) {
-	w = pPict->pDrawable->width;
-	h = pPict->pDrawable->height;
-	repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
-    } else {
-	w = h = 1;
-	repeatType = RepeatNormal;
-    }
-
+    w = pPix->drawable.width;
+    h = pPix->drawable.height;
+    repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
     repeat = (repeatType == RepeatNormal || repeatType == RepeatReflect) &&
 	!(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y));
 
@@ -1140,15 +1128,9 @@ static Bool R300TextureSetup(PicturePtr pPict, PixmapPtr pPix,
 
     TRACE;
 
-    if (pPict->pDrawable) {
-	w = pPict->pDrawable->width;
-	h = pPict->pDrawable->height;
-	repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
-    } else {
-	w = h = 1;
-	repeatType = RepeatNormal;
-    }
-
+    w = pPix->drawable.width;
+    h = pPix->drawable.height;
+    repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
     txpitch = exaGetPixmapPitch(pPix);
     txoffset = 0;
 
-- 
1.7.1



More information about the xorg-driver-ati mailing list