diff options
author | Dmitry Ermilov <dmitry.ermilov@intel.com> | 2020-04-22 14:12:44 -0400 |
---|---|---|
committer | XinfengZhang <carl.zhang@intel.com> | 2020-06-23 15:32:23 +0800 |
commit | 3cc2212c38630ffcdc6b38e0bd867845adee5ed9 (patch) | |
tree | cf848ea839857c3b64b2464e05cc8274b68cfc91 /va | |
parent | 7749f3cf22d1fb93ca6c65c06a3510064c8beca0 (diff) | |
download | libva-3cc2212c38630ffcdc6b38e0bd867845adee5ed9.tar.gz |
Add vaSyncSurface2 with timeout
Fixes #397
Signed-off-by: Dmitry Ermilov <dmitry.ermilov@intel.com>
Diffstat (limited to 'va')
-rw-r--r-- | va/va.c | 22 | ||||
-rw-r--r-- | va/va.h | 31 | ||||
-rw-r--r-- | va/va_backend.h | 8 | ||||
-rw-r--r-- | va/va_trace.c | 17 | ||||
-rw-r--r-- | va/va_trace.h | 7 |
5 files changed, 84 insertions, 1 deletions
@@ -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, @@ -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 /** @@ -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 +); + typedef enum { VASurfaceRendering = 1, /* Rendering in progress */ diff --git a/va/va_backend.h b/va/va_backend.h index f2cd7b0..f3d8998 100644 --- a/va/va_backend.h +++ b/va/va_backend.h @@ -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 diff --git a/va/va_trace.c b/va/va_trace.c index 14c73cd..f726b50 100644 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -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, diff --git a/va/va_trace.h b/va/va_trace.h index 3e919b2..6a3d166 100644 --- a/va/va_trace.h +++ b/va/va_trace.h @@ -213,6 +213,13 @@ void va_TraceSyncSurface( ); DLL_HIDDEN +void va_TraceSyncSurface2( + VADisplay dpy, + VASurfaceID surface, + uint64_t timeout_ns +); + +DLL_HIDDEN void va_TraceQuerySurfaceAttributes( VADisplay dpy, VAConfigID config, |