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 Oct 16, 2018
1 parent 250b3dc commit 8f543b5
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 @@ -2128,3 +2128,41 @@ vaQueryVideoProcPipelineCaps(
);
return status;
}

VAStatus
vaHWAsstCopy(
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->vaHWAsstCopy == NULL)
va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
else
va_status = ctx->vtable->vaHWAsstCopy( ctx, dst, src, option, cphandle);
return va_status;
}

VAStatus
vaHWAsstCopyWait(
VADisplay dpy,
uintptr_t cphandle
)
{
VAStatus va_status;
VADriverContextP ctx;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
if(ctx->vtable->vaHWAsstCopyWait == NULL)
va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
else
va_status = ctx->vtable->vaHWAsstCopyWait( 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 @@ -4492,6 +4492,36 @@ typedef struct _VAPictureHEVC
*/
#define VA_PICTURE_HEVC_RPS_LT_CURR 0x00000040

typedef enum{
VAHWAsstCopyObjSurface = 0,
VAHWAsstCopyObjBuffer = 1,
VAHWAsstCopyObjUserPTR = 2
}VAHWAsstCopyObjType;

typedef struct _VAHWCpObject{
union
{
VASurfaceID surface_id;
VABufferID Buffer_id;
uint8_t * userptr; //pointer to system memory
}obj;
VAHWAsstCopyObjType 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 vaHWAsstCopy(VADisplay dpy,VAHWCpObject * dst, VAHWCpObject * src, uint32_t option, uintptr_t* cphandle);

VAStatus vaHWAsstCopyWait(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 @@ -485,9 +485,23 @@ struct VADriverVTable
uint32_t flags, /* in */
void *descriptor /* out */
);
VAStatus
(*vaHWAsstCopy)(
VADriverContextP ctx, /* in */
VAHWCpObject *dst, /* in */
VAHWCpObject *src, /* in */
uint32_t option, /* in */
uintptr_t* cphandle /* out */
);

VAStatus
(*vaHWAsstCopyWait)(
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 8f543b5

Please sign in to comment.