[Mesa-dev] [PATCH] i965: Enable tiled mem_copy with sRGB-formatted resources

Anuj Phogat anuj.phogat at gmail.com
Sat Feb 13 00:47:11 UTC 2016


On Thu, Feb 11, 2016 at 5:29 PM, Nanley Chery <nanleychery at gmail.com> wrote:
> From: Nanley Chery <nanley.g.chery at intel.com>
>
> RGBA8 and BGRA8 unorm formats are compatible with the various
> mem_copy functions. Their sRGB counterparts are also compatible
> because they're also color-renderable (of importance when the
> specified resource is a readbuffer) and they share the same
> physical layout.
>
> Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> ---
>  src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> index 2383401..3135458 100644
> --- a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> +++ b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> @@ -757,7 +757,9 @@ bool intel_get_memcpy(mesa_format tiledFormat, GLenum format,
>        *cpp = 1;
>        *mem_copy = memcpy;
>     } else if ((tiledFormat == MESA_FORMAT_B8G8R8A8_UNORM) ||
> -              (tiledFormat == MESA_FORMAT_B8G8R8X8_UNORM)) {
> +              (tiledFormat == MESA_FORMAT_B8G8R8X8_UNORM) ||
> +              (tiledFormat == MESA_FORMAT_B8G8R8A8_SRGB) ||
> +              (tiledFormat == MESA_FORMAT_B8G8R8X8_SRGB)) {
>        *cpp = 4;
>        if (format == GL_BGRA) {
>           *mem_copy = memcpy;
> @@ -766,7 +768,9 @@ bool intel_get_memcpy(mesa_format tiledFormat, GLenum format,
>                                                 : rgba8_copy_aligned_src;
>        }
>     } else if ((tiledFormat == MESA_FORMAT_R8G8B8A8_UNORM) ||
> -              (tiledFormat == MESA_FORMAT_R8G8B8X8_UNORM)) {
> +              (tiledFormat == MESA_FORMAT_R8G8B8X8_UNORM) ||
> +              (tiledFormat == MESA_FORMAT_R8G8B8A8_SRGB) ||
> +              (tiledFormat == MESA_FORMAT_R8G8B8X8_SRGB)) {
>        *cpp = 4;
>        if (format == GL_BGRA) {
>           /* Copying from RGBA to BGRA is the same as BGRA to RGBA so we can
> --
> 2.7.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

We already allow memcpy for these format combinations on software
read/write paths. It makes sense to allow them here too.

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list