gallium/dri: Add Y21x formats

v2: Add all the Y21x tests to the A530 expected fail list.  All of the
YUV image import tests fail on this platform, and nobody has been able
to investigate why.

v3: Update the comment describing the zeroed bits in Y212.  Suggested by
Emma.

v4: Add all Y21x test to the rpi3 expected fail list.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9610>
This commit is contained in:
Ian Romanick 2021-03-12 12:45:58 -08:00 committed by Marge Bot
parent d884174a08
commit 2fdd9b8604
8 changed files with 66 additions and 1 deletions

View File

@ -268,6 +268,9 @@ spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p010,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p012,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p016,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y210,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y212,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y216,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y410,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y412,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y416,Fail

View File

@ -224,6 +224,9 @@ spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p010,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p012,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p016,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y210,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y212,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y216,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y412,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_y416,Fail
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_uyvy,Fail

View File

@ -580,7 +580,28 @@ static const struct dri2_format_mapping dri2_format_table[] = {
{ DRM_FORMAT_UYVY, __DRI_IMAGE_FORMAT_NONE,
__DRI_IMAGE_COMPONENTS_Y_UXVX, PIPE_FORMAT_UYVY, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_GR88 },
{ 0, 1, 0, __DRI_IMAGE_FORMAT_ABGR8888 } } }
{ 0, 1, 0, __DRI_IMAGE_FORMAT_ABGR8888 } } },
/* The Y21x formats work in a similar fashion to the YUYV and UYVY
* formats.
*/
{ DRM_FORMAT_Y210, __DRI_IMAGE_FORMAT_NONE,
__DRI_IMAGE_COMPONENTS_Y_XUXV, PIPE_FORMAT_Y210, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_GR1616 },
{ 0, 1, 0, __DRI_IMAGE_FORMAT_ABGR16161616 } } },
/* Y212 is an unusual format. It has the same layout as Y216 (i.e.,
* 16-bits of physical storage per channel), but the low 4 bits of each
* component are unused padding. The writer is supposed to write zeros
* to these bits.
*/
{ DRM_FORMAT_Y212, __DRI_IMAGE_FORMAT_NONE,
__DRI_IMAGE_COMPONENTS_Y_XUXV, PIPE_FORMAT_Y212, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_GR1616 },
{ 0, 1, 0, __DRI_IMAGE_FORMAT_ABGR16161616 } } },
{ DRM_FORMAT_Y216, __DRI_IMAGE_FORMAT_NONE,
__DRI_IMAGE_COMPONENTS_Y_XUXV, PIPE_FORMAT_Y216, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_GR1616 },
{ 0, 1, 0, __DRI_IMAGE_FORMAT_ABGR16161616 } } },
};
const struct dri2_format_mapping *

View File

@ -358,6 +358,9 @@ update_shader_samplers(struct st_context *st,
case PIPE_FORMAT_P010:
case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
case PIPE_FORMAT_Y210:
case PIPE_FORMAT_Y212:
case PIPE_FORMAT_Y216:
case PIPE_FORMAT_YUYV:
case PIPE_FORMAT_UYVY:
/* we need one additional sampler: */

View File

@ -238,6 +238,17 @@ update_textures(struct st_context *st,
sampler_views[extra] =
pipe->create_sampler_view(pipe, stObj->pt->next, &tmpl);
break;
case PIPE_FORMAT_Y210:
case PIPE_FORMAT_Y212:
case PIPE_FORMAT_Y216:
/* we need one additional R16G16B16A16 view: */
tmpl.format = PIPE_FORMAT_R16G16B16A16_UNORM;
tmpl.swizzle_b = PIPE_SWIZZLE_Z;
tmpl.swizzle_a = PIPE_SWIZZLE_W;
extra = u_bit_scan(&free_slots);
sampler_views[extra] =
pipe->create_sampler_view(pipe, stObj->pt->next, &tmpl);
break;
default:
break;
}

View File

@ -79,6 +79,16 @@ is_format_supported(struct pipe_screen *screen, enum pipe_format format,
PIPE_TEXTURE_2D, nr_samples,
nr_storage_samples, usage);
break;
case PIPE_FORMAT_Y210:
case PIPE_FORMAT_Y212:
case PIPE_FORMAT_Y216:
supported = screen->is_format_supported(screen, PIPE_FORMAT_R16G16_UNORM,
PIPE_TEXTURE_2D, nr_samples,
nr_storage_samples, usage) &&
screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_UNORM,
PIPE_TEXTURE_2D, nr_samples,
nr_storage_samples, usage);
break;
case PIPE_FORMAT_Y410:
supported = screen->is_format_supported(screen, PIPE_FORMAT_R10G10B10A2_UNORM,
PIPE_TEXTURE_2D, nr_samples,
@ -294,6 +304,12 @@ st_bind_egl_image(struct gl_context *ctx,
texFormat = MESA_FORMAT_R_UNORM16;
texObj->RequiredTextureImageUnits = 2;
break;
case PIPE_FORMAT_Y210:
case PIPE_FORMAT_Y212:
case PIPE_FORMAT_Y216:
texFormat = MESA_FORMAT_RG_UNORM16;
texObj->RequiredTextureImageUnits = 2;
break;
case PIPE_FORMAT_Y410:
texFormat = MESA_FORMAT_B10G10R10A2_UNORM;
internalFormat = GL_RGBA;

View File

@ -95,6 +95,9 @@ st_get_external_sampler_key(struct st_context *st, struct gl_program *prog)
key.lower_iyuv |= (1 << unit);
break;
case PIPE_FORMAT_YUYV:
case PIPE_FORMAT_Y210:
case PIPE_FORMAT_Y212:
case PIPE_FORMAT_Y216:
key.lower_yx_xuxv |= (1 << unit);
break;
case PIPE_FORMAT_UYVY:

View File

@ -511,6 +511,11 @@ get_sampler_view_format(struct st_context *st,
case PIPE_FORMAT_P016:
format = PIPE_FORMAT_R16_UNORM;
break;
case PIPE_FORMAT_Y210:
case PIPE_FORMAT_Y212:
case PIPE_FORMAT_Y216:
format = PIPE_FORMAT_R16G16_UNORM;
break;
case PIPE_FORMAT_Y410:
format = PIPE_FORMAT_R10G10B10A2_UNORM;
break;