diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index 8b7e929f0ef..8238730811a 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -890,11 +890,11 @@ static const struct dri2_format_mapping r8_g8b8_mapping = { { 1, 1, 1, __DRI_IMAGE_FORMAT_GR88 } } }; -static const struct dri2_format_mapping g8_b8r8_mapping = { +static const struct dri2_format_mapping r8_b8g8_mapping = { DRM_FORMAT_NV21, __DRI_IMAGE_FORMAT_NONE, __DRI_IMAGE_COMPONENTS_Y_UV, - PIPE_FORMAT_G8_B8R8_420_UNORM, + PIPE_FORMAT_R8_B8G8_420_UNORM, 2, { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8 }, { 1, 1, 1, __DRI_IMAGE_FORMAT_GR88 } } @@ -959,7 +959,7 @@ dri2_create_image_from_winsys(__DRIscreen *_screen, PIPE_BIND_SAMPLER_VIEW)) tex_usage |= PIPE_BIND_SAMPLER_VIEW; - /* For NV12, see if we have support for sampling r8_b8g8 */ + /* For NV12, see if we have support for sampling r8_g8b8 */ if (!tex_usage && map->pipe_format == PIPE_FORMAT_NV12 && pscreen->is_format_supported(pscreen, PIPE_FORMAT_R8_G8B8_420_UNORM, screen->target, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { @@ -967,11 +967,11 @@ dri2_create_image_from_winsys(__DRIscreen *_screen, tex_usage |= PIPE_BIND_SAMPLER_VIEW; } - /* For NV21, see if we have support for sampling g8_b8r8 */ + /* For NV21, see if we have support for sampling r8_b8g8 */ if (!tex_usage && map->pipe_format == PIPE_FORMAT_NV21 && - pscreen->is_format_supported(pscreen, PIPE_FORMAT_G8_B8R8_420_UNORM, + pscreen->is_format_supported(pscreen, PIPE_FORMAT_R8_B8G8_420_UNORM, screen->target, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { - map = &g8_b8r8_mapping; + map = &r8_b8g8_mapping; tex_usage |= PIPE_BIND_SAMPLER_VIEW; } diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index c34d2759513..4cad8b0c879 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -270,7 +270,7 @@ update_shader_samplers(struct st_context *st, break; FALLTHROUGH; case PIPE_FORMAT_NV21: - if (stObj->pt->format == PIPE_FORMAT_G8_B8R8_420_UNORM) + if (stObj->pt->format == PIPE_FORMAT_R8_B8G8_420_UNORM) /* no additional views needed */ break; FALLTHROUGH; diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index a923f05151c..6121e18576a 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -187,7 +187,7 @@ st_get_sampler_views(struct st_context *st, pipe->create_sampler_view(pipe, stObj->pt->next, &tmpl); break; case PIPE_FORMAT_NV21: - if (stObj->pt->format == PIPE_FORMAT_G8_B8R8_420_UNORM) + if (stObj->pt->format == PIPE_FORMAT_R8_B8G8_420_UNORM) /* no additional views needed */ break; diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c index 41ce901d2a1..e5054abece4 100644 --- a/src/mesa/state_tracker/st_cb_eglimage.c +++ b/src/mesa/state_tracker/st_cb_eglimage.c @@ -181,8 +181,8 @@ is_nv12_as_r8_g8b8_supported(struct pipe_screen *screen, struct st_egl_image *ou } if (out->format == PIPE_FORMAT_NV21 && - out->texture->format == PIPE_FORMAT_G8_B8R8_420_UNORM && - screen->is_format_supported(screen, PIPE_FORMAT_G8_B8R8_420_UNORM, + out->texture->format == PIPE_FORMAT_R8_B8G8_420_UNORM && + screen->is_format_supported(screen, PIPE_FORMAT_R8_B8G8_420_UNORM, PIPE_TEXTURE_2D, out->texture->nr_samples, out->texture->nr_storage_samples, @@ -366,10 +366,8 @@ st_bind_egl_image(struct gl_context *ctx, switch (stimg->format) { case PIPE_FORMAT_NV12: case PIPE_FORMAT_NV21: - if (stimg->texture->format == PIPE_FORMAT_R8_G8B8_420_UNORM) { - texFormat = MESA_FORMAT_R8G8B8X8_UNORM; - texObj->RequiredTextureImageUnits = 1; - } else if (stimg->texture->format == PIPE_FORMAT_G8_B8R8_420_UNORM) { + if (stimg->texture->format == PIPE_FORMAT_R8_G8B8_420_UNORM || + stimg->texture->format == PIPE_FORMAT_R8_B8G8_420_UNORM) { texFormat = MESA_FORMAT_R8G8B8X8_UNORM; texObj->RequiredTextureImageUnits = 1; } else { diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 70280832721..e212abcb85e 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -97,7 +97,7 @@ st_get_external_sampler_key(struct st_context *st, struct gl_program *prog) key.lower_nv12 |= (1 << unit); break; case PIPE_FORMAT_NV21: - if (stObj->pt->format == PIPE_FORMAT_G8_B8R8_420_UNORM) { + if (stObj->pt->format == PIPE_FORMAT_R8_B8G8_420_UNORM) { key.lower_yuv |= (1 << unit); break; } diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c index 73590097ebc..0b7b57ac7e5 100644 --- a/src/mesa/state_tracker/st_sampler_view.c +++ b/src/mesa/state_tracker/st_sampler_view.c @@ -387,8 +387,8 @@ st_get_sampler_view_format(const struct st_context *st, } FALLTHROUGH; case PIPE_FORMAT_NV21: - if (texObj->pt->format == PIPE_FORMAT_G8_B8R8_420_UNORM) { - format = PIPE_FORMAT_G8_B8R8_420_UNORM; + if (texObj->pt->format == PIPE_FORMAT_R8_B8G8_420_UNORM) { + format = PIPE_FORMAT_R8_B8G8_420_UNORM; break; } FALLTHROUGH; diff --git a/src/panfrost/lib/pan_format.c b/src/panfrost/lib/pan_format.c index 00dc8a7f7f2..fb4d7401d5a 100644 --- a/src/panfrost/lib/pan_format.c +++ b/src/panfrost/lib/pan_format.c @@ -193,7 +193,7 @@ const struct panfrost_format GENX(panfrost_pipe_format)[PIPE_FORMAT_COUNT] = { FMT_YUV(R8B8_R8G8_UNORM, YUYV8, VYUA, NO_SWAP, CO_SITED, _T__), FMT_YUV(B8R8_G8R8_UNORM, VYUY8, VUYA, SWAP, CO_SITED, _T__), FMT_YUV(R8_G8B8_420_UNORM, Y8_UV8_420, YUVA, NO_SWAP, CO_SITED, _T__), - FMT_YUV(G8_B8R8_420_UNORM, Y8_UV8_420, YVUA, NO_SWAP, CO_SITED, _T__), + FMT_YUV(R8_B8G8_420_UNORM, Y8_UV8_420, YVUA, NO_SWAP, CO_SITED, _T__), FMT_YUV(R8_G8_B8_420_UNORM, Y8_U8_V8_420, YUVA, NO_SWAP, CO_SITED, _T__), FMT_YUV(R8_B8_G8_420_UNORM, Y8_U8_V8_420, YVUA, NO_SWAP, CO_SITED, _T__), #endif diff --git a/src/util/format/u_format.csv b/src/util/format/u_format.csv index c82eeac34d2..fca81104c29 100644 --- a/src/util/format/u_format.csv +++ b/src/util/format/u_format.csv @@ -406,6 +406,7 @@ PIPE_FORMAT_Y8_400_UNORM , other , 1, 1, 1, un8, , , , x0 # RGB version of NV12 and YV12 for hardware that supports sampling from # multiplane textures but needs color-space conversion in the shader. PIPE_FORMAT_R8_G8B8_420_UNORM , planar2, 1, 1, 1, un8, , , , xyzw, rgb +PIPE_FORMAT_R8_B8G8_420_UNORM , planar2, 1, 1, 1, un8, , , , xyzw, rgb PIPE_FORMAT_G8_B8R8_420_UNORM , planar2, 1, 1, 1, un8, , , , xyzw, rgb PIPE_FORMAT_R8_G8_B8_420_UNORM , planar3, 1, 1, 1, un8, , , , xyzw, rgb PIPE_FORMAT_R8_B8_G8_420_UNORM , planar3, 1, 1, 1, un8, , , , xyzw, rgb diff --git a/src/util/format/u_format_table.py b/src/util/format/u_format_table.py index 1cd66a98889..26b58ee21ec 100644 --- a/src/util/format/u_format_table.py +++ b/src/util/format/u_format_table.py @@ -113,6 +113,7 @@ def has_access(format): 'y16_u16v16_422_unorm', 'y16_u16_v16_444_unorm', 'r8_g8b8_420_unorm', + 'r8_b8g8_420_unorm', 'g8_b8r8_420_unorm', 'r8_g8_b8_420_unorm', 'r8_b8_g8_420_unorm', diff --git a/src/util/format/u_formats.h b/src/util/format/u_formats.h index f705d12adf7..22fb41433d9 100644 --- a/src/util/format/u_formats.h +++ b/src/util/format/u_formats.h @@ -511,6 +511,7 @@ enum pipe_format { PIPE_FORMAT_XYUV, PIPE_FORMAT_R8_G8B8_420_UNORM, + PIPE_FORMAT_R8_B8G8_420_UNORM, PIPE_FORMAT_G8_B8R8_420_UNORM, PIPE_FORMAT_R8_G8_B8_420_UNORM, PIPE_FORMAT_R8_B8_G8_420_UNORM,