Re: [Mesa-dev] [PATCH 09/19] etnaviv: GC7000: BLT engine blitting support
2017-10-30 17:16 GMT+01:00 Wladimir J. van der Laan: > Add an implemenation of key clear_blit functions using the BLT engine > that replaced the RS on GC7000. > > Signed-off-by: Wladimir J. van der Laan > --- > src/gallium/drivers/etnaviv/Makefile.sources | 1 + src/gallium/drivers/etnaviv/meson.build needs changed too. > src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 7 +- > src/gallium/drivers/etnaviv/etnaviv_clear_blit.h | 3 + > .../drivers/etnaviv/etnaviv_clear_blit_blt.c | 412 > + > src/gallium/drivers/etnaviv/etnaviv_context.c | 6 +- > src/gallium/drivers/etnaviv/etnaviv_internal.h | 2 + > src/gallium/drivers/etnaviv/etnaviv_screen.c | 2 + > 7 files changed, 430 insertions(+), 3 deletions(-) > create mode 100644 src/gallium/drivers/etnaviv/etnaviv_clear_blit_blt.c > > diff --git a/src/gallium/drivers/etnaviv/Makefile.sources > b/src/gallium/drivers/etnaviv/Makefile.sources > index f4acaa2..56cc3b2 100644 > --- a/src/gallium/drivers/etnaviv/Makefile.sources > +++ b/src/gallium/drivers/etnaviv/Makefile.sources > @@ -13,6 +13,7 @@ C_SOURCES := \ > etnaviv_blt.h \ > etnaviv_clear_blit.c \ > etnaviv_clear_blit.h \ > + etnaviv_clear_blit_blt.c \ > etnaviv_clear_blit_rs.c \ > etnaviv_compiler.c \ > etnaviv_compiler.h \ > diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c > b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c > index faf8f39..3b3ab00 100644 > --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c > +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c > @@ -215,10 +215,15 @@ etna_copy_resource_box(struct pipe_context *pctx, > struct pipe_resource *dst, > void > etna_clear_blit_init(struct pipe_context *pctx) > { > + struct etna_context *ctx = etna_context(pctx); > + > pctx->clear_render_target = etna_clear_render_target; > pctx->clear_depth_stencil = etna_clear_depth_stencil; > pctx->resource_copy_region = etna_resource_copy_region; > pctx->flush_resource = etna_flush_resource; > > - etna_clear_blit_rs_init(pctx); > + if (ctx->specs.use_blt) > + etna_clear_blit_blt_init(pctx); > + else > + etna_clear_blit_rs_init(pctx); > } > diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h > b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h > index 7f84d2e..57b75e8 100644 > --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h > +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h > @@ -57,6 +57,9 @@ void > etna_clear_blit_init(struct pipe_context *pctx); > > void > +etna_clear_blit_blt_init(struct pipe_context *pctx); > + > +void > etna_clear_blit_rs_init(struct pipe_context *pctx); > > #endif > diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit_blt.c > b/src/gallium/drivers/etnaviv/etnaviv_clear_blit_blt.c > new file mode 100644 > index 000..e0c26cc > --- /dev/null > +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit_blt.c > @@ -0,0 +1,412 @@ > +/* > + * Copyright (c) 2017 Etnaviv Project > + * Copyright (C) 2017 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: > + *Wladimir J. van der Laan > + */ > + > +#include "etnaviv_clear_blit.h" > + > +#include "hw/common.xml.h" > + > +#include "etnaviv_blt.h" > +#include "etnaviv_context.h" > +#include "etnaviv_emit.h" > +#include "etnaviv_format.h" > +#include "etnaviv_resource.h" > +#include "etnaviv_surface.h" > +#include "etnaviv_translate.h" > + > +#include "pipe/p_defines.h" > +#include "pipe/p_state.h" > +#include "util/u_blitter.h" > +#include "util/u_inlines.h" > +#include "util/u_memory.h" > +#include "util/u_surface.h" > + > +#define translate_blt_format translate_rs_format > + > +static void > +etna_blit_clear_color_blt(struct
[Mesa-dev] [PATCH 09/19] etnaviv: GC7000: BLT engine blitting support
Add an implemenation of key clear_blit functions using the BLT engine that replaced the RS on GC7000. Signed-off-by: Wladimir J. van der Laan--- src/gallium/drivers/etnaviv/Makefile.sources | 1 + src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 7 +- src/gallium/drivers/etnaviv/etnaviv_clear_blit.h | 3 + .../drivers/etnaviv/etnaviv_clear_blit_blt.c | 412 + src/gallium/drivers/etnaviv/etnaviv_context.c | 6 +- src/gallium/drivers/etnaviv/etnaviv_internal.h | 2 + src/gallium/drivers/etnaviv/etnaviv_screen.c | 2 + 7 files changed, 430 insertions(+), 3 deletions(-) create mode 100644 src/gallium/drivers/etnaviv/etnaviv_clear_blit_blt.c diff --git a/src/gallium/drivers/etnaviv/Makefile.sources b/src/gallium/drivers/etnaviv/Makefile.sources index f4acaa2..56cc3b2 100644 --- a/src/gallium/drivers/etnaviv/Makefile.sources +++ b/src/gallium/drivers/etnaviv/Makefile.sources @@ -13,6 +13,7 @@ C_SOURCES := \ etnaviv_blt.h \ etnaviv_clear_blit.c \ etnaviv_clear_blit.h \ + etnaviv_clear_blit_blt.c \ etnaviv_clear_blit_rs.c \ etnaviv_compiler.c \ etnaviv_compiler.h \ diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c index faf8f39..3b3ab00 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c @@ -215,10 +215,15 @@ etna_copy_resource_box(struct pipe_context *pctx, struct pipe_resource *dst, void etna_clear_blit_init(struct pipe_context *pctx) { + struct etna_context *ctx = etna_context(pctx); + pctx->clear_render_target = etna_clear_render_target; pctx->clear_depth_stencil = etna_clear_depth_stencil; pctx->resource_copy_region = etna_resource_copy_region; pctx->flush_resource = etna_flush_resource; - etna_clear_blit_rs_init(pctx); + if (ctx->specs.use_blt) + etna_clear_blit_blt_init(pctx); + else + etna_clear_blit_rs_init(pctx); } diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h index 7f84d2e..57b75e8 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h @@ -57,6 +57,9 @@ void etna_clear_blit_init(struct pipe_context *pctx); void +etna_clear_blit_blt_init(struct pipe_context *pctx); + +void etna_clear_blit_rs_init(struct pipe_context *pctx); #endif diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit_blt.c b/src/gallium/drivers/etnaviv/etnaviv_clear_blit_blt.c new file mode 100644 index 000..e0c26cc --- /dev/null +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit_blt.c @@ -0,0 +1,412 @@ +/* + * Copyright (c) 2017 Etnaviv Project + * Copyright (C) 2017 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: + *Wladimir J. van der Laan + */ + +#include "etnaviv_clear_blit.h" + +#include "hw/common.xml.h" + +#include "etnaviv_blt.h" +#include "etnaviv_context.h" +#include "etnaviv_emit.h" +#include "etnaviv_format.h" +#include "etnaviv_resource.h" +#include "etnaviv_surface.h" +#include "etnaviv_translate.h" + +#include "pipe/p_defines.h" +#include "pipe/p_state.h" +#include "util/u_blitter.h" +#include "util/u_inlines.h" +#include "util/u_memory.h" +#include "util/u_surface.h" + +#define translate_blt_format translate_rs_format + +static void +etna_blit_clear_color_blt(struct pipe_context *pctx, struct pipe_surface *dst, + const union pipe_color_union *color) +{ + struct etna_context *ctx = etna_context(pctx); + struct etna_surface *surf = etna_surface(dst); + uint32_t new_clear_value = etna_clear_blit_pack_rgba(surf->base.format, color->f); + + struct etna_resource *res = etna_resource(surf->base.texture); +