i915g: stop using u_resource_vtbl::resource_destroy
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10659>
This commit is contained in:
parent
6d843c284d
commit
2bf7c3a665
|
@ -49,5 +49,5 @@ i915_init_screen_resource_functions(struct i915_screen *is)
|
|||
is->base.resource_create = i915_resource_create;
|
||||
is->base.resource_from_handle = i915_resource_from_handle;
|
||||
is->base.resource_get_handle = i915_resource_get_handle;
|
||||
is->base.resource_destroy = u_resource_destroy_vtbl;
|
||||
is->base.resource_destroy = i915_resource_destroy;
|
||||
}
|
||||
|
|
|
@ -136,6 +136,10 @@ struct pipe_resource *
|
|||
i915_buffer_create(struct pipe_screen *screen,
|
||||
const struct pipe_resource *template);
|
||||
|
||||
void
|
||||
i915_resource_destroy(struct pipe_screen *screen,
|
||||
struct pipe_resource *resource);
|
||||
|
||||
void
|
||||
i915_buffer_subdata(struct pipe_context *rm_ctx,
|
||||
struct pipe_resource *resource,
|
||||
|
|
|
@ -38,16 +38,31 @@
|
|||
|
||||
#include "i915_context.h"
|
||||
#include "i915_resource.h"
|
||||
#include "i915_screen.h"
|
||||
|
||||
|
||||
static void
|
||||
i915_buffer_destroy(struct pipe_screen *screen,
|
||||
struct pipe_resource *resource)
|
||||
void
|
||||
i915_resource_destroy(struct pipe_screen *screen,
|
||||
struct pipe_resource *resource)
|
||||
{
|
||||
struct i915_buffer *buffer = i915_buffer(resource);
|
||||
if (buffer->free_on_destroy)
|
||||
align_free(buffer->data);
|
||||
FREE(buffer);
|
||||
if (resource->target == PIPE_BUFFER) {
|
||||
struct i915_buffer *buffer = i915_buffer(resource);
|
||||
if (buffer->free_on_destroy)
|
||||
align_free(buffer->data);
|
||||
FREE(buffer);
|
||||
} else {
|
||||
struct i915_texture *tex = i915_texture(resource);
|
||||
struct i915_winsys *iws = i915_screen(screen)->iws;
|
||||
uint i;
|
||||
|
||||
if (tex->buffer)
|
||||
iws->buffer_destroy(iws, tex->buffer);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tex->image_offset); i++)
|
||||
FREE(tex->image_offset[i]);
|
||||
|
||||
FREE(tex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,7 +112,7 @@ i915_buffer_subdata(struct pipe_context *rm_ctx,
|
|||
|
||||
struct u_resource_vtbl i915_buffer_vtbl =
|
||||
{
|
||||
i915_buffer_destroy, /* resource_destroy */
|
||||
NULL,
|
||||
i915_buffer_transfer_map, /* transfer_map */
|
||||
i915_buffer_transfer_unmap, /* transfer_unmap */
|
||||
};
|
||||
|
|
|
@ -698,24 +698,6 @@ i915_resource_get_handle(struct pipe_screen *screen,
|
|||
return iws->buffer_get_handle(iws, tex->buffer, whandle, tex->stride);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
i915_texture_destroy(struct pipe_screen *screen,
|
||||
struct pipe_resource *pt)
|
||||
{
|
||||
struct i915_texture *tex = i915_texture(pt);
|
||||
struct i915_winsys *iws = i915_screen(screen)->iws;
|
||||
uint i;
|
||||
|
||||
if (tex->buffer)
|
||||
iws->buffer_destroy(iws, tex->buffer);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tex->image_offset); i++)
|
||||
FREE(tex->image_offset[i]);
|
||||
|
||||
FREE(tex);
|
||||
}
|
||||
|
||||
static void *
|
||||
i915_texture_transfer_map(struct pipe_context *pipe,
|
||||
struct pipe_resource *resource,
|
||||
|
@ -913,7 +895,7 @@ out:
|
|||
|
||||
struct u_resource_vtbl i915_texture_vtbl =
|
||||
{
|
||||
i915_texture_destroy, /* resource_destroy */
|
||||
NULL, /* resource_destroy */
|
||||
i915_texture_transfer_map, /* transfer_map */
|
||||
i915_texture_transfer_unmap, /* transfer_unmap */
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue