Mesa (master): r300g: allow the GTT domain for samplers
Marek Olšák
mareko at kemper.freedesktop.org
Fri Jul 9 18:30:32 UTC 2010
Module: Mesa
Branch: master
Commit: 347c00c46e9ecf858a8c21abf58a706b658b5b37
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=347c00c46e9ecf858a8c21abf58a706b658b5b37
Author: Marek Olšák <maraeo at gmail.com>
Date: Fri Jul 9 20:22:20 2010 +0200
r300g: allow the GTT domain for samplers
This fixes sluggishness in vdrift.
---
src/gallium/drivers/r300/r300_emit.c | 7 ++++---
src/gallium/drivers/r300/r300_texture.c | 10 ++++++++--
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 014b382..5ce3eb6 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -959,7 +959,8 @@ validate:
for (i = 0; i < fb->nr_cbufs; i++) {
tex = r300_texture(fb->cbufs[i]->texture);
assert(tex && tex->buffer && "cbuf is marked, but NULL!");
- if (!r300_add_texture(r300->rws, tex, 0, tex->domain)) {
+ if (!r300_add_texture(r300->rws, tex, 0,
+ r300_surface(fb->cbufs[i])->domain)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
@@ -968,8 +969,8 @@ validate:
if (fb->zsbuf) {
tex = r300_texture(fb->zsbuf->texture);
assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
- if (!r300_add_texture(r300->rws, tex,
- 0, tex->domain)) {
+ if (!r300_add_texture(r300->rws, tex, 0,
+ r300_surface(fb->zsbuf)->domain)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 094f22d..d378a71 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -1001,8 +1001,9 @@ struct pipe_resource* r300_texture_create(struct pipe_screen* screen,
tex->size,
util_format_short_name(base->format));
- tex->domain = base->flags & R300_RESOURCE_FLAG_TRANSFER ? R300_DOMAIN_GTT :
- R300_DOMAIN_VRAM;
+ tex->domain = base->flags & R300_RESOURCE_FLAG_TRANSFER ?
+ R300_DOMAIN_GTT :
+ R300_DOMAIN_VRAM | R300_DOMAIN_GTT;
tex->buffer = rws->buffer_create(rws, 2048, base->bind, tex->domain,
tex->size);
@@ -1044,7 +1045,12 @@ struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
surface->base.level = level;
surface->buffer = tex->buffer;
+
+ /* Prefer VRAM if there are multiple domains to choose from. */
surface->domain = tex->domain;
+ if (surface->domain & R300_DOMAIN_VRAM)
+ surface->domain &= ~R300_DOMAIN_GTT;
+
surface->offset = r300_texture_get_offset(tex, level, zslice, face);
surface->pitch = tex->fb_state.pitch[level];
surface->format = tex->fb_state.format;
More information about the mesa-commit
mailing list