Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New VAAPI definition for multi-frame processing #112

Merged
merged 2 commits into from
Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions va/va.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*mf_context may be a random value for this case, so va_TraceCreateMFContext shouldn't be called when ctx->vtable->vaCreateMFContext is a NULL pointer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, fixed

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 */
Expand Down
108 changes: 108 additions & 0 deletions va/va.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
25 changes: 24 additions & 1 deletion va/va_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
59 changes: 59 additions & 0 deletions va/va_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
28 changes: 28 additions & 0 deletions va/va_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,34 @@ void va_TraceDestroyContext (
VAContextID context
);

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,
Expand Down