summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/i915/i915_texture.c
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2010-02-17 21:28:01 +0000
committerJakob Bornecrantz <[email protected]>2010-03-01 16:05:40 +0000
commit0e1eb1b8765149873f9fd27d455d8b7ed3387709 (patch)
tree2955562ca54a61d2761d16b8db67004c8cac496d /src/gallium/drivers/i915/i915_texture.c
parent3f37f23d17734e8a49809859df58354ed9c00a2d (diff)
i915g: Conversion to winsys handle
Diffstat (limited to 'src/gallium/drivers/i915/i915_texture.c')
-rw-r--r--src/gallium/drivers/i915/i915_texture.c104
1 files changed, 54 insertions, 50 deletions
diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c
index 5ad65a2e9c8..334959c46da 100644
--- a/src/gallium/drivers/i915/i915_texture.c
+++ b/src/gallium/drivers/i915/i915_texture.c
@@ -673,6 +673,58 @@ fail:
}
static struct pipe_texture *
+i915_texture_from_handle(struct pipe_screen * screen,
+ const struct pipe_texture *templat,
+ struct winsys_handle *whandle)
+{
+ struct i915_screen *is = i915_screen(screen);
+ struct i915_texture *tex;
+ struct intel_winsys *iws = is->iws;
+ struct intel_buffer *buffer;
+ unsigned stride;
+
+ assert(screen);
+
+ buffer = iws->buffer_from_handle(iws, whandle, &stride);
+
+ /* Only supports one type */
+ if (templat->target != PIPE_TEXTURE_2D ||
+ templat->last_level != 0 ||
+ templat->depth0 != 1) {
+ return NULL;
+ }
+
+ tex = CALLOC_STRUCT(i915_texture);
+ if (!tex)
+ return NULL;
+
+ tex->base = *templat;
+ pipe_reference_init(&tex->base.reference, 1);
+ tex->base.screen = screen;
+
+ tex->stride = stride;
+
+ i915_miptree_set_level_info(tex, 0, 1, templat->width0, templat->height0, 1);
+ i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
+
+ tex->buffer = buffer;
+
+ return &tex->base;
+}
+
+static boolean
+i915_texture_get_handle(struct pipe_screen * screen,
+ struct pipe_texture *texture,
+ struct winsys_handle *whandle)
+{
+ struct i915_screen *is = i915_screen(screen);
+ struct i915_texture *tex = (struct i915_texture *)texture;
+ struct intel_winsys *iws = is->iws;
+
+ return iws->buffer_get_handle(iws, tex->buffer, whandle, tex->stride);
+}
+
+static struct pipe_texture *
i915_texture_blanket(struct pipe_screen * screen,
const struct pipe_texture *base,
const unsigned *stride,
@@ -869,6 +921,8 @@ void
i915_init_screen_texture_functions(struct i915_screen *is)
{
is->base.texture_create = i915_texture_create;
+ is->base.texture_from_handle = i915_texture_from_handle;
+ is->base.texture_get_handle = i915_texture_get_handle;
is->base.texture_blanket = i915_texture_blanket;
is->base.texture_destroy = i915_texture_destroy;
is->base.get_tex_surface = i915_get_tex_surface;
@@ -878,53 +932,3 @@ i915_init_screen_texture_functions(struct i915_screen *is)
is->base.transfer_unmap = i915_transfer_unmap;
is->base.tex_transfer_destroy = i915_tex_transfer_destroy;
}
-
-struct pipe_texture *
-i915_texture_blanket_intel(struct pipe_screen *screen,
- struct pipe_texture *base,
- unsigned stride,
- struct intel_buffer *buffer)
-{
- struct i915_texture *tex;
- assert(screen);
-
- /* Only supports one type */
- if (base->target != PIPE_TEXTURE_2D ||
- base->last_level != 0 ||
- base->depth0 != 1) {
- return NULL;
- }
-
- tex = CALLOC_STRUCT(i915_texture);
- if (!tex)
- return NULL;
-
- tex->base = *base;
- pipe_reference_init(&tex->base.reference, 1);
- tex->base.screen = screen;
-
- tex->stride = stride;
-
- i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1);
- i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
-
- tex->buffer = buffer;
-
- return &tex->base;
-}
-
-boolean
-i915_get_texture_buffer_intel(struct pipe_texture *texture,
- struct intel_buffer **buffer,
- unsigned *stride)
-{
- struct i915_texture *tex = (struct i915_texture *)texture;
-
- if (!texture)
- return FALSE;
-
- *stride = tex->stride;
- *buffer = tex->buffer;
-
- return TRUE;
-}