diff options
author | Artem Shaporenko <artem.shaporenko@intel.com> | 2017-09-04 15:16:24 +0300 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2017-11-21 16:01:31 -0800 |
commit | df192cfea5b634bf259020e9b88adf975c209746 (patch) | |
tree | 3b043f41da1e9d3500f929cd1697951f674a194b | |
parent | 6ca99be5042558035a78ffa87cfcd853611591cc (diff) | |
download | libva-df192cfea5b634bf259020e9b88adf975c209746.tar.gz |
New VAAPI definition for multi-frame processing applicable for Encode, FEI Encode/ENC/Pre-ENC, and VPP in future.
Signed-off-by: Artem Shaporenko artem.shaporenko@intel.com
-rw-r--r-- | va/va.c | 90 | ||||
-rw-r--r-- | va/va.h | 108 | ||||
-rw-r--r-- | va/va_backend.h | 25 | ||||
-rwxr-xr-x | va/va_trace.c | 59 | ||||
-rw-r--r-- | va/va_trace.h | 28 |
5 files changed, 309 insertions, 1 deletions
@@ -1151,6 +1151,96 @@ VAStatus vaDestroyContext ( return vaStatus; } +VAStatus vaCreateMFContext ( + VADisplay dpy, + VAMFContextID *mf_context /* out */ +) +{ + VADriverContextP ctx; + VAStatus vaStatus; + + CHECK_DISPLAY(dpy); + ctx = CTX(dpy); + if(ctx->vtable->vaCreateMFContext == NULL) + vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED; + else + { + vaStatus = ctx->vtable->vaCreateMFContext( ctx, mf_context); + VA_TRACE_ALL(va_TraceCreateMFContext, dpy, mf_context); + } + + return vaStatus; +} + +VAStatus vaMFAddContext ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID context +) +{ + VADriverContextP ctx; + VAStatus vaStatus; + + CHECK_DISPLAY(dpy); + ctx = CTX(dpy); + + if(ctx->vtable->vaMFAddContext == NULL) + vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED; + else + { + vaStatus = ctx->vtable->vaMFAddContext( ctx, context, mf_context); + VA_TRACE_ALL(va_TraceMFAddContext, dpy, context, mf_context); + } + + return vaStatus; +} + +VAStatus vaMFReleaseContext ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID context +) +{ + VADriverContextP ctx; + VAStatus vaStatus; + + CHECK_DISPLAY(dpy); + ctx = CTX(dpy); + if(ctx->vtable->vaMFReleaseContext == NULL) + vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED; + else + { + vaStatus = ctx->vtable->vaMFReleaseContext( ctx, context, mf_context); + VA_TRACE_ALL(va_TraceMFReleaseContext, dpy, context, mf_context); + } + + return vaStatus; +} + +VAStatus vaMFSubmit ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID *contexts, + int num_contexts +) +{ + VADriverContextP ctx; + VAStatus vaStatus; + + CHECK_DISPLAY(dpy); + ctx = CTX(dpy); + CHECK_VTABLE(vaStatus, ctx, MFSubmit); + if(ctx->vtable->vaMFSubmit == NULL) + vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED; + else + { + vaStatus = ctx->vtable->vaMFSubmit( ctx, mf_context, contexts, num_contexts); + VA_TRACE_ALL(va_TraceMFSubmit, dpy, mf_context, contexts, num_contexts); + } + + return vaStatus; +} + VAStatus vaCreateBuffer ( VADisplay dpy, VAContextID context, /* in */ @@ -1177,6 +1177,86 @@ VAStatus vaDestroyContext ( VAContextID context ); +//Multi-frame context +typedef VAGenericID VAMFContextID; +/** + * vaCreateMFContext - Create a multi-frame context + * interface encapsulating common for all streams memory objects and structures + * required for single GPU task submission from several VAContextID's. + * Allocation: This call only creates an instance, doesn't allocate any additional memory. + * Support identification: Application can identify multi-frame feature support by ability + * to create multi-frame context. If driver supports multi-frame - call successful, + * mf_context != NULL and VAStatus = VA_STATUS_SUCCESS, otherwise if multi-frame processing + * not supported driver returns VA_STATUS_ERROR_UNIMPLEMENTED and mf_context = NULL. + * return values: + * VA_STATUS_SUCCESS - operation successful. + * VA_STATUS_ERROR_UNIMPLEMENTED - no support for multi-frame. + * dpy: display adapter. + * mf_context: Multi-Frame context encapsulating all associated context + * for multi-frame submission. + */ +VAStatus vaCreateMFContext ( + VADisplay dpy, + VAMFContextID *mf_context /* out */ +); + +/** + * vaMFAddContext - Provide ability to associate each context used for + * Multi-Frame submission and common Multi-Frame context. + * Try to add context to understand if it is supported. + * Allocation: this call allocates and/or reallocates all memory objects + * common for all contexts associated with particular Multi-Frame context. + * All memory required for each context(pixel buffers, internal driver + * buffers required for processing) allocated during standard vaCreateContext call for each context. + * Runtime dependency - if current implementation doesn't allow to run different entry points/profile, + * first context added will set entry point/profile for whole Multi-Frame context, + * all other entry points and profiles can be rejected to be added. + * Return values: + * VA_STATUS_SUCCESS - operation successful, context was added. + * VA_STATUS_ERROR_OPERATION_FAILED - something unexpected happened - application have to close + * current mf_context and associated contexts and start working with new ones. + * VA_STATUS_ERROR_INVALID_CONTEXT - ContextID is invalid, means: + * 1 - mf_context is not valid context or + * 2 - driver can't suport different VAEntrypoint or VAProfile simultaneosly + * and current context contradicts with previously added, application can continue with current mf_context + * and other contexts passed this call, rejected context can continue work in stand-alone + * mode or other mf_context. + * VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT - particular context being added was created with with + * unsupported VAEntrypoint. Application can continue with current mf_context + * and other contexts passed this call, rejected context can continue work in stand-alone + * mode. + * VA_STATUS_ERROR_UNSUPPORTED_PROFILE - Current context with Particular VAEntrypoint is supported + * but VAProfile is not supported. Application can continue with current mf_context + * and other contexts passed this call, rejected context can continue work in stand-alone + * mode. + * dpy: display adapter. + * context: context being associated with Multi-Frame context. + * mf_context: - multi-frame context used to associate contexts for multi-frame submission. + */ +VAStatus vaMFAddContext ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID context +); + +/** + * vaMFReleaseContext - Removes context from multi-frame and + * association with multi-frame context. + * After association removed vaEndPicture will submit tasks, but not vaMFSubmit. + * Return values: + * VA_STATUS_SUCCESS - operation successful, context was removed. + * VA_STATUS_ERROR_OPERATION_FAILED - something unexpected happened. + * application need to destroy this VAMFContextID and all assotiated VAContextID + * dpy: display + * mf_context: VAMFContextID where context is added + * context: VAContextID to be added + */ +VAStatus vaMFReleaseContext ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID context +); + /** * Buffers * Buffers are used to pass various types of data from the @@ -2658,12 +2738,40 @@ VAStatus vaRenderPicture ( * The server should start processing all pending operations for this * surface. This call is non-blocking. The client can start another * Begin/Render/End sequence on a different render target. + * if VAContextID used in this function previously successfully passed + * vaMFAddContext call, real processing will be started during vaMFSubmit */ VAStatus vaEndPicture ( VADisplay dpy, VAContextID context ); +/** + * Make the end of rendering for a pictures in contexts passed with submission. + * The server should start processing all pending operations for contexts. + * All contexts passed should be associated through vaMFAddContext + * and call sequence Begin/Render/End performed. + * This call is non-blocking. The client can start another + * Begin/Render/End/vaMFSubmit sequence on a different render targets. + * Return values: + * VA_STATUS_SUCCESS - operation successful, context was removed. + * VA_STATUS_ERROR_INVALID_CONTEXT - mf_context or one of contexts are invalid + * due to mf_context not created or one of contexts not assotiated with mf_context + * through vaAddContext. + * VA_STATUS_ERROR_INVALID_PARAMETER - one of context has not submitted it's frame + * through vaBeginPicture vaRenderPicture vaEndPicture call sequence. + * dpy: display + * mf_context: Multi-Frame context + * contexts: list of contexts submitting their tasks for multi-frame operation. + * num_contexts: number of passed contexts. + */ +VAStatus vaMFSubmit ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID * contexts, + int num_contexts +); + /* Synchronization diff --git a/va/va_backend.h b/va/va_backend.h index 39663e1..a48c6ca 100644 --- a/va/va_backend.h +++ b/va/va_backend.h @@ -436,8 +436,31 @@ struct VADriverVTable VABufferID buf_id /* in */ ); + VAStatus (*vaCreateMFContext) ( + VADriverContextP ctx, + VAMFContextID *mfe_context /* out */ + ); + + VAStatus (*vaMFAddContext) ( + VADriverContextP ctx, + VAMFContextID mf_context, + VAContextID context + ); + + VAStatus (*vaMFReleaseContext) ( + VADriverContextP ctx, + VAMFContextID mf_context, + VAContextID context + ); + + VAStatus (*vaMFSubmit) ( + VADriverContextP ctx, + VAMFContextID mf_context, + VAContextID *contexts, + int num_contexts + ); /** \brief Reserved bytes for future use, must be zero */ - unsigned long reserved[64]; + unsigned long reserved[60]; }; struct VADriverContext diff --git a/va/va_trace.c b/va/va_trace.c index 29332fd..5e9d076 100755 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -1438,6 +1438,65 @@ void va_TraceDestroyContext ( UNLOCK_CONTEXT(pva_trace); } +void va_TraceCreateMFContext ( + VADisplay dpy, + VAMFContextID *mf_context /* out */ +) +{ + DPY2TRACECTX(dpy, VA_INVALID_ID, VA_INVALID_ID); + TRACE_FUNCNAME(idx); + if (mf_context) { + va_TraceMsg(trace_ctx, "\tmf_context = 0x%08x\n", *mf_context); + trace_ctx->trace_context = *mf_context; + } else + trace_ctx->trace_context = VA_INVALID_ID; +} + +void va_TraceMFAddContext ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID context +) +{ + DPY2TRACECTX(dpy, mf_context, VA_INVALID_ID); + + TRACE_FUNCNAME(idx); + va_TraceMsg(trace_ctx, "\tmf_context = 0x%08x\n", mf_context); + va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context); +} + +void va_TraceMFReleaseContext ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID context +) +{ + DPY2TRACECTX(dpy, mf_context, VA_INVALID_ID); + + TRACE_FUNCNAME(idx); + va_TraceMsg(trace_ctx, "\tmf_context = 0x%08x\n", mf_context); + va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context); +} + +void va_TraceMFSubmit ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID *contexts, + int num_contexts +) +{ + int i; + + DPY2TRACECTX(dpy, mf_context, VA_INVALID_ID); + + TRACE_FUNCNAME(idx); + va_TraceMsg(trace_ctx, "\tmf_context = 0x%08x\n", mf_context); + + for(i = 0; i < num_contexts; i++){ + va_TraceMsg(trace_ctx, "\t\tcontext[%d] = 0x%08x\n", i, contexts[i]); + } +} + void va_TraceCreateBuffer ( VADisplay dpy, VAContextID context, /* in */ diff --git a/va/va_trace.h b/va/va_trace.h index 3b0d4a2..48922f5 100644 --- a/va/va_trace.h +++ b/va/va_trace.h @@ -121,6 +121,34 @@ void va_TraceDestroyContext ( ); DLL_HIDDEN +void va_TraceCreateMFContext ( + VADisplay dpy, + VAContextID *mf_context /* out */ +); + +DLL_HIDDEN +void va_TraceMFAddContext ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID context +); + +DLL_HIDDEN +void va_TraceMFReleaseContext ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID context +); + +DLL_HIDDEN +void va_TraceMFSubmit ( + VADisplay dpy, + VAMFContextID mf_context, + VAContextID *contexts, + int num_contexts +); + +DLL_HIDDEN void va_TraceCreateBuffer ( VADisplay dpy, VAContextID context, /* in */ |