diff --git a/va/va.c b/va/va.c index 8b0bee6f0..8b1f0f27c 100644 --- a/va/va.c +++ b/va/va.c @@ -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; +} diff --git a/va/va.h b/va/va.h index 8e5f72107..2a0c4826b 100755 --- a/va/va.h +++ b/va/va.h @@ -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 #include #include diff --git a/va/va_backend.h b/va/va_backend.h index f2cd7b0f3..c0a256e0e 100644 --- a/va/va_backend.h +++ b/va/va_backend.h @@ -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