summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-12-01 22:40:00 +0100
committerMarek Olšák <[email protected]>2012-12-01 22:41:39 +0100
commit8ad9d42b338c6684930b7898734f9070b6368172 (patch)
tree4e09d9d09bb357ad898f17b814ff71b12ac6406e /src/gallium/drivers
parente694ea09f57cdce557a7424401e68b37e0e80fa7 (diff)
r300g: refuse to create too large textures
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r300/r300_texture.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 33333ca51b5..c16bb03e702 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -980,6 +980,21 @@ r300_texture_create_object(struct r300_screen *rscreen,
r300_texture_desc_init(rscreen, tex, base);
+ /* Figure out the ideal placement for the texture.. */
+ if (tex->domain & RADEON_DOMAIN_VRAM &&
+ tex->tex.size_in_bytes >= rscreen->info.vram_size) {
+ tex->domain &= ~RADEON_DOMAIN_VRAM;
+ tex->domain |= RADEON_DOMAIN_GTT;
+ }
+ if (tex->domain & RADEON_DOMAIN_GTT &&
+ tex->tex.size_in_bytes >= rscreen->info.gart_size) {
+ tex->domain &= ~RADEON_DOMAIN_GTT;
+ }
+ /* Just fail if the texture is too large. */
+ if (!tex->domain) {
+ goto fail;
+ }
+
/* Create the backing buffer if needed. */
if (!tex->buf) {
tex->buf = rws->buffer_create(rws, tex->tex.size_in_bytes, 2048,