Skip to content

Commit

Permalink
va: add VASurfaceAttribAlignmentSize
Browse files Browse the repository at this point in the history
Due to different HW implementation, the
surface could require a different alignment size
rather than the default ones, here introduces
a new VASurfaceAttribute, alignment size, which
contains two variables log2_width_alignment
and log2_height_alignment, each has 4 bits,
and the alignment needs to be left shifted
2**size from the application side.

The alignment is in the powers of 2 and
range in [2**0, ... 2**15] = [1, 2, 4, 8, ... 32768]

And this alignment should be met when creating
context as an add-on requirement. If not
implemented, the existing/default alignment
logic will be used.

Signed-off-by: Ruijing Dong <[email protected]>
  • Loading branch information
ruijingdong committed Jan 31, 2024
1 parent 3457aa8 commit 1bccaf7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ project(
# - reset minor version to zero when major version is incremented
va_api_major_version = 1
va_api_minor_version = 21
va_api_micro_version = 0
va_api_micro_version = 1

va_api_version = '@0@.@1@.@2@'.format(va_api_major_version,
va_api_minor_version,
Expand Down
23 changes: 23 additions & 0 deletions va/va.h
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,15 @@ typedef enum {
* when importing an existing buffer.
*/
VASurfaceAttribDRMFormatModifiers,
/** \brief width and height log2 aligment in pixels (int, read-only)
*
* For special HW requirement used in some codecs, if
* VASurfaceAttribAlignmentSize is not implemented in the driver, then
* the surface_width and surface_height should keep the original logic
* without any modification, this is an add-on requirement to
* surface_width and surface_height.
*/
VASurfaceAttribAlignmentSize,
/** \brief Number of surface attributes. */
VASurfaceAttribCount
} VASurfaceAttribType;
Expand Down Expand Up @@ -1727,6 +1736,20 @@ typedef struct _VASurfaceAttrib {
/** \brief User pointer memory type is supported. */
#define VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR 0x00000004
/**@}*/
/**
* \brief VASurfaceAttribAlignmentStruct structure for
* the VASurfaceAttribAlignmentSize attribute.
*/
typedef union _VASurfaceAttribAlignmentStruct {
struct {
/** \brief log2 width aligment */
uint32_t log2_width_alignment : 4;
/** \brief log2 height aligment */
uint32_t log2_height_alignment : 4;
uint32_t reserved : 24;
} bits;
uint32_t value;
} VASurfaceAttribAlignmentStruct;

/**
* \brief VASurfaceAttribExternalBuffers structure for
Expand Down

0 comments on commit 1bccaf7

Please sign in to comment.