Skip to content
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
22 changes: 22 additions & 0 deletions va/va.c
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,28 @@ VAStatus vaSyncSurface (
return va_status;
}

VAStatus vaSyncSurface2 (
VADisplay dpy,
VASurfaceID surface,
uint64_t timeout_ns
)
{
VAStatus va_status;
VADriverContextP ctx;

CHECK_DISPLAY(dpy);
ctx = CTX(dpy);

if (ctx->vtable->vaSyncSurface2)
va_status = ctx->vtable->vaSyncSurface2( ctx, surface, timeout_ns );
else
va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
VA_TRACE_LOG(va_TraceSyncSurface2, dpy, surface, timeout_ns);
VA_TRACE_RET(dpy, va_status);

return va_status;
}

VAStatus vaQuerySurfaceStatus (
VADisplay dpy,
VASurfaceID render_target,
Expand Down
31 changes: 31 additions & 0 deletions va/va.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ typedef int VAStatus; /** Return status type from functions */
#define VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE 0x00000024
/** \brief Indicate allocated buffer size is not enough for input or output. */
#define VA_STATUS_ERROR_NOT_ENOUGH_BUFFER 0x00000025
/** \brief Indicate an operation isn't completed because time-out interval elapsed. */
#define VA_STATUS_ERROR_TIMEDOUT 0x00000026
#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF

/**
Expand Down Expand Up @@ -3724,6 +3726,35 @@ VAStatus vaSyncSurface (
VASurfaceID render_target
);

/** \brief Indicates an infinite timeout. */
#define VA_TIMEOUT_INFINITE 0xFFFFFFFFFFFFFFFF

/**
* \brief Synchronizes pending operations associated with the supplied surface.
*
* This function blocks during specified timeout (in nanoseconds) until
* all pending operations on the render target have been completed.
* If timeout is zero, the function returns immediately.
*
* Possible errors:
* - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation
* does not support this interface
* - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied
* - \ref VA_STATUS_ERROR_INVALID_SURFACE: an invalid surface was supplied
* - \ref VA_STATUS_ERROR_TIMEDOUT: synchronization is still in progress,
* client should call the function again to complete synchronization
*
* @param[in] dpy the VA display
* @param[in] surface the surface for which synchronization is performed
* @param[in] timeout_ns the timeout in nanoseconds
*
*/
VAStatus vaSyncSurface2 (
VADisplay dpy,
VASurfaceID surface,
uint64_t timeout_ns
Copy link
Contributor

Choose a reason for hiding this comment

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

should we care about infinite wait? maybe int64_t is more suitable, negative value mean infinite?

);

typedef enum
{
VASurfaceRendering = 1, /* Rendering in progress */
Expand Down
8 changes: 7 additions & 1 deletion va/va_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,14 @@ struct VADriverVTable
void *descriptor /* out */
);

VAStatus (*vaSyncSurface2) (
VADriverContextP ctx,
VASurfaceID surface,
uint64_t timeout_ns
);

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

struct VADriverContext
Expand Down
17 changes: 17 additions & 0 deletions va/va_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -5455,6 +5455,23 @@ void va_TraceSyncSurface(
DPY2TRACE_VIRCTX_EXIT(pva_trace);
}

void va_TraceSyncSurface2(
VADisplay dpy,
VASurfaceID surface,
uint64_t timeout_ns
)
{
DPY2TRACE_VIRCTX(dpy);

TRACE_FUNCNAME(idx);

va_TraceMsg(trace_ctx, "\tsurface = 0x%08x\n", surface);
va_TraceMsg(trace_ctx, "\ttimeout_ns = %d\n", timeout_ns);
va_TraceMsg(trace_ctx, NULL);

DPY2TRACE_VIRCTX_EXIT(pva_trace);
}

void va_TraceQuerySurfaceAttributes(
VADisplay dpy,
VAConfigID config,
Expand Down
7 changes: 7 additions & 0 deletions va/va_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ void va_TraceSyncSurface(
VASurfaceID render_target
);

DLL_HIDDEN
void va_TraceSyncSurface2(
VADisplay dpy,
VASurfaceID surface,
uint64_t timeout_ns
);

DLL_HIDDEN
void va_TraceQuerySurfaceAttributes(
VADisplay dpy,
Expand Down