v3d: Also expose DRM_FORMAT_MOD_BROADCOM_SAND128 with PIPE_FORMAT_P030

Now we can display h265-10bit decoded frames formats on Raspberry Pi 4
devices on GL/ES applications.

v2: Don't expose LINEAR or UIF formats for P030 format.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19639>
This commit is contained in:
Jose Maria Casanova Crespo 2022-11-09 13:10:12 +01:00 committed by José María Casanova Crespo
parent 653cf8c8d2
commit e97b20f3ca
1 changed files with 19 additions and 4 deletions

View File

@ -763,9 +763,21 @@ v3d_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen,
int i;
int num_modifiers = ARRAY_SIZE(v3d_available_modifiers);
/* Expose DRM_FORMAT_MOD_BROADCOM_SAND128 only for PIPE_FORMAT_NV12 */
if (format != PIPE_FORMAT_NV12)
/* Expose DRM_FORMAT_MOD_BROADCOM_SAND128 only for PIPE_FORMAT_NV12
* and PIPE_FORMAT_P030, in the case of P030 we don't expose LINEAR
* or UIF.
*/
if (format != PIPE_FORMAT_NV12 && format != PIPE_FORMAT_P030) {
num_modifiers--;
} else if (format == PIPE_FORMAT_P030 ) {
*count = 1;
if (modifiers && max > 0) {
modifiers[0] = DRM_FORMAT_MOD_BROADCOM_SAND128;
if (external_only)
external_only[0] = true;
}
return;
}
if (!modifiers) {
*count = num_modifiers;
@ -787,18 +799,21 @@ v3d_screen_is_dmabuf_modifier_supported(struct pipe_screen *pscreen,
bool *external_only)
{
int i;
bool is_sand_col128 = (format == PIPE_FORMAT_NV12) &&
bool is_sand_col128 = (format == PIPE_FORMAT_NV12 || format == PIPE_FORMAT_P030) &&
(fourcc_mod_broadcom_mod(modifier) == DRM_FORMAT_MOD_BROADCOM_SAND128);
if (is_sand_col128) {
if (external_only)
*external_only = true;
return true;
} else if (format == PIPE_FORMAT_P030) {
/* For PIPE_FORMAT_P030 we don't expose LINEAR or UIF. */
return false;
}
/* We don't want to generally allow DRM_FORMAT_MOD_BROADCOM_SAND128
* modifier, that is the last v3d_available_modifiers. We only accept
* it in the case of having a PIPE_FORMAT_NV12.
* it in the case of having a PIPE_FORMAT_NV12 or PIPE_FORMAT_P030.
*/
assert(v3d_available_modifiers[ARRAY_SIZE(v3d_available_modifiers) - 1] ==
DRM_FORMAT_MOD_BROADCOM_SAND128);