Skip to content

Commit

Permalink
add vaCopy interface to copy surface and buffer
Browse files Browse the repository at this point in the history
Author:Dmitry Rogozhkin <[email protected]>
Author:XinfengZhang <[email protected]>

Signed-off-by: XinfengZhang <[email protected]>
  • Loading branch information
XinfengZhang committed Aug 25, 2020
1 parent 4359c18 commit d0535b1
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
20 changes: 20 additions & 0 deletions va/va.c
Original file line number Diff line number Diff line change
Expand Up @@ -2286,3 +2286,23 @@ vaQueryVideoProcPipelineCaps(
VA_TRACE_RET(dpy, status);
return status;
}

VAStatus
vaCopy(
VADisplay dpy,
VACopyObject *dst,
VACopyObject *src,
VACopyOption option
)
{
VAStatus va_status;
VADriverContextP ctx;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);

if(ctx->vtable->vaCopy == NULL)
va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
else
va_status = ctx->vtable->vaCopy( ctx, dst, src, option);
return va_status;
}
50 changes: 50 additions & 0 deletions va/va.h
Original file line number Diff line number Diff line change
Expand Up @@ -4730,6 +4730,56 @@ typedef struct _VAPictureHEVC
*/
#define VA_PICTURE_HEVC_RPS_LT_CURR 0x00000040

typedef enum{
VACopyObjectSurface = 0,
VACopyObjectBuffer = 1,
} VACopyObjectType;

typedef struct _VACopyObject {
VACopyObjectType obj_type; // type of object.
union
{
VASurfaceID surface_id;
VABufferID buffer_id;
} object;

uint32_t va_reserved[VA_PADDING_MEDIA];
} VACopyObject;

#define VA_COPY_SYNC_BLOCK 0x0
#define VA_COPY_SYNC_NONBLOCK 0x1

#define VA_COPY_MODE_BALANCE 0x0
#define VA_COPY_MODE_PERF 0x1
#define VA_COPY_MODE_POWER_SAVING 0x2

typedef union _VACopyOption{
struct {
/** \brief va copy synchronization, the value should be VA_COPY_SYNC_XXX
* if it equal VA_COPY_SYNC_NONBLOCK , sync handle should be retrieved.
*/
uint32_t va_copy_sync : 2;
/** \brief va copy mode, the value should be VA_COPY_MODE_XXX */
uint32_t va_copy_mode : 4;
uint32_t reserved :26;
}bits;
uint32_t value;
}VACopyOption;

/** \brief Copies an object.
*
* Copies specified object (surface or buffer). If non-blocking copy
* is requested (VA_COPY_NONBLOCK), then need vaSyncBuffer or vaSyncSurface/vaSyncSurface2
* to sync the destination object.
*
* @param[in] dpy the VA display
* @param[in] dst Destination object to copy to
* @param[in] src Source object to copy from
* @param[in] option VA copy option
* @return VA_STATUS_SUCCESS if successful
*/
VAStatus vaCopy(VADisplay dpy, VACopyObject * dst, VACopyObject * src, VACopyOption option);

#include <va/va_dec_hevc.h>
#include <va/va_dec_jpeg.h>
#include <va/va_dec_vp8.h>
Expand Down
10 changes: 8 additions & 2 deletions va/va_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ struct VADriverVTable
uint32_t flags, /* in */
void *descriptor /* out */
);

VAStatus (*vaSyncSurface2) (
VADriverContextP ctx,
VASurfaceID surface,
Expand All @@ -497,8 +496,15 @@ struct VADriverVTable
uint64_t timeout_ns
);

VAStatus
(*vaCopy)(
VADriverContextP ctx, /* in */
VACopyObject *dst, /* in */
VACopyObject *src, /* in */
VACopyOption option /* in */
);
/** \brief Reserved bytes for future use, must be zero */
unsigned long reserved[55];
unsigned long reserved[54];
};

struct VADriverContext
Expand Down

0 comments on commit d0535b1

Please sign in to comment.