From bb4557795c5716e9c7ad09d5599997ff55ec863a Mon Sep 17 00:00:00 2001 From: "Li, Xin6" Date: Tue, 7 Nov 2023 13:52:52 +0800 Subject: [PATCH 1/2] va:Add PRIME3 defination Add PRIME3 memory type defination to support create surface with extra flags. --- va/va_drmcommon.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++ va/va_trace.c | 27 ++++++++++++++++++++++- 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/va/va_drmcommon.h b/va/va_drmcommon.h index 0bda45874..a8e9a55a7 100644 --- a/va/va_drmcommon.h +++ b/va/va_drmcommon.h @@ -28,6 +28,7 @@ #define VA_DRM_COMMON_H #include +#include /** \brief DRM authentication type. */ @@ -86,6 +87,11 @@ struct drm_state { * Used with VADRMPRIMESurfaceDescriptor. */ #define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 0x40000000 +/** \brief DRM PRIME3 memory type + * + * Used with VADRMPRIME3SurfaceDescriptor. + */ +#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3 0x80000000 /** * \brief External buffer descriptor for a DRM PRIME surface. @@ -158,6 +164,55 @@ typedef struct _VADRMPRIMESurfaceDescriptor { } layers[4]; } VADRMPRIMESurfaceDescriptor; +/** + * \brief External buffer descriptor for a DRM PRIME surface with flags + * + * This structure is an extention for VADRMPRIMESurfaceDescriptor, + * it has the same behavior as if used with VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2. + * + * The field "flags" is added, see "Surface external buffer descriptor flags". + * To use this structure, use VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3 instead. + */ +typedef struct _VADRMPRIME3SurfaceDescriptor { + /** Pixel format fourcc of the whole surface (VA_FOURCC_*). */ + uint32_t fourcc; + /** Width of the surface in pixels. */ + uint32_t width; + /** Height of the surface in pixels. */ + uint32_t height; + /** Number of distinct DRM objects making up the surface. */ + uint32_t num_objects; + /** Description of each object. */ + struct { + /** DRM PRIME file descriptor for this object. */ + int fd; + /** Total size of this object (may include regions which are + * not part of the surface). */ + uint32_t size; + /** Format modifier applied to this object. */ + uint64_t drm_format_modifier; + } objects[4]; + /** Number of layers making up the surface. */ + uint32_t num_layers; + /** Description of each layer in the surface. */ + struct { + /** DRM format fourcc of this layer (DRM_FOURCC_*). */ + uint32_t drm_format; + /** Number of planes in this layer. */ + uint32_t num_planes; + /** Index in the objects array of the object containing each + * plane. */ + uint32_t object_index[4]; + /** Offset within the object of each plane. */ + uint32_t offset[4]; + /** Pitch of each plane. */ + uint32_t pitch[4]; + } layers[4]; + /** \brief flags. See "Surface external buffer descriptor flags". */ + uint32_t flags; + /** reserved bytes, must be zero */ + uint32_t reserved[VA_PADDING_MEDIUM + 1]; +} VADRMPRIME3SurfaceDescriptor; /** * \brief List of DRM format modifiers. * diff --git a/va/va_trace.c b/va/va_trace.c index a273bf051..365708cff 100644 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -1255,6 +1255,31 @@ static void va_TraceSurfaceAttributes( va_TraceMsg(trace_ctx, "\t\t\t\tlayers[%d].pitch[%d]=0x%d\n", j, k, tmp->layers[j].pitch[k]); } } + } else if (memtype == VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3) { + VADRMPRIME3SurfaceDescriptor *tmp = (VADRMPRIME3SurfaceDescriptor *) p->value.value.p; + uint32_t j, k; + + va_TraceMsg(trace_ctx, "\t\t--VADRMPRIME3SurfaceDescriptor\n"); + va_TraceMsg(trace_ctx, "\t\t pixel_format=0x%08x\n", tmp->fourcc); + va_TraceMsg(trace_ctx, "\t\t width=%d\n", tmp->width); + va_TraceMsg(trace_ctx, "\t\t height=%d\n", tmp->height); + va_TraceMsg(trace_ctx, "\t\t num_objects=0x%08x\n", tmp->num_objects); + va_TraceMsg(trace_ctx, "\t\t flags=0x%08x\n", tmp->flags); + for (j = 0; j < tmp->num_objects && tmp->num_objects <= 4; j++) { + va_TraceMsg(trace_ctx, "\t\t\tobjects[%d].fd=%d\n", j, tmp->objects[j].fd); + va_TraceMsg(trace_ctx, "\t\t\tobjects[%d].size=%d\n", j, tmp->objects[j].size); + va_TraceMsg(trace_ctx, "\t\t\tobjects[%d].drm_format_modifier=%llx\n", j, tmp->objects[j].drm_format_modifier); + } + va_TraceMsg(trace_ctx, "\t\t num_layers=%d\n", tmp->num_layers); + for (j = 0; j < tmp->num_layers && tmp->num_layers <= 4; j++) { + va_TraceMsg(trace_ctx, "\t\t\tlayers[%d].drm_format=0x%08x\n", j, tmp->layers[j].drm_format); + va_TraceMsg(trace_ctx, "\t\t\tlayers[%d].num_planes=0x%d\n", j, tmp->layers[j].num_planes); + for (k = 0; k < 4; k++) { + va_TraceMsg(trace_ctx, "\t\t\t\tlayers[%d].object_index[%d]=0x%d\n", j, k, tmp->layers[j].object_index[k]); + va_TraceMsg(trace_ctx, "\t\t\t\tlayers[%d].offset[%d]=0x%d\n", j, k, tmp->layers[j].offset[k]); + va_TraceMsg(trace_ctx, "\t\t\t\tlayers[%d].pitch[%d]=0x%d\n", j, k, tmp->layers[j].pitch[k]); + } + } #if defined(_WIN32) } else if (memtype == VA_SURFACE_ATTRIB_MEM_TYPE_NTHANDLE) { va_TraceMsg(trace_ctx, "\t\t--Win32 %d surfaces\n", num_surfaces); @@ -6336,7 +6361,7 @@ void va_TraceExportSurfaceHandle( va_TraceMsg(trace_ctx, "\tmemType = 0x%08x\n", memType); va_TraceMsg(trace_ctx, "\tflags = 0x%08x\n", flags); - if (memType != VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2) { + if (memType != VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 && memType != VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3) { DPY2TRACE_VIRCTX_EXIT(pva_trace); return; } From 8d472216d0102a58a36bcde5ae815da20c912d7a Mon Sep 17 00:00:00 2001 From: "Li, Xin6" Date: Mon, 11 Dec 2023 16:30:53 +0800 Subject: [PATCH 2/2] promote version --- configure.ac | 2 +- meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index bb8b97a8b..a7491ed42 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ # - reset micro version to zero when minor version is incremented # - reset minor version to zero when major version is incremented m4_define([va_api_major_version], [1]) -m4_define([va_api_minor_version], [21]) +m4_define([va_api_minor_version], [22]) m4_define([va_api_micro_version], [0]) m4_define([va_api_version], diff --git a/meson.build b/meson.build index 6acf90676..70e9af4d5 100644 --- a/meson.build +++ b/meson.build @@ -19,7 +19,7 @@ project( # - reset micro version to zero when minor version is incremented # - reset minor version to zero when major version is incremented va_api_major_version = 1 -va_api_minor_version = 21 +va_api_minor_version = 22 va_api_micro_version = 0 va_api_version = '@0@.@1@.@2@'.format(va_api_major_version,