Mesa (gallium-0.2): r300: Update to match pipe_surface changes.

Corbin Simpson csimpson at kemper.freedesktop.org
Sun Feb 8 09:41:43 UTC 2009


Module: Mesa
Branch: gallium-0.2
Commit: ea3398cf3395fd36ac6edc717f2680361ac5e239
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea3398cf3395fd36ac6edc717f2680361ac5e239

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Sun Feb  8 01:01:26 2009 -0800

r300: Update to match pipe_surface changes.

---

 src/gallium/drivers/r300/r300_context.h |    4 ++++
 src/gallium/drivers/r300/r300_emit.c    |    4 +++-
 src/gallium/drivers/r300/r300_screen.c  |    6 ++++--
 src/gallium/drivers/r300/r300_surface.c |    3 ++-
 src/gallium/drivers/r300/r300_texture.c |    4 ----
 5 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index fb91c17..376c576 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -179,8 +179,12 @@ static struct r300_context* r300_context(struct pipe_context* context) {
 void r300_init_state_functions(struct r300_context* r300);
 void r300_init_surface_functions(struct r300_context* r300);
 
+/* Fun with includes: r300_winsys also declares this prototype.
+ * We'll just step out in that case... */
+#ifndef R300_WINSYS_H
 struct pipe_context* r300_create_context(struct pipe_screen* screen,
                                          struct pipe_winsys* winsys,
                                          struct r300_winsys* r300_winsys);
+#endif
 
 #endif /* R300_CONTEXT_H */
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index c71b8d0..585a9e7 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -84,12 +84,14 @@ void r300_emit_fb_state(struct r300_context* r300,
                         struct pipe_framebuffer_state* fb)
 {
     CS_LOCALS(r300);
+    struct r300_texture* tex;
     int i;
 
     BEGIN_CS((3 * fb->nr_cbufs) + 6);
     for (i = 0; i < fb->nr_cbufs; i++) {
+        tex = (struct r300_texture*)fb->cbufs[i]->texture;
         OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1);
-        OUT_CS_RELOC(fb->cbufs[i]->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
+        OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
     }
     R300_PACIFY;
     END_CS;
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index fd916fa..8ed66a1 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -214,7 +214,8 @@ static void* r300_surface_map(struct pipe_screen* screen,
                               struct pipe_surface* surface,
                               unsigned flags)
 {
-    char* map = pipe_buffer_map(screen, surface->buffer, flags);
+    struct r300_texture* tex = (struct r300_texture*)surface->texture;
+    char* map = pipe_buffer_map(screen, tex->buffer, flags);
 
     if (!map) {
         return NULL;
@@ -226,7 +227,8 @@ static void* r300_surface_map(struct pipe_screen* screen,
 static void r300_surface_unmap(struct pipe_screen* screen,
                                struct pipe_surface* surface)
 {
-    pipe_buffer_unmap(screen, surface->buffer);
+    struct r300_texture* tex = (struct r300_texture*)surface->texture;
+    pipe_buffer_unmap(screen, tex->buffer);
 }
 
 static void r300_destroy_screen(struct pipe_screen* pscreen)
diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c
index 1ed4a4e..bbd2ade 100644
--- a/src/gallium/drivers/r300/r300_surface.c
+++ b/src/gallium/drivers/r300/r300_surface.c
@@ -33,6 +33,7 @@ static void r300_surface_fill(struct pipe_context* pipe,
     struct r300_context* r300 = r300_context(pipe);
     CS_LOCALS(r300);
     struct r300_capabilities* caps = ((struct r300_screen*)pipe->screen)->caps;
+    struct r300_texture* tex = (struct r300_texture*)dest->texture;
     int i;
     float r, g, b, a;
     r = (float)((color >> 16) & 0xff) / 255.0f;
@@ -291,7 +292,7 @@ OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT,
     R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
 
 OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0, 1);
-OUT_CS_RELOC(dest->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
+OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
 /* XXX this should not be so rigid and it still doesn't work right */
 OUT_CS_REG(R300_RB3D_COLORPITCH0, (dest->stride >> 2) | R300_COLOR_FORMAT_ARGB8888);
 OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0x0000000F);
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index f9ad14f..7f57656 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -121,7 +121,6 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
     if (surface) {
         surface->refcount = 1;
         pipe_texture_reference(&surface->texture, texture);
-        pipe_buffer_reference(screen, &surface->buffer, tex->buffer);
         surface->format = texture->format;
         surface->width = texture->width[level];
         surface->height = texture->height[level];
@@ -148,7 +147,6 @@ static void r300_tex_surface_release(struct pipe_screen* screen,
 
     if (s->refcount <= 0) {
         pipe_texture_reference(&s->texture, NULL);
-        pipe_buffer_reference(screen, &s->buffer, NULL);
         FREE(s);
     }
 
@@ -180,8 +178,6 @@ static struct pipe_texture*
 
     /* XXX tex->stride = *stride; */
 
-    pipe_buffer_reference(screen, &tex->buffer, buffer);
-
     return (struct pipe_texture*)tex;
 }
 




More information about the mesa-commit mailing list