From: Jerome Glisse <[email protected]>

This is some kind off degenerate case that we might get from time to
time, just fallback to software when facing it.

v2: Handle the other degenerate case of NULL drawable

Signed-off-by: Jerome Glisse <[email protected]>
---
 src/evergreen_exa.c     |   14 +++++++++-----
 src/r600_exa.c          |   14 +++++++++-----
 src/radeon_exa_render.c |   12 ++++++++++++
 3 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c
index 883fa5c..9f79da8 100644
--- a/src/evergreen_exa.c
+++ b/src/evergreen_exa.c
@@ -837,13 +837,12 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, 
PixmapPtr pPix,
     CLEAR (tex_res);
     CLEAR (tex_samp);
 
-    for (i = 0; i < sizeof(EVERGREENTexFormats) / 
sizeof(EVERGREENTexFormats[0]); i++) {
-       if (EVERGREENTexFormats[i].fmt == pPict->format)
-           break;
-    }
-
     /* Texture */
     if (pPict->pDrawable) {
+        if (pPict->pDrawable->width > pPix->drawable.width || 
pPict->pDrawable->height > pPix->drawable.height) {
+            /* just let software fallback handle this degenerate case */
+            return FALSE;
+        }
        tex_res.w               = pPict->pDrawable->width;
        tex_res.h               = pPict->pDrawable->height;
        repeatType              = pPict->repeat ? pPict->repeatType : 
RepeatNone;
@@ -853,6 +852,11 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, 
PixmapPtr pPix,
        repeatType              = RepeatNormal;
     }
 
+    for (i = 0; i < sizeof(EVERGREENTexFormats) / 
sizeof(EVERGREENTexFormats[0]); i++) {
+       if (EVERGREENTexFormats[i].fmt == pPict->format)
+           break;
+    }
+
     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..fa56ec5 100644
--- a/src/r600_exa.c
+++ b/src/r600_exa.c
@@ -854,13 +854,12 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr 
pPix,
     CLEAR (tex_res);
     CLEAR (tex_samp);
 
-    for (i = 0; i < sizeof(R600TexFormats) / sizeof(R600TexFormats[0]); i++) {
-       if (R600TexFormats[i].fmt == pPict->format)
-           break;
-    }
-
     /* Texture */
     if (pPict->pDrawable) {
+        if (pPict->pDrawable->width > pPix->drawable.width || 
pPict->pDrawable->height > pPix->drawable.height) {
+            /* just let software fallback handle this degenerate case */
+            return FALSE;
+        }
        tex_res.w               = pPict->pDrawable->width;
        tex_res.h               = pPict->pDrawable->height;
        repeatType              = pPict->repeat ? pPict->repeatType : 
RepeatNone;
@@ -869,6 +868,11 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr 
pPix,
        tex_res.h               = 1;
        repeatType              = RepeatNormal;
     }
+    for (i = 0; i < sizeof(R600TexFormats) / sizeof(R600TexFormats[0]); i++) {
+       if (R600TexFormats[i].fmt == pPict->format)
+           break;
+    }
+
     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..df754b7 100644
--- a/src/radeon_exa_render.c
+++ b/src/radeon_exa_render.c
@@ -360,6 +360,10 @@ static Bool R100TextureSetup(PicturePtr pPict, PixmapPtr 
pPix,
     struct radeon_exa_pixmap_priv *driver_priv;
 
     if (pPict->pDrawable) {
+        if (pPict->pDrawable->width > pPix->drawable.width || 
pPict->pDrawable->height > pPix->drawable.height) {
+            /* just let software fallback handle this degenerate case */
+            return FALSE;
+        }
        w = pPict->pDrawable->width;
        h = pPict->pDrawable->height;
        repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
@@ -757,6 +761,10 @@ static Bool R200TextureSetup(PicturePtr pPict, PixmapPtr 
pPix,
     struct radeon_exa_pixmap_priv *driver_priv;
 
     if (pPict->pDrawable) {
+        if (pPict->pDrawable->width > pPix->drawable.width || 
pPict->pDrawable->height > pPix->drawable.height) {
+            /* just let software fallback handle this degenerate case */
+            return FALSE;
+        }
        w = pPict->pDrawable->width;
        h = pPict->pDrawable->height;
        repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
@@ -1141,6 +1149,10 @@ static Bool R300TextureSetup(PicturePtr pPict, PixmapPtr 
pPix,
     TRACE;
 
     if (pPict->pDrawable) {
+        if (pPict->pDrawable->width > pPix->drawable.width || 
pPict->pDrawable->height > pPix->drawable.height) {
+            /* just let software fallback handle this degenerate case */
+            return FALSE;
+        }
        w = pPict->pDrawable->width;
        h = pPict->pDrawable->height;
        repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
-- 
1.7.1

_______________________________________________
xorg-driver-ati mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-driver-ati

Reply via email to