aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-02-27 23:27:03 -0500
committerDave Airlie <airlied@redhat.com>2011-02-27 23:24:01 -0500
commitaf50621a18418a7a0a71b0b4f60ce74b37967b9e (patch)
tree5ee1148245ff9dd66e4a09a6409c4e3f1c326888
parentcf8a47d1561a44f77f0269834a669e377b382f62 (diff)
drm/radeon: make sure ib reads are in-order.
have to read values from the IB in order as we could cross a page boundary at any time and won't be able to go backwards. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index fa7c6e58205b..6701fa4e41fa 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -1279,7 +1279,7 @@ static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 i
1279{ 1279{
1280 struct r600_cs_track *track = p->track; 1280 struct r600_cs_track *track = p->track;
1281 u32 nfaces, llevel, blevel, w0, h0, d0; 1281 u32 nfaces, llevel, blevel, w0, h0, d0;
1282 u32 word0, word1, l0_size, mipmap_size; 1282 u32 word0, word1, l0_size, mipmap_size, word2, word3;
1283 u32 height_align, pitch, pitch_align, depth_align; 1283 u32 height_align, pitch, pitch_align, depth_align;
1284 u32 array, barray, larray; 1284 u32 array, barray, larray;
1285 u64 base_align; 1285 u64 base_align;
@@ -1365,6 +1365,9 @@ static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 i
1365 return -EINVAL; 1365 return -EINVAL;
1366 } 1366 }
1367 1367
1368 word2 = radeon_get_ib_value(p, idx + 2) << 8;
1369 word3 = radeon_get_ib_value(p, idx + 3) << 8;
1370
1368 word0 = radeon_get_ib_value(p, idx + 4); 1371 word0 = radeon_get_ib_value(p, idx + 4);
1369 word1 = radeon_get_ib_value(p, idx + 5); 1372 word1 = radeon_get_ib_value(p, idx + 5);
1370 blevel = G_038010_BASE_LEVEL(word0); 1373 blevel = G_038010_BASE_LEVEL(word0);
@@ -1379,18 +1382,17 @@ static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 i
1379 pitch_align, height_align, base_align, 1382 pitch_align, height_align, base_align,
1380 &l0_size, &mipmap_size); 1383 &l0_size, &mipmap_size);
1381 /* using get ib will give us the offset into the texture bo */ 1384 /* using get ib will give us the offset into the texture bo */
1382 word0 = radeon_get_ib_value(p, idx + 2) << 8; 1385 if ((l0_size + word2) > radeon_bo_size(texture)) {
1383 if ((l0_size + word0) > radeon_bo_size(texture)) {
1384 dev_warn(p->dev, "texture bo too small (%d %d %d %d -> %d have %ld)\n", 1386 dev_warn(p->dev, "texture bo too small (%d %d %d %d -> %d have %ld)\n",
1385 w0, h0, format, word0, l0_size, radeon_bo_size(texture)); 1387 w0, h0, format, word2, l0_size, radeon_bo_size(texture));
1386 dev_warn(p->dev, "alignments %d %d %d %lld\n", pitch, pitch_align, height_align, base_align); 1388 dev_warn(p->dev, "alignments %d %d %d %lld\n", pitch, pitch_align, height_align, base_align);
1387 return -EINVAL; 1389 return -EINVAL;
1388 } 1390 }
1389 /* using get ib will give us the offset into the mipmap bo */ 1391 /* using get ib will give us the offset into the mipmap bo */
1390 word0 = radeon_get_ib_value(p, idx + 3) << 8; 1392 word3 = radeon_get_ib_value(p, idx + 3) << 8;
1391 if ((mipmap_size + word0) > radeon_bo_size(mipmap)) { 1393 if ((mipmap_size + word3) > radeon_bo_size(mipmap)) {
1392 /*dev_warn(p->dev, "mipmap bo too small (%d %d %d %d %d %d -> %d have %ld)\n", 1394 /*dev_warn(p->dev, "mipmap bo too small (%d %d %d %d %d %d -> %d have %ld)\n",
1393 w0, h0, format, blevel, nlevels, word0, mipmap_size, radeon_bo_size(texture));*/ 1395 w0, h0, format, blevel, nlevels, word3, mipmap_size, radeon_bo_size(texture));*/
1394 } 1396 }
1395 return 0; 1397 return 0;
1396} 1398}