[Mesa-dev] [PATCH] st/mesa: add missing ETC2 entries to format_map

Ilia Mirkin imirkin at alum.mit.edu
Tue Feb 16 20:50:12 UTC 2016


Sounds reasonable. The original patch is

Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Tue, Feb 16, 2016 at 3:46 PM, Rob Clark <robdclark at gmail.com> wrote:
> gave that a quick try.. and, well, I think that may just be the start
> of the rabbit-hole..
>
> 0xb69eb92c in __memcpy_neon () from /lib/libc.so.6
> (gdb) bt
> #0  0xb69eb92c in __memcpy_neon () from /lib/libc.so.6
> #1  0xb5ea63e0 in _mesa_store_compressed_texsubimage (ctx=0x2ff970,
> dims=2, texImage=0xb382ac50, xoffset=0, yoffset=0, zoffset=0,
> width=2048, height=2048, depth=1, format=37492,
>     imageSize=2097152, data=0xb3400000) at
> ../../../src/mesa/main/texstore.c:1364
> #2  0xb5f60320 in st_CompressedTexSubImage (ctx=0x2ff970, dims=2,
> texImage=0xb382ac50, x=0, y=0, z=0, w=2048, h=2048, d=1, format=37492,
> imageSize=2097152, data=0x0)
>     at ../../../src/mesa/state_tracker/st_cb_texture.c:2043
> #3  0xb5e8ece0 in _mesa_compressed_texture_sub_image (ctx=0x2ff970,
> dims=2, texObj=0xb382a9b0, texImage=0xb382ac50, target=3553, level=0,
> xoffset=0, yoffset=0, zoffset=0, width=2048,
>     height=2048, depth=1, format=37492, imageSize=2097152, data=0x0)
> at ../../../src/mesa/main/teximage.c:4388
> #4  0xb5e8f350 in _mesa_CompressedTexSubImage2D (target=3553, level=0,
> xoffset=0, yoffset=0, width=2048, height=2048, format=37492,
> imageSize=2097152, data=0x0)
>     at ../../../src/mesa/main/teximage.c:4509
> #5  0xb67cfadc in shared_dispatch_stub_412 (target=3553, level=0,
> xoffset=0, yoffset=0, width=2048, height=2048, format=37492,
> imageSize=2097152, data=0x0)
>     at ./shared-glapi/glapi_mapi_tmp.h:19098
>
> I'll think I'll skip the fallback format_map entries for now, since a
> debug build assert is less obnoxious than a segfault..
>
> BR,
> -R
>
>
> On Tue, Feb 16, 2016 at 12:14 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> Should be noted that, not at all due to this patch,
>> glTexStorage(ETC1/ETC2) is broken on gallium drivers that don't
>> implement those formats in HW (i.e. use the sw fallback). This patch
>> makes it work for drivers that *do* support it in HW, but more work
>> needed for the other drivers. Maybe we should just have the
>> PIPE_FORMAT_RGBA8 stuff right in there as fallback formats? [Would
>> need to do that for ETC1 as well.]
>>
>> On Tue, Feb 16, 2016 at 12:04 PM, Rob Clark <robdclark at gmail.com> wrote:
>>> From: Rob Clark <robclark at freedesktop.org>
>>>
>>> Noticed by Ilia when I was trying to figure out why some app was failing
>>> to use ETC2.
>>>
>>> Signed-off-by: Rob Clark <robclark at freedesktop.org>
>>> Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
>>> ---
>>>  src/mesa/state_tracker/st_format.c | 42 ++++++++++++++++++++++++++++++++++++++
>>>  1 file changed, 42 insertions(+)
>>>
>>> diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
>>> index 2b92bad..82bf3a1 100644
>>> --- a/src/mesa/state_tracker/st_format.c
>>> +++ b/src/mesa/state_tracker/st_format.c
>>> @@ -1484,6 +1484,48 @@ static const struct format_mapping format_map[] = {
>>>        { PIPE_FORMAT_ETC1_RGB8, 0 }
>>>     },
>>>
>>> +   /* ETC2 */
>>> +   {
>>> +      { GL_COMPRESSED_RGB8_ETC2, 0 },
>>> +      { PIPE_FORMAT_ETC2_RGB8, 0 }
>>> +   },
>>> +   {
>>> +      { GL_COMPRESSED_SRGB8_ETC2, 0 },
>>> +      { PIPE_FORMAT_ETC2_SRGB8, 0 }
>>> +   },
>>> +   {
>>> +      { GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 0 },
>>> +      { PIPE_FORMAT_ETC2_RGB8A1, 0 }
>>> +   },
>>> +   {
>>> +      { GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 0 },
>>> +      { PIPE_FORMAT_ETC2_SRGB8A1, 0 }
>>> +   },
>>> +   {
>>> +      { GL_COMPRESSED_RGBA8_ETC2_EAC, 0 },
>>> +      { PIPE_FORMAT_ETC2_RGBA8, 0 }
>>> +   },
>>> +   {
>>> +      { GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 0 },
>>> +      { PIPE_FORMAT_ETC2_SRGBA8, 0 }
>>> +   },
>>> +   {
>>> +      { GL_COMPRESSED_R11_EAC, 0 },
>>> +      { PIPE_FORMAT_ETC2_R11_UNORM, 0 }
>>> +   },
>>> +   {
>>> +      { GL_COMPRESSED_SIGNED_R11_EAC, 0 },
>>> +      { PIPE_FORMAT_ETC2_R11_SNORM, 0 }
>>> +   },
>>> +   {
>>> +      { GL_COMPRESSED_RG11_EAC, 0 },
>>> +      { PIPE_FORMAT_ETC2_RG11_UNORM, 0 }
>>> +   },
>>> +   {
>>> +      { GL_COMPRESSED_SIGNED_RG11_EAC, 0 },
>>> +      { PIPE_FORMAT_ETC2_RG11_SNORM, 0 }
>>> +   },
>>> +
>>>     /* BPTC */
>>>     {
>>>        { GL_COMPRESSED_RGBA_BPTC_UNORM, 0 },
>>> --
>>> 2.5.0
>>>


More information about the mesa-dev mailing list