Re: [Mesa-dev] [PATCH 07/19] etnaviv: GC7000: Add etnaviv_blt

2017-11-05 Thread Christian Gmeiner
2017-10-30 17:16 GMT+01:00 Wladimir J. van der Laan :
> Add a low-level library for using the BLT engine from the etnaviv
> driver.
>

As I have no HW to test it I am just looking at the code and write
down what I think :)

There are some code style issues: https://www.mesa3d.org/codingstyle.html

> Signed-off-by: Wladimir J. van der Laan 
> ---
>  src/gallium/drivers/etnaviv/Makefile.sources |   2 +
>  src/gallium/drivers/etnaviv/etnaviv_blt.c| 219 
> +++
>  src/gallium/drivers/etnaviv/etnaviv_blt.h| 128 
>  3 files changed, 349 insertions(+)
>  create mode 100644 src/gallium/drivers/etnaviv/etnaviv_blt.c
>  create mode 100644 src/gallium/drivers/etnaviv/etnaviv_blt.h
>
> diff --git a/src/gallium/drivers/etnaviv/Makefile.sources 
> b/src/gallium/drivers/etnaviv/Makefile.sources
> index ea8df80..3fab212 100644
> --- a/src/gallium/drivers/etnaviv/Makefile.sources
> +++ b/src/gallium/drivers/etnaviv/Makefile.sources
> @@ -9,6 +9,8 @@ C_SOURCES :=  \
> etnaviv_asm.h \
> etnaviv_blend.c \
> etnaviv_blend.h \
> +   etnaviv_blt.c \
> +   etnaviv_blt.h \
> etnaviv_clear_blit.c \
> etnaviv_clear_blit.h \
> etnaviv_compiler.c \
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_blt.c 
> b/src/gallium/drivers/etnaviv/etnaviv_blt.c
> new file mode 100644
> index 000..c88bc1e
> --- /dev/null
> +++ b/src/gallium/drivers/etnaviv/etnaviv_blt.c
> @@ -0,0 +1,219 @@
> +/*
> + * 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_blt.h"
> +
> +#include "etnaviv_emit.h"
> +#include "util/u_math.h"
> +
> +#include "hw/common_3d.xml.h"
> +#include "hw/state_blt.xml.h"
> +
> +#include 
> +
> +static inline uint32_t blt_compute_stride_bits(const struct blt_imginfo *img)
> +{

should be:

static inline uint32_t
blt_compute_stride_bits(const struct blt_imginfo *img)
{

> +return VIVS_BLT_DEST_STRIDE_TILING(img->tiling == ETNA_LAYOUT_LINEAR ? 0 
> : 3) | /* 1/3? */
> +   VIVS_BLT_DEST_STRIDE_FORMAT(img->format) |
> +   VIVS_BLT_DEST_STRIDE_STRIDE(img->stride);
> +}
> +
> +static inline uint32_t blt_compute_img_config_bits(const struct blt_imginfo 
> *img, bool for_dest)
> +{
> +uint32_t tiling_bits = 0;
> +if (img->tiling == ETNA_LAYOUT_SUPER_TILED) {
> +tiling_bits |= for_dest ? BLT_IMAGE_CONFIG_TO_SUPER_TILED : 
> BLT_IMAGE_CONFIG_FROM_SUPER_TILED;
> +}
> +
> +return BLT_IMAGE_CONFIG_CACHE_MODE(img->cache_mode) |
> +   COND(img->use_ts, BLT_IMAGE_CONFIG_TS) |
> +   COND(img->compressed, BLT_IMAGE_CONFIG_COMPRESSION) |
> +   BLT_IMAGE_CONFIG_COMPRESSION_FORMAT(img->compress_fmt) |
> +   COND(for_dest, BLT_IMAGE_CONFIG_UNK22) |
> +   BLT_IMAGE_CONFIG_SWIZ_R(0) | /* not used? */
> +   BLT_IMAGE_CONFIG_SWIZ_G(1) |
> +   BLT_IMAGE_CONFIG_SWIZ_B(2) |
> +   BLT_IMAGE_CONFIG_SWIZ_A(3) |
> +   tiling_bits;
> +}
> +
> +static inline uint32_t blt_compute_swizzle_bits(const struct blt_imginfo 
> *img, bool for_dest)
> +{
> +uint32_t swiz = VIVS_BLT_SWIZZLE_SRC_R(img->swizzle[0]) |
> +VIVS_BLT_SWIZZLE_SRC_G(img->swizzle[1]) |
> +VIVS_BLT_SWIZZLE_SRC_B(img->swizzle[2]) |
> +VIVS_BLT_SWIZZLE_SRC_A(img->swizzle[3]);
> +return for_dest ? (swiz << 12) : swiz;
> +}
> +
> +void emit_blt_clearimage(struct etna_cmd_stream *stream, const struct 
> blt_clear_op *op)
> +{
> +etna_cmd_stream_reserve(stream, 64*2); /* Make sure BLT op doesn't get 
> broken up */
> +
> +etna_set_state(stream, VIVS_BLT_ENABLE, 0x0001);
> +assert(op->dest.bpp);
> +etna_set_state(stream, VIVS_BLT_CONFIG, 
> V

Re: [Mesa-dev] [PATCH 07/19] etnaviv: GC7000: Add etnaviv_blt

2017-11-05 Thread Christian Gmeiner
2017-11-05 13:02 GMT+01:00 Christian Gmeiner :
> 2017-10-30 17:16 GMT+01:00 Wladimir J. van der Laan :
>> Add a low-level library for using the BLT engine from the etnaviv
>> driver.
>>
>
> As I have no HW to test it I am just looking at the code and write
> down what I think :)
>
> There are some code style issues: https://www.mesa3d.org/codingstyle.html
>
>> Signed-off-by: Wladimir J. van der Laan 
>> ---
>>  src/gallium/drivers/etnaviv/Makefile.sources |   2 +

src/gallium/drivers/etnaviv/meson.build needs changed too.

-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev