context: Rename target structure elements to make them explicit

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
This commit is contained in:
Paul Kocialkowski
2018-04-23 14:47:32 +02:00
parent 5e1ac89413
commit 104eb22462
3 changed files with 24 additions and 24 deletions
+16 -16
View File
@@ -46,7 +46,7 @@
VAStatus SunxiCedrusCreateContext(VADriverContextP context, VAStatus SunxiCedrusCreateContext(VADriverContextP context,
VAConfigID config_id, int picture_width, int picture_height, int flag, VAConfigID config_id, int picture_width, int picture_height, int flag,
VASurfaceID *render_targets, int render_targets_count, VASurfaceID *surfaces_ids, int surfaces_count,
VAContextID *context_id) VAContextID *context_id)
{ {
struct sunxi_cedrus_driver_data *driver_data = struct sunxi_cedrus_driver_data *driver_data =
@@ -74,9 +74,9 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP context,
} }
obj_context->config_id = config_id; obj_context->config_id = config_id;
obj_context->render_target = VA_INVALID; obj_context->render_surface_id = VA_INVALID;
obj_context->render_targets = (VASurfaceID *) malloc(render_targets_count * sizeof(VASurfaceID)); obj_context->surfaces_ids = (VASurfaceID *) malloc(surfaces_count * sizeof(VASurfaceID));
obj_context->render_targets_count = render_targets_count; obj_context->surfaces_count = surfaces_count;
obj_context->picture_width = picture_width; obj_context->picture_width = picture_width;
obj_context->picture_height = picture_height; obj_context->picture_height = picture_height;
obj_context->num_rendered_surfaces = 0; obj_context->num_rendered_surfaces = 0;
@@ -86,20 +86,20 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP context,
struct v4l2_ctrl_mpeg2_frame_hdr mpeg2_frame_hdr; struct v4l2_ctrl_mpeg2_frame_hdr mpeg2_frame_hdr;
uint32_t num_rendered_surfaces; uint32_t num_rendered_surfaces;
if (obj_context->render_targets == NULL) if (obj_context->surfaces_ids == NULL)
{ {
vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED; vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
return vaStatus; return vaStatus;
} }
for(i = 0; i < render_targets_count; i++) for(i = 0; i < surfaces_count; i++)
{ {
if (NULL == SURFACE(render_targets[i])) if (NULL == SURFACE(surfaces_ids[i]))
{ {
vaStatus = VA_STATUS_ERROR_INVALID_SURFACE; vaStatus = VA_STATUS_ERROR_INVALID_SURFACE;
break; break;
} }
obj_context->render_targets[i] = render_targets[i]; obj_context->surfaces_ids[i] = surfaces_ids[i];
} }
obj_context->flags = flag; obj_context->flags = flag;
@@ -107,9 +107,9 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP context,
if (VA_STATUS_SUCCESS != vaStatus) if (VA_STATUS_SUCCESS != vaStatus)
{ {
obj_context->config_id = -1; obj_context->config_id = -1;
free(obj_context->render_targets); free(obj_context->surfaces_ids);
obj_context->render_targets = NULL; obj_context->surfaces_ids = NULL;
obj_context->render_targets_count = 0; obj_context->surfaces_count = 0;
obj_context->flags = 0; obj_context->flags = 0;
object_heap_free(&driver_data->context_heap, (object_base_p) obj_context); object_heap_free(&driver_data->context_heap, (object_base_p) obj_context);
} }
@@ -166,13 +166,13 @@ VAStatus SunxiCedrusDestroyContext(VADriverContextP context,
obj_context->config_id = -1; obj_context->config_id = -1;
obj_context->picture_width = 0; obj_context->picture_width = 0;
obj_context->picture_height = 0; obj_context->picture_height = 0;
if (obj_context->render_targets) if (obj_context->surfaces_ids)
free(obj_context->render_targets); free(obj_context->surfaces_ids);
obj_context->render_targets = NULL; obj_context->surfaces_ids = NULL;
obj_context->render_targets_count = 0; obj_context->surfaces_count = 0;
obj_context->flags = 0; obj_context->flags = 0;
obj_context->render_target = -1; obj_context->render_surface_id = -1;
object_heap_free(&driver_data->context_heap, (object_base_p) obj_context); object_heap_free(&driver_data->context_heap, (object_base_p) obj_context);
+4 -4
View File
@@ -43,9 +43,9 @@ struct object_context {
struct object_base base; struct object_base base;
VAConfigID config_id; VAConfigID config_id;
VASurfaceID render_target; VASurfaceID render_surface_id;
VASurfaceID *render_targets; VASurfaceID *surfaces_ids;
int render_targets_count; int surfaces_count;
int picture_width; int picture_width;
int picture_height; int picture_height;
@@ -57,7 +57,7 @@ struct object_context {
VAStatus SunxiCedrusCreateContext(VADriverContextP context, VAStatus SunxiCedrusCreateContext(VADriverContextP context,
VAConfigID config_id, int picture_width, int picture_height, int flag, VAConfigID config_id, int picture_width, int picture_height, int flag,
VASurfaceID *render_targets, int render_targets_count, VASurfaceID *surfaces_ids, int surfaces_count,
VAContextID *context_id); VAContextID *context_id);
VAStatus SunxiCedrusDestroyContext(VADriverContextP context, VAStatus SunxiCedrusDestroyContext(VADriverContextP context,
VAContextID context_id); VAContextID context_id);
+4 -4
View File
@@ -75,7 +75,7 @@ VAStatus SunxiCedrusBeginPicture(VADriverContextP ctx, VAContextID context,
obj_surface->input_buf_index = obj_context->num_rendered_surfaces%INPUT_BUFFERS_NB; obj_surface->input_buf_index = obj_context->num_rendered_surfaces%INPUT_BUFFERS_NB;
obj_context->num_rendered_surfaces ++; obj_context->num_rendered_surfaces ++;
obj_context->render_target = obj_surface->base.id; obj_context->render_surface_id = obj_surface->base.id;
return vaStatus; return vaStatus;
} }
@@ -101,7 +101,7 @@ VAStatus SunxiCedrusRenderPicture(VADriverContextP ctx, VAContextID context,
return vaStatus; return vaStatus;
} }
obj_surface = SURFACE(obj_context->render_target); obj_surface = SURFACE(obj_context->render_surface_id);
assert(obj_surface); assert(obj_surface);
/* verify that we got valid buffer references */ /* verify that we got valid buffer references */
@@ -151,7 +151,7 @@ VAStatus SunxiCedrusEndPicture(VADriverContextP ctx, VAContextID context)
obj_context = CONTEXT(context); obj_context = CONTEXT(context);
assert(obj_context); assert(obj_context);
obj_surface = SURFACE(obj_context->render_target); obj_surface = SURFACE(obj_context->render_surface_id);
assert(obj_surface); assert(obj_surface);
obj_config = CONFIG(obj_context->config_id); obj_config = CONFIG(obj_context->config_id);
@@ -242,7 +242,7 @@ VAStatus SunxiCedrusEndPicture(VADriverContextP ctx, VAContextID context)
/* For now, assume that we are done with rendering right away */ /* For now, assume that we are done with rendering right away */
obj_context->render_target = -1; obj_context->render_surface_id = -1;
return vaStatus; return vaStatus;
} }