Re: [Mesa-dev] [PATCH v3 2/4] gallium/auxiliary: Add helper support for bptc format compress/decompress
Thank you, Marek. After small additional fixes and rebase up of your branch - bptc rgb_float also works. I have updated my merge request. On Tue, Sep 22, 2020 at 7:47 PM Marek Olšák wrote: > bptc-float-modes is fixed by: > https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6774 > > Marek > > On Tue, Sep 22, 2020 at 4:33 AM Denis Pauk wrote: > >> Hi Dave, >> >> Could you please check >> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6809/diffs ? >> >> It contains possible fixes for bptc rgba unorm. Bug is related to >> incorrect reuse current bit_offet reuse between iterations. >> >> Decompress rgb_float has left without fixes for now. >> >> On Sat, May 23, 2020 at 12:47 PM Denis Pauk wrote: >> >>> Hi Dave, >>> >>> I had tested code before only with bptc-modes and bptc-float-modes from >>> piglit. It was free time project, so no real tests. >>> >>> Code had reused implementation from intel classic driver if i correctly >>> remember. >>> >>> Maybe something wrong with pixel type conversion. I will check. >>> >>> On Sun, May 10, 2020 at 10:26 AM Dave Airlie wrote: >>> >>>> On Wed, 27 Jun 2018 at 06:36, Denis Pauk wrote: >>>> > >>>> > Reuse code shared with mesa/main/texcompress_bptc. >>>> > >>>> > v2: Use block decompress function >>>> > v3: Include static bptc code from texcompress_bptc_tmp.h >>>> > Suggested-by: Marek Olšák >>>> > >>>> > Signed-off-by: Denis Pauk >>>> > CC: Nicolai Hähnle >>>> > CC: Marek Olšák >>>> > CC: Gert Wollny >>>> > --- >>>> >>>> Hi Denis, >>>> >>>> not sure you are still around or interested in this code, but I've >>>> recently run Vulkan CTS over it and it fails some bc7 tests. >>>> >>>> It also fails a piglit test that I'm not sure is related or not yet. >>>> >>>> It only seems to be a corner case failure, like 6 or 7 pixels in the >>>> CTS cases, but I'm wondering if you have any insight or memory of >>>> where it might diverge. >>>> >>>> Dave. >>>> >>> >>> >>> -- >>> Best regards, >>> Denis. >>> >> >> >> -- >> Best regards, >> Denis. >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev >> > -- Best regards, Denis. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 2/4] gallium/auxiliary: Add helper support for bptc format compress/decompress
Hi Dave, Could you please check https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6809/diffs ? It contains possible fixes for bptc rgba unorm. Bug is related to incorrect reuse current bit_offet reuse between iterations. Decompress rgb_float has left without fixes for now. On Sat, May 23, 2020 at 12:47 PM Denis Pauk wrote: > Hi Dave, > > I had tested code before only with bptc-modes and bptc-float-modes from > piglit. It was free time project, so no real tests. > > Code had reused implementation from intel classic driver if i correctly > remember. > > Maybe something wrong with pixel type conversion. I will check. > > On Sun, May 10, 2020 at 10:26 AM Dave Airlie wrote: > >> On Wed, 27 Jun 2018 at 06:36, Denis Pauk wrote: >> > >> > Reuse code shared with mesa/main/texcompress_bptc. >> > >> > v2: Use block decompress function >> > v3: Include static bptc code from texcompress_bptc_tmp.h >> > Suggested-by: Marek Olšák >> > >> > Signed-off-by: Denis Pauk >> > CC: Nicolai Hähnle >> > CC: Marek Olšák >> > CC: Gert Wollny >> > --- >> >> Hi Denis, >> >> not sure you are still around or interested in this code, but I've >> recently run Vulkan CTS over it and it fails some bc7 tests. >> >> It also fails a piglit test that I'm not sure is related or not yet. >> >> It only seems to be a corner case failure, like 6 or 7 pixels in the >> CTS cases, but I'm wondering if you have any insight or memory of >> where it might diverge. >> >> Dave. >> > > > -- > Best regards, > Denis. > -- Best regards, Denis. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 2/4] gallium/auxiliary: Add helper support for bptc format compress/decompress
Hi Dave, I had tested code before only with bptc-modes and bptc-float-modes from piglit. It was free time project, so no real tests. Code had reused implementation from intel classic driver if i correctly remember. Maybe something wrong with pixel type conversion. I will check. On Sun, May 10, 2020 at 10:26 AM Dave Airlie wrote: > On Wed, 27 Jun 2018 at 06:36, Denis Pauk wrote: > > > > Reuse code shared with mesa/main/texcompress_bptc. > > > > v2: Use block decompress function > > v3: Include static bptc code from texcompress_bptc_tmp.h > > Suggested-by: Marek Olšák > > > > Signed-off-by: Denis Pauk > > CC: Nicolai Hähnle > > CC: Marek Olšák > > CC: Gert Wollny > > --- > > Hi Denis, > > not sure you are still around or interested in this code, but I've > recently run Vulkan CTS over it and it fails some bc7 tests. > > It also fails a piglit test that I'm not sure is related or not yet. > > It only seems to be a corner case failure, like 6 or 7 pixels in the > CTS cases, but I'm wondering if you have any insight or memory of > where it might diverge. > > Dave. > -- Best regards, Denis. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 2/2] docs/features: mark GL_ARB_texture_compression_bptc as done for llvmpipe, softpipe, swr
Signed-off-by: Denis Pauk CC: Marek Olšák CC: Rhys Perry CC: Bruce Cherniak CC: Matt Turner --- docs/features.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features.txt b/docs/features.txt index 9ccf803d47..ce6595320c 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -151,7 +151,7 @@ GL 4.1, GLSL 4.10 --- all DONE: i965/gen7+, nvc0, r600, radeonsi, virgl GL 4.2, GLSL 4.20 -- all DONE: i965/gen7+, nvc0, r600, radeonsi, virgl - GL_ARB_texture_compression_bptc DONE (freedreno, i965) + GL_ARB_texture_compression_bptc DONE (freedreno, i965, llvmpipe, softpipe, swr) GL_ARB_compressed_texture_pixel_storage DONE (all drivers) GL_ARB_shader_atomic_counters DONE (freedreno/a5xx, i965, softpipe) GL_ARB_texture_storageDONE (all drivers) -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 1/2] gallium/swr: Enable support bptc format.
Reuse Code from: f69bc797e1 gallium/auxiliary: Add helper support for bptc format compress/decompress Signed-off-by: Denis Pauk Reviewed-by: Bruce Cherniak CC: Marek Olšák CC: Tim Rowley --- src/gallium/drivers/swr/swr_screen.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index de9008ddf6..0dbdac6ec6 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -141,8 +141,7 @@ swr_is_format_supported(struct pipe_screen *_screen, return FALSE; } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { return FALSE; } -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] (no subject)
Hi! Could you please review changes? And could you also merge changes if it is ok. First patch is already reviewed by Bruce Cherniak and does not have any changes. Second patch contains updates for docs/features.txt for status bptc support. [PATCH v2 1/2] gallium/swr: Enable support bptc format. [PATCH v2 2/2] docs/features: mark GL_ARB_texture_compression_bptc as done ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] gallium/swr: Enable support bptc format.
Reuse Code from: f69bc797e1 gallium/auxiliary: Add helper support for bptc format compress/decompress Signed-off-by: Denis Pauk Reviewed-by: Bruce Cherniak CC: Marek Olšák CC: Tim Rowley --- src/gallium/drivers/swr/swr_screen.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index de9008ddf6..0dbdac6ec6 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -141,8 +141,7 @@ swr_is_format_supported(struct pipe_screen *_screen, return FALSE; } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { return FALSE; } -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] docs/features: mark GL_ARB_texture_compression_bptc as done for llvmpipe, softpipe, swr
Signed-off-by: Denis Pauk CC: Marek Olšák CC: Rhys Perry CC: Bruce Cherniak CC: Matt Turner --- docs/features.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features.txt b/docs/features.txt index 9ccf803d47..ce6595320c 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -151,7 +151,7 @@ GL 4.1, GLSL 4.10 --- all DONE: i965/gen7+, nvc0, r600, radeonsi, virgl GL 4.2, GLSL 4.20 -- all DONE: i965/gen7+, nvc0, r600, radeonsi, virgl - GL_ARB_texture_compression_bptc DONE (freedreno, i965) + GL_ARB_texture_compression_bptc DONE (freedreno, i965, llvmpipe, softpipe, swr) GL_ARB_compressed_texture_pixel_storage DONE (all drivers) GL_ARB_shader_atomic_counters DONE (freedreno/a5xx, i965, softpipe) GL_ARB_texture_storageDONE (all drivers) -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/swr: Enable support bptc format.
Hi, Could you please merge patch to master? On Wed, Aug 1, 2018 at 10:33 PM Denis Pauk wrote: > Hi Bruce, > > Thank you. Best wishes to Alok. > > Could someone also update docs/features.txt with bptc/astc support? Look > like we can mark bptc as done for all gallium software renders and astc_ldr > for all gallium drivers. > > > Best regards, > Denis. > > On Wed, Aug 1, 2018, 6:14 PM Cherniak, Bruce > wrote: > >> >> On Aug 1, 2018, at 8:10 AM, Denis Pauk wrote: >> >> Hi Marek, >> >> Could you merge this changes to master? Or someone else with push rights? >> >> Do mesa have some formal rule what amount of commits/contribution >> required for recieve "merge" rights? >> >> >> Hi Denis, >> >> We will push this for you on our next commit. Alok has just gotten >> married and is out on honeymoon, >> so it may be a little while. If Marek (or anyone else) would like to get >> to it sooner, that would be >> great. >> >> Thanks, >> Bruce >> >> >> On Sat, Jul 28, 2018 at 11:03 PM Denis Pauk wrote: >> >>> Hi Bruce, >>> >>> Thank you, could you please merge commits? (I don't have commit rights.) >>> >>> On Fri, Jul 27, 2018 at 11:02 PM Cherniak, Bruce < >>> bruce.chern...@intel.com> wrote: >>> >>>> Reviewed-by: Bruce Cherniak >>>> >>>> > On Jul 27, 2018, at 1:45 PM, Denis Pauk wrote: >>>> > >>>> > Reuse Code from: >>>> > f69bc797e1 gallium/auxiliary: Add helper support for bptc format >>>> compress/decompress >>>> > >>>> > Signed-off-by: Denis Pauk >>>> > CC: Marek Olšák >>>> > CC: Bruce Cherniak >>>> > CC: Tim Rowley >>>> > --- >>>> > src/gallium/drivers/swr/swr_screen.cpp | 3 +-- >>>> > 1 file changed, 1 insertion(+), 2 deletions(-) >>>> > >>>> > diff --git a/src/gallium/drivers/swr/swr_screen.cpp >>>> b/src/gallium/drivers/swr/swr_screen.cpp >>>> > index 65fa1bc50e..1cc01aa47d 100644 >>>> > --- a/src/gallium/drivers/swr/swr_screen.cpp >>>> > +++ b/src/gallium/drivers/swr/swr_screen.cpp >>>> > @@ -137,8 +137,7 @@ swr_is_format_supported(struct pipe_screen >>>> *_screen, >>>> > return FALSE; >>>> >} >>>> > >>>> > - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || >>>> > - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { >>>> > + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { >>>> > return FALSE; >>>> >} >>>> > >>>> > -- >>>> > 2.18.0 >>>> > >>>> >>>> >>> >>> -- >>> Best regards, >>> Denis. >>> >> >> >> -- >> Best regards, >> Denis. >> >> >> -- Best regards, Denis. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/swr: Enable support bptc format.
Hi Bruce, Thank you. Best wishes to Alok. Could someone also update docs/features.txt with bptc/astc support? Look like we can mark bptc as done for all gallium software renders and astc_ldr for all gallium drivers. Best regards, Denis. On Wed, Aug 1, 2018, 6:14 PM Cherniak, Bruce wrote: > > On Aug 1, 2018, at 8:10 AM, Denis Pauk wrote: > > Hi Marek, > > Could you merge this changes to master? Or someone else with push rights? > > Do mesa have some formal rule what amount of commits/contribution required > for recieve "merge" rights? > > > Hi Denis, > > We will push this for you on our next commit. Alok has just gotten > married and is out on honeymoon, > so it may be a little while. If Marek (or anyone else) would like to get > to it sooner, that would be > great. > > Thanks, > Bruce > > > On Sat, Jul 28, 2018 at 11:03 PM Denis Pauk wrote: > >> Hi Bruce, >> >> Thank you, could you please merge commits? (I don't have commit rights.) >> >> On Fri, Jul 27, 2018 at 11:02 PM Cherniak, Bruce < >> bruce.chern...@intel.com> wrote: >> >>> Reviewed-by: Bruce Cherniak >>> >>> > On Jul 27, 2018, at 1:45 PM, Denis Pauk wrote: >>> > >>> > Reuse Code from: >>> > f69bc797e1 gallium/auxiliary: Add helper support for bptc format >>> compress/decompress >>> > >>> > Signed-off-by: Denis Pauk >>> > CC: Marek Olšák >>> > CC: Bruce Cherniak >>> > CC: Tim Rowley >>> > --- >>> > src/gallium/drivers/swr/swr_screen.cpp | 3 +-- >>> > 1 file changed, 1 insertion(+), 2 deletions(-) >>> > >>> > diff --git a/src/gallium/drivers/swr/swr_screen.cpp >>> b/src/gallium/drivers/swr/swr_screen.cpp >>> > index 65fa1bc50e..1cc01aa47d 100644 >>> > --- a/src/gallium/drivers/swr/swr_screen.cpp >>> > +++ b/src/gallium/drivers/swr/swr_screen.cpp >>> > @@ -137,8 +137,7 @@ swr_is_format_supported(struct pipe_screen >>> *_screen, >>> > return FALSE; >>> >} >>> > >>> > - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || >>> > - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { >>> > + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { >>> > return FALSE; >>> >} >>> > >>> > -- >>> > 2.18.0 >>> > >>> >>> >> >> -- >> Best regards, >> Denis. >> > > > -- > Best regards, > Denis. > > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/swr: Enable support bptc format.
Hi Marek, Could you merge this changes to master? Or someone else with push rights? Do mesa have some formal rule what amount of commits/contribution required for recieve "merge" rights? On Sat, Jul 28, 2018 at 11:03 PM Denis Pauk wrote: > Hi Bruce, > > Thank you, could you please merge commits? (I don't have commit rights.) > > On Fri, Jul 27, 2018 at 11:02 PM Cherniak, Bruce > wrote: > >> Reviewed-by: Bruce Cherniak >> >> > On Jul 27, 2018, at 1:45 PM, Denis Pauk wrote: >> > >> > Reuse Code from: >> > f69bc797e1 gallium/auxiliary: Add helper support for bptc format >> compress/decompress >> > >> > Signed-off-by: Denis Pauk >> > CC: Marek Olšák >> > CC: Bruce Cherniak >> > CC: Tim Rowley >> > --- >> > src/gallium/drivers/swr/swr_screen.cpp | 3 +-- >> > 1 file changed, 1 insertion(+), 2 deletions(-) >> > >> > diff --git a/src/gallium/drivers/swr/swr_screen.cpp >> b/src/gallium/drivers/swr/swr_screen.cpp >> > index 65fa1bc50e..1cc01aa47d 100644 >> > --- a/src/gallium/drivers/swr/swr_screen.cpp >> > +++ b/src/gallium/drivers/swr/swr_screen.cpp >> > @@ -137,8 +137,7 @@ swr_is_format_supported(struct pipe_screen *_screen, >> > return FALSE; >> >} >> > >> > - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || >> > - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { >> > + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { >> > return FALSE; >> >} >> > >> > -- >> > 2.18.0 >> > >> >> > > -- > Best regards, > Denis. > -- Best regards, Denis. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/swr: Enable support bptc format.
Hi Bruce, Thank you, could you please merge commits? (I don't have commit rights.) On Fri, Jul 27, 2018 at 11:02 PM Cherniak, Bruce wrote: > Reviewed-by: Bruce Cherniak > > > On Jul 27, 2018, at 1:45 PM, Denis Pauk wrote: > > > > Reuse Code from: > > f69bc797e1 gallium/auxiliary: Add helper support for bptc format > compress/decompress > > > > Signed-off-by: Denis Pauk > > CC: Marek Olšák > > CC: Bruce Cherniak > > CC: Tim Rowley > > --- > > src/gallium/drivers/swr/swr_screen.cpp | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/src/gallium/drivers/swr/swr_screen.cpp > b/src/gallium/drivers/swr/swr_screen.cpp > > index 65fa1bc50e..1cc01aa47d 100644 > > --- a/src/gallium/drivers/swr/swr_screen.cpp > > +++ b/src/gallium/drivers/swr/swr_screen.cpp > > @@ -137,8 +137,7 @@ swr_is_format_supported(struct pipe_screen *_screen, > > return FALSE; > >} > > > > - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || > > - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { > > + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { > > return FALSE; > >} > > > > -- > > 2.18.0 > > > > -- Best regards, Denis. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gallium/swr: Enable support bptc format.
Reuse Code from: f69bc797e1 gallium/auxiliary: Add helper support for bptc format compress/decompress Signed-off-by: Denis Pauk CC: Marek Olšák CC: Bruce Cherniak CC: Tim Rowley --- src/gallium/drivers/swr/swr_screen.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index 65fa1bc50e..1cc01aa47d 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -137,8 +137,7 @@ swr_is_format_supported(struct pipe_screen *_screen, return FALSE; } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { return FALSE; } -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 4/4] gallium/llvmpipe: Enable support bptc format.
Thank you. Best regards, Denis. On Sun, Jul 1, 2018, 10:44 PM Marek Olšák wrote: > Pushed, thanks for the patches. > > Marek > > On Sun, Jul 1, 2018 at 2:25 AM, Denis Pauk wrote: > > HI Marek, > > > > Thank you, could you merge commits? > > > > I don't have commit rights. > > > > On Sat, Jun 30, 2018 at 12:29 AM Marek Olšák wrote: > >> > >> For the series: > >> > >> Reviewed-by: Marek Olšák > >> > >> Marek > >> > >> On Tue, Jun 26, 2018 at 4:30 PM, Denis Pauk > wrote: > >> > v2: none > >> > v3: none > >> > > >> > Signed-off-by: Denis Pauk > >> > CC: Marek Olšák > >> > CC: Rhys Perry > >> > CC: Matt Turner > >> > --- > >> > src/gallium/drivers/llvmpipe/lp_screen.c | 3 +-- > >> > src/gallium/drivers/llvmpipe/lp_test_format.c | 3 +-- > >> > 2 files changed, 2 insertions(+), 4 deletions(-) > >> > > >> > diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c > >> > b/src/gallium/drivers/llvmpipe/lp_screen.c > >> > index 28dbd9908f..9921a941d5 100644 > >> > --- a/src/gallium/drivers/llvmpipe/lp_screen.c > >> > +++ b/src/gallium/drivers/llvmpipe/lp_screen.c > >> > @@ -534,8 +534,7 @@ llvmpipe_is_format_supported( struct pipe_screen > >> > *_screen, > >> >} > >> > } > >> > > >> > - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || > >> > - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { > >> > + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { > >> >/* Software decoding is not hooked up. */ > >> >return FALSE; > >> > } > >> > diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c > >> > b/src/gallium/drivers/llvmpipe/lp_test_format.c > >> > index e9a6e01fdc..a8aa33d8ae 100644 > >> > --- a/src/gallium/drivers/llvmpipe/lp_test_format.c > >> > +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c > >> > @@ -388,8 +388,7 @@ test_all(unsigned verbose, FILE *fp) > >> >} > >> > > >> >/* missing fetch funcs */ > >> > - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || > >> > - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { > >> > + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { > >> > continue; > >> >} > >> > > >> > -- > >> > 2.18.0 > >> > > > > > > > > > -- > > Best regards, > > Denis. > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 4/4] gallium/llvmpipe: Enable support bptc format.
HI Marek, Thank you, could you merge commits? I don't have commit rights. On Sat, Jun 30, 2018 at 12:29 AM Marek Olšák wrote: > For the series: > > Reviewed-by: Marek Olšák > > Marek > > On Tue, Jun 26, 2018 at 4:30 PM, Denis Pauk wrote: > > v2: none > > v3: none > > > > Signed-off-by: Denis Pauk > > CC: Marek Olšák > > CC: Rhys Perry > > CC: Matt Turner > > --- > > src/gallium/drivers/llvmpipe/lp_screen.c | 3 +-- > > src/gallium/drivers/llvmpipe/lp_test_format.c | 3 +-- > > 2 files changed, 2 insertions(+), 4 deletions(-) > > > > diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c > b/src/gallium/drivers/llvmpipe/lp_screen.c > > index 28dbd9908f..9921a941d5 100644 > > --- a/src/gallium/drivers/llvmpipe/lp_screen.c > > +++ b/src/gallium/drivers/llvmpipe/lp_screen.c > > @@ -534,8 +534,7 @@ llvmpipe_is_format_supported( struct pipe_screen > *_screen, > >} > > } > > > > - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || > > - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { > > + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { > >/* Software decoding is not hooked up. */ > >return FALSE; > > } > > diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c > b/src/gallium/drivers/llvmpipe/lp_test_format.c > > index e9a6e01fdc..a8aa33d8ae 100644 > > --- a/src/gallium/drivers/llvmpipe/lp_test_format.c > > +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c > > @@ -388,8 +388,7 @@ test_all(unsigned verbose, FILE *fp) > >} > > > >/* missing fetch funcs */ > > - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || > > - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { > > + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { > > continue; > >} > > > > -- > > 2.18.0 > > > -- Best regards, Denis. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 0/4] Add support GL_ARB_texture_compression_bptc in llvmpipe and softpipe.
If someone can test I can also add support for bptc to swr tracker. (I have no access to Intel CPUs with avx* support.) Best regards, Denis. On Tue, Jun 26, 2018, 11:44 PM Denis Pauk wrote: > Sorry for mess, i forgot to send cover letter and used "git send-email -v3 > @~4 --in-reply-to="<20180623131928.4186-1-pauk.de...@gmail.com>"". > > That have broke logic in https://patchwork.freedesktop.org/series/45301/. > > All mails with "v3" prefix contains fully same patches. > > On Tue, Jun 26, 2018 at 11:31 PM Denis Pauk wrote: > >> This series add code for reuse in gallium bptc decode logic from >> mesa/main/texcompress_bptc.c. >> >> Checked on x86_64 by: >> * LIBGL_ALWAYS_SOFTWARE=true GALLIUM_DRIVER={llvmpipe,softpipe} >> * piglit/bin/bptc-float-modes >> * piglit/bin/bptc-modes >> * piglit/bin/compressedteximage GL_COMPRESSED_RGBA_BPTC_UNORM >> * piglit/bin/compressedteximage GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM >> * piglit/bin/compressedteximage GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT >> * piglit/bin/compressedteximage GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT >> >> v2: Added logic for decompress 4x4 as single block. >> v3: Move bptc decode code to texcompress_bptc_tmp.h >> Suggested-by: Marek Olšák >> >> Sorry, I have resent this patch series, previously sent without cover >> letter. >> >> Best regards, >> Denis. >> >> -- >> src/gallium/auxiliary/Makefile.sources|2 + >> src/gallium/auxiliary/meson.build |2 + >> src/gallium/auxiliary/util/u_format_bptc.c| 279 >> src/gallium/auxiliary/util/u_format_bptc.h| 122 ++ >> src/gallium/auxiliary/util/u_format_table.py |3 +- >> src/gallium/auxiliary/util/u_tile.c |1 + >> src/gallium/drivers/llvmpipe/lp_screen.c |3 +- >> src/gallium/drivers/llvmpipe/lp_test_format.c |3 +- >> src/gallium/drivers/softpipe/sp_screen.c |3 +- >> src/mesa/Makefile.sources |1 + >> src/mesa/main/texcompress_bptc.c | 1451 +--- >> src/mesa/main/texcompress_bptc_tmp.h | 1743 >> + >> 12 files changed, 2172 insertions(+), 1441 deletions(-) >> >> >> >> > > -- > Best regards, > Denis. > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 0/4] Add support GL_ARB_texture_compression_bptc in llvmpipe and softpipe.
Sorry for mess, i forgot to send cover letter and used "git send-email -v3 @~4 --in-reply-to="<20180623131928.4186-1-pauk.de...@gmail.com>"". That have broke logic in https://patchwork.freedesktop.org/series/45301/. All mails with "v3" prefix contains fully same patches. On Tue, Jun 26, 2018 at 11:31 PM Denis Pauk wrote: > This series add code for reuse in gallium bptc decode logic from > mesa/main/texcompress_bptc.c. > > Checked on x86_64 by: > * LIBGL_ALWAYS_SOFTWARE=true GALLIUM_DRIVER={llvmpipe,softpipe} > * piglit/bin/bptc-float-modes > * piglit/bin/bptc-modes > * piglit/bin/compressedteximage GL_COMPRESSED_RGBA_BPTC_UNORM > * piglit/bin/compressedteximage GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM > * piglit/bin/compressedteximage GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT > * piglit/bin/compressedteximage GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT > > v2: Added logic for decompress 4x4 as single block. > v3: Move bptc decode code to texcompress_bptc_tmp.h > Suggested-by: Marek Olšák > > Sorry, I have resent this patch series, previously sent without cover > letter. > > Best regards, > Denis. > > -- > src/gallium/auxiliary/Makefile.sources|2 + > src/gallium/auxiliary/meson.build |2 + > src/gallium/auxiliary/util/u_format_bptc.c| 279 > src/gallium/auxiliary/util/u_format_bptc.h| 122 ++ > src/gallium/auxiliary/util/u_format_table.py |3 +- > src/gallium/auxiliary/util/u_tile.c |1 + > src/gallium/drivers/llvmpipe/lp_screen.c |3 +- > src/gallium/drivers/llvmpipe/lp_test_format.c |3 +- > src/gallium/drivers/softpipe/sp_screen.c |3 +- > src/mesa/Makefile.sources |1 + > src/mesa/main/texcompress_bptc.c | 1451 +--- > src/mesa/main/texcompress_bptc_tmp.h | 1743 > + > 12 files changed, 2172 insertions(+), 1441 deletions(-) > > > > -- Best regards, Denis. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 4/4] gallium/llvmpipe: Enable support bptc format.
v2: none v3: none Signed-off-by: Denis Pauk CC: Marek Olšák CC: Rhys Perry CC: Matt Turner --- src/gallium/drivers/llvmpipe/lp_screen.c | 3 +-- src/gallium/drivers/llvmpipe/lp_test_format.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 28dbd9908f..9921a941d5 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -534,8 +534,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, } } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { /* Software decoding is not hooked up. */ return FALSE; } diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index e9a6e01fdc..a8aa33d8ae 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -388,8 +388,7 @@ test_all(unsigned verbose, FILE *fp) } /* missing fetch funcs */ - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { continue; } -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 3/4] gallium/softpipe: Enable support bptc format.
v2: none v3: none Signed-off-by: Denis Pauk CC: Marek Olšák CC: Rhys Perry --- src/gallium/drivers/softpipe/sp_screen.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 8fbcbc8bac..ed8f8d9112 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -441,8 +441,7 @@ softpipe_is_format_supported( struct pipe_screen *screen, return FALSE; } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { /* Software decoding is not hooked up. */ return FALSE; } -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 2/4] gallium/auxiliary: Add helper support for bptc format compress/decompress
Reuse code shared with mesa/main/texcompress_bptc. v2: Use block decompress function v3: Include static bptc code from texcompress_bptc_tmp.h Suggested-by: Marek Olšák Signed-off-by: Denis Pauk CC: Nicolai Hähnle CC: Marek Olšák CC: Gert Wollny --- src/gallium/auxiliary/Makefile.sources | 2 + src/gallium/auxiliary/meson.build| 2 + src/gallium/auxiliary/util/u_format_bptc.c | 279 +++ src/gallium/auxiliary/util/u_format_bptc.h | 122 src/gallium/auxiliary/util/u_format_table.py | 3 +- src/gallium/auxiliary/util/u_tile.c | 1 + 6 files changed, 408 insertions(+), 1 deletion(-) create mode 100644 src/gallium/auxiliary/util/u_format_bptc.c create mode 100644 src/gallium/auxiliary/util/u_format_bptc.h diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 066746f2d0..626cde123a 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -256,6 +256,8 @@ C_SOURCES := \ util/u_fifo.h \ util/u_format.c \ util/u_format.h \ + util/u_format_bptc.c \ + util/u_format_bptc.h \ util/u_format_etc.c \ util/u_format_etc.h \ util/u_format_latc.c \ diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index 1f7548142b..98542d7ef3 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -276,6 +276,8 @@ files_libgallium = files( 'util/u_fifo.h', 'util/u_format.c', 'util/u_format.h', + 'util/u_format_bptc.c', + 'util/u_format_bptc.h', 'util/u_format_etc.c', 'util/u_format_etc.h', 'util/u_format_latc.c', diff --git a/src/gallium/auxiliary/util/u_format_bptc.c b/src/gallium/auxiliary/util/u_format_bptc.c new file mode 100644 index 00..87ec4139e0 --- /dev/null +++ b/src/gallium/auxiliary/util/u_format_bptc.c @@ -0,0 +1,279 @@ +/** + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (c) 2008 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + **/ + +#include "u_math.h" +#include "u_format.h" +#include "u_format_bptc.h" +#include "util/format_srgb.h" + +#define BPTC_BLOCK_DECODE +#include "../../../mesa/main/texcompress_bptc_tmp.h" + +void +util_format_bptc_rgba_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + decompress_rgba_unorm(width, height, +src_row, src_stride, +dst_row, dst_stride); +} + +void +util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + compress_rgba_unorm(width, height, + src_row, src_stride, + dst_row, dst_stride); +} + +void +util_format_bptc_rgba_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + uint8_t *temp_block; + temp_block = malloc(width * height * 4 * sizeof(uint8_t)); + decompress_rgba_unorm(width, height, + src_row, src_stride, + temp_block, width * 4 * sizeof(uint8_t)); + util_format_read_4f(PIPE_FORMAT_R8G8B8A8_UNORM, + dst_row, dst_
[Mesa-dev] [PATCH v3 1/4] mesa: add header for share bptc decompress functions
Move shared bptc functions to texcompress_bptc_tmp.h: * fetch_rgba_unorm_from_block * fetch_rgb_float_from_block * compress_rgba_unorm * compress_rgb_float Create decompress functions: * decompress_rgba_unorm * decompress_rgb_float Functions will be reused in gallium/auxiliary code. v2: Add block decompress function v3: Move all shared code to header Suggested-by: Marek Olšák Signed-off-by: Denis Pauk CC: Marek Olšák --- src/mesa/Makefile.sources|1 + src/mesa/main/texcompress_bptc.c | 1451 + src/mesa/main/texcompress_bptc_tmp.h | 1743 ++ 3 files changed, 1761 insertions(+), 1434 deletions(-) create mode 100644 src/mesa/main/texcompress_bptc_tmp.h diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 00aba0a2f7..63f3734c32 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -216,6 +216,7 @@ MAIN_FILES = \ main/texcompress.c \ main/texcompress_bptc.c \ main/texcompress_bptc.h \ + main/texcompress_bptc_tmp.h \ main/texcompress_cpal.c \ main/texcompress_cpal.h \ main/texcompress_etc.c \ diff --git a/src/mesa/main/texcompress_bptc.c b/src/mesa/main/texcompress_bptc.c index fd37be97f3..46279f144f 100644 --- a/src/mesa/main/texcompress_bptc.c +++ b/src/mesa/main/texcompress_bptc.c @@ -29,632 +29,38 @@ #include #include "texcompress.h" #include "texcompress_bptc.h" -#include "util/format_srgb.h" -#include "util/half_float.h" +#include "texcompress_bptc_tmp.h" #include "texstore.h" -#include "macros.h" #include "image.h" #include "mtypes.h" -#define BLOCK_SIZE 4 -#define N_PARTITIONS 64 -#define BLOCK_BYTES 16 - -struct bptc_unorm_mode { - int n_subsets; - int n_partition_bits; - bool has_rotation_bits; - bool has_index_selection_bit; - int n_color_bits; - int n_alpha_bits; - bool has_endpoint_pbits; - bool has_shared_pbits; - int n_index_bits; - int n_secondary_index_bits; -}; - -struct bptc_float_bitfield { - int8_t endpoint; - uint8_t component; - uint8_t offset; - uint8_t n_bits; - bool reverse; -}; - -struct bptc_float_mode { - bool reserved; - bool transformed_endpoints; - int n_partition_bits; - int n_endpoint_bits; - int n_index_bits; - int n_delta_bits[3]; - struct bptc_float_bitfield bitfields[24]; -}; - -struct bit_writer { - uint8_t buf; - int pos; - uint8_t *dst; -}; - -static const struct bptc_unorm_mode -bptc_unorm_modes[] = { - /* 0 */ { 3, 4, false, false, 4, 0, true, false, 3, 0 }, - /* 1 */ { 2, 6, false, false, 6, 0, false, true, 3, 0 }, - /* 2 */ { 3, 6, false, false, 5, 0, false, false, 2, 0 }, - /* 3 */ { 2, 6, false, false, 7, 0, true, false, 2, 0 }, - /* 4 */ { 1, 0, true, true, 5, 6, false, false, 2, 3 }, - /* 5 */ { 1, 0, true, false, 7, 8, false, false, 2, 2 }, - /* 6 */ { 1, 0, false, false, 7, 7, true, false, 4, 0 }, - /* 7 */ { 2, 6, false, false, 5, 5, true, false, 2, 0 } -}; - -static const struct bptc_float_mode -bptc_float_modes[] = { - /* 00 */ - { false, true, 5, 10, 3, { 5, 5, 5 }, - { { 2, 1, 4, 1, false }, { 2, 2, 4, 1, false }, { 3, 2, 4, 1, false }, - { 0, 0, 0, 10, false }, { 0, 1, 0, 10, false }, { 0, 2, 0, 10, false }, - { 1, 0, 0, 5, false }, { 3, 1, 4, 1, false }, { 2, 1, 0, 4, false }, - { 1, 1, 0, 5, false }, { 3, 2, 0, 1, false }, { 3, 1, 0, 4, false }, - { 1, 2, 0, 5, false }, { 3, 2, 1, 1, false }, { 2, 2, 0, 4, false }, - { 2, 0, 0, 5, false }, { 3, 2, 2, 1, false }, { 3, 0, 0, 5, false }, - { 3, 2, 3, 1, false }, - { -1 } } - }, - /* 01 */ - { false, true, 5, 7, 3, { 6, 6, 6 }, - { { 2, 1, 5, 1, false }, { 3, 1, 4, 1, false }, { 3, 1, 5, 1, false }, - { 0, 0, 0, 7, false }, { 3, 2, 0, 1, false }, { 3, 2, 1, 1, false }, - { 2, 2, 4, 1, false }, { 0, 1, 0, 7, false }, { 2, 2, 5, 1, false }, - { 3, 2, 2, 1, false }, { 2, 1, 4, 1, false }, { 0, 2, 0, 7, false }, - { 3, 2, 3, 1, false }, { 3, 2, 5, 1, false }, { 3, 2, 4, 1, false }, - { 1, 0, 0, 6, false }, { 2, 1, 0, 4, false }, { 1, 1, 0, 6, false }, - { 3, 1, 0, 4, false }, { 1, 2, 0, 6, false }, { 2, 2, 0, 4, false }, - { 2, 0, 0, 6, false }, - { 3, 0, 0, 6, false }, - { -1 } } - }, - /* 00010 */ - { false, true, 5, 11, 3, { 5, 4, 4 }, - { { 0, 0, 0, 10, false }, { 0, 1, 0, 10, false }, { 0, 2, 0, 10, false }, - { 1, 0, 0, 5, false }, { 0, 0, 10, 1, false }, { 2, 1, 0, 4, false }, - { 1, 1, 0, 4, false }, { 0, 1, 10, 1, false }, { 3, 2, 0, 1, false }, - { 3, 1, 0, 4, false }, { 1, 2, 0, 4, false }, { 0, 2, 10, 1, false }, - { 3, 2, 1, 1, false }, { 2, 2, 0, 4, false }, { 2, 0, 0, 5, false }, - { 3, 2, 2, 1, false }, { 3, 0, 0, 5, false }, { 3, 2, 3, 1, false }, - { -1 } } - }, - /* 00011 */ - { false, false
[Mesa-dev] [PATCH v3 0/4] Add support GL_ARB_texture_compression_bptc in llvmpipe and softpipe.
This series add code for reuse in gallium bptc decode logic from mesa/main/texcompress_bptc.c. Checked on x86_64 by: * LIBGL_ALWAYS_SOFTWARE=true GALLIUM_DRIVER={llvmpipe,softpipe} * piglit/bin/bptc-float-modes * piglit/bin/bptc-modes * piglit/bin/compressedteximage GL_COMPRESSED_RGBA_BPTC_UNORM * piglit/bin/compressedteximage GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM * piglit/bin/compressedteximage GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT * piglit/bin/compressedteximage GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT v2: Added logic for decompress 4x4 as single block. v3: Move bptc decode code to texcompress_bptc_tmp.h Suggested-by: Marek Olšák Sorry, I have resent this patch series, previously sent without cover letter. Best regards, Denis. -- src/gallium/auxiliary/Makefile.sources|2 + src/gallium/auxiliary/meson.build |2 + src/gallium/auxiliary/util/u_format_bptc.c| 279 src/gallium/auxiliary/util/u_format_bptc.h| 122 ++ src/gallium/auxiliary/util/u_format_table.py |3 +- src/gallium/auxiliary/util/u_tile.c |1 + src/gallium/drivers/llvmpipe/lp_screen.c |3 +- src/gallium/drivers/llvmpipe/lp_test_format.c |3 +- src/gallium/drivers/softpipe/sp_screen.c |3 +- src/mesa/Makefile.sources |1 + src/mesa/main/texcompress_bptc.c | 1451 +--- src/mesa/main/texcompress_bptc_tmp.h | 1743 + 12 files changed, 2172 insertions(+), 1441 deletions(-) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 2/4] gallium/auxiliary: Add helper support for bptc format compress/decompress
Reuse code shared with mesa/main/texcompress_bptc. v2: Use block decompress function v3: Include static bptc code from texcompress_bptc_tmp.h Suggested-by: Marek Olšák Signed-off-by: Denis Pauk CC: Nicolai Hähnle CC: Marek Olšák CC: Gert Wollny --- src/gallium/auxiliary/Makefile.sources | 2 + src/gallium/auxiliary/meson.build| 2 + src/gallium/auxiliary/util/u_format_bptc.c | 279 +++ src/gallium/auxiliary/util/u_format_bptc.h | 122 src/gallium/auxiliary/util/u_format_table.py | 3 +- src/gallium/auxiliary/util/u_tile.c | 1 + 6 files changed, 408 insertions(+), 1 deletion(-) create mode 100644 src/gallium/auxiliary/util/u_format_bptc.c create mode 100644 src/gallium/auxiliary/util/u_format_bptc.h diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 066746f2d0..626cde123a 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -256,6 +256,8 @@ C_SOURCES := \ util/u_fifo.h \ util/u_format.c \ util/u_format.h \ + util/u_format_bptc.c \ + util/u_format_bptc.h \ util/u_format_etc.c \ util/u_format_etc.h \ util/u_format_latc.c \ diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index 1f7548142b..98542d7ef3 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -276,6 +276,8 @@ files_libgallium = files( 'util/u_fifo.h', 'util/u_format.c', 'util/u_format.h', + 'util/u_format_bptc.c', + 'util/u_format_bptc.h', 'util/u_format_etc.c', 'util/u_format_etc.h', 'util/u_format_latc.c', diff --git a/src/gallium/auxiliary/util/u_format_bptc.c b/src/gallium/auxiliary/util/u_format_bptc.c new file mode 100644 index 00..87ec4139e0 --- /dev/null +++ b/src/gallium/auxiliary/util/u_format_bptc.c @@ -0,0 +1,279 @@ +/** + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (c) 2008 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + **/ + +#include "u_math.h" +#include "u_format.h" +#include "u_format_bptc.h" +#include "util/format_srgb.h" + +#define BPTC_BLOCK_DECODE +#include "../../../mesa/main/texcompress_bptc_tmp.h" + +void +util_format_bptc_rgba_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + decompress_rgba_unorm(width, height, +src_row, src_stride, +dst_row, dst_stride); +} + +void +util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + compress_rgba_unorm(width, height, + src_row, src_stride, + dst_row, dst_stride); +} + +void +util_format_bptc_rgba_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + uint8_t *temp_block; + temp_block = malloc(width * height * 4 * sizeof(uint8_t)); + decompress_rgba_unorm(width, height, + src_row, src_stride, + temp_block, width * 4 * sizeof(uint8_t)); + util_format_read_4f(PIPE_FORMAT_R8G8B8A8_UNORM, + dst_row, dst_
[Mesa-dev] [PATCH v3 4/4] gallium/llvmpipe: Enable support bptc format.
v2: none v3: none Signed-off-by: Denis Pauk CC: Marek Olšák CC: Rhys Perry CC: Matt Turner --- src/gallium/drivers/llvmpipe/lp_screen.c | 3 +-- src/gallium/drivers/llvmpipe/lp_test_format.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 28dbd9908f..9921a941d5 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -534,8 +534,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, } } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { /* Software decoding is not hooked up. */ return FALSE; } diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index e9a6e01fdc..a8aa33d8ae 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -388,8 +388,7 @@ test_all(unsigned verbose, FILE *fp) } /* missing fetch funcs */ - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { continue; } -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 3/4] gallium/softpipe: Enable support bptc format.
v2: none v3: none Signed-off-by: Denis Pauk CC: Marek Olšák CC: Rhys Perry --- src/gallium/drivers/softpipe/sp_screen.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 8fbcbc8bac..ed8f8d9112 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -441,8 +441,7 @@ softpipe_is_format_supported( struct pipe_screen *screen, return FALSE; } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { /* Software decoding is not hooked up. */ return FALSE; } -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 1/4] mesa: add header for share bptc decompress functions
Move shared bptc functions to texcompress_bptc_tmp.h: * fetch_rgba_unorm_from_block * fetch_rgb_float_from_block * compress_rgba_unorm * compress_rgb_float Create decompress functions: * decompress_rgba_unorm * decompress_rgb_float Functions will be reused in gallium/auxiliary code. v2: Add block decompress function v3: Move all shared code to header Suggested-by: Marek Olšák Signed-off-by: Denis Pauk CC: Marek Olšák --- src/mesa/Makefile.sources|1 + src/mesa/main/texcompress_bptc.c | 1451 + src/mesa/main/texcompress_bptc_tmp.h | 1743 ++ 3 files changed, 1761 insertions(+), 1434 deletions(-) create mode 100644 src/mesa/main/texcompress_bptc_tmp.h diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 00aba0a2f7..63f3734c32 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -216,6 +216,7 @@ MAIN_FILES = \ main/texcompress.c \ main/texcompress_bptc.c \ main/texcompress_bptc.h \ + main/texcompress_bptc_tmp.h \ main/texcompress_cpal.c \ main/texcompress_cpal.h \ main/texcompress_etc.c \ diff --git a/src/mesa/main/texcompress_bptc.c b/src/mesa/main/texcompress_bptc.c index fd37be97f3..46279f144f 100644 --- a/src/mesa/main/texcompress_bptc.c +++ b/src/mesa/main/texcompress_bptc.c @@ -29,632 +29,38 @@ #include #include "texcompress.h" #include "texcompress_bptc.h" -#include "util/format_srgb.h" -#include "util/half_float.h" +#include "texcompress_bptc_tmp.h" #include "texstore.h" -#include "macros.h" #include "image.h" #include "mtypes.h" -#define BLOCK_SIZE 4 -#define N_PARTITIONS 64 -#define BLOCK_BYTES 16 - -struct bptc_unorm_mode { - int n_subsets; - int n_partition_bits; - bool has_rotation_bits; - bool has_index_selection_bit; - int n_color_bits; - int n_alpha_bits; - bool has_endpoint_pbits; - bool has_shared_pbits; - int n_index_bits; - int n_secondary_index_bits; -}; - -struct bptc_float_bitfield { - int8_t endpoint; - uint8_t component; - uint8_t offset; - uint8_t n_bits; - bool reverse; -}; - -struct bptc_float_mode { - bool reserved; - bool transformed_endpoints; - int n_partition_bits; - int n_endpoint_bits; - int n_index_bits; - int n_delta_bits[3]; - struct bptc_float_bitfield bitfields[24]; -}; - -struct bit_writer { - uint8_t buf; - int pos; - uint8_t *dst; -}; - -static const struct bptc_unorm_mode -bptc_unorm_modes[] = { - /* 0 */ { 3, 4, false, false, 4, 0, true, false, 3, 0 }, - /* 1 */ { 2, 6, false, false, 6, 0, false, true, 3, 0 }, - /* 2 */ { 3, 6, false, false, 5, 0, false, false, 2, 0 }, - /* 3 */ { 2, 6, false, false, 7, 0, true, false, 2, 0 }, - /* 4 */ { 1, 0, true, true, 5, 6, false, false, 2, 3 }, - /* 5 */ { 1, 0, true, false, 7, 8, false, false, 2, 2 }, - /* 6 */ { 1, 0, false, false, 7, 7, true, false, 4, 0 }, - /* 7 */ { 2, 6, false, false, 5, 5, true, false, 2, 0 } -}; - -static const struct bptc_float_mode -bptc_float_modes[] = { - /* 00 */ - { false, true, 5, 10, 3, { 5, 5, 5 }, - { { 2, 1, 4, 1, false }, { 2, 2, 4, 1, false }, { 3, 2, 4, 1, false }, - { 0, 0, 0, 10, false }, { 0, 1, 0, 10, false }, { 0, 2, 0, 10, false }, - { 1, 0, 0, 5, false }, { 3, 1, 4, 1, false }, { 2, 1, 0, 4, false }, - { 1, 1, 0, 5, false }, { 3, 2, 0, 1, false }, { 3, 1, 0, 4, false }, - { 1, 2, 0, 5, false }, { 3, 2, 1, 1, false }, { 2, 2, 0, 4, false }, - { 2, 0, 0, 5, false }, { 3, 2, 2, 1, false }, { 3, 0, 0, 5, false }, - { 3, 2, 3, 1, false }, - { -1 } } - }, - /* 01 */ - { false, true, 5, 7, 3, { 6, 6, 6 }, - { { 2, 1, 5, 1, false }, { 3, 1, 4, 1, false }, { 3, 1, 5, 1, false }, - { 0, 0, 0, 7, false }, { 3, 2, 0, 1, false }, { 3, 2, 1, 1, false }, - { 2, 2, 4, 1, false }, { 0, 1, 0, 7, false }, { 2, 2, 5, 1, false }, - { 3, 2, 2, 1, false }, { 2, 1, 4, 1, false }, { 0, 2, 0, 7, false }, - { 3, 2, 3, 1, false }, { 3, 2, 5, 1, false }, { 3, 2, 4, 1, false }, - { 1, 0, 0, 6, false }, { 2, 1, 0, 4, false }, { 1, 1, 0, 6, false }, - { 3, 1, 0, 4, false }, { 1, 2, 0, 6, false }, { 2, 2, 0, 4, false }, - { 2, 0, 0, 6, false }, - { 3, 0, 0, 6, false }, - { -1 } } - }, - /* 00010 */ - { false, true, 5, 11, 3, { 5, 4, 4 }, - { { 0, 0, 0, 10, false }, { 0, 1, 0, 10, false }, { 0, 2, 0, 10, false }, - { 1, 0, 0, 5, false }, { 0, 0, 10, 1, false }, { 2, 1, 0, 4, false }, - { 1, 1, 0, 4, false }, { 0, 1, 10, 1, false }, { 3, 2, 0, 1, false }, - { 3, 1, 0, 4, false }, { 1, 2, 0, 4, false }, { 0, 2, 10, 1, false }, - { 3, 2, 1, 1, false }, { 2, 2, 0, 4, false }, { 2, 0, 0, 5, false }, - { 3, 2, 2, 1, false }, { 3, 0, 0, 5, false }, { 3, 2, 3, 1, false }, - { -1 } } - }, - /* 00011 */ - { false, false
Re: [Mesa-dev] [PATCH v2 1/4] mesa: add header for share bptc decompress functions
Hi! Thank you. I will move all shared code to texcompress_bptc_tmp.h, and send new patch series. On Mon, Jun 25, 2018 at 7:47 PM Marek Olšák wrote: > This looks OK, but did you try to build other gallium state trackers? > They don't link with anything in src/mesa, so the build will fail, > because the bptc functions are missing. The solution used for other > formats was to put all functions into header files, see > texcompress_*_tmp.h. Another solution would be to move the functions > to src/util, which is shared by all Mesa components. > > Also, all the function names (like compress_rgb_float) are too > generic. All non-static non-inline function names are global and > shouldn't conflict with anything else in Mesa, so they need to be more > unique. It's generally a good idea to make public inline function > names look unique to minimize name conflicts. > > Marek > > > > On Sat, Jun 23, 2018 at 9:19 AM, Denis Pauk wrote: > > Make functions public: > > * fetch_rgba_unorm_from_block > > * fetch_rgb_float_from_block > > * compress_rgba_unorm > > * compress_rgb_float > > > > Create decompress functions: > > * decompress_rgba_unorm > > * decompress_rgb_float > > > > Functions will be reused in gallium/auxiliary code. > > > > v2: Add block decompress function > > > > Signed-off-by: Denis Pauk > > CC: Marek Olšák > > --- > > src/mesa/Makefile.sources | 1 + > > src/mesa/main/texcompress_bptc.c | 303 - > > src/mesa/main/texcompress_bptc_share.h | 58 + > > 3 files changed, 358 insertions(+), 4 deletions(-) > > create mode 100644 src/mesa/main/texcompress_bptc_share.h > > > > diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources > > index 00aba0a2f7..d644112e6a 100644 > > --- a/src/mesa/Makefile.sources > > +++ b/src/mesa/Makefile.sources > > @@ -216,6 +216,7 @@ MAIN_FILES = \ > > main/texcompress.c \ > > main/texcompress_bptc.c \ > > main/texcompress_bptc.h \ > > + main/texcompress_bptc_share.h \ > > main/texcompress_cpal.c \ > > main/texcompress_cpal.h \ > > main/texcompress_etc.c \ > > diff --git a/src/mesa/main/texcompress_bptc.c > b/src/mesa/main/texcompress_bptc.c > > index fd37be97f3..74828d63db 100644 > > --- a/src/mesa/main/texcompress_bptc.c > > +++ b/src/mesa/main/texcompress_bptc.c > > @@ -29,6 +29,7 @@ > > #include > > #include "texcompress.h" > > #include "texcompress_bptc.h" > > +#include "texcompress_bptc_share.h" > > #include "util/format_srgb.h" > > #include "util/half_float.h" > > #include "texstore.h" > > @@ -535,7 +536,7 @@ apply_rotation(int rotation, > > result[3] = t; > > } > > > > -static void > > +void > > fetch_rgba_unorm_from_block(const uint8_t *block, > > uint8_t *result, > > int texel) > > @@ -657,6 +658,173 @@ fetch_rgba_unorm_from_block(const uint8_t *block, > > apply_rotation(rotation, result); > > } > > > > +static void > > +decompress_rgba_unorm_block(int src_width, int src_height, > > +const uint8_t *block, > > +uint8_t *dst_row, int dst_rowstride) > > +{ > > + int mode_num = ffs(block[0]); > > + const struct bptc_unorm_mode *mode; > > + int bit_offset, secondary_bit_offset; > > + int partition_num; > > + int subset_num; > > + int rotation; > > + int index_selection; > > + int index_bits; > > + int indices[2]; > > + int index; > > + int anchors_before_texel; > > + bool anchor; > > + uint8_t endpoints[3 * 2][4]; > > + uint32_t subsets; > > + int component; > > + unsigned x, y; > > + > > + if (mode_num == 0) { > > + /* According to the spec this mode is reserved and shouldn't be > used. */ > > + for(y = 0; y < src_height; y += 1) { > > + uint8_t *result = dst_row; > > + memset(result, 0, 4 * src_width); > > + for(x = 0; x < src_width; x += 1) { > > +result[3] = 0xff; > > +result += 4; > > + } > > + dst_row += dst_rowstride; > > + } > > + return; > > + } > > + > > + mode = bptc_unorm_modes + mode_num - 1; > > + bit_offset = mode_num; > > + > > + partition_num = extract_bits(block, bi
[Mesa-dev] [PATCH v2 2/4] gallium/auxiliary: Add helper support for bptc format compress/decompress
Reuse code shared with mesa/main/texcompress_bptc. v2: Use block decompress function Signed-off-by: Denis Pauk CC: Nicolai Hähnle CC: Marek Olšák CC: Gert Wollny --- src/gallium/auxiliary/Makefile.sources | 2 + src/gallium/auxiliary/meson.build| 2 + src/gallium/auxiliary/util/u_format_bptc.c | 277 +++ src/gallium/auxiliary/util/u_format_bptc.h | 122 src/gallium/auxiliary/util/u_format_table.py | 3 +- src/gallium/auxiliary/util/u_tile.c | 1 + 6 files changed, 406 insertions(+), 1 deletion(-) create mode 100644 src/gallium/auxiliary/util/u_format_bptc.c create mode 100644 src/gallium/auxiliary/util/u_format_bptc.h diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 066746f2d0..626cde123a 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -256,6 +256,8 @@ C_SOURCES := \ util/u_fifo.h \ util/u_format.c \ util/u_format.h \ + util/u_format_bptc.c \ + util/u_format_bptc.h \ util/u_format_etc.c \ util/u_format_etc.h \ util/u_format_latc.c \ diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index 1f7548142b..98542d7ef3 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -276,6 +276,8 @@ files_libgallium = files( 'util/u_fifo.h', 'util/u_format.c', 'util/u_format.h', + 'util/u_format_bptc.c', + 'util/u_format_bptc.h', 'util/u_format_etc.c', 'util/u_format_etc.h', 'util/u_format_latc.c', diff --git a/src/gallium/auxiliary/util/u_format_bptc.c b/src/gallium/auxiliary/util/u_format_bptc.c new file mode 100644 index 00..44cfcb24e4 --- /dev/null +++ b/src/gallium/auxiliary/util/u_format_bptc.c @@ -0,0 +1,277 @@ +/** + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (c) 2008 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + **/ + +#include "u_math.h" +#include "u_format.h" +#include "u_format_bptc.h" +#include "util/format_srgb.h" +#include "../../../mesa/main/texcompress_bptc_share.h" + +void +util_format_bptc_rgba_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + decompress_rgba_unorm(width, height, +src_row, src_stride, +dst_row, dst_stride); +} + +void +util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + compress_rgba_unorm(width, height, + src_row, src_stride, + dst_row, dst_stride); +} + +void +util_format_bptc_rgba_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + uint8_t *temp_block; + temp_block = malloc(width * height * 4 * sizeof(uint8_t)); + decompress_rgba_unorm(width, height, + src_row, src_stride, + temp_block, width * 4 * sizeof(uint8_t)); + util_format_read_4f(PIPE_FORMAT_R8G8B8A8_UNORM, + dst_row, dst_stride, + temp_block, width * 4 * sizeof(uint8_t), + 0, 0, width, height); + free((void *
[Mesa-dev] [PATCH v2 4/4] gallium/llvmpipe: Enable support bptc format.
v2: none Signed-off-by: Denis Pauk CC: Marek Olšák CC: Rhys Perry CC: Matt Turner --- src/gallium/drivers/llvmpipe/lp_screen.c | 3 +-- src/gallium/drivers/llvmpipe/lp_test_format.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 28dbd9908f..9921a941d5 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -534,8 +534,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, } } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { /* Software decoding is not hooked up. */ return FALSE; } diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index e9a6e01fdc..a8aa33d8ae 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -388,8 +388,7 @@ test_all(unsigned verbose, FILE *fp) } /* missing fetch funcs */ - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { continue; } -- 2.17.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 1/4] mesa: add header for share bptc decompress functions
Make functions public: * fetch_rgba_unorm_from_block * fetch_rgb_float_from_block * compress_rgba_unorm * compress_rgb_float Create decompress functions: * decompress_rgba_unorm * decompress_rgb_float Functions will be reused in gallium/auxiliary code. v2: Add block decompress function Signed-off-by: Denis Pauk CC: Marek Olšák --- src/mesa/Makefile.sources | 1 + src/mesa/main/texcompress_bptc.c | 303 - src/mesa/main/texcompress_bptc_share.h | 58 + 3 files changed, 358 insertions(+), 4 deletions(-) create mode 100644 src/mesa/main/texcompress_bptc_share.h diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 00aba0a2f7..d644112e6a 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -216,6 +216,7 @@ MAIN_FILES = \ main/texcompress.c \ main/texcompress_bptc.c \ main/texcompress_bptc.h \ + main/texcompress_bptc_share.h \ main/texcompress_cpal.c \ main/texcompress_cpal.h \ main/texcompress_etc.c \ diff --git a/src/mesa/main/texcompress_bptc.c b/src/mesa/main/texcompress_bptc.c index fd37be97f3..74828d63db 100644 --- a/src/mesa/main/texcompress_bptc.c +++ b/src/mesa/main/texcompress_bptc.c @@ -29,6 +29,7 @@ #include #include "texcompress.h" #include "texcompress_bptc.h" +#include "texcompress_bptc_share.h" #include "util/format_srgb.h" #include "util/half_float.h" #include "texstore.h" @@ -535,7 +536,7 @@ apply_rotation(int rotation, result[3] = t; } -static void +void fetch_rgba_unorm_from_block(const uint8_t *block, uint8_t *result, int texel) @@ -657,6 +658,173 @@ fetch_rgba_unorm_from_block(const uint8_t *block, apply_rotation(rotation, result); } +static void +decompress_rgba_unorm_block(int src_width, int src_height, +const uint8_t *block, +uint8_t *dst_row, int dst_rowstride) +{ + int mode_num = ffs(block[0]); + const struct bptc_unorm_mode *mode; + int bit_offset, secondary_bit_offset; + int partition_num; + int subset_num; + int rotation; + int index_selection; + int index_bits; + int indices[2]; + int index; + int anchors_before_texel; + bool anchor; + uint8_t endpoints[3 * 2][4]; + uint32_t subsets; + int component; + unsigned x, y; + + if (mode_num == 0) { + /* According to the spec this mode is reserved and shouldn't be used. */ + for(y = 0; y < src_height; y += 1) { + uint8_t *result = dst_row; + memset(result, 0, 4 * src_width); + for(x = 0; x < src_width; x += 1) { +result[3] = 0xff; +result += 4; + } + dst_row += dst_rowstride; + } + return; + } + + mode = bptc_unorm_modes + mode_num - 1; + bit_offset = mode_num; + + partition_num = extract_bits(block, bit_offset, mode->n_partition_bits); + bit_offset += mode->n_partition_bits; + + switch (mode->n_subsets) { + case 1: + subsets = 0; + break; + case 2: + subsets = partition_table1[partition_num]; + break; + case 3: + subsets = partition_table2[partition_num]; + break; + default: + assert(false); + return; + } + + if (mode->has_rotation_bits) { + rotation = extract_bits(block, bit_offset, 2); + bit_offset += 2; + } else { + rotation = 0; + } + + if (mode->has_index_selection_bit) { + index_selection = extract_bits(block, bit_offset, 1); + bit_offset++; + } else { + index_selection = 0; + } + + bit_offset = extract_unorm_endpoints(mode, block, bit_offset, endpoints); + + for(y = 0; y < src_height; y += 1) { + uint8_t *result = dst_row; + for(x = 0; x < src_width; x += 1) { + int texel; + texel = x + y * 4; + + anchors_before_texel = count_anchors_before_texel(mode->n_subsets, + partition_num, + texel); + + /* Calculate the offset to the secondary index */ + secondary_bit_offset = (bit_offset + + BLOCK_SIZE * BLOCK_SIZE * mode->n_index_bits - + mode->n_subsets + + mode->n_secondary_index_bits * texel - + anchors_before_texel); + + /* Calculate the offset to the primary index for this texel */ + bit_offset += mode->n_index_bits * texel - anchors_before_texel; + + subset_num = (subsets >> (texel * 2)) & 3; + + anchor = is_anchor(mode->n_subsets, partition_num, texel); + + index_bits = mode->n_index_bits; + if (anchor) +index_bits--; + indices[0] = extra
[Mesa-dev] [PATCH v2 3/4] gallium/softpipe: Enable support bptc format.
v2: none Signed-off-by: Denis Pauk CC: Marek Olšák CC: Rhys Perry --- src/gallium/drivers/softpipe/sp_screen.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 8fbcbc8bac..ed8f8d9112 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -441,8 +441,7 @@ softpipe_is_format_supported( struct pipe_screen *screen, return FALSE; } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { /* Software decoding is not hooked up. */ return FALSE; } -- 2.17.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 0/4] Add support GL_ARB_texture_compression_bptc in llvmpipe and softpipe.
This series add code for reuse in gallium bptc decode logic from mesa/main/texcompress_bptc.c. Checked on x86_64 by: * LIBGL_ALWAYS_SOFTWARE=true GALLIUM_DRIVER={llvmpipe,softpipe} * piglit/bin/bptc-float-modes * piglit/bin/bptc-modes * piglit/bin/compressedteximage GL_COMPRESSED_RGBA_BPTC_UNORM * piglit/bin/compressedteximage GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM * piglit/bin/compressedteximage GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT * piglit/bin/compressedteximage GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT Could you please review? v2: Added logic for decompress 4x4 as single block. Best regards, Denis. --- src/gallium/auxiliary/Makefile.sources| 2 + src/gallium/auxiliary/meson.build | 2 + src/gallium/auxiliary/util/u_format_bptc.c| 277 +++ src/gallium/auxiliary/util/u_format_bptc.h| 122 +++ src/gallium/auxiliary/util/u_format_table.py | 3 +- src/gallium/auxiliary/util/u_tile.c | 1 + src/gallium/drivers/llvmpipe/lp_screen.c | 3 +- src/gallium/drivers/llvmpipe/lp_test_format.c | 3 +- src/gallium/drivers/softpipe/sp_screen.c | 3 +- src/mesa/Makefile.sources | 1 + src/mesa/main/texcompress_bptc.c | 303 +- src/mesa/main/texcompress_bptc_share.h| 58 + 12 files changed, 767 insertions(+), 11 deletions(-) --- [PATCH v2 1/4] mesa: add header for share bptc decompress functions [PATCH v2 2/4] gallium/auxiliary: Add helper support for bptc format [PATCH v2 3/4] gallium/softpipe: Enable support bptc format. [PATCH v2 4/4] gallium/llvmpipe: Enable support bptc format. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4] gallium/softpipe: Enable support bptc format.
--- src/gallium/drivers/softpipe/sp_screen.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index f9c916d938..676cd0812a 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -440,8 +440,7 @@ softpipe_is_format_supported( struct pipe_screen *screen, return FALSE; } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { /* Software decoding is not hooked up. */ return FALSE; } -- 2.17.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4] gallium/llvmpipe: Enable support bptc format.
--- src/gallium/drivers/llvmpipe/lp_screen.c | 3 +-- src/gallium/drivers/llvmpipe/lp_test_format.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index f12ad09298..c1a2fd3379 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -533,8 +533,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, } } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { /* Software decoding is not hooked up. */ return FALSE; } diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index e9a6e01fdc..a8aa33d8ae 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -388,8 +388,7 @@ test_all(unsigned verbose, FILE *fp) } /* missing fetch funcs */ - if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC || - format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { + if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { continue; } -- 2.17.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4] gallium/auxiliary: Add helper support for bptc format compress/decompress
Reuse code shared with mesa/main/texcompress_bptc. --- src/gallium/auxiliary/Makefile.sources | 2 + src/gallium/auxiliary/meson.build| 2 + src/gallium/auxiliary/util/u_format_bptc.c | 322 +++ src/gallium/auxiliary/util/u_format_bptc.h | 122 +++ src/gallium/auxiliary/util/u_format_table.py | 3 +- src/gallium/auxiliary/util/u_tile.c | 1 + 6 files changed, 451 insertions(+), 1 deletion(-) create mode 100644 src/gallium/auxiliary/util/u_format_bptc.c create mode 100644 src/gallium/auxiliary/util/u_format_bptc.h diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 066746f2d0..626cde123a 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -256,6 +256,8 @@ C_SOURCES := \ util/u_fifo.h \ util/u_format.c \ util/u_format.h \ + util/u_format_bptc.c \ + util/u_format_bptc.h \ util/u_format_etc.c \ util/u_format_etc.h \ util/u_format_latc.c \ diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index 92cfb8f7af..31b75c7207 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -276,6 +276,8 @@ files_libgallium = files( 'util/u_fifo.h', 'util/u_format.c', 'util/u_format.h', + 'util/u_format_bptc.c', + 'util/u_format_bptc.h', 'util/u_format_etc.c', 'util/u_format_etc.h', 'util/u_format_latc.c', diff --git a/src/gallium/auxiliary/util/u_format_bptc.c b/src/gallium/auxiliary/util/u_format_bptc.c new file mode 100644 index 00..d968f766a4 --- /dev/null +++ b/src/gallium/auxiliary/util/u_format_bptc.c @@ -0,0 +1,322 @@ +/** + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (c) 2008 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + **/ + +#include "u_math.h" +#include "u_format.h" +#include "u_format_bptc.h" +#include "util/format_srgb.h" +#include "../../../mesa/main/texcompress_bptc_share.h" +#include + +static void +rgb_float_unpack_rgba_float_with_sign(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height, bool is_signed) +{ + unsigned x, y; + + for(y = 0; y < height; y += 1) { + float *dst = dst_row; + const uint8_t *src = src_row; + + for(x = 0; x < width; x += 1) { + const uint8_t *block; + block = src + (x / 4) * 16; + fetch_rgb_float_from_block(block, dst, (x % 4) + (y % 4) * 4, is_signed); + dst += 4; + } + if (y % 4 == 3) { + src_row += src_stride; + } + dst_row += dst_stride / sizeof(*dst_row); + } +} + +static void +rgba_unorm_unpack_rgba_int8(uint8_t *dst_row, unsigned dst_stride, +const uint8_t *src_row, unsigned src_stride, +unsigned width, unsigned height) +{ + unsigned x, y; + + for(y = 0; y < height; y += 1) { + uint8_t *dst = dst_row; + const uint8_t *src = src_row; + + for(x = 0; x < width; x += 1) { + const uint8_t *block; + block = src + (x / 4) * 16; + fetch_rgba_unorm_from_block(block, dst, (x % 4) + (y % 4) * 4); + dst += 4; + } + if (y % 4 == 3) { + src_row += src_stride; + } + dst_row += (dst_stride * 1)/sizeof(*dst_row); + } +} + +void +util_format_bptc_rgba_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ +
[Mesa-dev] Add support GL_ARB_texture_compression_bptc in llvmpipe and softpipe.
Add code for reuse bptc decode logic from mesa/main/texcompress_bptc.c by make several function public(nonstatic) and define functions in texcompress_bptc_share.h. I have made minimal changes in code without possible performance improvements. And code decodes image by pixels instead possible decode full 4x4 block. Compress code works by compess full image at once (reuse compress function from texcompress_bptc). Checked on x86_64 by: * LIBGL_ALWAYS_SOFTWARE=true GALLIUM_DRIVER={llvmpipe,softpipe} * piglit/bin/bptc-float-modes * piglit/bin/bptc-modes * piglit/bin/compressedteximage GL_COMPRESSED_RGBA_BPTC_UNORM * piglit/bin/compressedteximage GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM * piglit/bin/compressedteximage GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT * piglit/bin/compressedteximage GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT Could you please review? Best regards, Denis. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] mesa: add header for share bptc decompress functions
Make functions public: * fetch_rgba_unorm_from_block * fetch_rgb_float_from_block * compress_rgba_unorm * compress_rgb_float Functions will be reused in gallium/auxiliary code. --- src/mesa/Makefile.sources | 1 + src/mesa/main/texcompress_bptc.c | 9 ++--- src/mesa/main/texcompress_bptc_share.h | 47 ++ 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 src/mesa/main/texcompress_bptc_share.h diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 00aba0a2f7..d644112e6a 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -216,6 +216,7 @@ MAIN_FILES = \ main/texcompress.c \ main/texcompress_bptc.c \ main/texcompress_bptc.h \ + main/texcompress_bptc_share.h \ main/texcompress_cpal.c \ main/texcompress_cpal.h \ main/texcompress_etc.c \ diff --git a/src/mesa/main/texcompress_bptc.c b/src/mesa/main/texcompress_bptc.c index fd37be97f3..6cfd9aece7 100644 --- a/src/mesa/main/texcompress_bptc.c +++ b/src/mesa/main/texcompress_bptc.c @@ -29,6 +29,7 @@ #include #include "texcompress.h" #include "texcompress_bptc.h" +#include "texcompress_bptc_share.h" #include "util/format_srgb.h" #include "util/half_float.h" #include "texstore.h" @@ -535,7 +536,7 @@ apply_rotation(int rotation, result[3] = t; } -static void +void fetch_rgba_unorm_from_block(const uint8_t *block, uint8_t *result, int texel) @@ -840,7 +841,7 @@ finish_signed_unquantize(int32_t value) return value * 31 / 32; } -static void +void fetch_rgb_float_from_block(const uint8_t *block, float *result, int texel, @@ -1247,7 +1248,7 @@ compress_rgba_unorm_block(int src_width, int src_height, endpoints); } -static void +void compress_rgba_unorm(int width, int height, const uint8_t *src, int src_rowstride, uint8_t *dst, int dst_rowstride) @@ -1555,7 +1556,7 @@ compress_rgb_float_block(int src_width, int src_height, endpoints); } -static void +void compress_rgb_float(int width, int height, const float *src, int src_rowstride, uint8_t *dst, int dst_rowstride, diff --git a/src/mesa/main/texcompress_bptc_share.h b/src/mesa/main/texcompress_bptc_share.h new file mode 100644 index 00..bf885ef038 --- /dev/null +++ b/src/mesa/main/texcompress_bptc_share.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef TEXCOMPRESS_BPTC_SHARE_H +#define TEXCOMPRESS_BPTC_SHARE_H + +void +fetch_rgba_unorm_from_block(const uint8_t *block, +uint8_t *result, +int texel); +void +fetch_rgb_float_from_block(const uint8_t *block, + float *result, + int texel, + bool is_signed); + +void +compress_rgb_float(int width, int height, + const float *src, int src_rowstride, + uint8_t *dst, int dst_rowstride, + bool is_signed); + +void +compress_rgba_unorm(int width, int height, +const uint8_t *src, int src_rowstride, +uint8_t *dst, int dst_rowstride); +#endif -- 2.17.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/{r600, radeonsi}: Fix segfault with color format (v2)
Hi! As for me, patch is too minor and be in future 18.+ release is enough, As i know application can't cause segfault by public API by this path(only by private api). On Tue, Nov 28, 2017 at 4:48 PM, Marek Olšákwrote: > On Tue, Nov 28, 2017 at 3:46 PM, Emil Velikov > wrote: > > On 28 November 2017 at 13:44, Andres Gomez wrote: > >> Denis, this looks like a good candidate to nominate for inclusion in > >> the 17.2 stable queue. > >> > >> What do you think? > >> > > Patch seems safe, but it's a bit meh since it says "segfault" without > > specifying any usecase. > > IIRC the only example is a "This only example of code, that we can use > > for check is_format_supported call. Its not real world code." > > > > If anyone can weight for/against that'll be appreciated. > > The patch is safe to apply to stable. > > Marek > -- Best regards, Denis. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/{r600, radeonsi}: Fix segfault with color format (v2)
Thank you. I have closed https://bugs.freedesktop.org/show_bug.cgi?id=102552 Best regards, Denis. On Sep 14, 2017 2:01 AM, "Marek Olšák" <mar...@gmail.com> wrote: > I pushed the patch. Thanks. > > Marek > > On Wed, Sep 13, 2017 at 9:27 PM, Denis Pauk <pauk.de...@gmail.com> wrote: > > Could you please commit this changes? > > > > I have not found what i need to do next after recieve "approve" for > changes > > in https://www.mesa3d.org/submittingpatches.html#reviewing. > > Do i need to send new mail with "Reviewed-by: " mark? > > > > On Wed, Sep 13, 2017 at 6:36 PM, Marek Olšák <mar...@gmail.com> wrote: > >> > >> I've changed my mind. The patch is OK: > >> > >> Reviewed-by: Marek Olšák <marek.ol...@amd.com> > >> > >> Marek > >> > >> On Wed, Sep 13, 2017 at 4:45 PM, Denis Pauk <pauk.de...@gmail.com> > wrote: > >> > What do you think about replace all checks in patch to asserts? > >> > > >> > > >> > Best regards, > >> > Denis. > >> > > >> > On Sep 13, 2017 1:00 PM, "Marek Olšák" <mar...@gmail.com> wrote: > >> >> > >> >> On Wed, Sep 13, 2017 at 6:54 AM, Денис Паук <pauk.de...@gmail.com> > >> >> wrote: > >> >> > Do you mean delete check in u_format.c:: util_format_is_supported? > >> >> > Could > >> >> > you > >> >> > please explain more? > >> >> > >> >> I mean delete everything. Invalid formats shouldn't be passed to > >> >> pipe_screen::is_format_supported. The code doing it needs to be > fixed. > >> >> > >> >> Marek > > > > > > > > > > -- > > Best regards, > > Denis. > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/{r600, radeonsi}: Fix segfault with color format (v2)
Could you please commit this changes? I have not found what i need to do next after recieve "approve" for changes in https://www.mesa3d.org/submittingpatches.html#reviewing. Do i need to send new mail with "Reviewed-by: " mark? On Wed, Sep 13, 2017 at 6:36 PM, Marek Olšák <mar...@gmail.com> wrote: > I've changed my mind. The patch is OK: > > Reviewed-by: Marek Olšák <marek.ol...@amd.com> > > Marek > > On Wed, Sep 13, 2017 at 4:45 PM, Denis Pauk <pauk.de...@gmail.com> wrote: > > What do you think about replace all checks in patch to asserts? > > > > > > Best regards, > > Denis. > > > > On Sep 13, 2017 1:00 PM, "Marek Olšák" <mar...@gmail.com> wrote: > >> > >> On Wed, Sep 13, 2017 at 6:54 AM, Денис Паук <pauk.de...@gmail.com> > wrote: > >> > Do you mean delete check in u_format.c:: util_format_is_supported? > Could > >> > you > >> > please explain more? > >> > >> I mean delete everything. Invalid formats shouldn't be passed to > >> pipe_screen::is_format_supported. The code doing it needs to be fixed. > >> > >> Marek > -- Best regards, Denis. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/{r600, radeonsi}: Fix segfault with color format (v2)
What do you think about replace all checks in patch to asserts? Best regards, Denis. On Sep 13, 2017 1:00 PM, "Marek Olšák"wrote: > On Wed, Sep 13, 2017 at 6:54 AM, Денис Паук wrote: > > Do you mean delete check in u_format.c:: util_format_is_supported? Could > you > > please explain more? > > I mean delete everything. Invalid formats shouldn't be passed to > pipe_screen::is_format_supported. The code doing it needs to be fixed. > > Marek > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/{r600, radeonsi}: Fix segfault with color format (v2)
This only example of code, that we can use for check is_format_supported call. Its not real world code. Best regards, Denis. On Sep 13, 2017 11:15 AM, "Nicolai Hähnle" <nhaeh...@gmail.com> wrote: > On 13.09.2017 08:26, Denis Pauk wrote: > >> Little additional note: >> >> This checks related to possible issue with such kind of supported format >> check in external code: >> >> >> for(int i=0; i> pscreen->is_format_supported(pscreen, i, PIPE_TEXTURE_2D, 0, >> PIPE_BIND_SAMPLER_VIEW); >> } >> - >> >> When we have segfault with: 73, 78, 79, 80, 81, >> >> 86 (holes in enum pipe_format) and format value >> >> bigger than PIPE_FORMAT_COUNT. >> > > Arguably, that code should call util_format_description() and skip the > format is the result is NULL. > > And why on earth is that code looping until PIPE_FORMAT_COUNT + 10 in the > first place? That never makes sense. > > Cheers, > Nicolai > > > >> >> >> Best regards, >>Denis. >> >> On Sep 13, 2017 7:54 AM, "Денис Паук" <pauk.de...@gmail.com > pauk.de...@gmail.com>> wrote: >> >> Do you mean delete check in u_format.c:: util_format_is_supported? >> Could you please explain more? >> >> On Wed, Sep 13, 2017 at 1:32 AM, Marek Olšák <mar...@gmail.com >> <mailto:mar...@gmail.com>> wrote: >> >> On Wed, Sep 13, 2017 at 12:31 AM, Marek Olšák <mar...@gmail.com >> <mailto:mar...@gmail.com>> wrote: >> > I think we shouldn't be getting PIPE_FORMAT_COUNT in >> > is_format_supported in the first place, and therefore drivers >> don't >> > have to work around it. >> >> Or any other invalid formats, for that matter. >> >> Marek >> >> > >> > Marek >> > >> > On Tue, Sep 12, 2017 at 10:38 PM, Denis Pauk >> <pauk.de...@gmail.com <mailto:pauk.de...@gmail.com>> wrote: >> >> Bugzilla: >> https://bugs.freedesktop.org/show_bug.cgi?id=102552 >> <https://bugs.freedesktop.org/show_bug.cgi?id=102552> >> >> >> >> v2: Patch cleanup proposed by Nicolai Hähnle. >> >> * deleted changes in si_translate_texformat. >> >> >> >> Cc: Nicolai Hähnle <nhaeh...@gmail.com >> <mailto:nhaeh...@gmail.com>> >> >> Cc: Ilia Mirkin <imir...@alum.mit.edu >> <mailto:imir...@alum.mit.edu>> >> >> --- >> >> src/gallium/auxiliary/util/u_format.c| 4 >> >> src/gallium/drivers/r600/r600_state_common.c | 4 >> >> src/gallium/drivers/radeonsi/si_state.c | 10 +- >> >> 3 files changed, 17 insertions(+), 1 deletion(-) >> >> >> >> diff --git a/src/gallium/auxiliary/util/u_format.c >> b/src/gallium/auxiliary/util/u_format.c >> >> index 3d281905ce..a6d42a428d 100644 >> >> --- a/src/gallium/auxiliary/util/u_format.c >> >> +++ b/src/gallium/auxiliary/util/u_format.c >> >> @@ -238,6 +238,10 @@ util_format_is_subsampled_422(enum >> pipe_format format) >> >> boolean >> >> util_format_is_supported(enum pipe_format format, unsigned >> bind) >> >> { >> >> + if (format >= PIPE_FORMAT_COUNT) { >> >> + return FALSE; >> >> + } >> >> + >> >> if (util_format_is_s3tc(format) && >> !util_format_s3tc_enabled) { >> >>return FALSE; >> >> } >> >> diff --git a/src/gallium/drivers/r600/r600_state_common.c >> b/src/gallium/drivers/r600/r600_state_common.c >> >> index c1bce8304b..1515c28091 100644 >> >> --- a/src/gallium/drivers/r600/r600_state_common.c >> >> +++ b/src/gallium/drivers/r600/r600_state_common.c >> >> @@ -2284,6 +2284,8 @@ uint32_t >> r600_translate_texformat(struct pipe_screen *screen, >> >> format = PIPE_FORMAT_A4R4_UNORM; >> >> >> >> desc = util_for
Re: [Mesa-dev] [PATCH] gallium/{r600, radeonsi}: Fix segfault with color format (v2)
Little additional note: This checks related to possible issue with such kind of supported format check in external code: for(int i=0; iis_format_supported(pscreen, i, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW); } - When we have segfault with: 73, 78, 79, 80, 81, 86 (holes in enum pipe_format) and format value bigger than PIPE_FORMAT_COUNT. Best regards, Denis. On Sep 13, 2017 7:54 AM, "Денис Паук" <pauk.de...@gmail.com> wrote: > Do you mean delete check in u_format.c:: util_format_is_supported? Could > you please explain more? > > On Wed, Sep 13, 2017 at 1:32 AM, Marek Olšák <mar...@gmail.com> wrote: > >> On Wed, Sep 13, 2017 at 12:31 AM, Marek Olšák <mar...@gmail.com> wrote: >> > I think we shouldn't be getting PIPE_FORMAT_COUNT in >> > is_format_supported in the first place, and therefore drivers don't >> > have to work around it. >> >> Or any other invalid formats, for that matter. >> >> Marek >> >> > >> > Marek >> > >> > On Tue, Sep 12, 2017 at 10:38 PM, Denis Pauk <pauk.de...@gmail.com> >> wrote: >> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102552 >> >> >> >> v2: Patch cleanup proposed by Nicolai Hähnle. >> >> * deleted changes in si_translate_texformat. >> >> >> >> Cc: Nicolai Hähnle <nhaeh...@gmail.com> >> >> Cc: Ilia Mirkin <imir...@alum.mit.edu> >> >> --- >> >> src/gallium/auxiliary/util/u_format.c| 4 >> >> src/gallium/drivers/r600/r600_state_common.c | 4 >> >> src/gallium/drivers/radeonsi/si_state.c | 10 +- >> >> 3 files changed, 17 insertions(+), 1 deletion(-) >> >> >> >> diff --git a/src/gallium/auxiliary/util/u_format.c >> b/src/gallium/auxiliary/util/u_format.c >> >> index 3d281905ce..a6d42a428d 100644 >> >> --- a/src/gallium/auxiliary/util/u_format.c >> >> +++ b/src/gallium/auxiliary/util/u_format.c >> >> @@ -238,6 +238,10 @@ util_format_is_subsampled_422(enum pipe_format >> format) >> >> boolean >> >> util_format_is_supported(enum pipe_format format, unsigned bind) >> >> { >> >> + if (format >= PIPE_FORMAT_COUNT) { >> >> + return FALSE; >> >> + } >> >> + >> >> if (util_format_is_s3tc(format) && !util_format_s3tc_enabled) { >> >>return FALSE; >> >> } >> >> diff --git a/src/gallium/drivers/r600/r600_state_common.c >> b/src/gallium/drivers/r600/r600_state_common.c >> >> index c1bce8304b..1515c28091 100644 >> >> --- a/src/gallium/drivers/r600/r600_state_common.c >> >> +++ b/src/gallium/drivers/r600/r600_state_common.c >> >> @@ -2284,6 +2284,8 @@ uint32_t r600_translate_texformat(struct >> pipe_screen *screen, >> >> format = PIPE_FORMAT_A4R4_UNORM; >> >> >> >> desc = util_format_description(format); >> >> + if (!desc) >> >> + goto out_unknown; >> >> >> >> /* Depth and stencil swizzling is handled separately. */ >> >> if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) { >> >> @@ -2650,6 +2652,8 @@ uint32_t r600_translate_colorformat(enum >> chip_class chip, enum pipe_format forma >> >> const struct util_format_description *desc = >> util_format_description(format); >> >> int channel = util_format_get_first_non_void_channel(format); >> >> bool is_float; >> >> + if (!desc) >> >> + return ~0U; >> >> >> >> #define HAS_SIZE(x,y,z,w) \ >> >> (desc->channel[0].size == (x) && desc->channel[1].size == (y) >> && \ >> >> diff --git a/src/gallium/drivers/radeonsi/si_state.c >> b/src/gallium/drivers/radeonsi/si_state.c >> >> index ee070107fd..f7ee24bdc6 100644 >> >> --- a/src/gallium/drivers/radeonsi/si_state.c >> >> +++ b/src/gallium/drivers/radeonsi/si_state.c >> >> @@ -1292,6 +1292,8 @@ static void si_emit_db_render_state(struct >> si_context *sctx, struct r600_atom *s >> >> static uint32_t si_translate_colorformat(enum pipe_format format) >> >> { >> >> const struct util_format_description *desc = >> util_format_description(format); >> >> + if (!desc) >> >> + return V_028C
[Mesa-dev] [PATCH] gallium/{r600, radeonsi}: Fix segfault with color format (v2)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102552 v2: Patch cleanup proposed by Nicolai Hähnle. * deleted changes in si_translate_texformat. Cc: Nicolai HähnleCc: Ilia Mirkin --- src/gallium/auxiliary/util/u_format.c| 4 src/gallium/drivers/r600/r600_state_common.c | 4 src/gallium/drivers/radeonsi/si_state.c | 10 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index 3d281905ce..a6d42a428d 100644 --- a/src/gallium/auxiliary/util/u_format.c +++ b/src/gallium/auxiliary/util/u_format.c @@ -238,6 +238,10 @@ util_format_is_subsampled_422(enum pipe_format format) boolean util_format_is_supported(enum pipe_format format, unsigned bind) { + if (format >= PIPE_FORMAT_COUNT) { + return FALSE; + } + if (util_format_is_s3tc(format) && !util_format_s3tc_enabled) { return FALSE; } diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index c1bce8304b..1515c28091 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -2284,6 +2284,8 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen, format = PIPE_FORMAT_A4R4_UNORM; desc = util_format_description(format); + if (!desc) + goto out_unknown; /* Depth and stencil swizzling is handled separately. */ if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) { @@ -2650,6 +2652,8 @@ uint32_t r600_translate_colorformat(enum chip_class chip, enum pipe_format forma const struct util_format_description *desc = util_format_description(format); int channel = util_format_get_first_non_void_channel(format); bool is_float; + if (!desc) + return ~0U; #define HAS_SIZE(x,y,z,w) \ (desc->channel[0].size == (x) && desc->channel[1].size == (y) && \ diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index ee070107fd..f7ee24bdc6 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -1292,6 +1292,8 @@ static void si_emit_db_render_state(struct si_context *sctx, struct r600_atom *s static uint32_t si_translate_colorformat(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); + if (!desc) + return V_028C70_COLOR_INVALID; #define HAS_SIZE(x,y,z,w) \ (desc->channel[0].size == (x) && desc->channel[1].size == (y) && \ @@ -1796,7 +1798,11 @@ static unsigned si_tex_dim(struct si_screen *sscreen, struct r600_texture *rtex, static bool si_is_sampler_format_supported(struct pipe_screen *screen, enum pipe_format format) { - return si_translate_texformat(screen, format, util_format_description(format), + struct util_format_description *desc = util_format_description(format); + if (!desc) + return false; + + return si_translate_texformat(screen, format, desc, util_format_get_first_non_void_channel(format)) != ~0U; } @@ -1925,6 +1931,8 @@ static unsigned si_is_vertex_format_supported(struct pipe_screen *screen, PIPE_BIND_VERTEX_BUFFER)) == 0); desc = util_format_description(format); + if (!desc) + return 0; /* There are no native 8_8_8 or 16_16_16 data formats, and we currently * select 8_8_8_8 and 16_16_16_16 instead. This works reasonably well -- 2.14.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gallium/{r600, radeonsi}: Fix segfault with color format
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102552 --- src/gallium/auxiliary/util/u_format.c| 4 src/gallium/drivers/r600/r600_state_common.c | 4 src/gallium/drivers/radeonsi/si_state.c | 13 - 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index 3d281905ce..a6d42a428d 100644 --- a/src/gallium/auxiliary/util/u_format.c +++ b/src/gallium/auxiliary/util/u_format.c @@ -238,6 +238,10 @@ util_format_is_subsampled_422(enum pipe_format format) boolean util_format_is_supported(enum pipe_format format, unsigned bind) { + if (format >= PIPE_FORMAT_COUNT) { + return FALSE; + } + if (util_format_is_s3tc(format) && !util_format_s3tc_enabled) { return FALSE; } diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index c1bce8304b..1515c28091 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -2284,6 +2284,8 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen, format = PIPE_FORMAT_A4R4_UNORM; desc = util_format_description(format); + if (!desc) + goto out_unknown; /* Depth and stencil swizzling is handled separately. */ if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) { @@ -2650,6 +2652,8 @@ uint32_t r600_translate_colorformat(enum chip_class chip, enum pipe_format forma const struct util_format_description *desc = util_format_description(format); int channel = util_format_get_first_non_void_channel(format); bool is_float; + if (!desc) + return ~0U; #define HAS_SIZE(x,y,z,w) \ (desc->channel[0].size == (x) && desc->channel[1].size == (y) && \ diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index ee070107fd..06fd5718fd 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -1292,6 +1292,8 @@ static void si_emit_db_render_state(struct si_context *sctx, struct r600_atom *s static uint32_t si_translate_colorformat(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); + if (!desc) + return V_028C70_COLOR_INVALID; #define HAS_SIZE(x,y,z,w) \ (desc->channel[0].size == (x) && desc->channel[1].size == (y) && \ @@ -1442,6 +1444,9 @@ static uint32_t si_translate_texformat(struct pipe_screen *screen, bool uniform = true; int i; + if (!desc) + goto out_unknown; + /* Colorspace (return non-RGB formats directly). */ switch (desc->colorspace) { /* Depth stencil formats */ @@ -1796,7 +1801,11 @@ static unsigned si_tex_dim(struct si_screen *sscreen, struct r600_texture *rtex, static bool si_is_sampler_format_supported(struct pipe_screen *screen, enum pipe_format format) { - return si_translate_texformat(screen, format, util_format_description(format), + struct util_format_description *desc = util_format_description(format); + if (!desc) + return false; + + return si_translate_texformat(screen, format, desc, util_format_get_first_non_void_channel(format)) != ~0U; } @@ -1925,6 +1934,8 @@ static unsigned si_is_vertex_format_supported(struct pipe_screen *screen, PIPE_BIND_VERTEX_BUFFER)) == 0); desc = util_format_description(format); + if (!desc) + return 0; /* There are no native 8_8_8 or 16_16_16 data formats, and we currently * select 8_8_8_8 and 16_16_16_16 instead. This works reasonably well -- 2.14.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev