Re: [Mesa-dev] [PATCH 1/3] etnaviv: Add support for extended texture formats
> Thx - will send out updated patches the next days. I quite busy with > lot of stuff atm but > a long weekend is coming :) Yeah np I could update my patches to that too and re-send them if that is more convenient, Wladimir ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] etnaviv: Add support for extended texture formats
2017-05-22 19:51 GMT+02:00 Lucas Stach: > Am Dienstag, den 16.05.2017, 21:31 +0200 schrieb Christian Gmeiner: >> Hi Wladimir. >> >> I started working on this topic last week and thought some time on how >> to add those ext texture formats in a clean and nice way. I come up >> with this patches: >> >> https://github.com/austriancoder/mesa/commit/1fac9dd179976dce3d991bb0715707021c093f1a.patch >> https://github.com/austriancoder/mesa/commit/f408fc40a028fa00e87900e6fd4cce65ee6640c2.patch >> >> IMO it is a simpler implementation as I do not need two variants of >> macros (base and extended) and there is no need for >> translate_texture_format_ext(..). >> What is your opinion about it? > > This looks much cleaner. I like it! > > Just a heads up if you haven't noticed: the first patch is broken, as > sv->base isn't initialized yet at the point where the format is > converted. I had to apply the following diff to make it work: > > >8 > - const uint32_t format = translate_texture_format(sv->base.format); > + const uint32_t format = translate_texture_format(so->format); > 8< > Thx - will send out updated patches the next days. I quite busy with lot of stuff atm but a long weekend is coming :) greets -- Christian Gmeiner, MSc https://www.youtube.com/user/AloryOFFICIAL https://soundcloud.com/christian-gmeiner ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] etnaviv: Add support for extended texture formats
Am Dienstag, den 16.05.2017, 21:31 +0200 schrieb Christian Gmeiner: > Hi Wladimir. > > I started working on this topic last week and thought some time on how > to add those ext texture formats in a clean and nice way. I come up > with this patches: > > https://github.com/austriancoder/mesa/commit/1fac9dd179976dce3d991bb0715707021c093f1a.patch > https://github.com/austriancoder/mesa/commit/f408fc40a028fa00e87900e6fd4cce65ee6640c2.patch > > IMO it is a simpler implementation as I do not need two variants of > macros (base and extended) and there is no need for > translate_texture_format_ext(..). > What is your opinion about it? This looks much cleaner. I like it! Just a heads up if you haven't noticed: the first patch is broken, as sv->base isn't initialized yet at the point where the format is converted. I had to apply the following diff to make it work: >8 - const uint32_t format = translate_texture_format(sv->base.format); + const uint32_t format = translate_texture_format(so->format); 8< Regards, Lucas ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] etnaviv: Add support for extended texture formats
On Tue, May 16, 2017 at 09:31:38PM +0200, Christian Gmeiner wrote: > Hi Wladimir. > > I started working on this topic last week and thought some time on how > to add those ext texture formats in a clean and nice way. I come up > with this patches: > > https://github.com/austriancoder/mesa/commit/1fac9dd179976dce3d991bb0715707021c093f1a.patch > https://github.com/austriancoder/mesa/commit/f408fc40a028fa00e87900e6fd4cce65ee6640c2.patch > > IMO it is a simpler implementation as I do not need two variants of > macros (base and extended) and there is no need for > translate_texture_format_ext(..). > What is your opinion about it? Good idea, the reason I'd been using two sets of macros is the hardcoding of TEXTURE_FORMAT#, hadn't dawned on me that TEXTURE_FORMAT_EXT also starts with TEXTURE_FORMAT :-) Wladimir ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] etnaviv: Add support for extended texture formats
Hi Wladimir. I started working on this topic last week and thought some time on how to add those ext texture formats in a clean and nice way. I come up with this patches: https://github.com/austriancoder/mesa/commit/1fac9dd179976dce3d991bb0715707021c093f1a.patch https://github.com/austriancoder/mesa/commit/f408fc40a028fa00e87900e6fd4cce65ee6640c2.patch IMO it is a simpler implementation as I do not need two variants of macros (base and extended) and there is no need for translate_texture_format_ext(..). What is your opinion about it? greets -- Christian Gmeiner, MSc https://www.youtube.com/user/AloryOFFICIAL https://soundcloud.com/christian-gmeiner ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] etnaviv: Add support for extended texture formats
This adds support for extended texture formats through TEXTURE_FORMAT_EXT. Two of these extended formats are added: - R8_SNORM - R8G8_UNORM --- src/gallium/drivers/etnaviv/etnaviv_format.c | 49 ++- src/gallium/drivers/etnaviv/etnaviv_format.h | 3 ++ src/gallium/drivers/etnaviv/etnaviv_texture.c | 3 +- 3 files changed, 45 insertions(+), 10 deletions(-) This patch series adds support for extended and swizzled texture formats on GC2000+. More can be added later, this just provides the base infrastructure. diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c b/src/gallium/drivers/etnaviv/etnaviv_format.c index 6935584..88bb520 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_format.c +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c @@ -51,8 +51,13 @@ struct etna_format { #define RS_FORMAT_X8B8G8R8(RS_FORMAT_X8R8G8B8 | RS_FORMAT_RB_SWAP) #define RS_FORMAT_A8B8G8R8(RS_FORMAT_A8R8G8B8 | RS_FORMAT_RB_SWAP) -/* vertex + texture */ -#define VT(pipe, vtxfmt, texfmt, rsfmt) \ +/* shift for extended texture formats */ +#define TX_FORMAT_MASK 0xff +#define TX_FORMAT_EXT_SHIFT 8 +#define TX_FORMAT_EXT_MASK 0xff00 + +/* vertex + texture (base) */ +#define VT(pipe, vtxfmt, texfmt, rsfmt) \ [PIPE_FORMAT_##pipe] = { \ .vtx = VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_##vtxfmt, \ .tex = TEXTURE_FORMAT_##texfmt, \ @@ -60,7 +65,16 @@ struct etna_format { .present = 1, \ } -/* texture-only */ +/* vertex + texture (extended) */ +#define VTE(pipe, vtxfmt, extfmt, rsfmt) \ + [PIPE_FORMAT_##pipe] = { \ + .vtx = VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_##vtxfmt, \ + .tex = TEXTURE_FORMAT_EXT_##extfmt << TX_FORMAT_EXT_SHIFT, \ + .rs = RS_FORMAT_##rsfmt,\ + .present = 1, \ + } + +/* texture-only (base) */ #define _T(pipe, fmt, rsfmt) \ [PIPE_FORMAT_##pipe] = {\ .vtx = ETNA_NO_MATCH,\ @@ -69,6 +83,15 @@ struct etna_format { .present = 1,\ } +/* texture-only (extended) */ +#define _TE(pipe, fmt, rsfmt) \ + [PIPE_FORMAT_##pipe] = {\ + .vtx = ETNA_NO_MATCH,\ + .tex = TEXTURE_FORMAT_EXT_##fmt << TX_FORMAT_EXT_SHIFT, \ + .rs = RS_FORMAT_##rsfmt, \ + .present = 1,\ + } + /* vertex-only */ #define V_(pipe, fmt, rsfmt) \ [PIPE_FORMAT_##pipe] = {\ @@ -81,7 +104,7 @@ struct etna_format { static struct etna_format formats[PIPE_FORMAT_COUNT] = { /* 8-bit */ V_(R8_UNORM, UNSIGNED_BYTE, NONE), - V_(R8_SNORM, BYTE, NONE), + VTE(R8_SNORM, BYTE, R8_SNORM, NONE), V_(R8_UINT,UNSIGNED_BYTE, NONE), V_(R8_SINT,BYTE, NONE), V_(R8_USCALED, UNSIGNED_BYTE, NONE), @@ -108,7 +131,7 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = { _T(B5G5R5A1_UNORM, A1R5G5B5, A1R5G5B5), _T(B5G5R5X1_UNORM, X1R5G5B5, X1R5G5B5), - V_(R8G8_UNORM, UNSIGNED_BYTE, NONE), + VTE(R8G8_UNORM, UNSIGNED_BYTE, G8R8, NONE), V_(R8G8_SNORM, BYTE, NONE), V_(R8G8_UINT,UNSIGNED_BYTE, NONE), V_(R8G8_SINT,BYTE, NONE), @@ -224,12 +247,20 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = { uint32_t translate_texture_format(enum pipe_format fmt) { - /* XXX with TEXTURE_FORMAT_EXT and swizzle on newer chips we can -* support much more */ - if (!formats[fmt].present) + /* XXX with swizzle on newer chips we can support much more */ + if (!formats[fmt].present || formats[fmt].tex == ETNA_NO_MATCH) + return ETNA_NO_MATCH; + + return formats[fmt].tex & TX_FORMAT_MASK; +} + +uint32_t +translate_texture_format_ext(enum pipe_format fmt) +{ + if (!formats[fmt].present || formats[fmt].tex == ETNA_NO_MATCH) return ETNA_NO_MATCH; - return formats[fmt].tex; + return (formats[fmt].tex & TX_FORMAT_EXT_MASK) >> TX_FORMAT_EXT_SHIFT; } uint32_t diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.h b/src/gallium/drivers/etnaviv/etnaviv_format.h index 549dfda..5dbab4d 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_format.h +++ b/src/gallium/drivers/etnaviv/etnaviv_format.h @@ -36,6 +36,9 @@ uint32_t translate_texture_format(enum pipe_format fmt); uint32_t +translate_texture_format_ext(enum pipe_format fmt); + +uint32_t translate_rs_format(enum pipe_format fmt); int diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c b/src/gallium/drivers/etnaviv/etnaviv_texture.c index 3a84238..28df5b2 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture.c +++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c @@ -212,7 +212,8 @@ etna_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,