mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
gallium/dri2: Implement dri2ImageExtension.queryDmaBufFormatModifierAttribs
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
0346b70083
commit
fe06655e86
1 changed files with 50 additions and 0 deletions
|
|
@ -819,6 +819,37 @@ dri2_create_image_from_name(__DRIscreen *_screen,
|
|||
return img;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
dri2_get_modifier_num_planes(uint64_t modifier)
|
||||
{
|
||||
switch (modifier) {
|
||||
case I915_FORMAT_MOD_Y_TILED_CCS:
|
||||
return 2;
|
||||
case DRM_FORMAT_MOD_BROADCOM_UIF:
|
||||
case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED:
|
||||
case DRM_FORMAT_MOD_LINEAR:
|
||||
/* DRM_FORMAT_MOD_NONE is the same as LINEAR */
|
||||
case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB:
|
||||
case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB:
|
||||
case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB:
|
||||
case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB:
|
||||
case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB:
|
||||
case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB:
|
||||
case DRM_FORMAT_MOD_QCOM_COMPRESSED:
|
||||
case DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED:
|
||||
case DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED:
|
||||
case DRM_FORMAT_MOD_VIVANTE_SUPER_TILED:
|
||||
case DRM_FORMAT_MOD_VIVANTE_TILED:
|
||||
/* FD_FORMAT_MOD_QCOM_TILED is not in drm_fourcc.h */
|
||||
case I915_FORMAT_MOD_X_TILED:
|
||||
case I915_FORMAT_MOD_Y_TILED:
|
||||
return 1;
|
||||
case DRM_FORMAT_MOD_INVALID:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static __DRIimage *
|
||||
dri2_create_image_from_fd(__DRIscreen *_screen,
|
||||
int width, int height, int fourcc,
|
||||
|
|
@ -1229,6 +1260,23 @@ dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
|
|||
return false;
|
||||
}
|
||||
|
||||
static boolean
|
||||
dri2_query_dma_buf_format_modifier_attribs(__DRIscreen *_screen,
|
||||
uint32_t fourcc, uint64_t modifier,
|
||||
int attrib, uint64_t *value)
|
||||
{
|
||||
switch (attrib) {
|
||||
case __DRI_IMAGE_FORMAT_MODIFIER_ATTRIB_PLANE_COUNT: {
|
||||
uint64_t mod_planes = dri2_get_modifier_num_planes(modifier);
|
||||
if (mod_planes > 0)
|
||||
*value = mod_planes;
|
||||
return mod_planes > 0;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static __DRIimage *
|
||||
dri2_from_dma_bufs(__DRIscreen *screen,
|
||||
int width, int height, int fourcc,
|
||||
|
|
@ -1852,6 +1900,8 @@ dri2_init_screen(__DRIscreen * sPriv)
|
|||
dri2ImageExtension.queryDmaBufFormats = dri2_query_dma_buf_formats;
|
||||
dri2ImageExtension.queryDmaBufModifiers =
|
||||
dri2_query_dma_buf_modifiers;
|
||||
dri2ImageExtension.queryDmaBufFormatModifierAttribs =
|
||||
dri2_query_dma_buf_format_modifier_attribs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue