X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fidentity%2Fid_objects.c;h=d37fb0042e54a2c6d46dfb1d2a6fb704ddb4236a;hp=e893e59940816913b900de77329c730e59a803a8;hb=ef92fe85de114cb50ca4b3070d0594aade54526c;hpb=862488075c5537b0613753b0d14c267527fc6199 diff --git a/src/gallium/drivers/identity/id_objects.c b/src/gallium/drivers/identity/id_objects.c index e893e599408..d37fb0042e5 100644 --- a/src/gallium/drivers/identity/id_objects.c +++ b/src/gallium/drivers/identity/id_objects.c @@ -25,11 +25,12 @@ * **************************************************************************/ +#include "util/u_inlines.h" #include "util/u_memory.h" -#include "id_public.h" #include "id_screen.h" #include "id_objects.h" +#include "id_context.h" struct pipe_buffer * identity_buffer_create(struct identity_screen *id_screen, @@ -142,7 +143,8 @@ identity_surface_destroy(struct identity_surface *id_surface) struct pipe_transfer * -identity_transfer_create(struct identity_texture *id_texture, +identity_transfer_create(struct identity_context *id_context, + struct identity_texture *id_texture, struct pipe_transfer *transfer) { struct identity_transfer *id_transfer; @@ -159,24 +161,63 @@ identity_transfer_create(struct identity_texture *id_texture, memcpy(&id_transfer->base, transfer, sizeof(struct pipe_transfer)); id_transfer->base.texture = NULL; - pipe_texture_reference(&id_transfer->base.texture, &id_texture->base); id_transfer->transfer = transfer; + + pipe_texture_reference(&id_transfer->base.texture, &id_texture->base); assert(id_transfer->base.texture == &id_texture->base); return &id_transfer->base; error: - transfer->texture->screen->tex_transfer_destroy(transfer); + id_context->pipe->tex_transfer_destroy(id_context->pipe, transfer); return NULL; } void -identity_transfer_destroy(struct identity_transfer *id_transfer) +identity_transfer_destroy(struct identity_context *id_context, + struct identity_transfer *id_transfer) { - struct identity_screen *id_screen = identity_screen(id_transfer->base.texture->screen); - struct pipe_screen *screen = id_screen->screen; - pipe_texture_reference(&id_transfer->base.texture, NULL); - screen->tex_transfer_destroy(id_transfer->transfer); + id_context->pipe->tex_transfer_destroy(id_context->pipe, + id_transfer->transfer); FREE(id_transfer); } + +struct pipe_video_surface * +identity_video_surface_create(struct identity_screen *id_screen, + struct pipe_video_surface *video_surface) +{ + struct identity_video_surface *id_video_surface; + + if (!video_surface) { + goto error; + } + + assert(video_surface->screen == id_screen->screen); + + id_video_surface = CALLOC_STRUCT(identity_video_surface); + if (!id_video_surface) { + goto error; + } + + memcpy(&id_video_surface->base, + video_surface, + sizeof(struct pipe_video_surface)); + + pipe_reference_init(&id_video_surface->base.reference, 1); + id_video_surface->base.screen = &id_screen->base; + id_video_surface->video_surface = video_surface; + + return &id_video_surface->base; + +error: + pipe_video_surface_reference(&video_surface, NULL); + return NULL; +} + +void +identity_video_surface_destroy(struct identity_video_surface *id_video_surface) +{ + pipe_video_surface_reference(&id_video_surface->video_surface, NULL); + FREE(id_video_surface); +}