Please review! Attached patch marks compressed formats as unsupported and 
unsupported texture formats will now fail to validate. This makes the command 
stream checker happier preventing the following kernel output:
radeon 0000:01:00.0: texture bo too small (256 256 4 0 -> 262144 have 94208)
[drm:radeon_cs_ioctl] *ERROR* Invalid command stream !
and has therefore the additional benefit that the calling app is not killed.

-Klaus S.
Author: Klaus Schnass <klaus.schn...@student.tuwien.ac.at>
Date:   Tue Feb 23 20:16:53 2010 +0100

    [PATCH] R6xx+ do not support compressed textures
    	- mark compressed textures as unsupported
    	- fail to validate unsupported textures

diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c
index dd33ef3..1600033 100644
--- a/src/mesa/drivers/dri/r600/r600_texstate.c
+++ b/src/mesa/drivers/dri/r600/r600_texstate.c
@@ -373,17 +373,11 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
 		  break;
 		*/
 	case MESA_FORMAT_RGB_DXT1: /* not supported yet */
-
-		break;
 	case MESA_FORMAT_RGBA_DXT1: /* not supported yet */
-
-		break;
 	case MESA_FORMAT_RGBA_DXT3: /* not supported yet */
-
-		break;
 	case MESA_FORMAT_RGBA_DXT5: /* not supported yet */
+	        return GL_FALSE;
 
-		break;
 	case MESA_FORMAT_RGBA_FLOAT32:
 		SETfield(t->SQ_TEX_RESOURCE1, FMT_32_32_32_32_FLOAT,
 			 SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
@@ -701,8 +695,8 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj)
 
 	t = radeon_tex_obj(tObj);
 
-	r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat);
-
+	if(!r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat))
+	  t->validated = GL_FALSE;
 }
 
 /**
@@ -711,7 +705,7 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj)
  * \param rmesa Context pointer
  * \param t the r300 texture object
  */
-static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
+static GLboolean setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
 {
 	context_t *rmesa = R700_CONTEXT(ctx);
 	radeonTexObj *t = radeon_tex_obj(texObj);
@@ -721,15 +715,15 @@ static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texO
 	if (rmesa->radeon.radeonScreen->driScreen->dri2.enabled &&
 	    t->image_override &&
 	    t->bo)
-		return;
+		return GL_TRUE;
 
 	firstImage = t->base.Image[0][t->minLod];
 
 	if (!t->image_override) {
 		if (!r600GetTexFormat(texObj, firstImage->TexFormat)) {
-			radeon_error("unexpected texture format in %s\n",
-				      __FUNCTION__);
-			return;
+			radeon_warning("unsupported texture format in %s\n",
+				       __FUNCTION__);
+			return GL_FALSE;
 		}
 	}
 
@@ -754,7 +748,7 @@ static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texO
 		break;
         default:
 		radeon_error("unexpected texture target type in %s\n", __FUNCTION__);
-		return;
+		return GL_FALSE;
 	}
 
 	row_align = rmesa->radeon.texture_row_align - 1;
@@ -799,6 +793,7 @@ static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texO
 		CLEARfield(t->SQ_TEX_SAMPLER0, DEPTH_COMPARE_FUNCTION_mask);
 	}
 
+	return GL_TRUE;
 }
 
 /**
@@ -815,7 +810,8 @@ static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object
 
 	/* Configure the hardware registers (more precisely, the cached version
 	 * of the hardware registers). */
-	setup_hardware_state(ctx, texObj, unit);
+	if (!setup_hardware_state(ctx, texObj, unit))
+	        return GL_FALSE;
 
 	t->validated = GL_TRUE;
 	return GL_TRUE;
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to