summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@tungstengraphics.com>2008-05-25 17:26:07 +0200
committerJakob Bornecrantz <jakob@tungstengraphics.com>2008-05-26 13:05:31 +0200
commite0fd3449f824ed8eaec49e83a0f90b7fe47e09a6 (patch)
tree009a8b2c0d3292d419744e254b695ca0282313b2 /src
parente3ddafd1d32192f4638d4930627ad66624325561 (diff)
i915: Fix for tex-surface merge
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/i915simple/i915_texture.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c
index 3e23e540f9..b08385e7db 100644
--- a/src/gallium/drivers/i915simple/i915_texture.c
+++ b/src/gallium/drivers/i915simple/i915_texture.c
@@ -132,11 +132,11 @@ i915_displaytarget_layout(struct pipe_screen *screen,
/* Now extract the goodies:
*/
- i915_miptree_set_image_offset( tex, 0, 0, 0, 0 );
- i915_miptree_set_level_info( tex, 0, 0, 0, 0,
+ i915_miptree_set_level_info( tex, 0, 1, 0, 0,
tex->base.width[0],
tex->base.height[0],
1 );
+ i915_miptree_set_image_offset( tex, 0, 0, 0, 0 );
tex->buffer = surf.buffer;
tex->pitch = surf.pitch;
@@ -633,6 +633,7 @@ i915_get_tex_surface_screen(struct pipe_screen *screen,
if (ps) {
assert(ps->refcount);
assert(ps->winsys);
+ pipe_texture_reference(&ps->texture, pt);
pipe_buffer_reference(ws, &ps->buffer, tex->buffer);
ps->format = pt->format;
ps->cpp = pt->cpp;
@@ -652,6 +653,29 @@ i915_init_texture_functions(struct i915_context *i915)
// i915->pipe.texture_update = i915_texture_update;
}
+static void
+i915_tex_surface_release_screen(struct pipe_screen *screen,
+ struct pipe_surface **surface)
+{
+ struct pipe_surface *surf = *surface;
+
+ if (--surf->refcount == 0) {
+
+ /* This really should not be possible, but it's actually
+ * happening quite a bit... Will fix.
+ */
+ if (surf->status == PIPE_SURFACE_STATUS_CLEAR) {
+ debug_printf("XXX destroying a surface with pending clears...\n");
+ assert(0);
+ }
+
+ pipe_texture_reference(&surf->texture, NULL);
+ pipe_buffer_reference(screen->winsys, &surf->buffer, NULL);
+ FREE(surf);
+ }
+
+ *surface = NULL;
+}
void
i915_init_screen_texture_functions(struct pipe_screen *screen)
@@ -659,4 +683,5 @@ i915_init_screen_texture_functions(struct pipe_screen *screen)
screen->texture_create = i915_texture_create_screen;
screen->texture_release = i915_texture_release_screen;
screen->get_tex_surface = i915_get_tex_surface_screen;
+ screen->tex_surface_release = i915_tex_surface_release_screen;
}