[Mesa-dev] [PATCH v2 2/4] Gallium: Add format PIPE_FORMAT_R8_SRGB

Roland Scheidegger sroland at vmware.com
Thu Nov 1 15:27:07 UTC 2018


Am 01.11.18 um 15:48 schrieb Gert Wollny:
> Am Dienstag, den 30.10.2018, 16:04 +0000 schrieb Roland Scheidegger:
>> With the format ordering in svga_format.c as Ilia mentioned fixed
>> Reviewed-by: Roland Scheidegger <sroland at vmware.com>
> 
> CMIIW, but I guess was that your R-b was only for this patch, right?
Right, I didn't have time to look at the others.

Roland


> 
> Best, 
> Gert 
> 
>>
>> Am 30.10.18 um 11:46 schrieb Gert Wollny:
>>> This format is needed to support EXT_texture_sRGB_R8. THe patch
>>> adds a new
>>> format enum, the format entries in Gallium and and svga, the
>>> mapping between
>>> sRGB and linear formats, and tests.
>>>
>>>   v2: - add mapping to linear format for PIPE_FORMATR_R8_SRGB
>>>   v3: - Add texture format to svga format table since otherwise
>>> building
>>>         mesa will fail when this driver is enabled. It was not
>>> tested
>>>         whether the extension actually works.
>>>   v4: - svga: remove the SVGA specific format definitions and table
>>> entries
>>>         and only add correct the location of PIPE_FORMAT_R8_SRGB in
>>> the
>>>         format_conversion_table (Ilia Mirkin)
>>>       - Split patch (1/2) to separate Gallium part and mesa/st
>>> part.
>>>         (Roland Scheidegger)
>>>       - Trim the commit message to only contain the relevant parts
>>> from the
>>>         split.
>>>
>>> Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
>>> ---
>>>  src/gallium/auxiliary/util/u_format.csv     | 1 +
>>>  src/gallium/auxiliary/util/u_format.h       | 4 ++++
>>>  src/gallium/auxiliary/util/u_format_tests.c | 4 ++++
>>>  src/gallium/drivers/svga/svga_format.c      | 1 +
>>>  src/gallium/include/pipe/p_format.h         | 2 ++
>>>  5 files changed, 12 insertions(+)
>>>
>>> diff --git a/src/gallium/auxiliary/util/u_format.csv
>>> b/src/gallium/auxiliary/util/u_format.csv
>>> index f9e4925f27..911ac07d32 100644
>>> --- a/src/gallium/auxiliary/util/u_format.csv
>>> +++ b/src/gallium/auxiliary/util/u_format.csv
>>> @@ -114,6 +114,7 @@ PIPE_FORMAT_I32_FLOAT             , plain, 1,
>>> 1, f32 ,     ,     ,     , xxxx, r
>>>  
>>>  # SRGB formats
>>>  PIPE_FORMAT_L8_SRGB               , plain, 1, 1, un8
>>> ,     ,     ,     , xxx1, srgb 
>>> +PIPE_FORMAT_R8_SRGB               , plain, 1, 1, un8
>>> ,     ,     ,     , x001, srgb
>>>  PIPE_FORMAT_L8A8_SRGB             , plain, 1, 1, un8 , un8
>>> ,     ,     , xxxy, srgb 
>>>  PIPE_FORMAT_R8G8B8_SRGB           , plain, 1, 1, un8 , un8 , un8
>>> ,     , xyz1, srgb 
>>>  PIPE_FORMAT_R8G8B8A8_SRGB         , plain, 1, 1, un8 , un8 , un8 ,
>>> un8 , xyzw, srgb 
>>> diff --git a/src/gallium/auxiliary/util/u_format.h
>>> b/src/gallium/auxiliary/util/u_format.h
>>> index e66849c16b..5bcfc1f115 100644
>>> --- a/src/gallium/auxiliary/util/u_format.h
>>> +++ b/src/gallium/auxiliary/util/u_format.h
>>> @@ -925,6 +925,8 @@ util_format_srgb(enum pipe_format format)
>>>     switch (format) {
>>>     case PIPE_FORMAT_L8_UNORM:
>>>        return PIPE_FORMAT_L8_SRGB;
>>> +   case PIPE_FORMAT_R8_UNORM:
>>> +      return PIPE_FORMAT_R8_SRGB;
>>>     case PIPE_FORMAT_L8A8_UNORM:
>>>        return PIPE_FORMAT_L8A8_SRGB;
>>>     case PIPE_FORMAT_R8G8B8_UNORM:
>>> @@ -1001,6 +1003,8 @@ util_format_linear(enum pipe_format format)
>>>     switch (format) {
>>>     case PIPE_FORMAT_L8_SRGB:
>>>        return PIPE_FORMAT_L8_UNORM;
>>> +   case PIPE_FORMAT_R8_SRGB:
>>> +      return PIPE_FORMAT_R8_UNORM;
>>>     case PIPE_FORMAT_L8A8_SRGB:
>>>        return PIPE_FORMAT_L8A8_UNORM;
>>>     case PIPE_FORMAT_R8G8B8_SRGB:
>>> diff --git a/src/gallium/auxiliary/util/u_format_tests.c
>>> b/src/gallium/auxiliary/util/u_format_tests.c
>>> index 9c9a5838d1..dee52533c1 100644
>>> --- a/src/gallium/auxiliary/util/u_format_tests.c
>>> +++ b/src/gallium/auxiliary/util/u_format_tests.c
>>> @@ -236,6 +236,10 @@ util_format_test_cases[] =
>>>     {PIPE_FORMAT_L8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xbc),
>>> UNPACKED_1x1(0.502886458033, 0.502886458033, 0.502886458033, 1.0)},
>>>     {PIPE_FORMAT_L8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xff),
>>> UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
>>>  
>>> +   {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0x00),
>>> UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
>>> +   {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xbc),
>>> UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
>>> +   {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xff),
>>> UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
>>> +
>>>     {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff),
>>> PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
>>>     {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff),
>>> PACKED_1x16(0x00bc), UNPACKED_1x1(0.502886458033, 0.502886458033,
>>> 0.502886458033, 0.0)},
>>>     {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff),
>>> PACKED_1x16(0x00ff), UNPACKED_1x1(1.0, 1.0, 1.0, 0.0)},
>>> diff --git a/src/gallium/drivers/svga/svga_format.c
>>> b/src/gallium/drivers/svga/svga_format.c
>>> index 9f6a618706..bf1bbca3e2 100644
>>> --- a/src/gallium/drivers/svga/svga_format.c
>>> +++ b/src/gallium/drivers/svga/svga_format.c
>>> @@ -154,6 +154,7 @@ static const struct vgpu10_format_entry
>>> format_conversion_table[] =
>>>     {
>>> PIPE_FORMAT_R16G16B16_FLOAT,       SVGA3D_R16G16B16A16_FLOAT,  SVGA
>>> 3D_FORMAT_INVALID,       SVGA3D_FORMAT_INVALID,       VF_W_TO_1 },
>>>     {
>>> PIPE_FORMAT_R16G16B16A16_FLOAT,    SVGA3D_R16G16B16A16_FLOAT,  SVGA
>>> 3D_R16G16B16A16_FLOAT,   SVGA3D_R16G16B16A16_FLOAT,   TF_GEN_MIPS
>>> },
>>>     {
>>> PIPE_FORMAT_L8_SRGB,               SVGA3D_FORMAT_INVALID,      SVGA
>>> 3D_FORMAT_INVALID,       SVGA3D_FORMAT_INVALID,       0 },
>>> +   {
>>> PIPE_FORMAT_R8_SRGB,               SVGA3D_FORMAT_INVALID,      SVGA
>>> 3D_FORMAT_INVALID,       SVGA3D_FORMAT_INVALID,       0 },
>>>     {
>>> PIPE_FORMAT_L8A8_SRGB,             SVGA3D_FORMAT_INVALID,      SVGA
>>> 3D_FORMAT_INVALID,       SVGA3D_FORMAT_INVALID,       0 },
>>>     {
>>> PIPE_FORMAT_R8G8B8_SRGB,           SVGA3D_FORMAT_INVALID,      SVGA
>>> 3D_FORMAT_INVALID,       SVGA3D_FORMAT_INVALID,       0 },
>>>     {
>>> PIPE_FORMAT_A8B8G8R8_SRGB,         SVGA3D_FORMAT_INVALID,      SVGA
>>> 3D_FORMAT_INVALID,       SVGA3D_FORMAT_INVALID,       0 },
>>> diff --git a/src/gallium/include/pipe/p_format.h
>>> b/src/gallium/include/pipe/p_format.h
>>> index 57399800fa..6fb91222f2 100644
>>> --- a/src/gallium/include/pipe/p_format.h
>>> +++ b/src/gallium/include/pipe/p_format.h
>>> @@ -396,6 +396,8 @@ enum pipe_format {
>>>     PIPE_FORMAT_X1B5G5R5_UNORM          = 310,
>>>     PIPE_FORMAT_A4B4G4R4_UNORM          = 311,
>>>  
>>> +   PIPE_FORMAT_R8_SRGB                 = 312,
>>> +
>>>     PIPE_FORMAT_COUNT
>>>  };
>>>  
>>>
>>
>>



More information about the mesa-dev mailing list