diff mbox

drm/radeon/kms: Fix for CS track check to allow at least one enabled component

Message ID 201002102336.13227.oldium.pro@seznam.cz (mailing list archive)
State Rejected
Headers show

Commit Message

Oldřich Jedlička Feb. 10, 2010, 10:36 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/r600_cs.c 
b/drivers/gpu/drm/radeon/r600_cs.c
index 7cabb62..f1dab96 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -233,6 +233,7 @@  static int r600_cs_track_check(struct radeon_cs_parser *p)
 	struct r600_cs_track *track = p->track;
 	u32 tmp;
 	int r, i;
+	bool is_valid = false;
 
 	/* on legacy kernel we don't perform advanced check */
 	if (p->rdev == NULL)
@@ -247,17 +248,20 @@  static int r600_cs_track_check(struct radeon_cs_parser 
*p)
 	for (i = 0; i < 8; i++) {
 		if ((tmp >> (i * 4)) & 0xF) {
 			/* at least one component is enabled */
-			if (track->cb_color_bo[i] == NULL) {
-				dev_warn(p->dev, "%s:%d mask 0x%08X | 0x%08X no cb for %d\n",
-					__func__, __LINE__, track->cb_target_mask, track-
>cb_shader_mask, i);
-				return -EINVAL;
+			if (track->cb_color_bo[i] != NULL) {
+				/* perform rewrite of CB_COLOR[0-7]_SIZE */
+				r = r600_cs_track_validate_cb(p, i);
+				if (r)
+					return r;
+				is_valid = true;
 			}
-			/* perform rewrite of CB_COLOR[0-7]_SIZE */
-			r = r600_cs_track_validate_cb(p, i);
-			if (r)
-				return r;
 		}
 	}
+	if (!is_valid) {
+		dev_warn(p->dev, "%s:%d mask 0x%08X | 0x%08X no cb found\n",
+			__func__, __LINE__, track->cb_target_mask, track->cb_shader_mask);
+		return -EINVAL;
+	}
 	return 0;