diff options
author | Dmitry Ermilov <dmitry.ermilov@intel.com> | 2020-04-23 06:46:24 -0400 |
---|---|---|
committer | XinfengZhang <carl.zhang@intel.com> | 2020-06-30 14:42:02 +0800 |
commit | afca400d5629409ae7d51c4b1109a1b73ab2844a (patch) | |
tree | 1d1d556722fb1e7d7a226d0ca5bbe30d7a675bb8 | |
parent | 3cc2212c38630ffcdc6b38e0bd867845adee5ed9 (diff) | |
download | libva-afca400d5629409ae7d51c4b1109a1b73ab2844a.tar.gz |
Add vaSyncBuffer for output buffers synchronization
Added notes about different ways for synchronization.
Signed-off-by: Dmitry Ermilov <dmitry.ermilov@intel.com>
-rw-r--r-- | va/va.c | 23 | ||||
-rw-r--r-- | va/va.h | 40 | ||||
-rw-r--r-- | va/va_backend.h | 8 | ||||
-rw-r--r-- | va/va_trace.c | 17 | ||||
-rw-r--r-- | va/va_trace.h | 6 |
5 files changed, 93 insertions, 1 deletions
@@ -1700,6 +1700,29 @@ VAStatus vaQuerySurfaceError ( return va_status; } +VAStatus vaSyncBuffer ( + VADisplay dpy, + VABufferID buf_id, + uint64_t timeout_ns +) +{ + VAStatus va_status; + VADriverContextP ctx; + + CHECK_DISPLAY(dpy); + ctx = CTX(dpy); + + VA_TRACE_LOG(va_TraceSyncBuffer, dpy, buf_id, timeout_ns); + + if (ctx->vtable->vaSyncBuffer) + va_status = ctx->vtable->vaSyncBuffer( ctx, buf_id, timeout_ns ); + else + va_status = VA_STATUS_ERROR_UNIMPLEMENTED; + VA_TRACE_RET(dpy, va_status); + + return va_status; +} + /* Get maximum number of image formats supported by the implementation */ int vaMaxNumImageFormats ( VADisplay dpy @@ -3811,6 +3811,46 @@ VAStatus vaQuerySurfaceError( ); /** + * \brief Synchronizes pending operations associated with the supplied buffer. + * + * This function blocks during specified timeout (in nanoseconds) until + * all pending operations on the supplied buffer 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_BUFFER: an invalid buffer 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] buf_id the buffer for which synchronization is performed + * @param[in] timeout_ns the timeout in nanoseconds + * + */ +VAStatus vaSyncBuffer( + VADisplay dpy, + VABufferID buf_id, + uint64_t timeout_ns +); + +/** + * Notes about synchronization interfaces: + * vaSyncSurface: + * 1. Allows to synchronize output surface (i.e. from decoding or VP) + * 2. Allows to synchronize all bitstreams being encoded from the given input surface (1->N pipelines). + * + * vaSyncSurface2: + * 1. The same as vaSyncSurface but allows to specify a timeout + * + * vaSyncBuffer: + * 1. Allows to synchronize output buffer (e.g. bitstream from encoding). + * Comparing to vaSyncSurface this function synchronizes given bitstream only. + */ + +/** * Images and Subpictures * VAImage is used to either get the surface data to client memory, or * to copy image data in client memory to a surface. diff --git a/va/va_backend.h b/va/va_backend.h index f3d8998..5ab8f6a 100644 --- a/va/va_backend.h +++ b/va/va_backend.h @@ -491,8 +491,14 @@ struct VADriverVTable uint64_t timeout_ns ); + VAStatus (*vaSyncBuffer) ( + VADriverContextP ctx, + VABufferID buf_id, + uint64_t timeout_ns + ); + /** \brief Reserved bytes for future use, must be zero */ - unsigned long reserved[56]; + unsigned long reserved[55]; }; struct VADriverContext diff --git a/va/va_trace.c b/va/va_trace.c index f726b50..1de3d9d 100644 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -5536,6 +5536,23 @@ void va_TraceQuerySurfaceError( DPY2TRACE_VIRCTX_EXIT(pva_trace); } +void va_TraceSyncBuffer( + VADisplay dpy, + VABufferID buf_id, + uint64_t timeout_ns +) +{ + DPY2TRACE_VIRCTX(dpy); + + TRACE_FUNCNAME(idx); + + va_TraceMsg(trace_ctx, "\tbuf_id = 0x%08x\n", buf_id); + va_TraceMsg(trace_ctx, "\ttimeout_ns = %d\n", timeout_ns); + va_TraceMsg(trace_ctx, NULL); + + DPY2TRACE_VIRCTX_EXIT(pva_trace); +} + void va_TraceMaxNumDisplayAttributes ( VADisplay dpy, int number diff --git a/va/va_trace.h b/va/va_trace.h index 6a3d166..5360443 100644 --- a/va/va_trace.h +++ b/va/va_trace.h @@ -242,6 +242,12 @@ void va_TraceQuerySurfaceError( void **error_info /*out*/ ); +DLL_HIDDEN +void va_TraceSyncBuffer( + VADisplay dpy, + VABufferID buf_id, + uint64_t timeout_ns +); DLL_HIDDEN void va_TraceMaxNumDisplayAttributes ( |