Skip to content

Commit

Permalink
add gpu accelarate copy interface
Browse files Browse the repository at this point in the history
Signed-off-by: XinfengZhang <[email protected]>
  • Loading branch information
XinfengZhang committed Feb 24, 2020
1 parent 8e467a6 commit 84ba876
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 1 deletion.
38 changes: 38 additions & 0 deletions va/va.c
Original file line number Diff line number Diff line change
Expand Up @@ -2247,3 +2247,41 @@ vaQueryVideoProcPipelineCaps(
VA_TRACE_RET(dpy, status);
return status;
}

VAStatus
vaHWAccelCopy(
VADisplay dpy,
VAHWCpObject *dst,
VAHWCpObject *src,
uint32_t option,
uintptr_t* cphandle
)
{
VAStatus va_status;
VADriverContextP ctx;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);

if(ctx->vtable->vaHWAccelCopy == NULL)
va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
else
va_status = ctx->vtable->vaHWAccelCopy( ctx, dst, src, option, cphandle);
return va_status;
}

VAStatus
vaHWAccelCopyWait(
VADisplay dpy,
uintptr_t cphandle
)
{
VAStatus va_status;
VADriverContextP ctx;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
if(ctx->vtable->vaHWAccelCopyWait == NULL)
va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
else
va_status = ctx->vtable->vaHWAccelCopyWait( ctx, cphandle);
return va_status;
}
30 changes: 30 additions & 0 deletions va/va.h
Original file line number Diff line number Diff line change
Expand Up @@ -4620,6 +4620,36 @@ typedef struct _VAPictureHEVC
*/
#define VA_PICTURE_HEVC_RPS_LT_CURR 0x00000040

typedef enum{
VAHWAccelCopyObjSurface = 0,
VAHWAccelCopyObjBuffer = 1,
VAHWAccelCopyObjUserPTR = 2
}VAHWAccelCopyObjType;

typedef struct _VAHWCpObject{
union
{
VASurfaceID surface_id;
VABufferID Buffer_id;
uint8_t * userptr; //pointer to system memory
}obj;
VAHWAccelCopyObjType obj_type; //type of object.
uint32_t size; // for userptr, it should be same with surface/buffer size
uint32_t width_stride; // for user ptr only,
uint32_t height_stride; // for user ptr only
uint32_t va_reserved[VA_PADDING_LOW];
}VAHWCpObject;

#define VA_GPU_ACCEL_COPY_BLOCK 0x00000001
#define VA_GPU_ACCEL_COPY_NONBLOCK 0x00000002

/** GPU accelarate copy
* it can be block copy or non block copy
* if it is non block copy, a handle is returned for wait funtion*/
VAStatus vaHWAccelCopy(VADisplay dpy,VAHWCpObject * dst, VAHWCpObject * src, uint32_t option, uintptr_t* cphandle);

VAStatus vaHWAccelCopyWait(VADisplay dpy, uintptr_t cphandle);

#include <va/va_dec_hevc.h>
#include <va/va_dec_jpeg.h>
#include <va/va_dec_vp8.h>
Expand Down
16 changes: 15 additions & 1 deletion va/va_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,23 @@ struct VADriverVTable
uint32_t flags, /* in */
void *descriptor /* out */
);
VAStatus
(*vaHWAccelCopy)(
VADriverContextP ctx, /* in */
VAHWCpObject *dst, /* in */
VAHWCpObject *src, /* in */
uint32_t option, /* in */
uintptr_t* cphandle /* out */
);

VAStatus
(*vaHWAccelCopyWait)(
VADriverContextP ctx, /* in */
uintptr_t cphandle /* in */
);

/** \brief Reserved bytes for future use, must be zero */
unsigned long reserved[57];
unsigned long reserved[55];
};

struct VADriverContext
Expand Down

0 comments on commit 84ba876

Please sign in to comment.