From b2f40a933036d022b2194e7384e43ff771c8fea0 Mon Sep 17 00:00:00 2001 From: "Carl.Zhang" Date: Wed, 21 Oct 2026 15:00:47 +0800 Subject: [PATCH] va: add VA_SURFACE_ATTRIB_USAGE_HINT_PRIVATE There is currently no way for an application to tell the backend driver at allocation time that a surface will never leave the VA driver. The existing usage hints only describe intended uses, and the absence of VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT cannot be distinguished from an application that simply did not pass a hint, so drivers must always assume the surface may later be exported and shared with other components such as compute or display. Add VA_SURFACE_ATTRIB_USAGE_HINT_PRIVATE to state that the surface is private to the VA driver and will not be exported. The driver is then free to choose a memory layout that is not shareable outside of it. The flag must not be combined with the DISPLAY or EXPORT hints, and vaExportSurfaceHandle() on such a surface fails with VA_STATUS_ERROR_INVALID_SURFACE. Drivers that do not recognize the flag may ignore it, so existing drivers keep working unchanged. Signed-off-by: Carl.Zhang --- va/va.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/va/va.h b/va/va.h index 7dc13741c..075b7e302 100644 --- a/va/va.h +++ b/va/va.h @@ -1837,6 +1837,17 @@ typedef struct _VASurfaceAttribExternalBuffers { /** \brief Surface used for export to third-party APIs, e.g. via * vaExportSurfaceHandle(). */ #define VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT 0x00000020 +/** \brief Surface is private to the VA driver and will never be shared + * with other components (e.g. compute, display) or exported via + * vaExportSurfaceHandle(). + * + * The driver may use a memory layout which is not shareable outside of + * the VA driver. It must not be combined with + * VA_SURFACE_ATTRIB_USAGE_HINT_DISPLAY or + * VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT, otherwise vaCreateSurfaces() + * returns VA_STATUS_ERROR_INVALID_PARAMETER. Drivers which do not + * recognize this flag may ignore it. */ +#define VA_SURFACE_ATTRIB_USAGE_HINT_PRIVATE 0x00000040 /**@}*/ @@ -4184,7 +4195,8 @@ vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id); * - VA_STATUS_ERROR_UNIMPLEMENTED: The driver does not implement * this interface. * - VA_STATUS_ERROR_INVALID_SURFACE: The surface is not valid, or - * the surface is not exportable in the specified way. + * the surface is not exportable in the specified way (e.g. it was + * created with VA_SURFACE_ATTRIB_USAGE_HINT_PRIVATE). * - VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE: The driver does not * support exporting surfaces to the specified memory type. */