r300-gallium, radeon-gallium: Continue migration to DRI2 state_tracker, part 2.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Wed, 4 Mar 2009 06:11:56 +0000 (22:11 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Wed, 4 Mar 2009 06:16:24 +0000 (22:16 -0800)
Almost there. glxinfo still works, and AFAICT so does trivial/clear.

src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_texture.h
src/gallium/drivers/r300/r300_winsys.h
src/gallium/winsys/drm/radeon/radeon_drm.c

index 8251a597eab1471d54c89ae7a0075f2a7afdb1a5..b3425587e3806fa4ca31a6842e2f03d4a4399449 100644 (file)
@@ -186,3 +186,21 @@ void r300_init_screen_texture_functions(struct pipe_screen* screen)
     screen->tex_surface_release = r300_tex_surface_release;
     screen->texture_blanket = r300_texture_blanket;
 }
+
+boolean r300_get_texture_buffer(struct pipe_texture* texture,
+                                struct pipe_buffer** buffer,
+                                unsigned* stride)
+{
+    struct r300_texture* tex = (struct r300_texture*)texture;
+    if (!tex) {
+        return FALSE;
+    }
+
+    pipe_buffer_reference(texture->screen, buffer, tex->buffer);
+
+    if (stride) {
+        *stride = tex->stride;
+    }
+
+    return TRUE;
+}
index 7964229a94f7f4a64b09e70811cf4e1a2fad4122..27f5ea1eb7b7487994d1da270d536bb9b5c4c464 100644 (file)
 
 void r300_init_screen_texture_functions(struct pipe_screen* screen);
 
+#ifndef R300_WINSYS_H
+
+boolean r300_get_texture_buffer(struct pipe_texture* texture,
+                                struct pipe_buffer** buffer,
+                                unsigned* stride);
+
+#endif /* R300_WINSYS_H */
+
 #endif /* R300_TEXTURE_H */
index b7341c4f3ad416b4b0d80a8ec69feb4ea9d4b761..8c9578de51420e2cf54629e6d52e914d664e3186 100644 (file)
@@ -92,4 +92,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
 }
 #endif
 
+boolean r300_get_texture_buffer(struct pipe_texture* texture,
+                                struct pipe_buffer** buffer,
+                                unsigned* stride);
+
 #endif /* R300_WINSYS_H */
index 9cd178f944aab464ccd97cf3e8011f41c6df60db..21f2a62e0fe0148450055b6dc39b5a08fa53efb0 100644 (file)
@@ -59,6 +59,7 @@ boolean radeon_buffer_from_texture(struct pipe_texture* texture,
                                    struct pipe_buffer** buffer,
                                    unsigned* stride)
 {
+    return FALSE;
 }
 
 /* Create a buffer from a handle. */
@@ -67,7 +68,8 @@ struct pipe_buffer* radeon_buffer_from_handle(struct pipe_screen* screen,
                                               const char* name,
                                               unsigned handle)
 {
-    struct radeon_bo_manager* bom = ((struct radeon_winsys*)screen->winsys)->bom;
+    struct radeon_bo_manager* bom =
+        ((struct radeon_winsys*)screen->winsys)->bom;
     struct radeon_pipe_buffer* radeon_buffer;
     struct radeon_bo* bo = NULL;
 
@@ -92,19 +94,29 @@ boolean radeon_handle_from_buffer(struct pipe_screen* screen,
                                   struct pipe_buffer* buffer,
                                   unsigned* handle)
 {
+    struct radeon_pipe_buffer* radeon_buffer =
+        (struct radeon_pipe_buffer*)buffer;
+    *handle = radeon_buffer->bo->handle;
+    return TRUE;
 }
 
 boolean radeon_global_handle_from_buffer(struct pipe_screen* screen,
                                          struct pipe_buffer* buffer,
                                          unsigned* handle)
 {
+    /* XXX WTF is the difference here? global? */
+    struct radeon_pipe_buffer* radeon_buffer =
+        (struct radeon_pipe_buffer*)buffer;
+    *handle = radeon_buffer->bo->handle;
+    return TRUE;
 }
 
 struct drm_api drm_api_hooks = {
     .create_screen = radeon_create_screen,
     .create_context = radeon_create_context,
-    .buffer_from_texture = radeon_buffer_from_texture,
+    /* XXX fix this */
+    .buffer_from_texture = r300_get_texture_buffer,
     .buffer_from_handle = radeon_buffer_from_handle,
     .handle_from_buffer = radeon_handle_from_buffer,
     .global_handle_from_buffer = radeon_global_handle_from_buffer,
-};
\ No newline at end of file
+};