From 97950176ad082cbe03dbcb1e40c60900d50c45e5 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Mon, 23 Apr 2018 10:06:11 +0200 Subject: [PATCH] surface: Use object surface structure directly instead of abstract type Signed-off-by: Paul Kocialkowski --- src/image.c | 2 +- src/mpeg2.c | 8 ++++---- src/mpeg2.h | 4 ++-- src/mpeg4.c | 10 +++++----- src/mpeg4.h | 6 +++--- src/picture.c | 6 +++--- src/surface.c | 12 ++++++------ src/surface.h | 4 +--- 8 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/image.c b/src/image.c index 9656971..abfdc17 100644 --- a/src/image.c +++ b/src/image.c @@ -91,7 +91,7 @@ VAStatus sunxi_cedrus_DeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image) { INIT_DRIVER_DATA - object_surface_p obj_surface; + struct object_surface *obj_surface; VAImageFormat fmt; struct object_buffer *obj_buffer; VAStatus ret; diff --git a/src/mpeg2.c b/src/mpeg2.c index 8c94f50..ffdc1ca 100644 --- a/src/mpeg2.c +++ b/src/mpeg2.c @@ -40,7 +40,7 @@ */ VAStatus sunxi_cedrus_render_mpeg2_slice_data(VADriverContextP ctx, - struct object_context *obj_context, object_surface_p obj_surface, + struct object_context *obj_context, struct object_surface *obj_surface, struct object_buffer *obj_buffer) { INIT_DRIVER_DATA @@ -53,7 +53,7 @@ VAStatus sunxi_cedrus_render_mpeg2_slice_data(VADriverContextP ctx, } VAStatus sunxi_cedrus_render_mpeg2_picture_parameter(VADriverContextP ctx, - struct object_context *obj_context, object_surface_p obj_surface, + struct object_context *obj_context, struct object_surface *obj_surface, struct object_buffer *obj_buffer) { INIT_DRIVER_DATA @@ -80,13 +80,13 @@ VAStatus sunxi_cedrus_render_mpeg2_picture_parameter(VADriverContextP ctx, obj_context->mpeg2_frame_hdr.intra_vlc_format = pic_param->picture_coding_extension.bits.intra_vlc_format; obj_context->mpeg2_frame_hdr.alternate_scan = pic_param->picture_coding_extension.bits.alternate_scan; - object_surface_p fwd_surface = SURFACE(pic_param->forward_reference_picture); + struct object_surface *fwd_surface = SURFACE(pic_param->forward_reference_picture); if(fwd_surface) obj_context->mpeg2_frame_hdr.forward_index = fwd_surface->output_buf_index; else obj_context->mpeg2_frame_hdr.forward_index = obj_surface->output_buf_index; - object_surface_p bwd_surface = SURFACE(pic_param->backward_reference_picture); + struct object_surface *bwd_surface = SURFACE(pic_param->backward_reference_picture); if(bwd_surface) obj_context->mpeg2_frame_hdr.backward_index = bwd_surface->output_buf_index; else diff --git a/src/mpeg2.h b/src/mpeg2.h index af29653..fbc274f 100644 --- a/src/mpeg2.h +++ b/src/mpeg2.h @@ -34,11 +34,11 @@ #include "surface.h" VAStatus sunxi_cedrus_render_mpeg2_slice_data(VADriverContextP ctx, - struct object_context *obj_context, object_surface_p obj_surface, + struct object_context *obj_context, struct object_surface *obj_surface, struct object_buffer *obj_buffer); VAStatus sunxi_cedrus_render_mpeg2_picture_parameter(VADriverContextP ctx, - struct object_context *obj_context, object_surface_p obj_surface, + struct object_context *obj_context, struct object_surface *obj_surface, struct object_buffer *obj_buffer); #endif /* _MPEG2_H_ */ diff --git a/src/mpeg4.c b/src/mpeg4.c index a8143d2..bd8b489 100644 --- a/src/mpeg4.c +++ b/src/mpeg4.c @@ -40,7 +40,7 @@ */ VAStatus sunxi_cedrus_render_mpeg4_slice_data(VADriverContextP ctx, - struct object_context *obj_context, object_surface_p obj_surface, + struct object_context *obj_context, struct object_surface *obj_surface, struct object_buffer *obj_buffer) { INIT_DRIVER_DATA @@ -71,7 +71,7 @@ VAStatus sunxi_cedrus_render_mpeg4_slice_data(VADriverContextP ctx, } VAStatus sunxi_cedrus_render_mpeg4_picture_parameter(VADriverContextP ctx, - struct object_context *obj_context, object_surface_p obj_surface, + struct object_context *obj_context, struct object_surface *obj_surface, struct object_buffer *obj_buffer) { INIT_DRIVER_DATA @@ -107,12 +107,12 @@ VAStatus sunxi_cedrus_render_mpeg4_picture_parameter(VADriverContextP ctx, obj_context->mpeg4_frame_hdr.trb = pic_param->TRB; obj_context->mpeg4_frame_hdr.trd = pic_param->TRD; - object_surface_p fwd_surface = SURFACE(pic_param->forward_reference_picture); + struct object_surface *fwd_surface = SURFACE(pic_param->forward_reference_picture); if(fwd_surface) obj_context->mpeg4_frame_hdr.forward_index = fwd_surface->output_buf_index; else obj_context->mpeg4_frame_hdr.forward_index = obj_surface->output_buf_index; - object_surface_p bwd_surface = SURFACE(pic_param->backward_reference_picture); + struct object_surface *bwd_surface = SURFACE(pic_param->backward_reference_picture); if(bwd_surface) obj_context->mpeg4_frame_hdr.backward_index = bwd_surface->output_buf_index; else @@ -122,7 +122,7 @@ VAStatus sunxi_cedrus_render_mpeg4_picture_parameter(VADriverContextP ctx, } VAStatus sunxi_cedrus_render_mpeg4_slice_parameter(VADriverContextP ctx, - struct object_context *obj_context, object_surface_p obj_surface, + struct object_context *obj_context, struct object_surface *obj_surface, struct object_buffer *obj_buffer) { VASliceParameterBufferMPEG4 *slice_param = (VASliceParameterBufferMPEG4 *)obj_buffer->buffer_data; diff --git a/src/mpeg4.h b/src/mpeg4.h index d66a1a8..2a64d29 100644 --- a/src/mpeg4.h +++ b/src/mpeg4.h @@ -34,15 +34,15 @@ #include "surface.h" VAStatus sunxi_cedrus_render_mpeg4_slice_data(VADriverContextP ctx, - struct object_context *obj_context, object_surface_p obj_surface, + struct object_context *obj_context, struct object_surface *obj_surface, struct object_buffer *obj_buffer); VAStatus sunxi_cedrus_render_mpeg4_picture_parameter(VADriverContextP ctx, - struct object_context *obj_context, object_surface_p obj_surface, + struct object_context *obj_context, struct object_surface *obj_surface, struct object_buffer *obj_buffer); VAStatus sunxi_cedrus_render_mpeg4_slice_parameter(VADriverContextP ctx, - struct object_context *obj_context, object_surface_p obj_surface, + struct object_context *obj_context, struct object_surface *obj_surface, struct object_buffer *obj_buffer); #endif /* _MPEG4_H_ */ diff --git a/src/picture.c b/src/picture.c index 9018970..b7fce2a 100644 --- a/src/picture.c +++ b/src/picture.c @@ -56,7 +56,7 @@ VAStatus sunxi_cedrus_BeginPicture(VADriverContextP ctx, VAContextID context, INIT_DRIVER_DATA VAStatus vaStatus = VA_STATUS_SUCCESS; struct object_context *obj_context; - object_surface_p obj_surface; + struct object_surface *obj_surface; obj_context = CONTEXT(context); assert(obj_context); @@ -86,7 +86,7 @@ VAStatus sunxi_cedrus_RenderPicture(VADriverContextP ctx, VAContextID context, INIT_DRIVER_DATA VAStatus vaStatus = VA_STATUS_SUCCESS; struct object_context *obj_context; - object_surface_p obj_surface; + struct object_surface *obj_surface; object_config_p obj_config; int i; @@ -145,7 +145,7 @@ VAStatus sunxi_cedrus_EndPicture(VADriverContextP ctx, VAContextID context) INIT_DRIVER_DATA VAStatus vaStatus = VA_STATUS_SUCCESS; struct object_context *obj_context; - object_surface_p obj_surface; + struct object_surface *obj_surface; struct v4l2_buffer out_buf, cap_buf; struct v4l2_plane plane[1]; struct v4l2_plane planes[2]; diff --git a/src/surface.c b/src/surface.c index 20cb51a..1b6d24f 100644 --- a/src/surface.c +++ b/src/surface.c @@ -90,7 +90,7 @@ VAStatus sunxi_cedrus_CreateSurfaces(VADriverContextP ctx, int width, for (i = 0; i < create_bufs.count; i++) { VASurfaceID surfaceID = object_heap_allocate(&driver_data->surface_heap); - object_surface_p obj_surface = SURFACE(surfaceID); + struct object_surface *obj_surface = SURFACE(surfaceID); if (NULL == obj_surface) { vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED; @@ -132,7 +132,7 @@ VAStatus sunxi_cedrus_CreateSurfaces(VADriverContextP ctx, int width, /* surfaces[i-1] was the last successful allocation */ for(; i--;) { - object_surface_p obj_surface = SURFACE(surfaces[i]); + struct object_surface *obj_surface = SURFACE(surfaces[i]); surfaces[i] = VA_INVALID_SURFACE; assert(obj_surface); object_heap_free(&driver_data->surface_heap, (object_base_p) obj_surface); @@ -148,7 +148,7 @@ VAStatus sunxi_cedrus_DestroySurfaces(VADriverContextP ctx, int i; for(i = num_surfaces; i--;) { - object_surface_p obj_surface = SURFACE(surface_list[i]); + struct object_surface *obj_surface = SURFACE(surface_list[i]); assert(obj_surface); object_heap_free(&driver_data->surface_heap, (object_base_p) obj_surface); } @@ -159,7 +159,7 @@ VAStatus sunxi_cedrus_SyncSurface(VADriverContextP ctx, VASurfaceID render_target) { INIT_DRIVER_DATA - object_surface_p obj_surface; + struct object_surface *obj_surface; struct v4l2_buffer buf; struct v4l2_plane plane[1]; struct v4l2_plane planes[2]; @@ -227,7 +227,7 @@ VAStatus sunxi_cedrus_QuerySurfaceStatus(VADriverContextP ctx, { INIT_DRIVER_DATA VAStatus vaStatus = VA_STATUS_SUCCESS; - object_surface_p obj_surface; + struct object_surface *obj_surface; obj_surface = SURFACE(render_target); assert(obj_surface); @@ -254,7 +254,7 @@ VAStatus sunxi_cedrus_PutSurface(VADriverContextP ctx, VASurfaceID surface, Colormap cm; int colorratio = 65535 / 255; int x, y; - object_surface_p obj_surface; + struct object_surface *obj_surface; obj_surface = SURFACE(surface); assert(obj_surface); diff --git a/src/surface.h b/src/surface.h index 0785404..0eb0654 100644 --- a/src/surface.h +++ b/src/surface.h @@ -30,7 +30,7 @@ #include "object_heap.h" -#define SURFACE(id) ((object_surface_p) object_heap_lookup(&driver_data->surface_heap, id)) +#define SURFACE(id) ((struct object_surface *) object_heap_lookup(&driver_data->surface_heap, id)) #define SURFACE_ID_OFFSET 0x04000000 struct object_surface { @@ -44,8 +44,6 @@ struct object_surface { VAStatus status; }; -typedef struct object_surface *object_surface_p; - VAStatus sunxi_cedrus_CreateSurfaces(VADriverContextP ctx, int width, int height, int format, int num_surfaces, VASurfaceID *surfaces);