[Mesa-dev] [PATCH v2 1/4] etnaviv: implement ETC2 block patching for HALTI0
Christian Gmeiner
christian.gmeiner at gmail.com
Wed Feb 27 15:13:12 UTC 2019
Hi Lucas
Am Mi., 27. Feb. 2019 um 10:22 Uhr schrieb Lucas Stach <l.stach at pengutronix.de>:
>
> Am Dienstag, den 26.02.2019, 19:15 +0100 schrieb Christian Gmeiner:
> > ETC2 is supported with HALTI0, however that implementation is buggy
> > in hardware. The blob driver does per-block patching to work around
> > this. We need to swap colors for t-mode etc2 blocks.
> >
> > > Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> > ---
> > src/gallium/drivers/etnaviv/Makefile.sources | 2 +
> > src/gallium/drivers/etnaviv/etnaviv_etc2.c | 149 +++++++++++++++++++
> > src/gallium/drivers/etnaviv/etnaviv_etc2.h | 51 +++++++
> > src/gallium/drivers/etnaviv/meson.build | 2 +
> > 4 files changed, 204 insertions(+)
> > create mode 100644 src/gallium/drivers/etnaviv/etnaviv_etc2.c
> > create mode 100644 src/gallium/drivers/etnaviv/etnaviv_etc2.h
> >
> > diff --git a/src/gallium/drivers/etnaviv/Makefile.sources b/src/gallium/drivers/etnaviv/Makefile.sources
> > index 0b208122999..01e7e49a38a 100644
> > --- a/src/gallium/drivers/etnaviv/Makefile.sources
> > +++ b/src/gallium/drivers/etnaviv/Makefile.sources
> > @@ -25,6 +25,8 @@ C_SOURCES := \
> > > etnaviv_disasm.h \
> > > etnaviv_emit.c \
> > > etnaviv_emit.h \
> > > + etnaviv_etc2.c \
> > > + etnaviv_etc2.h \
> > > etnaviv_fence.c \
> > > etnaviv_fence.h \
> > > etnaviv_format.c \
> > diff --git a/src/gallium/drivers/etnaviv/etnaviv_etc2.c b/src/gallium/drivers/etnaviv/etnaviv_etc2.c
> > new file mode 100644
> > index 00000000000..64811c3038d
> > --- /dev/null
> > +++ b/src/gallium/drivers/etnaviv/etnaviv_etc2.c
> > @@ -0,0 +1,149 @@
> > +/*
> > + * Copyright (c) 2019 Etnaviv Project
> > + * Copyright (C) 2019 Zodiac Inflight Innovations
> > + *
> > + * 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, sub license,
> > + * 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 NON-INFRINGEMENT. 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.
> > + *
> > + * Authors:
> > > + * Christian Gmeiner <christian.gmeiner at gmail.com>
> > + */
> > +
> > +#include "etnaviv_etc2.h"
> > +#include "etnaviv_resource.h"
> > +#include "etnaviv_screen.h"
> > +#include "hw/common.xml.h"
> > +#include "util/u_format.h"
> > +
> > +bool
> > +etna_etc2_needs_patching(const struct pipe_resource *prsc)
> > +{
> > + const struct etna_screen *screen = etna_screen(prsc->screen);
> > +
> > + if (!util_format_is_etc(prsc->format))
> > + return false;
> > +
> > + if (prsc->format == PIPE_FORMAT_ETC1_RGB8)
> > + return false;
>
> Isn't this format check redundant with the default case of the switch
> below?
>
As util_format_is_etc(..) fires for etc1 and etc2 I thought to be more
explicit here, but
I am fine to remove it.
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info
More information about the mesa-dev
mailing list