Re: [Mesa-dev] [PATCH 19/19] etnaviv: GC7000: Split off current texture code

2017-11-05 Thread Wladimir J. van der Laan
On Sun, Nov 05, 2017 at 04:31:40PM +0100, Christian Gmeiner wrote:

> > +#ifndef H_ETNAVIV_TEXTURE_PLAIN
> > +#define H_ETNAVIV_TEXTURE_PLAIN
> > +
> > +#include 
> > +
> > +#include "pipe/p_context.h"
> > +#include "pipe/p_state.h"
> > +
> > +#include "hw/state_3d.xml.h"
> 
> Is this include needed?

Huh, no, I don't see why the states would need to be included in the header,
probably a leftover, I'll remove it.

Wladimir

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


Re: [Mesa-dev] [PATCH 19/19] etnaviv: GC7000: Split off current texture code

2017-11-05 Thread Christian Gmeiner
2017-10-30 17:17 GMT+01:00 Wladimir J. van der Laan :
> Prepare for two texture handling paths, the descriptor-based
> path will be added in a future commit. These are structured
> so that the texture implementation handles its own state
> emission.
>
> Signed-off-by: Wladimir J. van der Laan 

Reviewed-by: Christian Gmeiner 

> ---
>  src/gallium/drivers/etnaviv/Makefile.sources   |   2 +
>  src/gallium/drivers/etnaviv/etnaviv_context.h  |   3 +
>  src/gallium/drivers/etnaviv/etnaviv_emit.c |  74 +-
>  src/gallium/drivers/etnaviv/etnaviv_texture.c  | 137 +-
>  src/gallium/drivers/etnaviv/etnaviv_texture.h  |  37 +--
>  .../drivers/etnaviv/etnaviv_texture_plain.c| 279 
> +
>  .../drivers/etnaviv/etnaviv_texture_plain.h|  77 ++
>  7 files changed, 367 insertions(+), 242 deletions(-)
>  create mode 100644 src/gallium/drivers/etnaviv/etnaviv_texture_plain.c
>  create mode 100644 src/gallium/drivers/etnaviv/etnaviv_texture_plain.h
>
> diff --git a/src/gallium/drivers/etnaviv/Makefile.sources 
> b/src/gallium/drivers/etnaviv/Makefile.sources
> index 56cc3b2..05ac073 100644
> --- a/src/gallium/drivers/etnaviv/Makefile.sources
> +++ b/src/gallium/drivers/etnaviv/Makefile.sources
> @@ -51,6 +51,8 @@ C_SOURCES :=  \
> etnaviv_surface.h \
> etnaviv_texture.c \
> etnaviv_texture.h \
> +   etnaviv_texture_plain.c \
> +   etnaviv_texture_plain.h \
> etnaviv_tiling.c \
> etnaviv_tiling.h \
> etnaviv_transfer.c \
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h 
> b/src/gallium/drivers/etnaviv/etnaviv_context.h
> index 1ed38ce..6672a67 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_context.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
> @@ -100,6 +100,9 @@ struct etna_shader_uniform_info {
>  struct etna_context {
> struct pipe_context base;
>
> +   /* GPU-specific implementation to emit texture state */
> +   void (*emit_texture_state)(struct etna_context *pctx);
> +
> struct etna_specs specs;
> struct etna_screen *screen;
> struct etna_cmd_stream *stream;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c 
> b/src/gallium/drivers/etnaviv/etnaviv_emit.c
> index b766005..3ad7467 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
> @@ -289,7 +289,6 @@ void
>  etna_emit_state(struct etna_context *ctx)
>  {
> struct etna_cmd_stream *stream = ctx->stream;
> -   uint32_t active_samplers = active_samplers_bits(ctx);
>
> /* Pre-reserve the command buffer space which we are likely to need.
>  * This must cover all the state emitted below, and the following
> @@ -625,77 +624,6 @@ etna_emit_state(struct etna_context *ctx)
>/*01668*/ EMIT_STATE_RELOC(TS_DEPTH_SURFACE_BASE, 
> >framebuffer.TS_DEPTH_SURFACE_BASE);
>/*0166C*/ EMIT_STATE(TS_DEPTH_CLEAR_VALUE, 
> ctx->framebuffer.TS_DEPTH_CLEAR_VALUE);
> }
> -
> -   if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS | ETNA_DIRTY_SAMPLERS))) {
> -  for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
> - uint32_t val = 0; /* 0 == sampler inactive */
> -
> - /* set active samplers to their configuration value (determined by 
> both
> -  * the sampler state and sampler view) */
> - if ((1 << x) & active_samplers) {
> -struct etna_sampler_state *ss = 
> etna_sampler_state(ctx->sampler[x]);
> -struct etna_sampler_view *sv = 
> etna_sampler_view(ctx->sampler_view[x]);
> -
> -val = (ss->TE_SAMPLER_CONFIG0 & sv->TE_SAMPLER_CONFIG0_MASK) |
> -  sv->TE_SAMPLER_CONFIG0;
> - }
> -
> - /*02000*/ EMIT_STATE(TE_SAMPLER_CONFIG0(x), val);
> -  }
> -   }
> -   if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS))) {
> -  struct etna_sampler_view *sv;
> -
> -  for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
> - if ((1 << x) & active_samplers) {
> -sv = etna_sampler_view(ctx->sampler_view[x]);
> -/*02040*/ EMIT_STATE(TE_SAMPLER_SIZE(x), sv->TE_SAMPLER_SIZE);
> - }
> -  }
> -  for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
> - if ((1 << x) & active_samplers) {
> -sv = etna_sampler_view(ctx->sampler_view[x]);
> -/*02080*/ EMIT_STATE(TE_SAMPLER_LOG_SIZE(x), 
> sv->TE_SAMPLER_LOG_SIZE);
> - }
> -  }
> -   }
> -   if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS | ETNA_DIRTY_SAMPLERS))) {
> -  struct etna_sampler_state *ss;
> -  struct etna_sampler_view *sv;
> -
> -  for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
> - if ((1 << x) & active_samplers) {
> -ss = etna_sampler_state(ctx->sampler[x]);
> -sv = etna_sampler_view(ctx->sampler_view[x]);
> -
> -/* min and max lod is determined both by the sampler and the 
> view */
> - 

[Mesa-dev] [PATCH 19/19] etnaviv: GC7000: Split off current texture code

2017-10-30 Thread Wladimir J. van der Laan
Prepare for two texture handling paths, the descriptor-based
path will be added in a future commit. These are structured
so that the texture implementation handles its own state
emission.

Signed-off-by: Wladimir J. van der Laan 
---
 src/gallium/drivers/etnaviv/Makefile.sources   |   2 +
 src/gallium/drivers/etnaviv/etnaviv_context.h  |   3 +
 src/gallium/drivers/etnaviv/etnaviv_emit.c |  74 +-
 src/gallium/drivers/etnaviv/etnaviv_texture.c  | 137 +-
 src/gallium/drivers/etnaviv/etnaviv_texture.h  |  37 +--
 .../drivers/etnaviv/etnaviv_texture_plain.c| 279 +
 .../drivers/etnaviv/etnaviv_texture_plain.h|  77 ++
 7 files changed, 367 insertions(+), 242 deletions(-)
 create mode 100644 src/gallium/drivers/etnaviv/etnaviv_texture_plain.c
 create mode 100644 src/gallium/drivers/etnaviv/etnaviv_texture_plain.h

diff --git a/src/gallium/drivers/etnaviv/Makefile.sources 
b/src/gallium/drivers/etnaviv/Makefile.sources
index 56cc3b2..05ac073 100644
--- a/src/gallium/drivers/etnaviv/Makefile.sources
+++ b/src/gallium/drivers/etnaviv/Makefile.sources
@@ -51,6 +51,8 @@ C_SOURCES :=  \
etnaviv_surface.h \
etnaviv_texture.c \
etnaviv_texture.h \
+   etnaviv_texture_plain.c \
+   etnaviv_texture_plain.h \
etnaviv_tiling.c \
etnaviv_tiling.h \
etnaviv_transfer.c \
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h 
b/src/gallium/drivers/etnaviv/etnaviv_context.h
index 1ed38ce..6672a67 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
@@ -100,6 +100,9 @@ struct etna_shader_uniform_info {
 struct etna_context {
struct pipe_context base;
 
+   /* GPU-specific implementation to emit texture state */
+   void (*emit_texture_state)(struct etna_context *pctx);
+
struct etna_specs specs;
struct etna_screen *screen;
struct etna_cmd_stream *stream;
diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c 
b/src/gallium/drivers/etnaviv/etnaviv_emit.c
index b766005..3ad7467 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
@@ -289,7 +289,6 @@ void
 etna_emit_state(struct etna_context *ctx)
 {
struct etna_cmd_stream *stream = ctx->stream;
-   uint32_t active_samplers = active_samplers_bits(ctx);
 
/* Pre-reserve the command buffer space which we are likely to need.
 * This must cover all the state emitted below, and the following
@@ -625,77 +624,6 @@ etna_emit_state(struct etna_context *ctx)
   /*01668*/ EMIT_STATE_RELOC(TS_DEPTH_SURFACE_BASE, 
>framebuffer.TS_DEPTH_SURFACE_BASE);
   /*0166C*/ EMIT_STATE(TS_DEPTH_CLEAR_VALUE, 
ctx->framebuffer.TS_DEPTH_CLEAR_VALUE);
}
-
-   if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS | ETNA_DIRTY_SAMPLERS))) {
-  for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
- uint32_t val = 0; /* 0 == sampler inactive */
-
- /* set active samplers to their configuration value (determined by 
both
-  * the sampler state and sampler view) */
- if ((1 << x) & active_samplers) {
-struct etna_sampler_state *ss = 
etna_sampler_state(ctx->sampler[x]);
-struct etna_sampler_view *sv = 
etna_sampler_view(ctx->sampler_view[x]);
-
-val = (ss->TE_SAMPLER_CONFIG0 & sv->TE_SAMPLER_CONFIG0_MASK) |
-  sv->TE_SAMPLER_CONFIG0;
- }
-
- /*02000*/ EMIT_STATE(TE_SAMPLER_CONFIG0(x), val);
-  }
-   }
-   if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS))) {
-  struct etna_sampler_view *sv;
-
-  for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
- if ((1 << x) & active_samplers) {
-sv = etna_sampler_view(ctx->sampler_view[x]);
-/*02040*/ EMIT_STATE(TE_SAMPLER_SIZE(x), sv->TE_SAMPLER_SIZE);
- }
-  }
-  for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
- if ((1 << x) & active_samplers) {
-sv = etna_sampler_view(ctx->sampler_view[x]);
-/*02080*/ EMIT_STATE(TE_SAMPLER_LOG_SIZE(x), 
sv->TE_SAMPLER_LOG_SIZE);
- }
-  }
-   }
-   if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS | ETNA_DIRTY_SAMPLERS))) {
-  struct etna_sampler_state *ss;
-  struct etna_sampler_view *sv;
-
-  for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
- if ((1 << x) & active_samplers) {
-ss = etna_sampler_state(ctx->sampler[x]);
-sv = etna_sampler_view(ctx->sampler_view[x]);
-
-/* min and max lod is determined both by the sampler and the view 
*/
-/*020C0*/ EMIT_STATE(TE_SAMPLER_LOD_CONFIG(x),
- ss->TE_SAMPLER_LOD_CONFIG |
- 
VIVS_TE_SAMPLER_LOD_CONFIG_MAX(MIN2(ss->max_lod, sv->max_lod)) |
- 
VIVS_TE_SAMPLER_LOD_CONFIG_MIN(MAX2(ss->min_lod, sv->min_lod)));
- }
-  }
-  for (int x = 0; x <