Mesa (master): i915: Enable winsys to get buffer from texture

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Wed Feb 25 01:02:51 UTC 2009


Module: Mesa
Branch: master
Commit: 36348ff1da9064ac93802dc4e10cef74de0a1f47
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=36348ff1da9064ac93802dc4e10cef74de0a1f47

Author: Jakob Bornecrantz <wallbraker at gmail.com>
Date:   Tue Feb 24 23:22:34 2009 +0100

i915: Enable winsys to get buffer from texture

---

 src/gallium/drivers/i915simple/i915_texture.c |   18 ++++++++++++++++++
 src/gallium/drivers/i915simple/i915_winsys.h  |   13 +++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c
index 9577265..6aead3e 100644
--- a/src/gallium/drivers/i915simple/i915_texture.c
+++ b/src/gallium/drivers/i915simple/i915_texture.c
@@ -42,6 +42,7 @@
 #include "i915_texture.h"
 #include "i915_debug.h"
 #include "i915_screen.h"
+#include "i915_winsys.h"
 
 /*
  * Helper function and arrays
@@ -765,3 +766,20 @@ i915_init_screen_texture_functions(struct pipe_screen *screen)
    screen->texture_blanket = i915_texture_blanket;
    screen->tex_surface_release = i915_tex_surface_release;
 }
+
+boolean i915_get_texture_buffer( struct pipe_texture *texture,
+                                 struct pipe_buffer **buf,
+                                 unsigned *stride )
+{
+   struct i915_texture *tex = (struct i915_texture *)texture;
+
+   if (!tex)
+      return FALSE;
+
+   pipe_buffer_reference(texture->screen, buf, tex->buffer);
+
+   if (stride)
+      *stride = tex->stride;
+
+   return TRUE;
+}
diff --git a/src/gallium/drivers/i915simple/i915_winsys.h b/src/gallium/drivers/i915simple/i915_winsys.h
index 39f3f5a..ff5b34f 100644
--- a/src/gallium/drivers/i915simple/i915_winsys.h
+++ b/src/gallium/drivers/i915simple/i915_winsys.h
@@ -56,6 +56,7 @@ extern "C" {
  */
 
 struct i915_batchbuffer;
+struct pipe_texture;
 struct pipe_buffer;
 struct pipe_fence_handle;
 struct pipe_winsys;
@@ -123,6 +124,18 @@ struct pipe_context *i915_create_context( struct pipe_screen *screen,
                                           struct pipe_winsys *winsys,
                                           struct i915_winsys *i915 );
 
+/**
+ * Used for the winsys to get the buffer used for a texture
+ * and also the stride used for the texture.
+ *
+ * Buffer is referenced for you so you need to unref after use.
+ *
+ * This is needed for example kms.
+ */
+boolean i915_get_texture_buffer( struct pipe_texture *texture,
+                                 struct pipe_buffer **buf,
+                                 unsigned *stride );
+
 #ifdef __cplusplus
 }
 #endif




More information about the mesa-commit mailing list