r300: Update to match pipe_surface changes.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 8 Feb 2009 09:01:26 +0000 (01:01 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 8 Feb 2009 09:01:26 +0000 (01:01 -0800)
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_surface.c
src/gallium/drivers/r300/r300_texture.c

index fb91c172f47774e88615fd2c212e27467fcecd6a..376c57639d8abc5cfa8f623baf0b33232c427a00 100644 (file)
@@ -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 */
index c71b8d0b025bdf774ed3739c014d5ad46c0acf4a..585a9e729d79350492977a92f1d7e4ed5dbe4137 100644 (file)
@@ -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;
index fd916fadbe62d824f1745d16b85f3e8797b48bc1..8ed66a1660c3a3cbfd32f9171b95850ef8272bfa 100644 (file)
@@ -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)
index 1ed4a4e3bcffba5c8312ec7355aaa8a2435fd084..bbd2ade64aca3aba9912156a140c76272cbbb59a 100644 (file)
@@ -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);
index f9ad14f12be4b310fe27bde711359427a779d8fc..7f57656a78efae81af2d2356f73f6a26d6478501 100644 (file)
@@ -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;
 }