buffer: Use object buffer structure directly instead of abstract type
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
This commit is contained in:
+6
-6
@@ -49,7 +49,7 @@ VAStatus sunxi_cedrus_CreateBuffer(VADriverContextP ctx, VAContextID context,
|
||||
INIT_DRIVER_DATA
|
||||
int bufferID;
|
||||
struct v4l2_plane plane[1];
|
||||
object_buffer_p obj_buffer;
|
||||
struct object_buffer *obj_buffer;
|
||||
|
||||
memset(plane, 0, sizeof(struct v4l2_plane));
|
||||
|
||||
@@ -123,7 +123,7 @@ VAStatus sunxi_cedrus_BufferSetNumElements(VADriverContextP ctx,
|
||||
{
|
||||
INIT_DRIVER_DATA
|
||||
VAStatus vaStatus = VA_STATUS_SUCCESS;
|
||||
object_buffer_p obj_buffer = BUFFER(buf_id);
|
||||
struct object_buffer *obj_buffer = BUFFER(buf_id);
|
||||
assert(obj_buffer);
|
||||
|
||||
if ((num_elements < 0) || (num_elements > obj_buffer->max_num_elements))
|
||||
@@ -139,7 +139,7 @@ VAStatus sunxi_cedrus_MapBuffer(VADriverContextP ctx, VABufferID buf_id,
|
||||
{
|
||||
INIT_DRIVER_DATA
|
||||
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
|
||||
object_buffer_p obj_buffer = BUFFER(buf_id);
|
||||
struct object_buffer *obj_buffer = BUFFER(buf_id);
|
||||
assert(obj_buffer);
|
||||
|
||||
if (NULL == obj_buffer)
|
||||
@@ -159,7 +159,7 @@ VAStatus sunxi_cedrus_MapBuffer(VADriverContextP ctx, VABufferID buf_id,
|
||||
VAStatus sunxi_cedrus_UnmapBuffer(VADriverContextP ctx, VABufferID buf_id)
|
||||
{
|
||||
INIT_DRIVER_DATA
|
||||
object_buffer_p obj_buffer = BUFFER(buf_id);
|
||||
struct object_buffer *obj_buffer = BUFFER(buf_id);
|
||||
|
||||
if (obj_buffer == NULL)
|
||||
return VA_STATUS_ERROR_INVALID_BUFFER;
|
||||
@@ -169,7 +169,7 @@ VAStatus sunxi_cedrus_UnmapBuffer(VADriverContextP ctx, VABufferID buf_id)
|
||||
}
|
||||
|
||||
void sunxi_cedrus_destroy_buffer(struct sunxi_cedrus_driver_data *driver_data,
|
||||
object_buffer_p obj_buffer)
|
||||
struct object_buffer *obj_buffer)
|
||||
{
|
||||
if (obj_buffer->buffer_data != NULL) {
|
||||
if (obj_buffer->type != VASliceDataBufferType)
|
||||
@@ -187,7 +187,7 @@ void sunxi_cedrus_destroy_buffer(struct sunxi_cedrus_driver_data *driver_data,
|
||||
VAStatus sunxi_cedrus_DestroyBuffer(VADriverContextP ctx, VABufferID buffer_id)
|
||||
{
|
||||
INIT_DRIVER_DATA
|
||||
object_buffer_p obj_buffer = BUFFER(buffer_id);
|
||||
struct object_buffer *obj_buffer = BUFFER(buffer_id);
|
||||
assert(obj_buffer);
|
||||
|
||||
sunxi_cedrus_destroy_buffer(driver_data, obj_buffer);
|
||||
|
||||
+2
-4
@@ -31,7 +31,7 @@
|
||||
#include "object_heap.h"
|
||||
#include "sunxi_cedrus_drv_video.h"
|
||||
|
||||
#define BUFFER(id) ((object_buffer_p) object_heap_lookup(&driver_data->buffer_heap, id))
|
||||
#define BUFFER(id) ((struct object_buffer *) object_heap_lookup(&driver_data->buffer_heap, id))
|
||||
#define BUFFER_ID_OFFSET 0x08000000
|
||||
|
||||
struct object_buffer {
|
||||
@@ -45,8 +45,6 @@ struct object_buffer {
|
||||
unsigned int map_size;
|
||||
};
|
||||
|
||||
typedef struct object_buffer *object_buffer_p;
|
||||
|
||||
VAStatus sunxi_cedrus_CreateBuffer(VADriverContextP ctx, VAContextID context,
|
||||
VABufferType type, unsigned int size, unsigned int num_elements,
|
||||
void *data, VABufferID *buf_id);
|
||||
@@ -60,7 +58,7 @@ VAStatus sunxi_cedrus_MapBuffer(VADriverContextP ctx, VABufferID buf_id,
|
||||
VAStatus sunxi_cedrus_UnmapBuffer(VADriverContextP ctx, VABufferID buf_id);
|
||||
|
||||
void sunxi_cedrus_destroy_buffer(struct sunxi_cedrus_driver_data *driver_data,
|
||||
object_buffer_p obj_buffer);
|
||||
struct object_buffer *obj_buffer);
|
||||
|
||||
VAStatus sunxi_cedrus_DestroyBuffer(VADriverContextP ctx, VABufferID buffer_id);
|
||||
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ VAStatus sunxi_cedrus_DeriveImage(VADriverContextP ctx, VASurfaceID surface,
|
||||
INIT_DRIVER_DATA
|
||||
object_surface_p obj_surface;
|
||||
VAImageFormat fmt;
|
||||
object_buffer_p obj_buffer;
|
||||
struct object_buffer *obj_buffer;
|
||||
VAStatus ret;
|
||||
|
||||
obj_surface = SURFACE(surface);
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@
|
||||
|
||||
VAStatus sunxi_cedrus_render_mpeg2_slice_data(VADriverContextP ctx,
|
||||
object_context_p obj_context, object_surface_p obj_surface,
|
||||
object_buffer_p obj_buffer)
|
||||
struct object_buffer *obj_buffer)
|
||||
{
|
||||
INIT_DRIVER_DATA
|
||||
VAStatus vaStatus = VA_STATUS_SUCCESS;
|
||||
@@ -54,7 +54,7 @@ VAStatus sunxi_cedrus_render_mpeg2_slice_data(VADriverContextP ctx,
|
||||
|
||||
VAStatus sunxi_cedrus_render_mpeg2_picture_parameter(VADriverContextP ctx,
|
||||
object_context_p obj_context, object_surface_p obj_surface,
|
||||
object_buffer_p obj_buffer)
|
||||
struct object_buffer *obj_buffer)
|
||||
{
|
||||
INIT_DRIVER_DATA
|
||||
VAStatus vaStatus = VA_STATUS_SUCCESS;
|
||||
|
||||
+2
-2
@@ -35,10 +35,10 @@
|
||||
|
||||
VAStatus sunxi_cedrus_render_mpeg2_slice_data(VADriverContextP ctx,
|
||||
object_context_p obj_context, object_surface_p obj_surface,
|
||||
object_buffer_p obj_buffer);
|
||||
struct object_buffer *obj_buffer);
|
||||
|
||||
VAStatus sunxi_cedrus_render_mpeg2_picture_parameter(VADriverContextP ctx,
|
||||
object_context_p obj_context, object_surface_p obj_surface,
|
||||
object_buffer_p obj_buffer);
|
||||
struct object_buffer *obj_buffer);
|
||||
|
||||
#endif /* _MPEG2_H_ */
|
||||
|
||||
+3
-3
@@ -41,7 +41,7 @@
|
||||
|
||||
VAStatus sunxi_cedrus_render_mpeg4_slice_data(VADriverContextP ctx,
|
||||
object_context_p obj_context, object_surface_p obj_surface,
|
||||
object_buffer_p obj_buffer)
|
||||
struct object_buffer *obj_buffer)
|
||||
{
|
||||
INIT_DRIVER_DATA
|
||||
VAStatus vaStatus = VA_STATUS_SUCCESS;
|
||||
@@ -72,7 +72,7 @@ VAStatus sunxi_cedrus_render_mpeg4_slice_data(VADriverContextP ctx,
|
||||
|
||||
VAStatus sunxi_cedrus_render_mpeg4_picture_parameter(VADriverContextP ctx,
|
||||
object_context_p obj_context, object_surface_p obj_surface,
|
||||
object_buffer_p obj_buffer)
|
||||
struct object_buffer *obj_buffer)
|
||||
{
|
||||
INIT_DRIVER_DATA
|
||||
VAStatus vaStatus = VA_STATUS_SUCCESS;
|
||||
@@ -123,7 +123,7 @@ VAStatus sunxi_cedrus_render_mpeg4_picture_parameter(VADriverContextP ctx,
|
||||
|
||||
VAStatus sunxi_cedrus_render_mpeg4_slice_parameter(VADriverContextP ctx,
|
||||
object_context_p obj_context, object_surface_p obj_surface,
|
||||
object_buffer_p obj_buffer)
|
||||
struct object_buffer *obj_buffer)
|
||||
{
|
||||
VASliceParameterBufferMPEG4 *slice_param = (VASliceParameterBufferMPEG4 *)obj_buffer->buffer_data;
|
||||
|
||||
|
||||
+3
-3
@@ -35,14 +35,14 @@
|
||||
|
||||
VAStatus sunxi_cedrus_render_mpeg4_slice_data(VADriverContextP ctx,
|
||||
object_context_p obj_context, object_surface_p obj_surface,
|
||||
object_buffer_p obj_buffer);
|
||||
struct object_buffer *obj_buffer);
|
||||
|
||||
VAStatus sunxi_cedrus_render_mpeg4_picture_parameter(VADriverContextP ctx,
|
||||
object_context_p obj_context, object_surface_p obj_surface,
|
||||
object_buffer_p obj_buffer);
|
||||
struct object_buffer *obj_buffer);
|
||||
|
||||
VAStatus sunxi_cedrus_render_mpeg4_slice_parameter(VADriverContextP ctx,
|
||||
object_context_p obj_context, object_surface_p obj_surface,
|
||||
object_buffer_p obj_buffer);
|
||||
struct object_buffer *obj_buffer);
|
||||
|
||||
#endif /* _MPEG4_H_ */
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ VAStatus sunxi_cedrus_RenderPicture(VADriverContextP ctx, VAContextID context,
|
||||
/* verify that we got valid buffer references */
|
||||
for(i = 0; i < num_buffers; i++)
|
||||
{
|
||||
object_buffer_p obj_buffer = BUFFER(buffers[i]);
|
||||
struct object_buffer *obj_buffer = BUFFER(buffers[i]);
|
||||
assert(obj_buffer);
|
||||
if (NULL == obj_buffer)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ void sunxi_cedrus_msg(const char *msg, ...)
|
||||
VAStatus sunxi_cedrus_Terminate(VADriverContextP ctx)
|
||||
{
|
||||
INIT_DRIVER_DATA
|
||||
object_buffer_p obj_buffer;
|
||||
struct object_buffer *obj_buffer;
|
||||
object_config_p obj_config;
|
||||
object_heap_iterator iter;
|
||||
|
||||
@@ -75,12 +75,12 @@ VAStatus sunxi_cedrus_Terminate(VADriverContextP ctx)
|
||||
close(driver_data->mem2mem_fd);
|
||||
|
||||
/* Clean up left over buffers */
|
||||
obj_buffer = (object_buffer_p) object_heap_first(&driver_data->buffer_heap, &iter);
|
||||
obj_buffer = (struct object_buffer *) object_heap_first(&driver_data->buffer_heap, &iter);
|
||||
while (obj_buffer)
|
||||
{
|
||||
sunxi_cedrus_msg("vaTerminate: bufferID %08x still allocated, destroying\n", obj_buffer->base.id);
|
||||
sunxi_cedrus_destroy_buffer(driver_data, obj_buffer);
|
||||
obj_buffer = (object_buffer_p) object_heap_next(&driver_data->buffer_heap, &iter);
|
||||
obj_buffer = (struct object_buffer *) object_heap_next(&driver_data->buffer_heap, &iter);
|
||||
}
|
||||
|
||||
object_heap_destroy(&driver_data->buffer_heap);
|
||||
|
||||
Reference in New Issue
Block a user