Re: [Mesa-dev] Question about handling RGBA/BGRA in etnaviv driver

2017-02-08 Thread Wladimir J. van der Laan

> > Another way that I just realized would be to convert a texture to BGRA the
> > first time it's rendered to.
> >
> > In contrast to the shader solution that has only a one-time overhead. Is
> > this a stupid idea for any reason?

> We are doing something similar to convert sampled textures to the
> correct tiling format
> for the multi-pipe GPUs. (sampler can read only from tiled formats but
> the multi-pipe GPU
> can only render to multi-tiled or super-tiled resources). Have a look where
> etna_copy_resource(..) gets used.

I implemented this today, but unfortunately it's not working.

MESA doesn't like the format of the gallium texture changing under it, as it
tracks its own formats. This results in assertion errors later on when it tries
to copy data to the texture (as it assumes it can just use copy_region).

It would be possible to add a "fake" resource res->rtt for rendering to
(similar to how res->texture is used for rendering *from*), then copy and
convert as needed, but I don't think the added complexity is worth it. It would
no longer be a one-time overhead, every frame would be converted - for no good
reason but keep Mesa's higher-level texture handling happy.

If we can't come up with a better solution to this I'd say the most
straightforward solution to that would be to revert "etnaviv: add RGBX/RGBA
pixel formats".

I guess in a way this problem is at a higher level, maybe it should be solved
at the Mesa / GL ES level - applications using OpenGL ES API expect an
abstraction "GL_RGBA" which does not necessarily need to use RGBA layout in
memory.

(On the other hand for desktop GL the internal format is the internal format and
it may be expected behavior that a GPU that doesn't support rendering to
GL_RGBA rejects FBO's set up that way?)

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


Re: [Mesa-dev] [PATCH 2/3] etnaviv: keep track of emitted loops

2017-02-08 Thread Wladimir J. van der Laan
On Wed, Feb 08, 2017 at 12:10:24PM +0100, Christian Gmeiner wrote:
> Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com>

Sure why not.

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_compiler.c | 6 ++
>  src/gallium/drivers/etnaviv/etnaviv_compiler.h | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c 
> b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> index 7446a19..af7b64d 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> @@ -183,6 +183,8 @@ struct etna_compile {
> unsigned labels_count, labels_sz;
> struct etna_compile_label *labels;
>  
> +   unsigned num_loops;
> +
> /* Code generation */
> int inst_ptr; /* current instruction pointer */
> uint32_t code[ETNA_MAX_INSTRUCTIONS * ETNA_INST_SIZE];
> @@ -1166,6 +1168,8 @@ trans_loop_bgn(const struct instr_translater *t, struct 
> etna_compile *c,
> f->lbl_loop_end = alloc_new_label(c);
>  
> label_place(c, f->lbl_loop_bgn);
> +
> +   c->num_loops++;
>  }
>  
>  static void
> @@ -2418,6 +2422,7 @@ etna_compile_shader(const struct etna_specs *specs,
> shader->processor = c->info.processor;
> shader->code_size = c->inst_ptr * 4;
> shader->code = mem_dup(c->code, c->inst_ptr * 16);
> +   shader->num_loops = c->num_loops;
> shader->num_temps = c->next_free_native;
> shader->vs_pos_out_reg = -1;
> shader->vs_pointsize_out_reg = -1;
> @@ -2455,6 +2460,7 @@ etna_dump_shader(const struct etna_shader *shader)
>  
> etna_disasm(shader->code, shader->code_size, PRINT_RAW);
>  
> +   printf("num loops: %i\n", shader->num_loops);
> printf("num temps: %i\n", shader->num_temps);
> printf("num const: %i\n", shader->uniforms.const_count);
> printf("immediates:\n");
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.h 
> b/src/gallium/drivers/etnaviv/etnaviv_compiler.h
> index d310109..211ae1a 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.h
> @@ -59,6 +59,7 @@ struct etna_shader {
> uint processor; /* TGSI_PROCESSOR_... */
> uint32_t code_size; /* code size in uint32 words */
> uint32_t *code;
> +   unsigned num_loops;
> unsigned num_temps;
>  
> struct etna_shader_uniform_info uniforms;
> -- 
> 2.7.4
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] etnaviv: shader-db traces

2017-02-08 Thread Wladimir J. van der Laan
On Wed, Feb 08, 2017 at 12:10:25PM +0100, Christian Gmeiner wrote:
> Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com>

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

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


[Mesa-dev] [PATCH 1/2] etnaviv: Update hw header files

2017-02-09 Thread Wladimir J. van der Laan
Update from etnaviv repository rnndb.
---
 src/gallium/drivers/etnaviv/hw/cmdstream.xml.h |   6 +-
 src/gallium/drivers/etnaviv/hw/common.xml.h|  14 +--
 src/gallium/drivers/etnaviv/hw/isa.xml.h   |   6 +-
 src/gallium/drivers/etnaviv/hw/state.xml.h |  30 +++--
 src/gallium/drivers/etnaviv/hw/state_3d.xml.h  | 152 +
 5 files changed, 160 insertions(+), 48 deletions(-)

This adds some newly discovered state for GC3000 (and some GC2000) features.

diff --git a/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h 
b/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
index c5275db..4e78eba 100644
--- a/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
+++ b/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
@@ -8,9 +8,9 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
 git clone git://0x04.net/rules-ng-ng
 
 The rules-ng-ng source files this header was generated from are:
-- cmdstream.xml (  14094 bytes, from 2016-11-16 18:54:37)
-- copyright.xml (   1597 bytes, from 2016-10-02 14:26:13)
-- common.xml(  23422 bytes, from 2016-11-16 18:54:37)
+- cmdstream.xml (  14313 bytes, from 2016-11-17 18:46:23)
+- copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
+- common.xml(  23473 bytes, from 2016-12-11 10:32:13)
 
 Copyright (C) 2012-2016 by the following authors:
 - Wladimir J. van der Laan <laa...@gmail.com>
diff --git a/src/gallium/drivers/etnaviv/hw/common.xml.h 
b/src/gallium/drivers/etnaviv/hw/common.xml.h
index 8d8ef7d..0f99db2 100644
--- a/src/gallium/drivers/etnaviv/hw/common.xml.h
+++ b/src/gallium/drivers/etnaviv/hw/common.xml.h
@@ -8,13 +8,13 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
 git clone git://0x04.net/rules-ng-ng
 
 The rules-ng-ng source files this header was generated from are:
-- state.xml (  19792 bytes, from 2016-11-16 18:54:37)
-- common.xml(  23422 bytes, from 2016-11-16 18:54:37)
-- state_hi.xml  (  25653 bytes, from 2016-10-02 14:26:13)
-- copyright.xml (   1597 bytes, from 2016-10-02 14:26:13)
-- state_2d.xml  (  51552 bytes, from 2016-10-02 14:26:13)
-- state_3d.xml  (  57579 bytes, from 2016-11-16 18:54:37)
-- state_vg.xml  (   5975 bytes, from 2016-10-02 14:26:13)
+- state.xml (  19930 bytes, from 2016-12-14 15:25:40)
+- common.xml(  23473 bytes, from 2016-12-11 10:32:13)
+- state_hi.xml  (  26403 bytes, from 2016-12-14 06:43:27)
+- copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
+- state_2d.xml  (  51552 bytes, from 2016-10-29 07:29:22)
+- state_3d.xml  (  66957 bytes, from 2016-12-15 11:31:03)
+- state_vg.xml  (   5975 bytes, from 2016-10-29 07:29:22)
 
 Copyright (C) 2012-2016 by the following authors:
 - Wladimir J. van der Laan <laa...@gmail.com>
diff --git a/src/gallium/drivers/etnaviv/hw/isa.xml.h 
b/src/gallium/drivers/etnaviv/hw/isa.xml.h
index 70cc74a..c604b44 100644
--- a/src/gallium/drivers/etnaviv/hw/isa.xml.h
+++ b/src/gallium/drivers/etnaviv/hw/isa.xml.h
@@ -8,8 +8,8 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
 git clone git://0x04.net/rules-ng-ng
 
 The rules-ng-ng source files this header was generated from are:
-- isa.xml   (  24392 bytes, from 2016-11-16 18:54:37)
-- copyright.xml (   1597 bytes, from 2016-10-02 14:26:13)
+- isa.xml   (  30048 bytes, from 2016-12-12 13:26:33)
+- copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
 
 Copyright (C) 2012-2016 by the following authors:
 - Wladimir J. van der Laan <laa...@gmail.com>
@@ -78,6 +78,7 @@ DEALINGS IN THE SOFTWARE.
 #define INST_OPCODE_CEIL   0x0026
 #define INST_OPCODE_SIGN   0x0027
 #define INST_OPCODE_I2F
0x002d
+#define INST_OPCODE_F2I
0x002e
 #define INST_OPCODE_CMP
0x0031
 #define INST_OPCODE_LOAD   0x0032
 #define INST_OPCODE_STORE  0x0033
@@ -92,6 +93,7 @@ DEALINGS IN THE SOFTWARE.
 #define INST_OPCODE_AND
0x005d
 #define INST_OPCODE_XOR
0x005e
 #define INST_OPCODE_NOT
0x005f
+#define INST_OPCODE_POPCOUNT   0x0061
 #define INST_CONDITION_TRUE0x
 #define INST_CONDITION_GT  0x0001
 #define INST_CONDITION_LT  0x0002
diff --git a/src/gallium/drivers/etnaviv/hw/state.xml.h 
b/src/gallium/drivers/etnaviv/hw/state.xml.h
index d9bb9c4..73ef042 100644
--- a/src/gallium/drivers/etnaviv/hw/state.xml.h
+++ b/src/gallium/drivers/etnaviv/hw/state.xml.h
@@ -8,13 +8,13 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
 git clone git://0x04.net/rules-ng-ng
 
 The rules-ng-ng source files this header 

[Mesa-dev] [PATCH 2/2] etnaviv: Set shader instruction area correctly for GC3000

2017-02-09 Thread Wladimir J. van der Laan
- Use the same instruction area on GC3000 as the Vivante driver.
  This allows the same number of instructions on GC3000 as GC2000
  instead of half.

- Makes sure that the "PE to FE" stall before updating the shader code
  or constants is hit (which is conditional on vs_offset > 0x4000). This
  is necessary on GC3000 too, it increases stability.
---
 src/gallium/drivers/etnaviv/etnaviv_screen.c | 26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index 8c66f79..1507967 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -626,14 +626,30 @@ etna_get_specs(struct etna_screen *screen)
screen->specs.has_new_sin_cos =
   VIV_FEATURE(screen, chipMinorFeatures3, HAS_FAST_TRANSCENDENTALS);
 
-   if (instruction_count > 256) { /* unified instruction memory? */
+   if (VIV_FEATURE(screen, chipMinorFeatures3, INSTRUCTION_CACHE)) {
+  /* GC3000 - this core is capable of loading shaders from
+   * memory. It can also run shaders from registers, as a fallback, but
+   * "max_instructions" does not have the correct value. It has place for
+   * 2*256 instructions just like GC2000, but the offsets are slightly
+   * different.
+   */
   screen->specs.vs_offset = 0xC000;
-  screen->specs.ps_offset = 0xD000; /* like vivante driver */
+  /* State 08000-0C000 mirrors 0C000-0E000, and the Vivante driver uses
+   * this mirror for writing PS instructions, probably safest to do the
+   * same.
+   */
+  screen->specs.ps_offset = 0x8000 + 0x1000;
   screen->specs.max_instructions = 256;
} else {
-  screen->specs.vs_offset = 0x4000;
-  screen->specs.ps_offset = 0x6000;
-  screen->specs.max_instructions = instruction_count / 2;
+  if (instruction_count > 256) { /* unified instruction memory? */
+ screen->specs.vs_offset = 0xC000;
+ screen->specs.ps_offset = 0xD000; /* like vivante driver */
+ screen->specs.max_instructions = 256;
+  } else {
+ screen->specs.vs_offset = 0x4000;
+ screen->specs.ps_offset = 0x6000;
+ screen->specs.max_instructions = instruction_count / 2;
+  }
}
 
if (VIV_FEATURE(screen, chipMinorFeatures1, HALTI0)) {
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 3/3] etnaviv: shader-db traces

2017-02-09 Thread Wladimir J. van der Laan
> > >>  /* shader object, for linking */
> > >>  struct etna_shader {
> > >> +   uint32_t id; /* for debug */
> > >
> > > Do you need this? It can certainly be removed from this patch, but I
> > > don't know if you have other stuff building on top of this.
> > >
> > 
> > It gets used in dump_shader_info(..) which was added with this patch.
> 
> My argument was that you could pass that value as an argument to
> dump_shader_info(). I don't see why it needs to be stored inside the
> etna_shader object.

One advantage of storing it is that debug logging that refers to the shader
can use the same number and it can be correlated with the info dumped earlier.

Not that that is part of this patch, but that seems to be the goal.

If not for that there's no real use for a counter anyway: just have whatever
parses the output do the counting based on what is printed first.

But I think it's fine as it is.

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


Re: [Mesa-dev] [PATCH 3/3] etnaviv: shader-db traces

2017-02-09 Thread Wladimir J. van der Laan
> Okay.. I will add the id member in a later patch to etna_shader
> object. For the moment
> I will pass it as an argument to dump_shader_info(..). Will send a V2
> of that series later the day.

To be honest I think it's nonsense to change this now, if you need an
id in the shader object then add an id to the shader object. It's not like
that overhead is significant and if you're going to add it later anyway
we're pretty much wasting time here by removing it and adding it back...

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


Re: [Mesa-dev] mx6q: Cannot run Cinematic demo correctly

2017-03-14 Thread Wladimir J. van der Laan
On Tue, Mar 14, 2017 at 06:39:32PM +0100, Christian Gmeiner wrote:
> > By only reverting:
> >
> > commit 6c89a728d9e5d072cb504453e73077564c6523d3
> > Author: Wladimir J. van der Laan <laa...@gmail.com>
> > Date:   Wed Dec 7 12:59:54 2016 +
> >
> > etnaviv: Cannot render to rb-swapped formats
> >
> > Exposing rb swapped (or other swizzled) formats for rendering would
> > involve swizzing in the pixel shader. This is not the case at the
> > moment, so reject requests for creating such surfaces.
> >
> > (GPUs that need an extra resolve step anyway due to multiple pixel
> > pipes, such as gc2000, might also do this swap in the resolve operation.
> > But this would be tricky to keep track of)
> >
> > CC: <mesa-sta...@lists.freedesktop.org>
> > Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
> > Acked-by: Christian Gmeiner <christian.gmei...@gmail.com>
> >
> > I can confirm that the Cinematic demo can run successfully. I do not
> > see the black boxes, nor font issues anymore.
> >
> 
> I am a little bit overloaded with my day job (again) and the initial plan was 
> to
> land something in stable for 17.0.1 release failed - but he 17.0.2 will come.
> 
> >
> > Also the previous error messages are gone:
> > QOpenGLFramebufferObject: Unsupported framebuffer format.
> > QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.
> > QOpenGLFramebufferObject: Unsupported framebuffer format.
> > QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.
> > QOpenGLFramebufferObject: Unsupported framebuffer format.
> > QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.
> > QOpenGLFramebufferObject: Unsupported framebuffer format.
> > QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.
> >
> > as to your other patch: I do not see commit
> > 89bb5c79e29613ad9a4e43d670654e98a220fc60 in mesa tree.
> >
> > Wladimir/Christian,
> >
> > What would be the proper fix for this problem?
> >
> 
> shader variants - due to lot of people are have this issue I will
> spend some time the next
> days to cleanup my wip patch series. I have too may concurrent etnaviv
> work items running
> in parallel :(

Yea, variants would be the way to render to RGBA succesfully
on vivantes.

Until then it's best to revert those two patches.

Reverting only the one (latest) patch can give red/blue swapped issues when
doing render-to-texture, it was applied in the first place to fix those issues
caused by the first patch, but it didn't really make things better.

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


Re: [Mesa-dev] [PATCH v2] etnaviv: native fence fd support

2017-04-11 Thread Wladimir J. van der Laan
On Fri, Apr 07, 2017 at 02:21:35PM +0200, Philipp Zabel wrote:
> This adds native fence fd support to etnaviv, similarly to commit
> 0b98e84e9ba0 ("freedreno: native fence fd"), enabled for kernel
> driver version 1.1 or later.
> 
> Signed-off-by: Philipp Zabel <p.za...@pengutronix.de>

Patch looks good to me,

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

> ---
> v2: address review comments
> - always call etna_cmd_stream_flush2
> - remove FIXME comment about in_fence_fd storage
> - simplify version check and add an ETNA_DRM_VERSION_FENCE_FD define
> 
> This depends on libdrm patches [1][2] which may or may not make their
> way into libdrm 2.4.79.
> [1] https://patchwork.kernel.org/patch/9669375/
> [2] https://patchwork.kernel.org/patch/9669377/
> ---
>  configure.ac  |  2 +-
>  src/gallium/drivers/etnaviv/etnaviv_context.c | 14 +++--
>  src/gallium/drivers/etnaviv/etnaviv_context.h |  1 +
>  src/gallium/drivers/etnaviv/etnaviv_fence.c   | 45 
> +--
>  src/gallium/drivers/etnaviv/etnaviv_fence.h   | 14 -
>  src/gallium/drivers/etnaviv/etnaviv_screen.c  | 12 ++-
>  src/gallium/drivers/etnaviv/etnaviv_screen.h  |  2 ++
>  7 files changed, 83 insertions(+), 7 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 7d92b33a0f..e75f4a5ce5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -80,7 +80,7 @@ LIBDRM_NVVIEUX_REQUIRED=2.4.66
>  LIBDRM_NOUVEAU_REQUIRED=2.4.66
>  LIBDRM_FREEDRENO_REQUIRED=2.4.74
>  LIBDRM_VC4_REQUIRED=2.4.69
> -LIBDRM_ETNAVIV_REQUIRED=2.4.74
> +LIBDRM_ETNAVIV_REQUIRED=2.4.79
>  
>  dnl Versions for external dependencies
>  DRI2PROTO_REQUIRED=2.8
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c 
> b/src/gallium/drivers/etnaviv/etnaviv_context.c
> index 555aa12765..09f782fc81 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_context.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
> @@ -73,6 +73,9 @@ etna_context_destroy(struct pipe_context *pctx)
>  
> slab_destroy_child(>transfer_pool);
>  
> +   if (ctx->in_fence_fd != -1)
> +  close(ctx->in_fence_fd);
> +
> FREE(pctx);
>  }
>  
> @@ -275,11 +278,14 @@ etna_flush(struct pipe_context *pctx, struct 
> pipe_fence_handle **fence,
> enum pipe_flush_flags flags)
>  {
> struct etna_context *ctx = etna_context(pctx);
> +   int out_fence_fd = -1;
>  
> -   etna_cmd_stream_flush(ctx->stream);
> +   etna_cmd_stream_flush2(ctx->stream, ctx->in_fence_fd,
> +   (flags & PIPE_FLUSH_FENCE_FD) ? _fence_fd :
> +   NULL);
>  
> if (fence)
> -  *fence = etna_fence_create(pctx);
> +  *fence = etna_fence_create(pctx, out_fence_fd);
>  }
>  
>  static void
> @@ -353,10 +359,14 @@ etna_context_create(struct pipe_screen *pscreen, void 
> *priv, unsigned flags)
> /*  Set sensible defaults for state */
> etna_cmd_stream_reset_notify(ctx->stream, ctx);
>  
> +   ctx->in_fence_fd = -1;
> +
> pctx->destroy = etna_context_destroy;
> pctx->draw_vbo = etna_draw_vbo;
> pctx->flush = etna_flush;
> pctx->set_debug_callback = etna_set_debug_callback;
> +   pctx->create_fence_fd = etna_create_fence_fd;
> +   pctx->fence_server_sync = etna_fence_server_sync;
>  
> /* creation of compile states */
> pctx->create_blend_state = etna_blend_state_create;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h 
> b/src/gallium/drivers/etnaviv/etnaviv_context.h
> index 9e00d34d23..56b57b55a8 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_context.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
> @@ -178,6 +178,7 @@ struct etna_context {
> } stats;
>  
> struct pipe_debug_callback debug;
> +   int in_fence_fd;
>  };
>  
>  static inline struct etna_context *
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_fence.c 
> b/src/gallium/drivers/etnaviv/etnaviv_fence.c
> index 02f520b8b3..65402aaa3b 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_fence.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_fence.c
> @@ -25,6 +25,8 @@
>   *Rob Clark <robcl...@freedesktop.org>
>   */
>  
> +#include 
> +
>  #include "etnaviv_fence.h"
>  #include "etnaviv_context.h"
>  #include "etnaviv_screen.h"
> @@ -36,16 +38,25 @@ struct pipe_fence_handle {
> struct pipe_reference reference;
> struct etna_context *ctx;
> struct etna_screen *screen;
> +   int fence_fd;
> uint32_t timestamp;
>  };
>  
>  static void
> +etna_fence_destroy(struct pipe_fence_handle *fe

Re: [Mesa-dev] [PATCH v2 2/3] etnaviv: Update includes from rnndb

2017-04-14 Thread Wladimir J. van der Laan
On Fri, Apr 14, 2017 at 11:57:21PM +0200, Christian Gmeiner wrote:
> > +#define INST_OPCODE_IMADLOSAT0 0x004e
> > +#define INST_OPCODE_IMADLOSAT0 0x004f
> 
> INST_OPCODE_IMADLOSAT0 got redefined...

Second one should be IMADLOSAT1. Strange, I fixed this but apparently it didn't 
make it to the patch,
messed up with git again :(
https://github.com/etnaviv/etna_viv/blob/master/src/etnaviv/isa.xml.h#L119

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


Re: [Mesa-dev] [PATCH v2 2/3] etnaviv: Update includes from rnndb

2017-04-14 Thread Wladimir J. van der Laan
On Sat, Apr 15, 2017 at 07:49:53AM +0200, Wladimir J. van der Laan wrote:
> On Fri, Apr 14, 2017 at 11:57:21PM +0200, Christian Gmeiner wrote:
> > > +#define INST_OPCODE_IMADLOSAT0 0x004e
> > > +#define INST_OPCODE_IMADLOSAT0 0x004f
> > 
> > INST_OPCODE_IMADLOSAT0 got redefined...
> 
> Second one should be IMADLOSAT1. Strange, I fixed this but apparently it 
> didn't make it to the patch,
> messed up with git again :(
> https://github.com/etnaviv/etna_viv/blob/master/src/etnaviv/isa.xml.h#L119

I now understand what went wrong: apparently I fixed another instance (IMUL not
IMAD) but not this one.
Strange, hadn't seen a warning for this.
Thanks for the fix,

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


[Mesa-dev] etnaviv: When to use supertiled layout?

2017-04-17 Thread Wladimir J. van der Laan
Hello,

Currently etnaviv chooses supertiled layout always for new resources that can
be rendered to, when this is available:

bool want_supertiled = screen->specs.can_supertile && 
!DBG_ENABLED(ETNA_DBG_NO_SUPERTILE);

However, etnaviv does not support render *from* supertiled textures (GC3000
claims to support SUPERTILED_TEXTURE but we don't use it), only from 4x4-tiled
ones.

This means that with FBO render-to-texture, extra overhead is incurred to
re-tile the texture every frame, which likely doesn't offset the cache benefits
of using supertiled in the first place (as well as using 2x as much video 
memory.)

I'm not sure how to improve this heuristic though: at the time the resource is
do we know whether it will be used to texture from? I don't think so.

Another heuristic option would be to use supertiled only for scan-out surfaces.
These in most cases need a conversion to linear anyway, or (in the case of
gc3000) the PRE supports supertiled as-is.

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


[Mesa-dev] [PATCH 3/3] etnaviv: SINGLE_BUFFER support on GC3000

2017-04-13 Thread Wladimir J. van der Laan
This patch adds support for the SINGLE_BUFFER feature on GC3000
GPUs, which allows rendering to a single buffer using multiple pixel
pipes.

This feature is always used when it is available, which means that
multi-tiled formats are no longer being used in that case, and all
buffers will be normal (super)tiled. This mimics the behavior of the
blob on GC3000.

- Because the same format can be used to render to and texture from,
  this avoids an extra resolve pass when rendering to texture.

- i.MX6qp includes a PRE which can scan-out directly from tiled formats,
  avoiding untiling overhead.
---
 src/gallium/drivers/etnaviv/etnaviv_context.c  |  3 +++
 src/gallium/drivers/etnaviv/etnaviv_emit.c |  6 --
 src/gallium/drivers/etnaviv/etnaviv_internal.h |  3 +++
 src/gallium/drivers/etnaviv/etnaviv_resource.c |  9 +++-
 src/gallium/drivers/etnaviv/etnaviv_rs.c   | 29 ++
 src/gallium/drivers/etnaviv/etnaviv_screen.c   |  5 +
 src/gallium/drivers/etnaviv/etnaviv_state.c| 10 +++--
 src/gallium/drivers/etnaviv/etnaviv_surface.c  | 21 +--
 8 files changed, 66 insertions(+), 20 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c 
b/src/gallium/drivers/etnaviv/etnaviv_context.c
index 555aa12..f2f709c 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -293,6 +293,9 @@ etna_cmd_stream_reset_notify(struct etna_cmd_stream 
*stream, void *priv)
etna_set_state(stream, VIVS_RA_EARLY_DEPTH, 0x0031);
etna_set_state(stream, VIVS_PA_W_CLIP_LIMIT, 0x3401);
 
+   /* Enable SINGLE_BUFFER for resolve, if supported */
+   etna_set_state(stream, VIVS_RS_SINGLE_BUFFER, 
COND(ctx->specs.single_buffer, VIVS_RS_SINGLE_BUFFER_ENABLE));
+
ctx->dirty = ~0L;
 
/* go through all the used resources and clear their status flag */
diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c 
b/src/gallium/drivers/etnaviv/etnaviv_emit.c
index af74cbb..7ced5fc 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
@@ -603,10 +603,12 @@ etna_emit_state(struct etna_context *ctx)
if (unlikely(dirty & (ETNA_DIRTY_STENCIL_REF))) {
   /*014A0*/ EMIT_STATE(PE_STENCIL_CONFIG_EXT, 
ctx->stencil_ref.PE_STENCIL_CONFIG_EXT);
}
+   if (unlikely(dirty & (ETNA_DIRTY_BLEND | ETNA_DIRTY_FRAMEBUFFER))) {
+  struct etna_blend_state *blend = etna_blend_state(ctx->blend);
+  /*014A4*/ EMIT_STATE(PE_LOGIC_OP, blend->PE_LOGIC_OP | 
ctx->framebuffer.PE_LOGIC_OP);
+   }
if (unlikely(dirty & (ETNA_DIRTY_BLEND))) {
   struct etna_blend_state *blend = etna_blend_state(ctx->blend);
-
-  /*014A4*/ EMIT_STATE(PE_LOGIC_OP, blend->PE_LOGIC_OP);
   for (int x = 0; x < 2; ++x) {
  /*014A8*/ EMIT_STATE(PE_DITHER(x), blend->PE_DITHER[x]);
   }
diff --git a/src/gallium/drivers/etnaviv/etnaviv_internal.h 
b/src/gallium/drivers/etnaviv/etnaviv_internal.h
index 2f09d55..2f8dacb 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_internal.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_internal.h
@@ -72,6 +72,8 @@ struct etna_specs {
unsigned has_shader_range_registers : 1;
/* has the new sin/cos functions */
unsigned has_new_sin_cos : 1;
+   /* supports single-buffer rendering with multiple pixel pipes */
+   unsigned single_buffer : 1;
/* can use any kind of wrapping mode on npot textures */
unsigned npot_tex_any_wrap;
/* number of bits per TS tile */
@@ -191,6 +193,7 @@ struct compiled_framebuffer_state {
uint32_t TS_COLOR_CLEAR_VALUE;
struct etna_reloc TS_COLOR_STATUS_BASE;
struct etna_reloc TS_COLOR_SURFACE_BASE;
+   uint32_t PE_LOGIC_OP;
bool msaa_mode; /* adds input (and possible temp) to PS */
 };
 
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 1f0582c..b4e853f 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -248,9 +248,16 @@ etna_resource_create(struct pipe_screen *pscreen,
   if (util_format_is_compressed(templat->format))
  layout = ETNA_LAYOUT_LINEAR;
} else if (templat->target != PIPE_BUFFER) {
-  bool want_multitiled = screen->specs.pixel_pipes > 1;
+  bool want_multitiled = false;
   bool want_supertiled = screen->specs.can_supertile && 
!DBG_ENABLED(ETNA_DBG_NO_SUPERTILE);
 
+  /* When this GPU supports single-buffer rendering, don't ever enable
+   * multi-tiling. This replicates the blob behavior on GC3000.
+   */
+  if (!screen->specs.single_buffer) {
+ want_multitiled = screen->specs.pixel_pipes > 1;
+  }
+
   /* Keep single byte blocksized resources as tiled, since we
* are unable to use the RS blit to de-tile them. However,
* if they're used as a render target or depth/stencil, they
diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.c 

[Mesa-dev] [PATCH 1/3] etnaviv: Add chipMinorFeatures4 and 5

2017-04-13 Thread Wladimir J. van der Laan
Request chipMinorFeatures bitfields 4 and 5 from the
drm driver.
---
 src/gallium/drivers/etnaviv/etnaviv_screen.c | 12 
 src/gallium/drivers/etnaviv/etnaviv_screen.h |  4 +++-
 2 files changed, 15 insertions(+), 1 deletion(-)

Adds two further chipminorfeatures words - 
viv_chipMinorFeatures4 is necessary to be able to detect SINGLE_BUFFER.
viv_chipMinorFeatures5 isn't, but adding it because it will come in useful 
later.

diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index aa53917..41bacbc 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -800,6 +800,18 @@ etna_screen_create(struct etna_device *dev, struct 
etna_gpu *gpu,
}
screen->features[4] = val;
 
+   if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_5, )) {
+  DBG("could not get ETNA_GPU_FEATURES_5");
+  goto fail;
+   }
+   screen->features[5] = val;
+
+   if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_6, )) {
+  DBG("could not get ETNA_GPU_FEATURES_6");
+  goto fail;
+   }
+   screen->features[6] = val;
+
if (!etna_get_specs(screen))
   goto fail;
 
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.h 
b/src/gallium/drivers/etnaviv/etnaviv_screen.h
index c33a9e3..a606e5d 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.h
@@ -44,6 +44,8 @@ enum viv_features_word {
viv_chipMinorFeatures1 = 2,
viv_chipMinorFeatures2 = 3,
viv_chipMinorFeatures3 = 4,
+   viv_chipMinorFeatures4 = 5,
+   viv_chipMinorFeatures5 = 6,
VIV_FEATURES_WORD_COUNT /* Must be last */
 };
 
@@ -69,7 +71,7 @@ struct etna_screen {
 
uint32_t model;
uint32_t revision;
-   uint32_t features[5];
+   uint32_t features[VIV_FEATURES_WORD_COUNT];
 
struct etna_specs specs;
 };
-- 
2.7.4

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


[Mesa-dev] [PATCH 2/3] etnaviv: Update includes from rnndb

2017-04-13 Thread Wladimir J. van der Laan
Update to etna_viv commit 411bd69.
---
 src/gallium/drivers/etnaviv/hw/cmdstream.xml.h |  2 +-
 src/gallium/drivers/etnaviv/hw/common.xml.h| 10 ++--
 src/gallium/drivers/etnaviv/hw/isa.xml.h   | 75 +-
 src/gallium/drivers/etnaviv/hw/state.xml.h | 10 ++--
 src/gallium/drivers/etnaviv/hw/state_3d.xml.h  | 14 ++---
 5 files changed, 91 insertions(+), 20 deletions(-)

Adds many shader instructions, and documents RS single_buffer state

diff --git a/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h 
b/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
index 4e78eba..d4da030 100644
--- a/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
+++ b/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
@@ -10,7 +10,7 @@ git clone git://0x04.net/rules-ng-ng
 The rules-ng-ng source files this header was generated from are:
 - cmdstream.xml (  14313 bytes, from 2016-11-17 18:46:23)
 - copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
-- common.xml(  23473 bytes, from 2016-12-11 10:32:13)
+- common.xml(  23473 bytes, from 2017-01-07 14:27:54)
 
 Copyright (C) 2012-2016 by the following authors:
 - Wladimir J. van der Laan <laa...@gmail.com>
diff --git a/src/gallium/drivers/etnaviv/hw/common.xml.h 
b/src/gallium/drivers/etnaviv/hw/common.xml.h
index 0f99db2..8b73fd8 100644
--- a/src/gallium/drivers/etnaviv/hw/common.xml.h
+++ b/src/gallium/drivers/etnaviv/hw/common.xml.h
@@ -8,15 +8,15 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
 git clone git://0x04.net/rules-ng-ng
 
 The rules-ng-ng source files this header was generated from are:
-- state.xml (  19930 bytes, from 2016-12-14 15:25:40)
-- common.xml(  23473 bytes, from 2016-12-11 10:32:13)
-- state_hi.xml  (  26403 bytes, from 2016-12-14 06:43:27)
+- state.xml (  19930 bytes, from 2017-01-07 14:27:54)
+- common.xml(  23473 bytes, from 2017-01-07 14:27:54)
+- state_hi.xml  (  26403 bytes, from 2017-01-07 14:27:54)
 - copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
 - state_2d.xml  (  51552 bytes, from 2016-10-29 07:29:22)
-- state_3d.xml  (  66957 bytes, from 2016-12-15 11:31:03)
+- state_3d.xml  (  66964 bytes, from 2017-04-13 12:38:05)
 - state_vg.xml  (   5975 bytes, from 2016-10-29 07:29:22)
 
-Copyright (C) 2012-2016 by the following authors:
+Copyright (C) 2012-2017 by the following authors:
 - Wladimir J. van der Laan <laa...@gmail.com>
 - Christian Gmeiner <christian.gmei...@gmail.com>
 - Lucas Stach <l.st...@pengutronix.de>
diff --git a/src/gallium/drivers/etnaviv/hw/isa.xml.h 
b/src/gallium/drivers/etnaviv/hw/isa.xml.h
index c604b44..28803df 100644
--- a/src/gallium/drivers/etnaviv/hw/isa.xml.h
+++ b/src/gallium/drivers/etnaviv/hw/isa.xml.h
@@ -8,10 +8,10 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
 git clone git://0x04.net/rules-ng-ng
 
 The rules-ng-ng source files this header was generated from are:
-- isa.xml   (  30048 bytes, from 2016-12-12 13:26:33)
+- isa.xml   (  34392 bytes, from 2017-04-13 12:44:36)
 - copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
 
-Copyright (C) 2012-2016 by the following authors:
+Copyright (C) 2012-2017 by the following authors:
 - Wladimir J. van der Laan <laa...@gmail.com>
 - Christian Gmeiner <christian.gmei...@gmail.com>
 - Lucas Stach <l.st...@pengutronix.de>
@@ -77,14 +77,54 @@ DEALINGS IN THE SOFTWARE.
 #define INST_OPCODE_FLOOR  0x0025
 #define INST_OPCODE_CEIL   0x0026
 #define INST_OPCODE_SIGN   0x0027
+#define INST_OPCODE_ADDLO  0x0028
+#define INST_OPCODE_MULLO  0x0029
+#define INST_OPCODE_BARRIER0x002a
+#define INST_OPCODE_SWIZZLE0x002b
+#define INST_OPCODE_I2I
0x002c
 #define INST_OPCODE_I2F
0x002d
 #define INST_OPCODE_F2I
0x002e
+#define INST_OPCODE_F2IRND 0x002f
+#define INST_OPCODE_F2I7   0x0030
 #define INST_OPCODE_CMP
0x0031
 #define INST_OPCODE_LOAD   0x0032
 #define INST_OPCODE_STORE  0x0033
+#define INST_OPCODE_COPYSIGN   0x0034
+#define INST_OPCODE_GETEXP 0x0035
+#define INST_OPCODE_GETMANT0x0036
+#define INST_OPCODE_NAN
0x0037
+#define INST_OPCODE_NEXTAFTER  0x0038
+#define INST_OPCODE_ROUNDEVEN 

[Mesa-dev] [PATCH v2 2/3] etnaviv: Update includes from rnndb

2017-04-14 Thread Wladimir J. van der Laan
Update to etna_viv commit 411bd69.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/hw/cmdstream.xml.h |  2 +-
 src/gallium/drivers/etnaviv/hw/common.xml.h| 10 ++--
 src/gallium/drivers/etnaviv/hw/isa.xml.h   | 75 +-
 src/gallium/drivers/etnaviv/hw/state.xml.h | 10 ++--
 src/gallium/drivers/etnaviv/hw/state_3d.xml.h  | 14 ++---
 5 files changed, 91 insertions(+), 20 deletions(-)

Same, no changes from v1 (well, Signed-off-by was added to the commit message).

diff --git a/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h 
b/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
index 4e78eba..d4da030 100644
--- a/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
+++ b/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
@@ -10,7 +10,7 @@ git clone git://0x04.net/rules-ng-ng
 The rules-ng-ng source files this header was generated from are:
 - cmdstream.xml (  14313 bytes, from 2016-11-17 18:46:23)
 - copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
-- common.xml(  23473 bytes, from 2016-12-11 10:32:13)
+- common.xml(  23473 bytes, from 2017-01-07 14:27:54)
 
 Copyright (C) 2012-2016 by the following authors:
 - Wladimir J. van der Laan <laa...@gmail.com>
diff --git a/src/gallium/drivers/etnaviv/hw/common.xml.h 
b/src/gallium/drivers/etnaviv/hw/common.xml.h
index 0f99db2..8b73fd8 100644
--- a/src/gallium/drivers/etnaviv/hw/common.xml.h
+++ b/src/gallium/drivers/etnaviv/hw/common.xml.h
@@ -8,15 +8,15 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
 git clone git://0x04.net/rules-ng-ng
 
 The rules-ng-ng source files this header was generated from are:
-- state.xml (  19930 bytes, from 2016-12-14 15:25:40)
-- common.xml(  23473 bytes, from 2016-12-11 10:32:13)
-- state_hi.xml  (  26403 bytes, from 2016-12-14 06:43:27)
+- state.xml (  19930 bytes, from 2017-01-07 14:27:54)
+- common.xml(  23473 bytes, from 2017-01-07 14:27:54)
+- state_hi.xml  (  26403 bytes, from 2017-01-07 14:27:54)
 - copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
 - state_2d.xml  (  51552 bytes, from 2016-10-29 07:29:22)
-- state_3d.xml  (  66957 bytes, from 2016-12-15 11:31:03)
+- state_3d.xml  (  66964 bytes, from 2017-04-13 12:38:05)
 - state_vg.xml  (   5975 bytes, from 2016-10-29 07:29:22)
 
-Copyright (C) 2012-2016 by the following authors:
+Copyright (C) 2012-2017 by the following authors:
 - Wladimir J. van der Laan <laa...@gmail.com>
 - Christian Gmeiner <christian.gmei...@gmail.com>
 - Lucas Stach <l.st...@pengutronix.de>
diff --git a/src/gallium/drivers/etnaviv/hw/isa.xml.h 
b/src/gallium/drivers/etnaviv/hw/isa.xml.h
index c604b44..28803df 100644
--- a/src/gallium/drivers/etnaviv/hw/isa.xml.h
+++ b/src/gallium/drivers/etnaviv/hw/isa.xml.h
@@ -8,10 +8,10 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
 git clone git://0x04.net/rules-ng-ng
 
 The rules-ng-ng source files this header was generated from are:
-- isa.xml   (  30048 bytes, from 2016-12-12 13:26:33)
+- isa.xml   (  34392 bytes, from 2017-04-13 12:44:36)
 - copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
 
-Copyright (C) 2012-2016 by the following authors:
+Copyright (C) 2012-2017 by the following authors:
 - Wladimir J. van der Laan <laa...@gmail.com>
 - Christian Gmeiner <christian.gmei...@gmail.com>
 - Lucas Stach <l.st...@pengutronix.de>
@@ -77,14 +77,54 @@ DEALINGS IN THE SOFTWARE.
 #define INST_OPCODE_FLOOR  0x0025
 #define INST_OPCODE_CEIL   0x0026
 #define INST_OPCODE_SIGN   0x0027
+#define INST_OPCODE_ADDLO  0x0028
+#define INST_OPCODE_MULLO  0x0029
+#define INST_OPCODE_BARRIER0x002a
+#define INST_OPCODE_SWIZZLE0x002b
+#define INST_OPCODE_I2I
0x002c
 #define INST_OPCODE_I2F
0x002d
 #define INST_OPCODE_F2I
0x002e
+#define INST_OPCODE_F2IRND 0x002f
+#define INST_OPCODE_F2I7   0x0030
 #define INST_OPCODE_CMP
0x0031
 #define INST_OPCODE_LOAD   0x0032
 #define INST_OPCODE_STORE  0x0033
+#define INST_OPCODE_COPYSIGN   0x0034
+#define INST_OPCODE_GETEXP 0x0035
+#define INST_OPCODE_GETMANT0x0036
+#define INST_OPCODE_NAN
0x0037
+#define INST_OPCODE_NEXTAFTER   

[Mesa-dev] [PATCH v2 1/3] etnaviv: Add chipMinorFeatures4 and 5

2017-04-14 Thread Wladimir J. van der Laan
Request chipMinorFeatures bitfields 4 and 5 from the
drm driver.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_screen.c | 12 
 src/gallium/drivers/etnaviv/etnaviv_screen.h |  4 +++-
 2 files changed, 15 insertions(+), 1 deletion(-)

no changes from v1 in this patch, just re-submitting the whole series.

diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index aa53917..41bacbc 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -800,6 +800,18 @@ etna_screen_create(struct etna_device *dev, struct 
etna_gpu *gpu,
}
screen->features[4] = val;
 
+   if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_5, )) {
+  DBG("could not get ETNA_GPU_FEATURES_5");
+  goto fail;
+   }
+   screen->features[5] = val;
+
+   if (etna_gpu_get_param(screen->gpu, ETNA_GPU_FEATURES_6, )) {
+  DBG("could not get ETNA_GPU_FEATURES_6");
+  goto fail;
+   }
+   screen->features[6] = val;
+
if (!etna_get_specs(screen))
   goto fail;
 
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.h 
b/src/gallium/drivers/etnaviv/etnaviv_screen.h
index c33a9e3..a606e5d 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.h
@@ -44,6 +44,8 @@ enum viv_features_word {
viv_chipMinorFeatures1 = 2,
viv_chipMinorFeatures2 = 3,
viv_chipMinorFeatures3 = 4,
+   viv_chipMinorFeatures4 = 5,
+   viv_chipMinorFeatures5 = 6,
VIV_FEATURES_WORD_COUNT /* Must be last */
 };
 
@@ -69,7 +71,7 @@ struct etna_screen {
 
uint32_t model;
uint32_t revision;
-   uint32_t features[5];
+   uint32_t features[VIV_FEATURES_WORD_COUNT];
 
struct etna_specs specs;
 };
-- 
2.7.4

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


[Mesa-dev] [PATCH v2 3/3] etnaviv: SINGLE_BUFFER support on GC3000

2017-04-14 Thread Wladimir J. van der Laan
This patch adds support for the SINGLE_BUFFER feature on GC3000
GPUs, which allows rendering to a single buffer using multiple pixel
pipes.

This feature is always used when it is available, which means that
multi-tiled formats are no longer being used in that case, and all
buffers will be normal (super)tiled. This mimics the behavior of the
blob on GC3000.

- Because the same format can be used to render to and texture from,
  this avoids an extra resolve pass when rendering to texture.

- i.MX6qp includes a PRE which can scan-out directly from tiled formats,
  avoiding untiling overhead.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_context.c  |  3 ++
 src/gallium/drivers/etnaviv/etnaviv_emit.c |  6 ++--
 src/gallium/drivers/etnaviv/etnaviv_internal.h |  3 ++
 src/gallium/drivers/etnaviv/etnaviv_resource.c |  8 +-
 src/gallium/drivers/etnaviv/etnaviv_rs.c   | 39 +++---
 src/gallium/drivers/etnaviv/etnaviv_screen.c   |  4 +++
 src/gallium/drivers/etnaviv/etnaviv_state.c| 10 +--
 src/gallium/drivers/etnaviv/etnaviv_surface.c  | 18 
 8 files changed, 63 insertions(+), 28 deletions(-)

Changed for v2:
- Minor code style changes as suggested by Christian Gmeiner and Philipp Zabel
- Remove duplicate code for multi-tiled case in etnaviv_rs.c / 
etnaviv_surface.c (Philipp Zabel)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c 
b/src/gallium/drivers/etnaviv/etnaviv_context.c
index 555aa12..f2f709c 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -293,6 +293,9 @@ etna_cmd_stream_reset_notify(struct etna_cmd_stream 
*stream, void *priv)
etna_set_state(stream, VIVS_RA_EARLY_DEPTH, 0x0031);
etna_set_state(stream, VIVS_PA_W_CLIP_LIMIT, 0x3401);
 
+   /* Enable SINGLE_BUFFER for resolve, if supported */
+   etna_set_state(stream, VIVS_RS_SINGLE_BUFFER, 
COND(ctx->specs.single_buffer, VIVS_RS_SINGLE_BUFFER_ENABLE));
+
ctx->dirty = ~0L;
 
/* go through all the used resources and clear their status flag */
diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c 
b/src/gallium/drivers/etnaviv/etnaviv_emit.c
index af74cbb..7ced5fc 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
@@ -603,10 +603,12 @@ etna_emit_state(struct etna_context *ctx)
if (unlikely(dirty & (ETNA_DIRTY_STENCIL_REF))) {
   /*014A0*/ EMIT_STATE(PE_STENCIL_CONFIG_EXT, 
ctx->stencil_ref.PE_STENCIL_CONFIG_EXT);
}
+   if (unlikely(dirty & (ETNA_DIRTY_BLEND | ETNA_DIRTY_FRAMEBUFFER))) {
+  struct etna_blend_state *blend = etna_blend_state(ctx->blend);
+  /*014A4*/ EMIT_STATE(PE_LOGIC_OP, blend->PE_LOGIC_OP | 
ctx->framebuffer.PE_LOGIC_OP);
+   }
if (unlikely(dirty & (ETNA_DIRTY_BLEND))) {
   struct etna_blend_state *blend = etna_blend_state(ctx->blend);
-
-  /*014A4*/ EMIT_STATE(PE_LOGIC_OP, blend->PE_LOGIC_OP);
   for (int x = 0; x < 2; ++x) {
  /*014A8*/ EMIT_STATE(PE_DITHER(x), blend->PE_DITHER[x]);
   }
diff --git a/src/gallium/drivers/etnaviv/etnaviv_internal.h 
b/src/gallium/drivers/etnaviv/etnaviv_internal.h
index 2f09d55..2f8dacb 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_internal.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_internal.h
@@ -72,6 +72,8 @@ struct etna_specs {
unsigned has_shader_range_registers : 1;
/* has the new sin/cos functions */
unsigned has_new_sin_cos : 1;
+   /* supports single-buffer rendering with multiple pixel pipes */
+   unsigned single_buffer : 1;
/* can use any kind of wrapping mode on npot textures */
unsigned npot_tex_any_wrap;
/* number of bits per TS tile */
@@ -191,6 +193,7 @@ struct compiled_framebuffer_state {
uint32_t TS_COLOR_CLEAR_VALUE;
struct etna_reloc TS_COLOR_STATUS_BASE;
struct etna_reloc TS_COLOR_SURFACE_BASE;
+   uint32_t PE_LOGIC_OP;
bool msaa_mode; /* adds input (and possible temp) to PS */
 };
 
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 1f0582c..8da0b0a 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -248,9 +248,15 @@ etna_resource_create(struct pipe_screen *pscreen,
   if (util_format_is_compressed(templat->format))
  layout = ETNA_LAYOUT_LINEAR;
} else if (templat->target != PIPE_BUFFER) {
-  bool want_multitiled = screen->specs.pixel_pipes > 1;
+  bool want_multitiled = false;
   bool want_supertiled = screen->specs.can_supertile && 
!DBG_ENABLED(ETNA_DBG_NO_SUPERTILE);
 
+  /* When this GPU supports single-buffer rendering, don't ever enable
+   * multi-tiling. This replicates the blob behavior on GC3000.
+   */
+  if (!screen->specs.single_buffer)
+ want_multitiled = screen

[Mesa-dev] [PATCH] etnaviv: Supertiled texture support on gc3000

2017-04-18 Thread Wladimir J. van der Laan
Support supertiled textures on hardware that has the appropriate
feature flag SUPERTILED_TEXTURE.

Most of the scaffolding was already in place in etna_layout_multiple:

   case ETNA_LAYOUT_SUPER_TILED:
  *paddingX = 64;
  *paddingY = 64;
  *halign = TEXTURE_HALIGN_SUPER_TILED;

So this is just a matter of allowing it.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_resource.c |  9 +++--
 src/gallium/drivers/etnaviv/etnaviv_texture.c  | 10 --
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 7b00d66..035c241 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -230,12 +230,9 @@ etna_resource_create(struct pipe_screen *pscreen,
 {
struct etna_screen *screen = etna_screen(pscreen);
 
-   /* Figure out what tiling to use -- for now, assume that textures cannot be
-* supertiled, and cannot be linear.
-* There is a feature flag SUPERTILED_TEXTURE (not supported on any known 
hw)
-* that may allow this, as well
-* as LINEAR_TEXTURE_SUPPORT (supported on gc880 and gc2000 at least), but
-* not sure how it works.
+   /* Figure out what tiling to use -- for now, assume that texture cannot be 
linear.
+* there is a capability LINEAR_TEXTURE_SUPPORT (supported on gc880 and
+* gc2000 at least), but not sure how it works.
 * Buffers always have LINEAR layout.
 */
unsigned layout = ETNA_LAYOUT_LINEAR;
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c 
b/src/gallium/drivers/etnaviv/etnaviv_texture.c
index 93b077b..3a84238 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c
@@ -129,12 +129,18 @@ etna_resource_sampler_compatible(struct etna_resource 
*res)
if (util_format_is_compressed(res->base.format))
   return true;
 
-   /* The sampler (as we currently know it) only accepts tiled layouts */
+   struct etna_screen *screen = etna_screen(res->base.screen);
+   /* This GPU supports texturing from supertiled textures? */
+   if (res->layout == ETNA_LAYOUT_SUPER_TILED && VIV_FEATURE(screen, 
chipMinorFeatures2, SUPERTILED_TEXTURE))
+  return true;
+
+   /* TODO: LINEAR_TEXTURE_SUPPORT */
+
+   /* Otherwise, only support tiled layouts */
if (res->layout != ETNA_LAYOUT_TILED)
   return false;
 
/* If we have HALIGN support, we can allow for the RS padding */
-   struct etna_screen *screen = etna_screen(res->base.screen);
if (VIV_FEATURE(screen, chipMinorFeatures1, TEXTURE_HALIGN))
   return true;
 
-- 
2.7.4

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


[Mesa-dev] [PATCH] etnaviv: Add support for R8_UNORM textures

2017-07-28 Thread Wladimir J. van der Laan
R8_UNORM textures can be emulated by means of L8 and a swizzle.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_format.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
b/src/gallium/drivers/etnaviv/etnaviv_format.c
index 69e07bc..a2e215b 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
@@ -90,7 +90,7 @@ struct etna_format {
 
 static struct etna_format formats[PIPE_FORMAT_COUNT] = {
/* 8-bit */
-   V_(R8_UNORM,   UNSIGNED_BYTE, NONE),
+   VT(R8_UNORM,   UNSIGNED_BYTE, L8, SWIZ(X, 0, 0, 1), NONE),
V_(R8_SNORM,   BYTE,  NONE),
V_(R8_UINT,UNSIGNED_BYTE, NONE),
V_(R8_SINT,BYTE,  NONE),
-- 
2.7.4

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


[Mesa-dev] [PATCH v2] etnaviv: Add support for ETC2 texture compression

2017-07-17 Thread Wladimir J. van der Laan
Add support for ETC2 compressed textures in the etnaviv driver.

One step closer towards GL ES 3 support.

For now, treat SRGB and RGB formats the same. It looks like these are
distinguished using a different bit in sampler state, and not part of
the format, but I have not yet been able to confirm this for sure.

(Only enabled on GC3000+ for now, as the GC2000 ETC2 decoder
implementation is buggy and we don't work around that)

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_format.c | 11 +++
 src/gallium/drivers/etnaviv/etnaviv_screen.c | 27 ++-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
b/src/gallium/drivers/etnaviv/etnaviv_format.c
index c7c032a..cb67060 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
@@ -234,6 +234,17 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
_T(DXT3_RGBA, DXT2_DXT3, SWIZ(X, Y, Z, W), NONE),
_T(DXT5_RGBA, DXT4_DXT5, SWIZ(X, Y, Z, W), NONE),
 
+   _T(ETC2_RGB8,   EXT_NONE | EXT_FORMAT,  SWIZ(X, 
Y, Z, W), NONE), /* Extd. format NONE doubles as ETC2_RGB8 */
+   _T(ETC2_SRGB8,  EXT_NONE | EXT_FORMAT,  SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_RGB8A1, EXT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | EXT_FORMAT, SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_SRGB8A1,EXT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | EXT_FORMAT, SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_RGBA8,  EXT_RGBA8_ETC2_EAC | EXT_FORMAT,SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_SRGBA8, EXT_RGBA8_ETC2_EAC | EXT_FORMAT,SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_R11_UNORM,  EXT_R11_EAC | EXT_FORMAT,   SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_R11_SNORM,  EXT_SIGNED_R11_EAC | EXT_FORMAT,SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_RG11_UNORM, EXT_RG11_EAC | EXT_FORMAT,  SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_RG11_SNORM, EXT_SIGNED_RG11_EAC | EXT_FORMAT,   SWIZ(X, 
Y, Z, W), NONE),
+
/* YUV */
_T(YUYV, YUY2, SWIZ(X, Y, Z, W), YUY2),
_T(UYVY, UYVY, SWIZ(X, Y, Z, W), NONE),
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index ec8de96..3cae16d 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -460,6 +460,26 @@ etna_screen_get_timestamp(struct pipe_screen *pscreen)
 }
 
 static bool
+etna_format_is_etc2(enum pipe_format format)
+{
+   switch (format) {
+  case PIPE_FORMAT_ETC2_RGB8:
+  case PIPE_FORMAT_ETC2_SRGB8:
+  case PIPE_FORMAT_ETC2_RGB8A1:
+  case PIPE_FORMAT_ETC2_SRGB8A1:
+  case PIPE_FORMAT_ETC2_RGBA8:
+  case PIPE_FORMAT_ETC2_SRGBA8:
+  case PIPE_FORMAT_ETC2_R11_UNORM:
+  case PIPE_FORMAT_ETC2_R11_SNORM:
+  case PIPE_FORMAT_ETC2_RG11_UNORM:
+  case PIPE_FORMAT_ETC2_RG11_SNORM:
+ return true;
+  default:
+ return false;
+   }
+}
+
+static bool
 gpu_supports_texure_format(struct etna_screen *screen, uint32_t fmt,
enum pipe_format format)
 {
@@ -474,7 +494,12 @@ gpu_supports_texure_format(struct etna_screen *screen, 
uint32_t fmt,
if (fmt & EXT_FORMAT)
   supported = VIV_FEATURE(screen, chipMinorFeatures1, HALTI0);
 
-   if (util_format_is_snorm(format))
+   /* ETC2 is supported on HALTI0, however that implementation is buggy in
+* hardware. The blob driver does per-block patching to work around this.
+* As this is currently not implemented by etnaviv, enable it for HALTI1
+* (GC3000) only.
+*/
+   if (util_format_is_snorm(format) || etna_format_is_etc2(format))
   supported = VIV_FEATURE(screen, chipMinorFeatures2, HALTI1);
 
if (!supported)
-- 
2.7.4

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


[Mesa-dev] [PATCH] etnaviv: Use the correct LOG instruction on GC3000

2017-07-11 Thread Wladimir J. van der Laan
GC3000 has a new LOG instruction, similar to the new SIN and COS instructions.

Generate the new instruction sequence when appropriate; there are
two occasions, as part of LIT and the generator for the LG2
instruction itself.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_compiler.c | 63 +++---
 src/gallium/drivers/etnaviv/etnaviv_internal.h |  4 +-
 src/gallium/drivers/etnaviv/etnaviv_screen.c   |  2 +-
 3 files changed, 59 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c 
b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
index 07315f7..6435b84 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
@@ -1389,12 +1389,27 @@ trans_lit(const struct instr_translater *t, struct 
etna_compile *c,
else
   src_w = swizzle(src[0], SWIZZLE(W, W, W, W));
 
-   struct etna_inst ins[3] = { };
-   ins[0].opcode = INST_OPCODE_LOG;
-   ins[0].dst = etna_native_to_dst(inner_temp, INST_COMPS_X);
-   ins[0].src[2] = src_y;
+   if (c->specs->has_new_transcendentals) { /* Alternative LOG sequence */
+  emit_inst(c, &(struct etna_inst) {
+ .opcode = INST_OPCODE_LOG,
+ .dst = etna_native_to_dst(inner_temp, INST_COMPS_X | INST_COMPS_Y),
+ .src[2] = src_y,
+ .tex = { .amode=1 }, /* Unknown bit needs to be set */
+  });
+  emit_inst(c, &(struct etna_inst) {
+ .opcode = INST_OPCODE_MUL,
+ .dst = etna_native_to_dst(inner_temp, INST_COMPS_X),
+ .src[0] = etna_native_to_src(inner_temp, SWIZZLE(X, X, X, X)),
+ .src[1] = etna_native_to_src(inner_temp, SWIZZLE(Y, Y, Y, Y)),
+  });
+   } else {
+  struct etna_inst ins[3] = { };
+  ins[0].opcode = INST_OPCODE_LOG;
+  ins[0].dst = etna_native_to_dst(inner_temp, INST_COMPS_X);
+  ins[0].src[2] = src_y;
 
-   emit_inst(c, [0]);
+  emit_inst(c, [0]);
+   }
emit_inst(c, &(struct etna_inst) {
   .opcode = INST_OPCODE_MUL,
   .sat = 0,
@@ -1450,7 +1465,7 @@ static void
 trans_trig(const struct instr_translater *t, struct etna_compile *c,
const struct tgsi_full_instruction *inst, struct etna_inst_src *src)
 {
-   if (c->specs->has_new_sin_cos) { /* Alternative SIN/COS */
+   if (c->specs->has_new_transcendentals) { /* Alternative SIN/COS */
   /* On newer chips alternative SIN/COS instructions are implemented,
* which:
* - Need their input scaled by 1/pi instead of 2/pi
@@ -1613,6 +1628,40 @@ trans_trig(const struct instr_translater *t, struct 
etna_compile *c,
 }
 
 static void
+trans_lg2(const struct instr_translater *t, struct etna_compile *c,
+const struct tgsi_full_instruction *inst, struct etna_inst_src 
*src)
+{
+   if (c->specs->has_new_transcendentals) {
+  /* On newer chips alternative LOG instruction is implemented,
+   * which outputs an x and y component, which need to be multiplied to
+   * get the result.
+   */
+  struct etna_native_reg temp = etna_compile_get_inner_temp(c); /* only 
using .xy */
+  emit_inst(c, &(struct etna_inst) {
+ .opcode = INST_OPCODE_LOG,
+ .sat = 0,
+ .dst = etna_native_to_dst(temp, INST_COMPS_X | INST_COMPS_Y),
+ .src[2] = src[0],
+ .tex = { .amode=1 }, /* Unknown bit needs to be set */
+  });
+  emit_inst(c, &(struct etna_inst) {
+ .opcode = INST_OPCODE_MUL,
+ .sat = inst->Instruction.Saturate,
+ .dst = convert_dst(c, >Dst[0]),
+ .src[0] = etna_native_to_src(temp, SWIZZLE(X, X, X, X)),
+ .src[1] = etna_native_to_src(temp, SWIZZLE(Y, Y, Y, Y)),
+  });
+   } else {
+  emit_inst(c, &(struct etna_inst) {
+ .opcode = INST_OPCODE_LOG,
+ .sat = inst->Instruction.Saturate,
+ .dst = convert_dst(c, >Dst[0]),
+ .src[2] = src[0],
+  });
+   }
+}
+
+static void
 trans_dph(const struct instr_translater *t, struct etna_compile *c,
   const struct tgsi_full_instruction *inst, struct etna_inst_src *src)
 {
@@ -1753,7 +1802,7 @@ static const struct instr_translater 
translaters[TGSI_OPCODE_LAST] = {
INSTR(DST, trans_instr, .opc = INST_OPCODE_DST, .src = {0, 1, -1}),
INSTR(MAD, trans_instr, .opc = INST_OPCODE_MAD, .src = {0, 1, 2}),
INSTR(EX2, trans_instr, .opc = INST_OPCODE_EXP, .src = {2, -1, -1}),
-   INSTR(LG2, trans_instr, .opc = INST_OPCODE_LOG, .src = {2, -1, -1}),
+   INSTR(LG2, trans_lg2),
INSTR(SQRT, trans_instr, .opc = INST_OPCODE_SQRT, .src = {2, -1, -1}),
INSTR(FRC, trans_instr, .opc = INST_OPCODE_FRC, .src = {2, -1, -1}),
INSTR(CEIL, trans_instr, .opc = INST_OPCODE_CEIL, .src = {2, -1, -1}),
diff --git a/src/gallium/drivers/etnaviv/etnaviv_internal.h 
b/src/gallium/drivers/etnaviv/etnaviv_internal.h
index 1212fdf..8a31167 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_intern

[Mesa-dev] [PATCH] etnaviv: Reset indexed rendering information when not rendering indexed

2017-07-14 Thread Wladimir J. van der Laan
A dangling bo object would result in memory corruption while
loading a level in ioquake3_opengl2.

Fixes a problem introduced in 330d0607ed60fd3edca192e54b4246310f06652f.
Fix suggested by Lucas Stach.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_context.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c 
b/src/gallium/drivers/etnaviv/etnaviv_context.c
index e759095..3437906 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -198,6 +198,12 @@ etna_draw_vbo(struct pipe_context *pctx, const struct 
pipe_draw_info *info)
  BUG("Unsupported or no index buffer");
  return;
   }
+   } else {
+  ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.bo = 0;
+  ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.offset = 0;
+  ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.flags = 0;
+  ctx->index_buffer.FE_INDEX_STREAM_CONTROL = 0;
+  ctx->dirty |= ETNA_DIRTY_INDEX_BUFFER;
}
 
struct etna_shader_key key = {};
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH] etnaviv: Avoid duplicates in formats table

2017-07-21 Thread Wladimir J. van der Laan
On Fri, Jul 21, 2017 at 02:43:11PM +0200, Lucas Stach wrote:
> Am Freitag, den 21.07.2017, 12:49 +0200 schrieb Wladimir J. van der
> Laan:
> > Remove the following duplicates from the formats table:
> > 
> > - R8G8B8A8_UNORM (V_,_T)
> > - R8G8B8X8_UNORM (_T,_T)
> > - DXT3_RGBA (_T,_T)
> > 
> > Only the first has an effect because the _T overrides the V_ initializer,
> > the latter two were harmless duplications of the same.
> 
> Urgh, well spotted. Has this caused issues in any application?

> > -   V_(R8G8B8A8_UNORM,   UNSIGNED_BYTE, A8B8G8R8),
> > -   _T(R8G8B8A8_UNORM, A8B8G8R8, SWIZ(X, Y, Z, W), A8B8G8R8),
> > +   VT(R8G8B8A8_UNORM,   UNSIGNED_BYTE, A8B8G8R8, SWIZ(X, Y, Z, W), 
> > A8B8G8R8),

Nope, I haven't seen any difference with or without this patch.

Which is surprising to me, as R8G8B8A8_UNORM vertex format is commonly used for
per-vertex coloring. But it's possible Mesa accomodates somehow if this
format is missing.

Regards,
Wladimir

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


[Mesa-dev] [PATCH] etnaviv: Clear lbl_usage array correctly

2017-07-23 Thread Wladimir J. van der Laan
Fill the entire array instead of just a quarter. This avoids
crashes with large shaders.
(currently this never causes a problem because shaders larger than 2048/4
instructions are not supported by this driver on any hardware, but it will
cause problems in the future)

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_compiler.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c 
b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
index cc6bfc9..165ab74 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
@@ -2353,7 +2353,7 @@ etna_compile_shader(struct etna_shader_variant *v)
if (!c)
   return false;
 
-   memset(>lbl_usage, -1, ARRAY_SIZE(c->lbl_usage));
+   memset(>lbl_usage, -1, sizeof(c->lbl_usage));
 
const struct tgsi_token *tokens = v->shader->tokens;
 
-- 
2.7.4

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


[Mesa-dev] [PATCH 0/3] etnaviv: Support large shaders on GC3000

2017-07-24 Thread Wladimir J. van der Laan
This patch adds support for large shaders on GC3000. For example the "terrain"
glmark benchmark with a large fragment shader will work after this.

If the GPU supports ICACHE, shaders larger than the available state area will
be uploaded to a bo of their own and instructed to be loaded from memory on
demand. Small shaders will be uploaded in the usual way. This mimics the
behavior of the blob.

On GPUs that don't support ICACHE, this patch should make no difference.

Wladimir J. van der Laan (3):
  etnaviv: Update headers from rnndb
  etnaviv: Unified uniforms support
  etnaviv: Implement ICACHE

 src/gallium/drivers/etnaviv/etnaviv_compiler.c |  3 +-
 src/gallium/drivers/etnaviv/etnaviv_compiler.h |  5 ++
 src/gallium/drivers/etnaviv/etnaviv_emit.c | 71 +++---
 src/gallium/drivers/etnaviv/etnaviv_internal.h | 10 
 src/gallium/drivers/etnaviv/etnaviv_screen.c   | 19 ++-
 src/gallium/drivers/etnaviv/etnaviv_shader.c   | 45 +++-
 src/gallium/drivers/etnaviv/hw/state_3d.xml.h  | 14 +++--
 7 files changed, 140 insertions(+), 27 deletions(-)

-- 
2.7.4

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


[Mesa-dev] [PATCH 2/3] etnaviv: Unified uniforms support

2017-07-24 Thread Wladimir J. van der Laan
GC3000 has changed from a separate store for VS and PS uniforms
to a single, unified one. There is backwards compatibilty functionalty,
however this does not work correctly together with ICACHE.

This patch adds explicit support, although in the simplest way possible:
the PS/VS uniforms split is still fixed and hardcoded. It should
make no difference on hardware that does not have unified uniform
memory.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_emit.c | 19 +++
 src/gallium/drivers/etnaviv/etnaviv_internal.h |  6 ++
 src/gallium/drivers/etnaviv/etnaviv_screen.c   | 15 +++
 3 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c 
b/src/gallium/drivers/etnaviv/etnaviv_emit.c
index bfff699..273b3d0 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
@@ -747,10 +747,17 @@ etna_emit_state(struct etna_context *ctx)
   etna_set_state_multi(stream, ctx->specs.ps_offset,
ctx->shader_state.ps_inst_mem_size,
ctx->shader_state.PS_INST_MEM);
-  /*05000*/ etna_set_state_multi(stream, VIVS_VS_UNIFORMS(0),
+
+  if (ctx->specs.has_unified_uniforms) {
+ etna_set_state(stream, VIVS_VS_UNIFORM_BASE, 0);
+ etna_set_state(stream, VIVS_PS_UNIFORM_BASE, 
ctx->specs.max_vs_uniforms);
+  }
+  etna_set_state(stream, VIVS_VS_UNIFORM_CACHE, 
VIVS_VS_UNIFORM_CACHE_FLUSH);
+  etna_set_state_multi(stream, ctx->specs.vs_uniforms_offset,
  ctx->shader_state.vs_uniforms_size,
  ctx->shader_state.VS_UNIFORMS);
-  /*07000*/ etna_set_state_multi(stream, VIVS_PS_UNIFORMS(0),
+  etna_set_state(stream, VIVS_VS_UNIFORM_CACHE, 
VIVS_VS_UNIFORM_CACHE_FLUSH | VIVS_VS_UNIFORM_CACHE_PS);
+  etna_set_state_multi(stream, ctx->specs.ps_uniforms_offset,
  ctx->shader_state.ps_uniforms_size,
  ctx->shader_state.PS_UNIFORMS);
 
@@ -764,19 +771,23 @@ etna_emit_state(struct etna_context *ctx)
   memcpy(ctx->gpu3d.PS_UNIFORMS, ctx->shader_state.PS_UNIFORMS,
  ctx->shader_state.ps_uniforms_size * 4);
} else {
+  /* ideally this cache would only be flushed if there are VS uniform 
changes */
+  etna_set_state(stream, VIVS_VS_UNIFORM_CACHE, 
VIVS_VS_UNIFORM_CACHE_FLUSH);
   etna_coalesce_start(stream, );
   for (int x = 0; x < ctx->shader.vs->uniforms.const_count; ++x) {
  if (ctx->gpu3d.VS_UNIFORMS[x] != ctx->shader_state.VS_UNIFORMS[x]) {
-/*05000*/ EMIT_STATE(VS_UNIFORMS(x), 
ctx->shader_state.VS_UNIFORMS[x]);
+etna_coalsence_emit(stream, , 
ctx->specs.vs_uniforms_offset + x*4, ctx->shader_state.VS_UNIFORMS[x]);
 ctx->gpu3d.VS_UNIFORMS[x] = ctx->shader_state.VS_UNIFORMS[x];
  }
   }
   etna_coalesce_end(stream, );
 
+  /* ideally this cache would only be flushed if there are PS uniform 
changes */
+  etna_set_state(stream, VIVS_VS_UNIFORM_CACHE, 
VIVS_VS_UNIFORM_CACHE_FLUSH | VIVS_VS_UNIFORM_CACHE_PS);
   etna_coalesce_start(stream, );
   for (int x = 0; x < ctx->shader.fs->uniforms.const_count; ++x) {
  if (ctx->gpu3d.PS_UNIFORMS[x] != ctx->shader_state.PS_UNIFORMS[x]) {
-/*07000*/ EMIT_STATE(PS_UNIFORMS(x), 
ctx->shader_state.PS_UNIFORMS[x]);
+etna_coalsence_emit(stream, , 
ctx->specs.ps_uniforms_offset + x*4, ctx->shader_state.PS_UNIFORMS[x]);
 ctx->gpu3d.PS_UNIFORMS[x] = ctx->shader_state.PS_UNIFORMS[x];
  }
   }
diff --git a/src/gallium/drivers/etnaviv/etnaviv_internal.h 
b/src/gallium/drivers/etnaviv/etnaviv_internal.h
index 8a31167..5c13f23 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_internal.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_internal.h
@@ -74,6 +74,8 @@ struct etna_specs {
unsigned has_new_transcendentals : 1;
/* supports single-buffer rendering with multiple pixel pipes */
unsigned single_buffer : 1;
+   /* has unified uniforms memory */
+   unsigned has_unified_uniforms : 1;
/* can use any kind of wrapping mode on npot textures */
unsigned npot_tex_any_wrap;
/* number of bits per TS tile */
@@ -100,6 +102,10 @@ struct etna_specs {
uint32_t vs_offset;
/* pixel shader memory address*/
uint32_t ps_offset;
+   /* vertex shader uniforms address*/
+   uint32_t vs_uniforms_offset;
+   /* pixel shader uniforms address*/
+   uint32_t ps_uniforms_offset;
/* vertex/fragment shader max instructions */
uint32_t max_instructions;
/* maximum number of varyings */
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index 5dc436d..81480e9 

[Mesa-dev] [PATCH 1/3] etnaviv: Update headers from rnndb

2017-07-24 Thread Wladimir J. van der Laan
Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/hw/state_3d.xml.h | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/hw/state_3d.xml.h 
b/src/gallium/drivers/etnaviv/hw/state_3d.xml.h
index eacd868..d8b7a94 100644
--- a/src/gallium/drivers/etnaviv/hw/state_3d.xml.h
+++ b/src/gallium/drivers/etnaviv/hw/state_3d.xml.h
@@ -13,7 +13,7 @@ The rules-ng-ng source files this header was generated from 
are:
 - state_hi.xml  (  26403 bytes, from 2017-01-07 14:27:54)
 - copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
 - state_2d.xml  (  51552 bytes, from 2016-10-29 07:29:22)
-- state_3d.xml  (  67249 bytes, from 2017-07-07 06:41:31)
+- state_3d.xml  (  67197 bytes, from 2017-07-23 10:53:21)
 - state_vg.xml  (   5975 bytes, from 2016-10-29 07:29:22)
 
 Copyright (C) 2012-2017 by the following authors:
@@ -278,10 +278,10 @@ DEALINGS IN THE SOFTWARE.
 #define VIVS_VS_RANGE_HIGH__SHIFT  16
 #define VIVS_VS_RANGE_HIGH(x)  (((x) << 
VIVS_VS_RANGE_HIGH__SHIFT) & VIVS_VS_RANGE_HIGH__MASK)
 
-#define VIVS_VS_NEW_UNK00860   0x0860
-#define VIVS_VS_NEW_UNK00860_UNK0  0x0001
-#define VIVS_VS_NEW_UNK00860_PS
0x0010
-#define VIVS_VS_NEW_UNK00860_UNK12 0x1000
+#define VIVS_VS_UNIFORM_CACHE  0x0860
+#define VIVS_VS_UNIFORM_CACHE_FLUSH0x0001
+#define VIVS_VS_UNIFORM_CACHE_PS   0x0010
+#define VIVS_VS_UNIFORM_CACHE_UNK120x1000
 
 #define VIVS_VS_UNIFORM_BASE   0x0864
 
@@ -1199,6 +1199,7 @@ DEALINGS IN THE SOFTWARE.
 #define VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_A__MASK
0x0070
 #define VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_A__SHIFT   20
 #define VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_A(x)   (((x) << 
VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_A__SHIFT) & 
VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_A__MASK)
+#define VIVS_TE_SAMPLER_CONFIG1_UNK25  0x0200
 #define VIVS_TE_SAMPLER_CONFIG1_HALIGN__MASK   0x1c00
 #define VIVS_TE_SAMPLER_CONFIG1_HALIGN__SHIFT  26
 #define VIVS_TE_SAMPLER_CONFIG1_HALIGN(x)  (((x) << 
VIVS_TE_SAMPLER_CONFIG1_HALIGN__SHIFT) & VIVS_TE_SAMPLER_CONFIG1_HALIGN__MASK)
@@ -1303,6 +1304,7 @@ DEALINGS IN THE SOFTWARE.
 #define VIVS_NTE_SAMPLER_CONFIG1_SWIZZLE_A__MASK   0x0070
 #define VIVS_NTE_SAMPLER_CONFIG1_SWIZZLE_A__SHIFT  20
 #define VIVS_NTE_SAMPLER_CONFIG1_SWIZZLE_A(x)  (((x) << 
VIVS_NTE_SAMPLER_CONFIG1_SWIZZLE_A__SHIFT) & 
VIVS_NTE_SAMPLER_CONFIG1_SWIZZLE_A__MASK)
+#define VIVS_NTE_SAMPLER_CONFIG1_UNK25 0x0200
 #define VIVS_NTE_SAMPLER_CONFIG1_HALIGN__MASK  0x1c00
 #define VIVS_NTE_SAMPLER_CONFIG1_HALIGN__SHIFT 26
 #define VIVS_NTE_SAMPLER_CONFIG1_HALIGN(x) (((x) << 
VIVS_NTE_SAMPLER_CONFIG1_HALIGN__SHIFT) & VIVS_NTE_SAMPLER_CONFIG1_HALIGN__MASK)
@@ -1313,6 +1315,8 @@ DEALINGS IN THE SOFTWARE.
 
 #define VIVS_NTE_SAMPLER_UNK10500(i0) (0x00010500 + 
0x4*(i0))
 
+#define VIVS_NTE_SAMPLER_UNK10700(i0) (0x00010700 + 
0x4*(i0))
+
 #define VIVS_NTE_SAMPLER_ADDR(i0) (0x00010800 + 
0x40*(i0))
 #define VIVS_NTE_SAMPLER_ADDR__ESIZE   0x0040
 #define VIVS_NTE_SAMPLER_ADDR__LEN 0x0020
-- 
2.7.4

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


[Mesa-dev] [PATCH 3/3] etnaviv: Implement ICACHE

2017-07-24 Thread Wladimir J. van der Laan
This patch adds support for large shaders on GC3000. For example the "terrain"
glmark benchmark with a large fragment shader will work after this.

If the GPU supports ICACHE, shaders larger than the available state area will
be uploaded to a bo of their own and instructed to be loaded from memory on
demand. Small shaders will be uploaded in the usual way. This mimics the
behavior of the blob.

On GPUs that don't support ICACHE, this patch should make no difference.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_compiler.c |  3 +-
 src/gallium/drivers/etnaviv/etnaviv_compiler.h |  5 +++
 src/gallium/drivers/etnaviv/etnaviv_emit.c | 52 ++
 src/gallium/drivers/etnaviv/etnaviv_internal.h |  4 ++
 src/gallium/drivers/etnaviv/etnaviv_screen.c   |  4 +-
 src/gallium/drivers/etnaviv/etnaviv_shader.c   | 45 +-
 6 files changed, 95 insertions(+), 18 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c 
b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
index fbe66d0..0664d52 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
@@ -2277,7 +2277,7 @@ etna_compile_check_limits(struct etna_compile *c)
/* round up number of uniforms, including immediates, in units of four */
int num_uniforms = c->imm_base / 4 + (c->imm_size + 3) / 4;
 
-   if (c->inst_ptr > c->specs->max_instructions) {
+   if (!c->specs->has_icache && c->inst_ptr > c->specs->max_instructions) {
   DBG("Number of instructions (%d) exceeds maximum %d", c->inst_ptr,
   c->specs->max_instructions);
   return false;
@@ -2501,6 +2501,7 @@ etna_compile_shader(struct etna_shader_variant *v)
v->vs_pointsize_out_reg = -1;
v->ps_color_out_reg = -1;
v->ps_depth_out_reg = -1;
+   v->needs_icache = c->inst_ptr > c->specs->max_instructions;
copy_uniform_state_to_shader(c, v);
 
if (c->info.processor == PIPE_SHADER_VERTEX) {
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.h 
b/src/gallium/drivers/etnaviv/etnaviv_compiler.h
index 88a093f..f5c1689 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.h
@@ -94,12 +94,17 @@ struct etna_shader_variant {
/* unknown input property (XX_INPUT_COUNT, field UNK8) */
uint32_t input_count_unk8;
 
+   /* shader is larger than GPU instruction limit, thus needs icache */
+   bool needs_icache;
+
/* shader variants form a linked list */
struct etna_shader_variant *next;
 
/* replicated here to avoid passing extra ptrs everywhere */
struct etna_shader *shader;
struct etna_shader_key key;
+
+   struct etna_bo *bo; /* cached code memory bo handle (for icache) */
 };
 
 struct etna_varying {
diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c 
b/src/gallium/drivers/etnaviv/etnaviv_emit.c
index 273b3d0..c2117d5 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
@@ -421,9 +421,6 @@ etna_emit_state(struct etna_context *ctx)
if (unlikely(dirty & (ETNA_DIRTY_SHADER))) {
   /*00830*/ EMIT_STATE(VS_LOAD_BALANCING, 
ctx->shader_state.VS_LOAD_BALANCING);
   /*00838*/ EMIT_STATE(VS_START_PC, ctx->shader_state.VS_START_PC);
-  if (ctx->specs.has_shader_range_registers) {
- /*0085C*/ EMIT_STATE(VS_RANGE, (ctx->shader_state.vs_inst_mem_size / 
4 - 1) << 16);
-  }
}
if (unlikely(dirty & (ETNA_DIRTY_VIEWPORT))) {
   /*00A00*/ EMIT_STATE_FIXP(PA_VIEWPORT_SCALE_X, 
ctx->viewport.PA_VIEWPORT_SCALE_X);
@@ -534,10 +531,6 @@ etna_emit_state(struct etna_context *ctx)
   : ctx->shader_state.PS_TEMP_REGISTER_CONTROL);
   /*01010*/ EMIT_STATE(PS_CONTROL, ctx->shader_state.PS_CONTROL);
   /*01018*/ EMIT_STATE(PS_START_PC, ctx->shader_state.PS_START_PC);
-  if (ctx->specs.has_shader_range_registers) {
- /*0101C*/ EMIT_STATE(PS_RANGE, ((ctx->shader_state.ps_inst_mem_size / 
4 - 1 + 0x100) << 16) |
-0x100);
-  }
}
if (unlikely(dirty & (ETNA_DIRTY_ZSA | ETNA_DIRTY_FRAMEBUFFER))) {
   uint32_t val = etna_zsa_state(ctx->zsa)->PE_DEPTH_CONFIG;
@@ -739,14 +732,43 @@ etna_emit_state(struct etna_context *ctx)
if (dirty & (ETNA_DIRTY_SHADER)) {
   /* Special case: a new shader was loaded; simply re-load all uniforms and
* shader code at once */
-  /*04000 or 0C000*/
-  etna_set_state_multi(stream, ctx->specs.vs_offset,
-   ctx->shader_state.vs_inst_mem_size,
-   ctx->shader_state.VS_INST_MEM);
-  /*06000 or 0D000*/
-  etna_set_state_multi(stream, ctx->specs.ps_offset,
-   

[Mesa-dev] [PATCH] etnaviv: Avoid duplicates in formats table

2017-07-21 Thread Wladimir J. van der Laan
Remove the following duplicates from the formats table:

- R8G8B8A8_UNORM (V_,_T)
- R8G8B8X8_UNORM (_T,_T)
- DXT3_RGBA (_T,_T)

Only the first has an effect because the _T overrides the V_ initializer,
the latter two were harmless duplications of the same.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_format.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
b/src/gallium/drivers/etnaviv/etnaviv_format.c
index 492499a..69e07bc 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
@@ -155,7 +155,7 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
 
V_(A8B8G8R8_UNORM,   UNSIGNED_BYTE, NONE),
 
-   V_(R8G8B8A8_UNORM,   UNSIGNED_BYTE, A8B8G8R8),
+   VT(R8G8B8A8_UNORM,   UNSIGNED_BYTE, A8B8G8R8, SWIZ(X, Y, Z, W), A8B8G8R8),
V_(R8G8B8A8_SNORM,   BYTE,  A8B8G8R8),
_T(R8G8B8X8_UNORM,   X8B8G8R8,  SWIZ(X, Y, Z, W), X8B8G8R8),
V_(R8G8B8A8_UINT,UNSIGNED_BYTE, A8B8G8R8),
@@ -163,9 +163,6 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
V_(R8G8B8A8_USCALED, UNSIGNED_BYTE, A8B8G8R8),
V_(R8G8B8A8_SSCALED, BYTE,  A8B8G8R8),
 
-   _T(R8G8B8A8_UNORM, A8B8G8R8, SWIZ(X, Y, Z, W), A8B8G8R8),
-   _T(R8G8B8X8_UNORM, X8B8G8R8, SWIZ(X, Y, Z, W), X8B8G8R8),
-
_T(B8G8R8A8_UNORM, A8R8G8B8, SWIZ(X, Y, Z, W), A8R8G8B8),
_T(B8G8R8X8_UNORM, X8R8G8B8, SWIZ(X, Y, Z, W), X8R8G8B8),
 
@@ -230,7 +227,6 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
_T(DXT1_RGB,  DXT1,  SWIZ(X, Y, Z, W), NONE),
_T(DXT1_RGBA, DXT1,  SWIZ(X, Y, Z, W), NONE),
_T(DXT3_RGBA, DXT2_DXT3, SWIZ(X, Y, Z, W), NONE),
-   _T(DXT3_RGBA, DXT2_DXT3, SWIZ(X, Y, Z, W), NONE),
_T(DXT5_RGBA, DXT4_DXT5, SWIZ(X, Y, Z, W), NONE),
 
_T(ETC2_RGB8,   EXT_NONE | EXT_FORMAT,  SWIZ(X, 
Y, Z, W), NONE), /* Extd. format NONE doubles as ETC2_RGB8 */
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 11/11] etnaviv: advertise supported dmabuf modifiers

2017-06-27 Thread Wladimir J. van der Laan
On Fri, Jun 23, 2017 at 05:50:28PM +0200, Lucas Stach wrote:
> Simply advertise all supported modifiers, independent of the format.
> Special formats, like compressed, which don't support all those modifiers
> are already culled from the dmabuf format list, as we don't support
> the render target binding for them.

The SPLIT formats are only supported on hardware with multiple pixel pipes.

Should this be checked, or is it harmless to advertize them unconditionally?

Reviewed-by: Wladimir J. van der Laan

> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_screen.c | 36 
> 
>  1 file changed, 36 insertions(+)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
> b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index b70897b6e41f..571f0b3d42d8 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -45,6 +45,8 @@
>  
>  #include "state_tracker/drm_driver.h"
>  
> +#include 
> +
>  #define ETNA_DRM_VERSION(major, minor) ((major) << 16 | (minor))
>  #define ETNA_DRM_VERSION_FENCE_FD  ETNA_DRM_VERSION(1, 1)
>  
> @@ -545,6 +547,39 @@ etna_screen_is_format_supported(struct pipe_screen 
> *pscreen,
> return usage == allowed;
>  }
>  
> +const uint64_t supported_modifiers[] = {
> +   DRM_FORMAT_MOD_LINEAR,
> +   DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED,
> +   DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED,
> +   DRM_FORMAT_MOD_VIVANTE_TILED,
> +   DRM_FORMAT_MOD_VIVANTE_SUPER_TILED,
> +};
> +
> +static void
> +etna_screen_query_dmabuf_modifiers(struct pipe_screen *screen,
> +   enum pipe_format format, int max,
> +   uint64_t *modifiers,
> +   unsigned int *external_only, int *count)
> +{
> +   int i;
> +
> +   if (!max) {
> +  *count = ARRAY_SIZE(supported_modifiers);
> +  return;
> +   }
> +
> +   if (max > ARRAY_SIZE(supported_modifiers))
> +  max = ARRAY_SIZE(supported_modifiers);
> +
> +   for (i = 0; i < max; i++) {
> +  modifiers[i] = supported_modifiers[i];
> +  if (external_only)
> + external_only[i] = 0;
> +   }
> +
> +   *count = i;
> +}
> +
>  static boolean
>  etna_get_specs(struct etna_screen *screen)
>  {
> @@ -839,6 +874,7 @@ etna_screen_create(struct etna_device *dev, struct 
> etna_gpu *gpu,
> pscreen->get_timestamp = etna_screen_get_timestamp;
> pscreen->context_create = etna_context_create;
> pscreen->is_format_supported = etna_screen_is_format_supported;
> +   pscreen->query_dmabuf_modifiers = etna_screen_query_dmabuf_modifiers;
>  
> etna_fence_screen_init(pscreen);
> etna_query_screen_init(pscreen);
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 04/11] etnaviv: pad scanout buffer size to RS alignment

2017-06-27 Thread Wladimir J. van der Laan
On Fri, Jun 23, 2017 at 05:50:21PM +0200, Lucas Stach wrote:
> This fixes failures to import the scanout buffer with screen resolutions
> that don't satisfy teh RS alignment restrictions, like 1680x1050.

Thanks. I remember having this issue on OLPC, but never came up with a good
solution.

Reviewed-by: Wladimir J. van der Laan

> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 13 +++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index c6e7e98837b6..5cd20fafba49 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -215,9 +215,18 @@ etna_resource_alloc(struct pipe_screen *pscreen, 
> unsigned layout,
> rsc->ts_bo = 0; /* TS is only created when first bound to surface */
>  
> if (templat->bind & PIPE_BIND_SCANOUT) {
> +  struct pipe_resource scanout_templat = *templat;
>struct winsys_handle handle;
> -  rsc->scanout = renderonly_scanout_for_resource(>base, screen->ro,
> - );
> +  unsigned padX, padY;
> +
> +  /* pad scanout buffer size to be compatible with the RS */
> +  padX = ETNA_RS_WIDTH_MASK + 1;
> +  padY = (ETNA_RS_HEIGHT_MASK + 1) * screen->specs.pixel_pipes;
> +  scanout_templat.width0 = align(scanout_templat.width0, padX);
> +  scanout_templat.height0 = align(scanout_templat.height0, padY);
> +
> +  rsc->scanout = renderonly_scanout_for_resource(_templat,
> + screen->ro, );
>if (!rsc->scanout)
>   goto free_rsc;
>  
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 02/11] etnaviv: fix memory leak when BO allocation fails

2017-06-27 Thread Wladimir J. van der Laan
On Fri, Jun 23, 2017 at 05:50:19PM +0200, Lucas Stach wrote:
> The resource struct is already allocated at this point and should be
> free properly.
> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index dfd087071193..97e0a15597fa 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -208,7 +208,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned 
> layout,
> struct etna_bo *bo = etna_bo_new(screen->dev, size, flags);
> if (unlikely(bo == NULL)) {
>BUG("Problem allocating video memory for resource");
> -  return NULL;
> +  goto free_rsc;
> }
>  
> rsc->bo = bo;
> @@ -223,6 +223,10 @@ etna_resource_alloc(struct pipe_screen *pscreen, 
> unsigned layout,
> }
>  
> return >base;
> +
> +free_rsc:
> +   FREE(rsc);
> +   return NULL;
>  }
>  
>  static struct pipe_resource *
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 05/11] etnaviv: increment correct seqno for external resources

2017-06-28 Thread Wladimir J. van der Laan
On Fri, Jun 23, 2017 at 05:50:22PM +0200, Lucas Stach wrote:
> If we import a dma-buf with a sampler/pixel pipe incompatible modifier,
> the imported buffer will end up in an external resource view. As
> resource_changed signals the change of the imported resource, we need
> to update the external view seqno, instead of the base resource seqno.

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 5cd20fafba49..43f63f8908a0 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -311,7 +311,10 @@ etna_resource_changed(struct pipe_screen *pscreen, 
> struct pipe_resource *prsc)
>  {
> struct etna_resource *res = etna_resource(prsc);
>  
> -   res->seqno++;
> +   if (res->external)
> +  etna_resource(res->external)->seqno++;
> +   else
> +  res->seqno++;
>  }
>  
>  static void
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 06/11] etnaviv: also update textures from external resources

2017-06-28 Thread Wladimir J. van der Laan
On Fri, Jun 23, 2017 at 05:50:23PM +0200, Lucas Stach wrote:
> This reworks the logic in etna_update_sampler_source to select the
> newest resource view for updating the texture view. This should make
> the logic easier to follow and fixes texture updates from imported
> dma-bufs.

Comment in-line

> Signed-off-by: Lucas Stach 
> ---
>  src/gallium/drivers/etnaviv/etnaviv_texture.c | 23 +++
>  1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c 
> b/src/gallium/drivers/etnaviv/etnaviv_texture.c
> index df77829078c0..b7e424f89bba 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_texture.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c
> @@ -113,16 +113,23 @@ etna_delete_sampler_state(struct pipe_context *pctx, 
> void *ss)
>  static void
>  etna_update_sampler_source(struct pipe_sampler_view *view)
>  {
> +   struct etna_resource *base = etna_resource(view->texture);
> +   struct etna_resource *to = base, *from = base;
>  
> +   if (base->external && etna_resource_newer(etna_resource(base->external), 
> base))
> +  from = etna_resource(base->external);
> +
> +   if (base->texture)
> +  to = etna_resource(base->texture);
> +
> +   if ((to != from) && etna_resource_older(to, from)) {
> +  etna_copy_resource(view->context, >base, >base, 0,
> + view->texture->last_level);
> +  to->seqno = from->seqno;
> +   } else if ((to == from) && etna_resource_needs_flush(to)) {
> +  etna_copy_resource(view->context, >base, >base, 0,

Why do this copy if to==from?

>   view->texture->last_level);
> +  to->flush_seqno = from->seqno;
> }
>  }
>  
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 08/11] etnaviv: fold etna_screen_bo_get_handle into etna_resource_get_handle

2017-06-28 Thread Wladimir J. van der Laan
On Fri, Jun 23, 2017 at 05:50:25PM +0200, Lucas Stach wrote:
> There is no point in keeping this indirection. Makes the code easier to
> follow.
> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>

Seems to make sense - etna_screen_bo_get_handle doesn't actually do anything
screen specific.

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 14 --
>  src/gallium/drivers/etnaviv/etnaviv_screen.c   | 19 ---
>  src/gallium/drivers/etnaviv/etnaviv_screen.h   |  4 
>  3 files changed, 12 insertions(+), 25 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index f006d24a1bba..66d96aacbbe7 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -471,13 +471,23 @@ etna_resource_get_handle(struct pipe_screen *pscreen,
>   struct winsys_handle *handle, unsigned usage)
>  {
> struct etna_resource *rsc = etna_resource(prsc);
> +   handle->stride = rsc->levels[0].stride;
>  
> if (handle->type == DRM_API_HANDLE_TYPE_KMS &&
> renderonly_get_handle(rsc->scanout, handle))
>return TRUE;
>  
> -   return etna_screen_bo_get_handle(pscreen, rsc->bo, rsc->levels[0].stride,
> -handle);
> +   if (handle->type == DRM_API_HANDLE_TYPE_SHARED) {
> +  return etna_bo_get_name(rsc->bo, >handle) == 0;
> +   } else if (handle->type == DRM_API_HANDLE_TYPE_KMS) {
> +  handle->handle = etna_bo_handle(rsc->bo);
> +  return TRUE;
> +   } else if (handle->type == DRM_API_HANDLE_TYPE_FD) {
> +  handle->handle = etna_bo_dmabuf(rsc->bo);
> +  return TRUE;
> +   } else {
> +  return FALSE;
> +   }
>  }
>  
>  void
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
> b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index 6c0735e0fbf2..b70897b6e41f 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -696,25 +696,6 @@ fail:
> return false;
>  }
>  
> -boolean
> -etna_screen_bo_get_handle(struct pipe_screen *pscreen, struct etna_bo *bo,
> -  unsigned stride, struct winsys_handle *whandle)
> -{
> -   whandle->stride = stride;
> -
> -   if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
> -  return etna_bo_get_name(bo, >handle) == 0;
> -   } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
> -  whandle->handle = etna_bo_handle(bo);
> -  return TRUE;
> -   } else if (whandle->type == DRM_API_HANDLE_TYPE_FD) {
> -  whandle->handle = etna_bo_dmabuf(bo);
> -  return TRUE;
> -   } else {
> -  return FALSE;
> -   }
> -}
> -
>  struct etna_bo *
>  etna_screen_bo_from_handle(struct pipe_screen *pscreen,
> struct winsys_handle *whandle, unsigned 
> *out_stride)
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.h 
> b/src/gallium/drivers/etnaviv/etnaviv_screen.h
> index bec740b0a000..dc57a38dbb80 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.h
> @@ -84,10 +84,6 @@ etna_screen(struct pipe_screen *pscreen)
> return (struct etna_screen *)pscreen;
>  }
>  
> -boolean
> -etna_screen_bo_get_handle(struct pipe_screen *pscreen, struct etna_bo *bo,
> -  unsigned stride, struct winsys_handle *whandle);
> -
>  struct etna_bo *
>  etna_screen_bo_from_handle(struct pipe_screen *pscreen,
> struct winsys_handle *whandle, unsigned 
> *out_stride);
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 06/11] etnaviv: also update textures from external resources

2017-06-28 Thread Wladimir J. van der Laan
> > Why do this copy if to==from?
> 
> Tile-status resolve. We currently don't support sampler TS (which is

Ah of course.

Might make sense to add a comment mentioning this, it's not straightforward
when reading the code :)

> probably worth implementing, as it has potentially large performance
> gains for the render to texture cases).

Agreed.

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

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


Re: [Mesa-dev] [PATCH 07/11] etnaviv: implement resource import with modifier

2017-06-28 Thread Wladimir J. van der Laan
On Fri, Jun 23, 2017 at 05:50:24PM +0200, Lucas Stach wrote:
> This implements resource import with modifier, deriving the correct
> internal layout from the modifier and constructing a render compatible
> base resource if needed.
> 
> This removes the special cases for DDX and renderonly scanout allocated
> buffers, as the linear modifier is enough to trigger correct handling
> of those buffers.

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 112 
> +
>  1 file changed, 78 insertions(+), 34 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 43f63f8908a0..f006d24a1bba 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -36,6 +36,29 @@
>  #include "util/u_inlines.h"
>  #include "util/u_memory.h"
>  
> +#include 
> +
> +#ifndef DRM_FORMAT_MOD_INVALID
> +#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
> +#endif
> +
> +static unsigned int modifier_to_layout(uint64_t modifier)
> +{
> +   switch (modifier) {
> +   case DRM_FORMAT_MOD_VIVANTE_TILED:
> +  return ETNA_LAYOUT_TILED;
> +   case DRM_FORMAT_MOD_VIVANTE_SUPER_TILED:
> +  return ETNA_LAYOUT_SUPER_TILED;
> +   case DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED:
> +  return ETNA_LAYOUT_MULTI_TILED;
> +   case DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED:
> +  return ETNA_LAYOUT_MULTI_SUPERTILED;
> +   case DRM_FORMAT_MOD_LINEAR:
> +   default:
> +  return ETNA_LAYOUT_LINEAR;
> +   }
> +}
> +
>  /* A tile is 4x4 pixels, having 'screen->specs.bits_per_tile' of tile status.
>   * So, in a buffer of N pixels, there are N / (4 * 4) tiles.
>   * We need N * screen->specs.bits_per_tile / (4 * 4) bits of tile status, or
> @@ -141,6 +164,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned 
> layout,
>  const struct pipe_resource *templat)
>  {
> struct etna_screen *screen = etna_screen(pscreen);
> +   struct etna_resource *rsc;
> unsigned size;
>  
> DBG_F(ETNA_DBG_RESOURCE_MSGS,
> @@ -186,8 +210,36 @@ etna_resource_alloc(struct pipe_screen *pscreen, 
> unsigned layout,
>   paddingY = min_paddingY;
> }
>  
> -   struct etna_resource *rsc = CALLOC_STRUCT(etna_resource);
> +   if (templat->bind & PIPE_BIND_SCANOUT) {
> +  struct pipe_resource scanout_templat = *templat;
> +  struct renderonly_scanout *scanout;
> +  struct winsys_handle handle;
> +  unsigned padX, padY;
>  
> +  /* pad scanout buffer size to be compatible with the RS */
> +  padX = ETNA_RS_WIDTH_MASK + 1;
> +  padY = (ETNA_RS_HEIGHT_MASK + 1) * screen->specs.pixel_pipes;
> +  scanout_templat.width0 = align(scanout_templat.width0, padX);
> +  scanout_templat.height0 = align(scanout_templat.height0, padY);
> +
> +  scanout = renderonly_scanout_for_resource(_templat,
> +screen->ro, );
> +  if (!scanout)
> + return NULL;
> +
> +  rsc = etna_resource(pscreen->resource_from_handle(pscreen, templat,
> +,
> +
> PIPE_HANDLE_USAGE_WRITE));
> +  close(handle.handle);
> +  if (!rsc)
> + return NULL;
> +
> +  rsc->scanout = scanout;
> +
> +  return >base;
> +   }
> +
> +   rsc = CALLOC_STRUCT(etna_resource);
> if (!rsc)
>return NULL;
>  
> @@ -214,30 +266,6 @@ etna_resource_alloc(struct pipe_screen *pscreen, 
> unsigned layout,
> rsc->bo = bo;
> rsc->ts_bo = 0; /* TS is only created when first bound to surface */
>  
> -   if (templat->bind & PIPE_BIND_SCANOUT) {
> -  struct pipe_resource scanout_templat = *templat;
> -  struct winsys_handle handle;
> -  unsigned padX, padY;
> -
> -  /* pad scanout buffer size to be compatible with the RS */
> -  padX = ETNA_RS_WIDTH_MASK + 1;
> -  padY = (ETNA_RS_HEIGHT_MASK + 1) * screen->specs.pixel_pipes;
> -  scanout_templat.width0 = align(scanout_templat.width0, padX);
> -  scanout_templat.height0 = align(scanout_templat.height0, padY);
> -
> -  rsc->scanout = renderonly_scanout_for_resource(_templat,
> - screen->ro, );
> -  if (!rsc->scanout)
> - goto free_rsc;
> -
> -  rsc->external = pscreen->resour

Re: [Mesa-dev] [PATCH 09/11] etnaviv: fill in modifier in etna_resource_get_handle

2017-06-28 Thread Wladimir J. van der Laan
On Fri, Jun 23, 2017 at 05:50:26PM +0200, Lucas Stach wrote:
> This allows the state trackers to know the tiling layout of the
> resource and pass this through the various userspace protocols.

> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>

Comment inline.

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 30 
> +-
>  1 file changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 66d96aacbbe7..df5a5700bc19 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -464,6 +464,24 @@ fail:
> return NULL;
>  }
>  
> +static uint64_t layout_to_modifier(unsigned int layout)
> +{
> +   switch (layout) {
> +   case ETNA_LAYOUT_TILED:
> +  return DRM_FORMAT_MOD_VIVANTE_TILED;
> +   case ETNA_LAYOUT_SUPER_TILED:
> +  return DRM_FORMAT_MOD_VIVANTE_SUPER_TILED;
> +   case ETNA_LAYOUT_MULTI_TILED:
> +  return DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED;
> +   case ETNA_LAYOUT_MULTI_SUPERTILED:
> +  return DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED;
> +   case ETNA_LAYOUT_LINEAR:
> +  return DRM_FORMAT_MOD_LINEAR;
> +   default:
> +  return DRM_FORMAT_MOD_INVALID;
> +   }
> +}
> +

It would make sense to put this function after modifier_to_layout
as introduced in 07/11: in the rare case when a tiling layout is added,
both need to be updated, after all. 

>  static boolean
>  etna_resource_get_handle(struct pipe_screen *pscreen,
>   struct pipe_context *pctx,
> @@ -472,10 +490,20 @@ etna_resource_get_handle(struct pipe_screen *pscreen,
>  {
> struct etna_resource *rsc = etna_resource(prsc);
> handle->stride = rsc->levels[0].stride;
> +   handle->modifier = layout_to_modifier(rsc->layout);
>  
> if (handle->type == DRM_API_HANDLE_TYPE_KMS &&
> -   renderonly_get_handle(rsc->scanout, handle))
> +   renderonly_get_handle(rsc->scanout, handle)) {
> +  /*
> +   * If we export the renderonly handle and the scanout BO is attached as
> +   * an external resource we need to fill in the modifier from the 
> external
> +   * resource.
> +   */
> +  if (rsc->external)
> + handle->modifier = 
> layout_to_modifier(etna_resource(rsc->external)->layout);
> +
>return TRUE;
> +   }
>  
> if (handle->type == DRM_API_HANDLE_TYPE_SHARED) {
>return etna_bo_get_name(rsc->bo, >handle) == 0;
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/11] etnaviv: implement resource creation with modifier

2017-06-28 Thread Wladimir J. van der Laan
On Fri, Jun 23, 2017 at 05:50:27PM +0200, Lucas Stach wrote:
> This allows to create buffers with a specific tiling layout, which is 
> primarily
> used by GBM to allocate the EGL back buffers with the correct tiling/modifier
> for use with the scanout engines.
> 
> Signed-off-by: Lucas Stach 
> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 97 
> --
>  src/gallium/drivers/etnaviv/etnaviv_resource.h |  2 +-
>  src/gallium/drivers/etnaviv/etnaviv_texture.c  |  2 +-
>  src/gallium/drivers/etnaviv/etnaviv_transfer.c |  2 +-
>  4 files changed, 96 insertions(+), 7 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index df5a5700bc19..8462012b9d5f 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -161,7 +161,7 @@ setup_miptree(struct etna_resource *rsc, unsigned 
> paddingX, unsigned paddingY,
>  /* Create a new resource object, using the given template info */
>  struct pipe_resource *
>  etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
> -const struct pipe_resource *templat)
> +uint64_t modifier, const struct pipe_resource *templat)
>  {
> struct etna_screen *screen = etna_screen(pscreen);
> struct etna_resource *rsc;
> @@ -217,8 +217,13 @@ etna_resource_alloc(struct pipe_screen *pscreen, 
> unsigned layout,
>unsigned padX, padY;
>  
>/* pad scanout buffer size to be compatible with the RS */
> -  padX = ETNA_RS_WIDTH_MASK + 1;
> -  padY = (ETNA_RS_HEIGHT_MASK + 1) * screen->specs.pixel_pipes;
> +  if (modifier != DRM_FORMAT_MOD_LINEAR) {
> + padX = paddingX;
> + padY = paddingY;
> +  } else {
> + padX = ETNA_RS_WIDTH_MASK + 1;
> + padY = (ETNA_RS_HEIGHT_MASK + 1) * screen->specs.pixel_pipes;

We repeat `4 * screen->specs.pixel_pipes`, or in this case
`(ETNA_RS_HEIGHT_MASK + 1) * screen->specs.pixel_pipes` in many places.

Maybe this 'minimum padding for RS' computation logic could factored
out for more readable code.

> +  }
>scanout_templat.width0 = align(scanout_templat.width0, padX);
>scanout_templat.height0 = align(scanout_templat.height0, padY);
>  
> @@ -227,6 +232,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned 
> layout,
>if (!scanout)
>   return NULL;
>  
> +  handle.modifier = modifier;
>rsc = etna_resource(pscreen->resource_from_handle(pscreen, templat,
>  ,
>  
> PIPE_HANDLE_USAGE_WRITE));
> @@ -331,7 +337,89 @@ etna_resource_create(struct pipe_screen *pscreen,
> if (templat->target == PIPE_TEXTURE_3D)
>layout = ETNA_LAYOUT_LINEAR;
>  
> -   return etna_resource_alloc(pscreen, layout, templat);
> +   /* modifier is only used for scanout surfaces, so safe to use LINEAR here 
> */
> +   return etna_resource_alloc(pscreen, layout, DRM_FORMAT_MOD_LINEAR, 
> templat);
> +}
> +
> +enum modifier_priority {
> +   MODIFIER_PRIORITY_INVALID = 0,
> +   MODIFIER_PRIORITY_LINEAR,
> +   MODIFIER_PRIORITY_SPLIT_TILED,
> +   MODIFIER_PRIORITY_SPLIT_SUPER_TILED,
> +   MODIFIER_PRIORITY_TILED,
> +   MODIFIER_PRIORITY_SUPER_TILED,
> +};
> +
> +const uint64_t priority_to_modifier[] = {
> +   [MODIFIER_PRIORITY_INVALID] = DRM_FORMAT_MOD_INVALID,
> +   [MODIFIER_PRIORITY_LINEAR] = DRM_FORMAT_MOD_LINEAR,
> +   [MODIFIER_PRIORITY_SPLIT_TILED] = DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED,
> +   [MODIFIER_PRIORITY_SPLIT_SUPER_TILED] = 
> DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED,
> +   [MODIFIER_PRIORITY_TILED] = DRM_FORMAT_MOD_VIVANTE_TILED,
> +   [MODIFIER_PRIORITY_SUPER_TILED] = DRM_FORMAT_MOD_VIVANTE_SUPER_TILED,
> +};
> +
> +static uint64_t
> +select_best_modifier(const struct etna_screen * screen,
> + const uint64_t *modifiers, const unsigned count)
> +{
> +   enum modifier_priority prio = MODIFIER_PRIORITY_INVALID;
> +
> +   for (int i = 0; i < count; i++) {
> +  switch (modifiers[i]) {
> +  case DRM_FORMAT_MOD_VIVANTE_SUPER_TILED:
> + if ((screen->specs.pixel_pipes > 1 && !screen->specs.single_buffer) 
> ||
> + !screen->specs.can_supertile)
> +break;
> + prio = MAX2(prio, MODIFIER_PRIORITY_SUPER_TILED);
> + break;
> +  case DRM_FORMAT_MOD_VIVANTE_TILED:
> + if (screen->specs.pixel_pipes > 1 && !screen->specs.single_buffer)
> +break;
> + prio = MAX2(prio, MODIFIER_PRIORITY_TILED);
> + break;
> +  case DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED:
> + if ((screen->specs.pixel_pipes < 2) || !screen->specs.can_supertile)
> +break;
> + prio = MAX2(prio, MODIFIER_PRIORITY_SPLIT_SUPER_TILED);
> + break;
> +  case DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED:
> + 

Re: [Mesa-dev] [PATCH 1/2] etnaviv: fix etna_bo_from_name

2017-08-05 Thread Wladimir J. van der Laan
On Fri, Aug 04, 2017 at 06:54:12PM +0200, Philipp Zabel wrote:
> On Fri, 2017-08-04 at 18:15 +0200, Wladimir J. van der Laan wrote:
> > On Fri, Aug 04, 2017 at 05:07:54PM +0200, Philipp Zabel wrote:
> > > Look up BOs from the name table using the name parameter instead of
> > > req.handle (which at this point is always zero).
> > 
> > Good catch.
> > 
> > Just out of interest: when is this used, what problems does this cause?
> 
> It is used by the etnaviv gallium driver in etna_screen_bo_from_handle
> for DRM_API_HANDLE_TYPE_SHARED handles. Since this just falls back to
> asking the kernel to DRM_IOCTL_GEM_OPEN if the BO is not found in the
> name_table already, this bug caused no problems.

Thanks for the explanation,

Reviewed-By: Wladimir J. van der Laan

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


Re: [Mesa-dev] [PATCH 1/2] etnaviv: fix etna_bo_from_name

2017-08-04 Thread Wladimir J. van der Laan
On Fri, Aug 04, 2017 at 05:07:54PM +0200, Philipp Zabel wrote:
> Look up BOs from the name table using the name parameter instead of
> req.handle (which at this point is always zero).

Good catch.

Just out of interest: when is this used, what problems does this cause?

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


Re: [Mesa-dev] [PATCH 1/5] etnaviv: stop oversizing buffer resources

2017-05-10 Thread Wladimir J. van der Laan
Good catch!

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

On Wed, May 10, 2017 at 06:01:04PM +0200, Lucas Stach wrote:
> PIPE_BUFFER is a target enum, not a binding. This caused the driver to
> up-align the height of buffer resources, leading to largely oversizing
> those resources. This is especially bad, as the buffer resources used
> by the upload manager are already 1MB in size. Height alignment meant
> that those would result in 4 to 8MB big BOs.
> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 0e37345c0c0a..26f2ed733498 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -180,7 +180,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned 
> layout,
>  , );
> assert(paddingX && paddingY);
>  
> -   if (templat->bind != PIPE_BUFFER) {
> +   if (templat->target != PIPE_BUFFER) {
>unsigned min_paddingY = 4 * screen->specs.pixel_pipes;
>if (paddingY < min_paddingY)
>   paddingY = min_paddingY;
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/5] etnaviv: apply feature overrides in one central location

2017-05-10 Thread Wladimir J. van der Laan
Yes, good idea to do this in one place.

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

On Wed, May 10, 2017 at 06:01:06PM +0200, Lucas Stach wrote:
> This way we can just test the feature bits and don't need to spread
> the debug overrides to all locations touching a feature.
> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_clear_blit.c |  6 ++
>  src/gallium/drivers/etnaviv/etnaviv_resource.c   |  2 +-
>  src/gallium/drivers/etnaviv/etnaviv_screen.c | 10 ++
>  src/gallium/drivers/etnaviv/etnaviv_surface.c|  2 +-
>  src/gallium/drivers/etnaviv/etnaviv_zsa.c|  9 +
>  5 files changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c 
> b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> index 528b57389d57..ae1c5862880f 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> @@ -111,8 +111,7 @@ etna_blit_clear_color(struct pipe_context *pctx, struct 
> pipe_surface *dst,
> if (surf->surf.ts_size) { /* TS: use precompiled clear command */
>ctx->framebuffer.TS_COLOR_CLEAR_VALUE = new_clear_value;
>  
> -  if (!DBG_ENABLED(ETNA_DBG_NO_AUTODISABLE) &&
> -  VIV_FEATURE(ctx->screen, chipMinorFeatures1, AUTO_DISABLE)) {
> +  if (VIV_FEATURE(ctx->screen, chipMinorFeatures1, AUTO_DISABLE)) {
>   /* Set number of color tiles to be filled */
>   etna_set_state(ctx->stream, VIVS_TS_COLOR_AUTO_DISABLE_COUNT,
>  surf->surf.padded_width * surf->surf.padded_height / 
> 16);
> @@ -171,8 +170,7 @@ etna_blit_clear_zs(struct pipe_context *pctx, struct 
> pipe_surface *dst,
> if (surf->surf.ts_size) { /* TS: use precompiled clear command */
>/* Set new clear depth value */
>ctx->framebuffer.TS_DEPTH_CLEAR_VALUE = new_clear_value;
> -  if (!DBG_ENABLED(ETNA_DBG_NO_AUTODISABLE) &&
> -  VIV_FEATURE(ctx->screen, chipMinorFeatures1, AUTO_DISABLE)) {
> +  if (VIV_FEATURE(ctx->screen, chipMinorFeatures1, AUTO_DISABLE)) {
>   /* Set number of depth tiles to be filled */
>   etna_set_state(ctx->stream, VIVS_TS_DEPTH_AUTO_DISABLE_COUNT,
>  surf->surf.padded_width * surf->surf.padded_height / 
> 16);
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 26f2ed733498..103b53c1c310 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -247,7 +247,7 @@ etna_resource_create(struct pipe_screen *pscreen,
>   layout = ETNA_LAYOUT_LINEAR;
> } else if (templat->target != PIPE_BUFFER) {
>bool want_multitiled = false;
> -  bool want_supertiled = screen->specs.can_supertile && 
> !DBG_ENABLED(ETNA_DBG_NO_SUPERTILE);
> +  bool want_supertiled = screen->specs.can_supertile;
>  
>/* When this GPU supports single-buffer rendering, don't ever enable
> * multi-tiling. This replicates the blob behavior on GC3000.
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
> b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index 626f7c778985..aba6bb701dc3 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -829,6 +829,16 @@ etna_screen_create(struct etna_device *dev, struct 
> etna_gpu *gpu,
> if (!etna_get_specs(screen))
>goto fail;
>  
> +   /* apply debug options that disable individual features */
> +   if (DBG_ENABLED(ETNA_DBG_NO_EARLY_Z))
> +  screen->features[viv_chipFeatures] |= chipFeatures_NO_EARLY_Z;
> +   if (DBG_ENABLED(ETNA_DBG_NO_TS))
> + screen->features[viv_chipFeatures] &= ~chipFeatures_FAST_CLEAR;
> +   if (DBG_ENABLED(ETNA_DBG_NO_AUTODISABLE))
> +  screen->features[viv_chipMinorFeatures1] &= 
> ~chipMinorFeatures1_AUTO_DISABLE;
> +   if (DBG_ENABLED(ETNA_DBG_NO_SUPERTILE))
> +  screen->specs.can_supertile = 0;
> +
> pscreen->destroy = etna_screen_destroy;
> pscreen->get_param = etna_screen_get_param;
> pscreen->get_paramf = etna_screen_get_paramf;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_surface.c 
> b/src/gallium/drivers/etnaviv/etnaviv_surface.c
> index 1db9b40a5108..4b95f6575a45 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_surface.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_surface.c
> @@ -66,7 +66,7 @@ etna_create_surface(struct pipe_context *pctx, struct 
> pipe_resource *prsc,
>  
> if (VIV

Re: [Mesa-dev] [PATCH 5/5] etnaviv: increment the resource seqno in resource_changed

2017-05-10 Thread Wladimir J. van der Laan

Seems more straightforward, but I don't know the rationale
why it was done the way it was.

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com> 

On Wed, May 10, 2017 at 06:01:08PM +0200, Lucas Stach wrote:
> From: Philipp Zabel <p.za...@pengutronix.de>
> 
> Just increment the resource seqno instead of setting the texture
> seqno to be lower by one than the resource seqno.
> 
> Signed-off-by: Philipp Zabel <p.za...@pengutronix.de>
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 103b53c1c310..1341e1ea2314 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -286,11 +286,7 @@ etna_resource_changed(struct pipe_screen *pscreen, 
> struct pipe_resource *prsc)
>  {
> struct etna_resource *res = etna_resource(prsc);
>  
> -   /* Make sure texture is older than the imported renderable buffer,
> -* so etna_update_sampler_source will copy the pixel data again.
> -*/
> -   if (res->texture)
> -  etna_resource(res->texture)->seqno = res->seqno - 1;
> +   res->seqno++;
>  }
>  
>  static void
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] etnaviv: Check extended format availability on GPU

2017-05-16 Thread Wladimir J. van der Laan
Hello Philipp,

On Tue, May 16, 2017 at 04:33:34PM +0200, Philipp Zabel wrote:
> Hi Wladimir,
> 
> On Tue, 2017-05-16 at 10:42 +0200, Wladimir J. van der Laan wrote:
> > Current information shows that both extended texture/render formats
> > and texture swizzling were introduced with the HALTI0 feature bit,
> > available on GC2000/GC3000.
> 
> With this patch applied, trying to import R8_UNORM dma-buffers via
> EGLImage results in an endless recursion:
> 
> etna_copy_resource -> etna_blit -> util_try_blit_via_copy_region ->
> util_resource_copy_region -> etna_transfer_map -> etna_copy_resource ->
> etna_blit -> ...

Apparently the software fallback isn't kicking in, that is a bug.

> The only thing that looks remotely related is RS_FORMAT_R8I, but that is
> marked as extended format in rnndb and doesn't fit into
> RS_CONFIG_SOURCE/DEST_FORMAT. Is it even possible to tile R8/A8/L8
> textures in hardware?

I'm afraid so -
As far as I know the RS cannot deal with the extended formats at all,
neither on GC2000 nor GC3000. They are PE-only.

The Vivante blob does the tiling for 8-bit textures in software.

On GC3000 it is possible to render to _RG, and possibly _R8I (haven't tested
this). However I'm not sure this will help with tiling, unless it's
possible to feed it a linear texture.

(there is some linear texture support in Vivantes but I have never observed how
it works, it's restricted to a narrow set of formats at least...)

Regards,
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-16 Thread Wladimir J. van der Laan
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


[Mesa-dev] [PATCH 3/3] etnaviv: Check extended format availability on GPU

2017-05-16 Thread Wladimir J. van der Laan
Current information shows that both extended texture/render formats
and texture swizzling were introduced with the HALTI0 feature bit,
available on GC2000/GC3000.
---
 src/gallium/drivers/etnaviv/etnaviv_format.c | 12 
 src/gallium/drivers/etnaviv/etnaviv_format.h |  3 +++
 src/gallium/drivers/etnaviv/etnaviv_screen.c | 21 ++---
 3 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
b/src/gallium/drivers/etnaviv/etnaviv_format.c
index 23bb6c1..dbedda3 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
@@ -293,6 +293,18 @@ translate_texture_format_swiz(enum pipe_format fmt, 
unsigned char tex_swz[4])
return true;
 }
 
+bool
+translate_texture_format_needs_swiz(enum pipe_format fmt)
+{
+   if (!formats[fmt].present)
+  return false;
+
+   return formats[fmt].tex_swz[0] != 0 ||
+  formats[fmt].tex_swz[1] != 1 ||
+  formats[fmt].tex_swz[2] != 2 ||
+  formats[fmt].tex_swz[3] != 3;
+}
+
 uint32_t
 translate_rs_format(enum pipe_format fmt)
 {
diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.h 
b/src/gallium/drivers/etnaviv/etnaviv_format.h
index ce75161..9e60d64 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.h
@@ -50,4 +50,7 @@ translate_vertex_format_type(enum pipe_format fmt);
 bool
 translate_texture_format_swiz(enum pipe_format fmt, unsigned char tex_swz[4]);
 
+bool
+translate_texture_format_needs_swiz(enum pipe_format fmt);
+
 #endif /* ETNAVIV_FORMAT_H_ */
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index a92cfd4..80d62aa 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -459,6 +459,12 @@ gpu_supports_texure_format(struct etna_screen *screen, 
uint32_t fmt)
return true;
 }
 
+static bool
+gpu_supports_extended_texure_format(struct etna_screen *screen, uint32_t 
fmt_ext)
+{
+   return VIV_FEATURE(screen, chipMinorFeatures1, HALTI0);
+}
+
 static boolean
 etna_screen_is_format_supported(struct pipe_screen *pscreen,
 enum pipe_format format,
@@ -499,9 +505,18 @@ etna_screen_is_format_supported(struct pipe_screen 
*pscreen,
 
if (usage & PIPE_BIND_SAMPLER_VIEW) {
   uint32_t fmt = translate_texture_format(format);
-
-  if (!gpu_supports_texure_format(screen, fmt))
- fmt = ETNA_NO_MATCH;
+  uint32_t fmt_ext = translate_texture_format_ext(format);
+
+  /* extended and swizzled texture formats are only supported with HALTI0 
*/
+  if (fmt_ext || translate_texture_format_needs_swiz(format)) {
+ /* fmt will be 0 for extended formats, which is ok as it is only 
compared
+  * against ETNA_NO_MATCH below */
+ if (!gpu_supports_extended_texure_format(screen, fmt_ext))
+fmt = ETNA_NO_MATCH;
+  } else {
+ if (!gpu_supports_texure_format(screen, fmt))
+fmt = ETNA_NO_MATCH;
+  }
 
   if (sample_count < 2 && fmt != ETNA_NO_MATCH)
  allowed |= PIPE_BIND_SAMPLER_VIEW;
-- 
2.7.4

___
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

2017-05-16 Thread Wladimir J. van der Laan
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,
   

[Mesa-dev] [PATCH 2/3] etnaviv: Add support for swizzled texture formats

2017-05-16 Thread Wladimir J. van der Laan
---
 src/gallium/drivers/etnaviv/etnaviv_format.c  | 50 +--
 src/gallium/drivers/etnaviv/etnaviv_format.h  |  3 ++
 src/gallium/drivers/etnaviv/etnaviv_texture.c | 15 +---
 3 files changed, 54 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
b/src/gallium/drivers/etnaviv/etnaviv_format.c
index 88bb520..23bb6c1 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
@@ -40,6 +40,7 @@ struct etna_format {
unsigned tex;
unsigned rs;
boolean present;
+   const unsigned char tex_swz[4];
 };
 
 #define RS_FORMAT_NONE ~0
@@ -56,22 +57,27 @@ struct etna_format {
 #define TX_FORMAT_EXT_SHIFT  8
 #define TX_FORMAT_EXT_MASK   0xff00
 
-/* vertex + texture (base) */
-#define VT(pipe, vtxfmt, texfmt, rsfmt)   \
+#define SWIZ_XYZW {0,1,2,3}
+#define SWIZ_X001 {0,4,4,5}
+
+/* vertex + texture (base, with swizzle) */
+#define VT(pipe, vtxfmt, texfmt, swiz, rsfmt) \
[PIPE_FORMAT_##pipe] = {   \
   .vtx = VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_##vtxfmt, \
   .tex = TEXTURE_FORMAT_##texfmt, \
   .rs = RS_FORMAT_##rsfmt,\
   .present = 1,   \
+  .tex_swz = (const unsigned char[])swiz, \
}
 
-/* vertex + texture (extended) */
-#define VTE(pipe, vtxfmt, extfmt, rsfmt)   \
+/* vertex + texture (extended, with swizzle) */
+#define VTE(pipe, vtxfmt, extfmt, swiz, 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,   \
+  .tex_swz = (const unsigned char[])swiz, \
}
 
 /* texture-only (base) */
@@ -81,15 +87,27 @@ struct etna_format {
   .tex = TEXTURE_FORMAT_##fmt, \
   .rs = RS_FORMAT_##rsfmt, \
   .present = 1,\
+  .tex_swz = (const unsigned char[])SWIZ_XYZW, \
}
 
-/* texture-only (extended) */
-#define _TE(pipe, fmt, rsfmt)   \
+/* texture-only (base, with swizzle) */
+#define _TS(pipe, fmt, rsfmt, swiz)   \
+   [PIPE_FORMAT_##pipe] = {\
+  .vtx = ETNA_NO_MATCH,\
+  .tex = TEXTURE_FORMAT_##fmt, \
+  .rs = RS_FORMAT_##rsfmt, \
+  .present = 1,\
+  .tex_swz = (const unsigned char[])swiz, \
+   }
+
+/* texture-only (extended, with swizzle) */
+#define _TE(pipe, fmt, rsfmt, swiz)   \
[PIPE_FORMAT_##pipe] = {\
   .vtx = ETNA_NO_MATCH,\
   .tex = TEXTURE_FORMAT_EXT_##fmt << TX_FORMAT_EXT_SHIFT, \
   .rs = RS_FORMAT_##rsfmt, \
   .present = 1,\
+  .tex_swz = (const unsigned char[])swiz,   \
}
 
 /* vertex-only */
@@ -103,8 +121,8 @@ struct etna_format {
 
 static struct etna_format formats[PIPE_FORMAT_COUNT] = {
/* 8-bit */
-   V_(R8_UNORM,   UNSIGNED_BYTE, NONE),
-   VTE(R8_SNORM,  BYTE,  R8_SNORM, NONE),
+   VT(R8_UNORM,   UNSIGNED_BYTE, L8, SWIZ_X001, NONE),
+   VTE(R8_SNORM,  BYTE,  R8_SNORM, SWIZ_XYZW, NONE),
V_(R8_UINT,UNSIGNED_BYTE, NONE),
V_(R8_SINT,BYTE,  NONE),
V_(R8_USCALED, UNSIGNED_BYTE, NONE),
@@ -131,7 +149,7 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
_T(B5G5R5A1_UNORM, A1R5G5B5, A1R5G5B5),
_T(B5G5R5X1_UNORM, X1R5G5B5, X1R5G5B5),
 
-   VTE(R8G8_UNORM,  UNSIGNED_BYTE,  G8R8, NONE),
+   VTE(R8G8_UNORM,  UNSIGNED_BYTE,  G8R8, SWIZ_XYZW, NONE),
V_(R8G8_SNORM,   BYTE,   NONE),
V_(R8G8_UINT,UNSIGNED_BYTE,  NONE),
V_(R8G8_SINT,BYTE,   NONE),
@@ -247,7 +265,6 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
 uint32_t
 translate_texture_format(enum pipe_format fmt)
 {
-   /* 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;
 
@@ -263,6 +280,19 @@ translate_texture_format_ext(enum pipe_format fmt)
return (formats[fmt].tex & TX_FORMAT_EXT_MASK) >> TX_FORMAT_EXT_SHIFT;
 }
 
+bool
+translate_texture_format_swiz(enum pipe_format fmt, unsigned char tex_swz[4])
+{
+   if (!formats[fmt].present)
+  return false;
+
+   tex_swz[0] = formats[fmt].tex_swz[0];
+   tex_swz[1] = formats[fmt].tex_swz[1];
+   tex_swz[2] = formats[fmt].tex_swz[2];
+   tex_swz[3] = formats[fmt].tex_swz[3];
+   return true;
+}
+
 uint32_t
 translate_rs_format(enum pipe_format fmt)
 {
diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.h 
b/src/gallium/drivers/etnaviv/etnaviv_format.h
index 5dbab4d..ce75161 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.h
@@ -47,4 +47,7 @@ 

Re: [Mesa-dev] [RFC] etnaviv: flush color cache and depth cache together before resolves

2017-06-20 Thread Wladimir J. van der Laan
On Tue, May 30, 2017 at 12:50:07PM +0200, Philipp Zabel wrote:
> Before resolving a rendertarget or a depth/stencil resource into a
> texture, flush both the color cache and the depth cache together.
> 
> It is unclear whether this is necessary for the following stall to
> work properly, or whether the depth flush just adds enough time
> for the color cache flush to finish before the resolver is started,
> but this change removes artifacts that otherwise appear if a texture
> is sampled directly after rendering into it.
> 
> The test case is a simple QML scene graph with a QtWebEngine based
> WebView rendered on top of a blue background:
> 
>   import QtQuick 2.0
>   import QtQuick.Window 2.2
>   import QtWebView 1.1
> 
>   Window {
>   Rectangle {
>   id: background
>   anchors.fill: parent
>   color: "blue"
>   }
> 
>   WebView {
>   id: webView
>   anchors.fill: parent
>   }
> 
>   Component.onCompleted: {
>   webView.url = ""
>   }
>   }
> 
> If the website is animated, the WebView renders the site contents into
> texture tiles and immediately afterwards samples from them to draw the
> tiles into the Qt renderbuffer. Without this patch, a small irregular
> triangle in the lower right of each browser tile appears solid blue, as
> if the texture sampler samples zeroes instead of the website contents,
> and the previously rendered blue Rectangle shows through.
> 
> Other attempts such as adding a pipeline stall before the color flush or
> a TS cache flush afterwards or flushing multiple times, with stalls
> before and after each flush, have shown no effect.
> 
> Signed-off-by: Philipp Zabel 
> ---
>  src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 13 -
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c 
> b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> index ae1c586288..faa6bd0436 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> @@ -455,15 +455,10 @@ etna_try_rs_blit(struct pipe_context *pctx,
>ts_mem_config |= VIVS_TS_MEM_CONFIG_MSAA | msaa_format;
> }
>  
> -   uint32_t to_flush = 0;
> -
> -   if (src->base.bind & PIPE_BIND_RENDER_TARGET)
> -  to_flush |= VIVS_GL_FLUSH_CACHE_COLOR;
> -   if (src->base.bind & PIPE_BIND_DEPTH_STENCIL)
> -  to_flush |= VIVS_GL_FLUSH_CACHE_DEPTH;
> -
> -   if (to_flush) {
> -  etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE, to_flush);
> +   if (src->base.bind & PIPE_BIND_RENDER_TARGET ||
> +   src->base.bind & PIPE_BIND_DEPTH_STENCIL) {
> +  etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE,
> +  VIVS_GL_FLUSH_CACHE_COLOR | VIVS_GL_FLUSH_CACHE_DEPTH);

Can you please add a comment here, describing (as above) why both
caches are flushed?

These things are hard to get right, so any bit of documentation why
a certain choice was made while reading the code helps.

>etna_stall(ctx->stream, SYNC_RECIPIENT_RA, SYNC_RECIPIENT_PE);
> }
>  
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [libdrm 4/4] etnaviv: support performance monitor requests

2017-06-20 Thread Wladimir J. van der Laan
On Fri, Jun 09, 2017 at 12:27:37PM +0200, Christian Gmeiner wrote:
> Add etna_cmd_stream_perf(..) to submit perform requests.
> Userspace can submit pmrs via submit ioctl to sample perfmon
> signals.

Comment in-line.

> Signed-off-by: Christian Gmeiner 
> ---
>  etnaviv/etnaviv-symbol-check |  1 +
>  etnaviv/etnaviv_cmd_stream.c | 20 
>  etnaviv/etnaviv_drmif.h  | 12 
>  etnaviv/etnaviv_priv.h   |  4 
>  4 files changed, 37 insertions(+)
> 
> diff --git a/etnaviv/etnaviv-symbol-check b/etnaviv/etnaviv-symbol-check
> index bd95b45..bc50961 100755
> --- a/etnaviv/etnaviv-symbol-check
> +++ b/etnaviv/etnaviv-symbol-check
> @@ -41,6 +41,7 @@ etna_cmd_stream_timestamp
>  etna_cmd_stream_flush
>  etna_cmd_stream_flush2
>  etna_cmd_stream_finish
> +etna_cmd_stream_perf
>  etna_cmd_stream_reloc
>  etna_perfmon_create
>  etna_perfmon_del
> diff --git a/etnaviv/etnaviv_cmd_stream.c b/etnaviv/etnaviv_cmd_stream.c
> index 8d0e813..d6f26a8 100644
> --- a/etnaviv/etnaviv_cmd_stream.c
> +++ b/etnaviv/etnaviv_cmd_stream.c
> @@ -105,6 +105,7 @@ void etna_cmd_stream_del(struct etna_cmd_stream *stream)
>  
>   free(stream->buffer);
>   free(priv->submit.relocs);
> + free(priv->submit.pmrs);
>   free(priv);
>  }
>  
> @@ -115,6 +116,7 @@ static void reset_buffer(struct etna_cmd_stream *stream)
>   stream->offset = 0;
>   priv->submit.nr_bos = 0;
>   priv->submit.nr_relocs = 0;
> + priv->submit.nr_pmrs = 0;
>   priv->nr_bos = 0;
>  
>   if (priv->reset_notify)
> @@ -191,6 +193,8 @@ static void flush(struct etna_cmd_stream *stream, int 
> in_fence_fd,
>   .nr_bos = priv->submit.nr_bos,
>   .relocs = VOID2U64(priv->submit.relocs),
>   .nr_relocs = priv->submit.nr_relocs,
> + .pmrs = VOID2U64(priv->submit.pmrs),
> + .nr_pmrs = priv->submit.nr_pmrs,
>   .stream = VOID2U64(stream->buffer),
>   .stream_size = stream->offset * 4, /* in bytes */
>   };
> @@ -260,3 +264,19 @@ void etna_cmd_stream_reloc(struct etna_cmd_stream 
> *stream, const struct etna_rel
>  
>   etna_cmd_stream_emit(stream, addr);
>  }
> +
> +void etna_cmd_stream_perf(struct etna_cmd_stream *stream, const struct 
> etna_perf *p)
> +{
> + struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
> + struct drm_etnaviv_gem_submit_pmr *pmr;
> + uint32_t idx = APPEND(>submit, pmrs);

Should we check for realloc() errors here? (or assert priv->submit.pmrs is not 
NULL)

> +
> + pmr = >submit.pmrs[idx];
> +
> + pmr->flags = p->flags;
> + pmr->sequence = p->sequence;
> + pmr->read_offset = p->offset;
> + pmr->read_idx = bo2idx(stream, p->bo, ETNA_SUBMIT_BO_READ);
> + pmr->domain = p->signal->domain->id;
> + pmr->signal = p->signal->signal;
> +}
> diff --git a/etnaviv/etnaviv_drmif.h b/etnaviv/etnaviv_drmif.h
> index 0a7f6a3..e77a3b2 100644
> --- a/etnaviv/etnaviv_drmif.h
> +++ b/etnaviv/etnaviv_drmif.h
> @@ -200,4 +200,16 @@ void etna_perfmon_del(struct etna_perfmon *perfmon);
>  struct etna_perfmon_domain *etna_perfmon_get_dom_by_name(struct etna_perfmon 
> *pm, const char *name);
>  struct etna_perfmon_signal *etna_perfmon_get_sig_by_name(struct 
> etna_perfmon_domain *dom, const char *name);
>  
> +struct etna_perf {
> +#define ETNA_PM_PROCESS_PRE 0x0001
> +#define ETNA_PM_PROCESS_POST0x0002
> + uint32_t flags;
> + uint32_t sequence;
> + struct etna_perfmon_signal *signal;
> + struct etna_bo *bo;
> + uint32_t offset;
> +};
> +
> +void etna_cmd_stream_perf(struct etna_cmd_stream *stream, const struct 
> etna_perf *p);
> +
>  #endif /* ETNAVIV_DRMIF_H_ */
> diff --git a/etnaviv/etnaviv_priv.h b/etnaviv/etnaviv_priv.h
> index 37ffd80..60e65ec 100644
> --- a/etnaviv/etnaviv_priv.h
> +++ b/etnaviv/etnaviv_priv.h
> @@ -140,6 +140,10 @@ struct etna_cmd_stream_priv {
>   /* reloc's table: */
>   struct drm_etnaviv_gem_submit_reloc *relocs;
>   uint32_t nr_relocs, max_relocs;
> +
> + /* perf's table: */
> + struct drm_etnaviv_gem_submit_pmr *pmrs;
> + uint32_t nr_pmrs, max_pmrs;
>   } submit;
>  
>   /* should have matching entries in submit.bos: */
> -- 
> 2.9.4
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] etnaviv: fix blend color for RB swapped rendertargets

2017-06-20 Thread Wladimir J. van der Laan
On Mon, Jun 05, 2017 at 09:11:02PM +0200, Lucas Stach wrote:
> Same as with the colormasks, the blend color needs to be swizzled according
> to the rendertarget format.

Yes, indeed.

Reviewed-by: Wladimir J. van der Laan

> Signed-off-by: Lucas Stach <d...@lynxeye.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_blend.c| 35 
> ++
>  src/gallium/drivers/etnaviv/etnaviv_blend.h|  6 +
>  src/gallium/drivers/etnaviv/etnaviv_internal.h |  1 +
>  src/gallium/drivers/etnaviv/etnaviv_state.c| 17 +++--
>  4 files changed, 45 insertions(+), 14 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_blend.c 
> b/src/gallium/drivers/etnaviv/etnaviv_blend.c
> index 8ea09a3..6ed0e0f 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_blend.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_blend.c
> @@ -129,3 +129,38 @@ etna_update_blend(struct etna_context *ctx)
>  
> return true;
>  }
> +
> +void
> +etna_set_blend_color(struct pipe_context *pctx, const struct 
> pipe_blend_color *bc)
> +{
> +   struct etna_context *ctx = etna_context(pctx);
> +   struct compiled_blend_color *cs = >blend_color;
> +
> +   memcpy(cs->color, bc->color, sizeof(float) * 4);
> +
> +   ctx->dirty |= ETNA_DIRTY_BLEND_COLOR;
> +}
> +
> +bool
> +etna_update_blend_color(struct etna_context *ctx)
> +{
> +   struct pipe_framebuffer_state *pfb = >framebuffer_s;
> +   struct compiled_blend_color *cs = >blend_color;
> +
> +   if (pfb->cbufs[0] &&
> +   translate_rs_format_rb_swap(pfb->cbufs[0]->texture->format)) {
> +  cs->PE_ALPHA_BLEND_COLOR =
> + VIVS_PE_ALPHA_BLEND_COLOR_R(etna_cfloat_to_uint8(cs->color[2])) |
> + VIVS_PE_ALPHA_BLEND_COLOR_G(etna_cfloat_to_uint8(cs->color[1])) |
> + VIVS_PE_ALPHA_BLEND_COLOR_B(etna_cfloat_to_uint8(cs->color[0])) |
> + VIVS_PE_ALPHA_BLEND_COLOR_A(etna_cfloat_to_uint8(cs->color[3]));
> +   } else {
> +  cs->PE_ALPHA_BLEND_COLOR =
> + VIVS_PE_ALPHA_BLEND_COLOR_R(etna_cfloat_to_uint8(cs->color[0])) |
> + VIVS_PE_ALPHA_BLEND_COLOR_G(etna_cfloat_to_uint8(cs->color[1])) |
> + VIVS_PE_ALPHA_BLEND_COLOR_B(etna_cfloat_to_uint8(cs->color[2])) |
> + VIVS_PE_ALPHA_BLEND_COLOR_A(etna_cfloat_to_uint8(cs->color[3]));
> + }

Looks ok to me - though I wish we just had a swizzle[4] for the
rendertarget-color mapping instead of having to special casing rb-swap.

> +
> + return true;
> +}
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_blend.h 
> b/src/gallium/drivers/etnaviv/etnaviv_blend.h
> index e26864d..c219396 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_blend.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_blend.h
> @@ -56,4 +56,10 @@ etna_blend_state_create(struct pipe_context *pctx,
>  bool
>  etna_update_blend(struct etna_context *ctx);
>  
> +void
> +etna_set_blend_color(struct pipe_context *pctx, const struct 
> pipe_blend_color *bc);
> +
> +bool
> +etna_update_blend_color(struct etna_context *ctx);
> +
>  #endif
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_internal.h 
> b/src/gallium/drivers/etnaviv/etnaviv_internal.h
> index 2f8dacb..1212fdf 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_internal.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_internal.h
> @@ -126,6 +126,7 @@ struct etna_specs {
>  
>  /* Compiled pipe_blend_color */
>  struct compiled_blend_color {
> +   float color[4];
> uint32_t PE_ALPHA_BLEND_COLOR;
>  };
>  
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c 
> b/src/gallium/drivers/etnaviv/etnaviv_state.c
> index fb7bb0f..fc3d9f1 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_state.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_state.c
> @@ -43,20 +43,6 @@
>  #include "util/u_memory.h"
>  
>  static void
> -etna_set_blend_color(struct pipe_context *pctx, const struct 
> pipe_blend_color *bc)
> -{
> -   struct etna_context *ctx = etna_context(pctx);
> -   struct compiled_blend_color *cs = >blend_color;
> -
> -   cs->PE_ALPHA_BLEND_COLOR =
> -  VIVS_PE_ALPHA_BLEND_COLOR_R(etna_cfloat_to_uint8(bc->color[0])) |
> -  VIVS_PE_ALPHA_BLEND_COLOR_G(etna_cfloat_to_uint8(bc->color[1])) |
> -  VIVS_PE_ALPHA_BLEND_COLOR_B(etna_cfloat_to_uint8(bc->color[2])) |
> -  VIVS_PE_ALPHA_BLEND_COLOR_A(etna_cfloat_to_uint8(bc->color[3]));
> -   ctx->dirty |= ETNA_DIRTY_BLEND_COLOR;
> -}
> -
> -static void
>  etna_set_stencil_ref(struct pipe_context *pctx, const struct 
> pipe_stencil_ref *sr)
>  {
> struct etna_context *ctx = etna_context(pctx);
> @@ -600,6 +586,9 @@ sta

Re: [Mesa-dev] [libdrm 2/4] etnaviv: sync uapi header

2017-06-20 Thread Wladimir J. van der Laan
On Fri, Jun 09, 2017 at 12:27:35PM +0200, Christian Gmeiner wrote:
> Import the etnaviv header changes from kernel commits x
> 
> The drm_etnaviv_gem_submit structure was extended to include performance
> monitor requests. Also two new ioctls got added to readout performance
> monitor domains and their signals.

Looks straightforward.

Cannot find the associated kernel patch, so I could not check if the interface
matches.

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

> 
> Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com>
> ---
>  etnaviv/etnaviv_drm.h | 35 ++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/etnaviv/etnaviv_drm.h b/etnaviv/etnaviv_drm.h
> index 76f6f78..7c1db88 100644
> --- a/etnaviv/etnaviv_drm.h
> +++ b/etnaviv/etnaviv_drm.h
> @@ -150,6 +150,18 @@ struct drm_etnaviv_gem_submit_bo {
>   __u64 presumed;   /* in/out, presumed buffer address */
>  };
>  
> +#define ETNA_PM_PROCESS_PRE 0x0001
> +#define ETNA_PM_PROCESS_POST0x0002
> +struct drm_etnaviv_gem_submit_pmr {
> + __u32 flags;  /* in, when to process request 
> (ETNA_PM_PROCESS_x) */
> + __u8  domain; /* in, pm domain */
> + __u8  signal; /* in, pm signal */
> + __u16 pad[3];
> + __u32 sequence;   /* in, sequence number used for sync */
> + __u32 read_offset;/* in, offset from read_bo */
> + __u32 read_idx;   /* in, index of read_bo buffer */
> +};
> +
>  /* Each cmdstream submit consists of a table of buffers involved, and
>   * one or more cmdstream buffers.  This allows for conditional execution
>   * (context-restore), and IB buffers needed for per tile/bin draw cmds.
> @@ -175,6 +187,9 @@ struct drm_etnaviv_gem_submit {
>   __u64 stream; /* in, ptr to cmdstream */
>   __u32 flags;  /* in, mask of ETNA_SUBMIT_x */
>   __s32 fence_fd;   /* in/out, fence fd (see ETNA_SUBMIT_FENCE_FD_x) 
> */
> + __u64 pmrs;   /* in, ptr to array of submit_pm's */
> + __u32 nr_pmrs;/* in, number of submit_pm's */
> + __u32 padding;
>  };
>  
>  /* The normal way to synchronize with the GPU is just to CPU_PREP on
> @@ -210,6 +225,20 @@ struct drm_etnaviv_gem_wait {
>   struct drm_etnaviv_timespec timeout;/* in */
>  };
>  
> +struct drm_etnaviv_pm_domain {
> + __u32 pipe;   /* in */
> + __u8  iter;   /* in/out, select pm domain at index iter */
> + __u8  nr_signals; /* out, how many signals does this domain provide */
> + char  name[64];   /* out, name of domain */
> +};
> +
> +struct drm_etnaviv_pm_signal {
> + __u32 pipe;   /* in */
> + __u8  domain; /* in, pm domain index */
> + __u8  iter;   /* in/out, select pm source at index iter */
> + char  name[64];   /* out, name of domain */
> +};
> +
>  #define DRM_ETNAVIV_GET_PARAM  0x00
>  /* placeholder:
>  #define DRM_ETNAVIV_SET_PARAM  0x01
> @@ -222,7 +251,9 @@ struct drm_etnaviv_gem_wait {
>  #define DRM_ETNAVIV_WAIT_FENCE 0x07
>  #define DRM_ETNAVIV_GEM_USERPTR0x08
>  #define DRM_ETNAVIV_GEM_WAIT   0x09
> -#define DRM_ETNAVIV_NUM_IOCTLS 0x0a
> +#define DRM_ETNAVIV_PM_QUERY_DOM   0x0a
> +#define DRM_ETNAVIV_PM_QUERY_SIG   0x0b
> +#define DRM_ETNAVIV_NUM_IOCTLS 0x0c
>  
>  #define DRM_IOCTL_ETNAVIV_GET_PARAMDRM_IOWR(DRM_COMMAND_BASE + 
> DRM_ETNAVIV_GET_PARAM, struct drm_etnaviv_param)
>  #define DRM_IOCTL_ETNAVIV_GEM_NEW  DRM_IOWR(DRM_COMMAND_BASE + 
> DRM_ETNAVIV_GEM_NEW, struct drm_etnaviv_gem_new)
> @@ -233,6 +264,8 @@ struct drm_etnaviv_gem_wait {
>  #define DRM_IOCTL_ETNAVIV_WAIT_FENCE   DRM_IOW(DRM_COMMAND_BASE + 
> DRM_ETNAVIV_WAIT_FENCE, struct drm_etnaviv_wait_fence)
>  #define DRM_IOCTL_ETNAVIV_GEM_USERPTR  DRM_IOWR(DRM_COMMAND_BASE + 
> DRM_ETNAVIV_GEM_USERPTR, struct drm_etnaviv_gem_userptr)
>  #define DRM_IOCTL_ETNAVIV_GEM_WAIT DRM_IOW(DRM_COMMAND_BASE + 
> DRM_ETNAVIV_GEM_WAIT, struct drm_etnaviv_gem_wait)
> +#define DRM_IOCTL_ETNAVIV_QUERY_DOMDRM_IOW(DRM_COMMAND_BASE + 
> DRM_ETNAVIV_PM_QUERY_DOM, struct drm_etnaviv_pm_domain)
> +#define DRM_IOCTL_ETNAVIV_QUERY_SIGDRM_IOW(DRM_COMMAND_BASE + 
> DRM_ETNAVIV_PM_QUERY_SIG, struct drm_etnaviv_pm_signal)
>  
>  #if defined(__cplusplus)
>  }
> -- 
> 2.9.4
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [libdrm 3/4] etnaviv: add permon support

2017-06-20 Thread Wladimir J. van der Laan
On Fri, Jun 09, 2017 at 12:27:36PM +0200, Christian Gmeiner wrote:
> Query all domains and their signals and provide it this information
> via struct etna_perfmon and the corresponding api functions.

Comments in-line.

> Signed-off-by: Christian Gmeiner 
> ---
>  etnaviv/Makefile.sources |   1 +
>  etnaviv/etnaviv-symbol-check |   4 +
>  etnaviv/etnaviv_drmif.h  |  10 +++
>  etnaviv/etnaviv_perfmon.c| 206 
> +++
>  etnaviv/etnaviv_priv.h   |  21 +
>  5 files changed, 242 insertions(+)
>  create mode 100644 etnaviv/etnaviv_perfmon.c
> 
> diff --git a/etnaviv/Makefile.sources b/etnaviv/Makefile.sources
> index 5258056..0eb7378 100644
> --- a/etnaviv/Makefile.sources
> +++ b/etnaviv/Makefile.sources
> @@ -3,6 +3,7 @@ LIBDRM_ETNAVIV_FILES := \
>   etnaviv_gpu.c \
>   etnaviv_bo.c \
>   etnaviv_bo_cache.c \
> + etnaviv_perfmon.c \
>   etnaviv_pipe.c \
>   etnaviv_cmd_stream.c \
>   etnaviv_drm.h \
> --- /dev/null
> +++ b/etnaviv/etnaviv_perfmon.c
> @@ -0,0 +1,206 @@
> +/*
> + * 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, sublicense,
> + * 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 NONINFRINGEMENT.  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 
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +# include 
> +#endif
> +
> +#include "etnaviv_priv.h"
> +
> +static int
> +etna_perfmon_query_signals(struct etna_perfmon *pm, struct 
> etna_perfmon_domain *dom)
> +{
> + struct etna_device *dev = pm->pipe->gpu->dev;
> + struct drm_etnaviv_pm_signal req = {
> + .pipe = pm->pipe->id,
> + .domain = dom->id
> + };
> +
> + do {
> + struct etna_perfmon_signal *sig;
> + int ret;
> +
> + ret = drmCommandWriteRead(dev->fd, DRM_ETNAVIV_PM_QUERY_SIG, 
> , sizeof(req));
> + if (ret)
> + break;

What does it means if ret is non-zero here? If there is an error, would we
want to log a debug message at least, and possibly return non-zero
from this function?
(same comment for etna_perfmon_query_domains)

> + if (req.iter == 0xff)
> + return 0;

0xff is a magic value, used a few times - maybe define a constant?
(same comment for etna_perfmon_query_domains)

> +
> + sig = calloc(1, sizeof(*sig));
> + if (!sig)
> + return -ENOMEM;
> +
> + INFO_MSG("perfmon signal:");
> + INFO_MSG("iter   = %d", req.iter);
> + INFO_MSG("name   = %s", req.name);
> +
> + sig->domain = dom;
> + sig->signal = req.iter;
> + strncpy(sig->name, req.name, sizeof(sig->name));
> + list_addtail(>head, >signals);
> +
> + req.iter++;
> + } while (req.iter != 0xff);
> +
> + return 0;
> +}
> +
> +static int
> +etna_perfmon_query_domains(struct etna_perfmon *pm)
> +{
> + struct etna_device *dev = pm->pipe->gpu->dev;
> + struct drm_etnaviv_pm_domain req = {
> + .pipe = pm->pipe->id
> + };
> +
> + do {
> + struct etna_perfmon_domain *dom;
> + int ret;
> +
> + ret = drmCommandWriteRead(dev->fd, DRM_ETNAVIV_PM_QUERY_DOM, 
> , sizeof(req));
> + if (ret)
> + break;
> +
> + if (req.iter == 0xff)
> + return 0;
> +
> + dom = calloc(1, sizeof(*dom));
> + if (!dom)
> + return -ENOMEM;
> + list_inithead(>signals);
> +
> + dom->id = req.iter;
> + strncpy(dom->name, req.name, sizeof(dom->name));
> + list_addtail(>head, >domains);
> +
> + INFO_MSG("perfmon domain:");
> + INFO_MSG("iter   = %d", 

Re: [Mesa-dev] [PATCH] etnaviv: add rs-operations sw query

2017-06-20 Thread Wladimir J. van der Laan
On Fri, Jun 09, 2017 at 12:34:49PM +0200, Christian Gmeiner wrote:
> It could be useful to get the number of emited resolve operations when
> doing driver optimizations.

Nothing to add, seems useful and correct.
(though RS operations are better than falling back on the software blit path - 
should we count these too?)

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

> 
> Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_context.h  | 1 +
>  src/gallium/drivers/etnaviv/etnaviv_emit.c | 2 ++
>  src/gallium/drivers/etnaviv/etnaviv_query.c| 1 +
>  src/gallium/drivers/etnaviv/etnaviv_query.h| 1 +
>  src/gallium/drivers/etnaviv/etnaviv_query_sw.c | 3 +++
>  5 files changed, 8 insertions(+)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h 
> b/src/gallium/drivers/etnaviv/etnaviv_context.h
> index 2bb8cf5..2c9b24d 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_context.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
> @@ -174,6 +174,7 @@ struct etna_context {
> struct {
>uint64_t prims_emitted;
>uint64_t draw_calls;
> +  uint64_t rs_operations;
> } stats;
>  
> struct pipe_debug_callback debug;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c 
> b/src/gallium/drivers/etnaviv/etnaviv_emit.c
> index 81aaca9..bfff699 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
> @@ -171,6 +171,8 @@ etna_submit_rs_state(struct etna_context *ctx,
> struct etna_cmd_stream *stream = ctx->stream;
> struct etna_coalesce coalesce;
>  
> +   ctx->stats.rs_operations++;
> +
> if (screen->specs.pixel_pipes == 1) {
>etna_cmd_stream_reserve(stream, 22);
>etna_coalesce_start(stream, );
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_query.c 
> b/src/gallium/drivers/etnaviv/etnaviv_query.c
> index b33e580..617e475 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_query.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_query.c
> @@ -84,6 +84,7 @@ etna_get_driver_query_info(struct pipe_screen *pscreen, 
> unsigned index,
> struct pipe_driver_query_info list[] = {
>{"prims-emitted", PIPE_QUERY_PRIMITIVES_EMITTED, { 0 }},
>{"draw-calls", ETNA_QUERY_DRAW_CALLS, { 0 }},
> +  {"rs-operations", ETNA_QUERY_RS_OPERATIONS, { 0 }},
> };
>  
> if (!info)
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_query.h 
> b/src/gallium/drivers/etnaviv/etnaviv_query.h
> index 9a8d579..cebd662 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_query.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_query.h
> @@ -54,6 +54,7 @@ etna_query(struct pipe_query *pq)
>  }
>  
>  #define ETNA_QUERY_DRAW_CALLS(PIPE_QUERY_DRIVER_SPECIFIC + 0)
> +#define ETNA_QUERY_RS_OPERATIONS (PIPE_QUERY_DRIVER_SPECIFIC + 1)
>  
>  void
>  etna_query_screen_init(struct pipe_screen *pscreen);
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_sw.c 
> b/src/gallium/drivers/etnaviv/etnaviv_query_sw.c
> index d6420d9..213c61f 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_query_sw.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_query_sw.c
> @@ -50,6 +50,8 @@ read_counter(struct etna_context *ctx, int type)
>return ctx->stats.prims_emitted;
> case ETNA_QUERY_DRAW_CALLS:
>return ctx->stats.draw_calls;
> +   case ETNA_QUERY_RS_OPERATIONS:
> +  return ctx->stats.rs_operations;
> }
>  
> return 0;
> @@ -106,6 +108,7 @@ etna_sw_create_query(struct etna_context *ctx, unsigned 
> query_type)
> switch (query_type) {
> case PIPE_QUERY_PRIMITIVES_EMITTED:
> case ETNA_QUERY_DRAW_CALLS:
> +   case ETNA_QUERY_RS_OPERATIONS:
>break;
> default:
>return NULL;
> -- 
> 2.9.4
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/4] etnaviv: add support for swizzled texture formats

2017-06-22 Thread Wladimir J. van der Laan
On Wed, Jun 21, 2017 at 10:36:46PM +0200, Christian Gmeiner wrote:
> Passes all ext_texture_swizzle piglits.

You seem to have dropped the check in etnaviv_screen.c for HALTI0 when texture
formats have implicit non-identity swizzle.
I do think that is necessary as those formats don't work on  Signed-off-by: Christian Gmeiner 
> ---
>  src/gallium/drivers/etnaviv/etnaviv_format.c  | 91 
> ++-
>  src/gallium/drivers/etnaviv/etnaviv_format.h  |  4 ++
>  src/gallium/drivers/etnaviv/etnaviv_screen.c  |  2 +-
>  src/gallium/drivers/etnaviv/etnaviv_texture.c |  9 ++-
>  4 files changed, 71 insertions(+), 35 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
> b/src/gallium/drivers/etnaviv/etnaviv_format.c
> index e9cd104..02b8d52 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
> @@ -40,6 +40,7 @@ struct etna_format {
> unsigned tex;
> unsigned rs;
> boolean present;
> +   const unsigned char tex_swiz[4];
>  };
>  
>  #define RS_FORMAT_NONE ~0
> @@ -51,22 +52,31 @@ 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)
>  
> +#define SWIZ(x,y,z,w) {\
> +   PIPE_SWIZZLE_##x,   \
> +   PIPE_SWIZZLE_##y,   \
> +   PIPE_SWIZZLE_##z,   \
> +   PIPE_SWIZZLE_##w\
> +}
> +
>  /* vertex + texture */
> -#define VT(pipe, vtxfmt, texfmt, rsfmt)   \
> +#define VT(pipe, vtxfmt, texfmt, texswiz, rsfmt)  \
> [PIPE_FORMAT_##pipe] = {   \
>.vtx = VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_##vtxfmt, \
>.tex = TEXTURE_FORMAT_##texfmt, \
>.rs = RS_FORMAT_##rsfmt,\
>.present = 1,   \
> +  .tex_swiz = texswiz,\
> }
>  
>  /* texture-only */
> -#define _T(pipe, fmt, rsfmt)   \
> +#define _T(pipe, fmt, swiz, rsfmt) \
> [PIPE_FORMAT_##pipe] = {\
>.vtx = ETNA_NO_MATCH,\
>.tex = TEXTURE_FORMAT_##fmt, \
>.rs = RS_FORMAT_##rsfmt, \
>.present = 1,\
> +  .tex_swiz = swiz,\
> }
>  
>  /* vertex-only */
> @@ -87,9 +97,9 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
> V_(R8_USCALED, UNSIGNED_BYTE, NONE),
> V_(R8_SSCALED, BYTE,  NONE),
>  
> -   _T(A8_UNORM, A8, NONE),
> -   _T(L8_UNORM, L8, NONE),
> -   _T(I8_UNORM, I8, NONE),
> +   _T(A8_UNORM, A8, SWIZ(X, Y, Z, W), NONE),
> +   _T(L8_UNORM, L8, SWIZ(X, Y, Z, W), NONE),
> +   _T(I8_UNORM, I8, SWIZ(X, Y, Z, W), NONE),
>  
> /* 16-bit */
> V_(R16_UNORM,   UNSIGNED_SHORT, NONE),
> @@ -100,15 +110,15 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
> V_(R16_SSCALED, SHORT,  NONE),
> V_(R16_FLOAT,   HALF_FLOAT, NONE),
>  
> -   _T(B4G4R4A4_UNORM, A4R4G4B4, A4R4G4B4),
> -   _T(B4G4R4X4_UNORM, X4R4G4B4, X4R4G4B4),
> +   _T(B4G4R4A4_UNORM, A4R4G4B4, SWIZ(X, Y, Z, W), A4R4G4B4),
> +   _T(B4G4R4X4_UNORM, X4R4G4B4, SWIZ(X, Y, Z, W), X4R4G4B4),
>  
> -   _T(L8A8_UNORM, A8L8, NONE),
> +   _T(L8A8_UNORM, A8L8, SWIZ(X, Y, Z, W), NONE),
>  
> -   _T(Z16_UNORM,  D16,  A4R4G4B4),
> -   _T(B5G6R5_UNORM,   R5G6B5,   R5G6B5),
> -   _T(B5G5R5A1_UNORM, A1R5G5B5, A1R5G5B5),
> -   _T(B5G5R5X1_UNORM, X1R5G5B5, X1R5G5B5),
> +   _T(Z16_UNORM,  D16,  SWIZ(X, Y, Z, W), A4R4G4B4),
> +   _T(B5G6R5_UNORM,   R5G6B5,   SWIZ(X, Y, Z, W), R5G6B5),
> +   _T(B5G5R5A1_UNORM, A1R5G5B5, SWIZ(X, Y, Z, W), A1R5G5B5),
> +   _T(B5G5R5X1_UNORM, X1R5G5B5, SWIZ(X, Y, Z, W), X1R5G5B5),
>  
> V_(R8G8_UNORM,   UNSIGNED_BYTE,  NONE),
> V_(R8G8_SNORM,   BYTE,   NONE),
> @@ -147,25 +157,25 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
>  
> V_(R8G8B8A8_UNORM,   UNSIGNED_BYTE, A8B8G8R8),
> V_(R8G8B8A8_SNORM,   BYTE,  A8B8G8R8),
> -   _T(R8G8B8X8_UNORM,   X8B8G8R8,  X8B8G8R8),
> +   _T(R8G8B8X8_UNORM,   X8B8G8R8,  SWIZ(X, Y, Z, W), X8B8G8R8),
> V_(R8G8B8A8_UINT,UNSIGNED_BYTE, A8B8G8R8),
> V_(R8G8B8A8_SINT,BYTE,  A8B8G8R8),
> V_(R8G8B8A8_USCALED, UNSIGNED_BYTE, A8B8G8R8),
> V_(R8G8B8A8_SSCALED, BYTE,  A8B8G8R8),
>  
> -   _T(R8G8B8A8_UNORM, A8B8G8R8, A8B8G8R8),
> -   _T(R8G8B8X8_UNORM, X8B8G8R8, X8B8G8R8),
> +   _T(R8G8B8A8_UNORM, A8B8G8R8, SWIZ(X, Y, Z, W), A8B8G8R8),
> +   _T(R8G8B8X8_UNORM, X8B8G8R8, SWIZ(X, Y, Z, W), X8B8G8R8),
>  
> -   _T(B8G8R8A8_UNORM, A8R8G8B8, A8R8G8B8),
> -   _T(B8G8R8X8_UNORM, X8R8G8B8, X8R8G8B8),
> +   _T(B8G8R8A8_UNORM, A8R8G8B8, SWIZ(X, Y, Z, W), A8R8G8B8),
> +   _T(B8G8R8X8_UNORM, X8R8G8B8, SWIZ(X, Y, Z, W), X8R8G8B8),
>  
> V_(R10G10B10A2_UNORM,   UNSIGNED_INT_10_10_10_2, NONE),
> V_(R10G10B10A2_SNORM,   INT_10_10_10_2,  NONE),
> 

Re: [Mesa-dev] [PATCH 4/4] etnaviv: add support for snorm textures

2017-06-22 Thread Wladimir J. van der Laan
On Wed, Jun 21, 2017 at 10:36:48PM +0200, Christian Gmeiner wrote:
> Based on a patch from Wladimir J. van der Laan and untested due
> to lack of hardware. Binary blob emits those formats if GPU supports
> HALTI1 (faked with ibvivhook).

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_format.c | 7 ---
>  src/gallium/drivers/etnaviv/etnaviv_screen.c | 8 ++--
>  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
> b/src/gallium/drivers/etnaviv/etnaviv_format.c
> index c9a8ce2..47f80ac 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
> @@ -91,7 +91,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),
> +   VT(R8_SNORM,   BYTE,  EXT_R8_SNORM | EXT_FORMAT, SWIZ(X, 0, 0, 
> 1), NONE),
> V_(R8_UINT,UNSIGNED_BYTE, NONE),
> V_(R8_SINT,BYTE,  NONE),
> V_(R8_USCALED, UNSIGNED_BYTE, NONE),
> @@ -121,7 +121,7 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
> _T(B5G5R5X1_UNORM, X1R5G5B5, SWIZ(X, Y, Z, W), X1R5G5B5),
>  
> VT(R8G8_UNORM,   UNSIGNED_BYTE,  EXT_G8R8 | EXT_FORMAT, SWIZ(X, Y, 0, 1), 
> NONE),
> -   V_(R8G8_SNORM,   BYTE,   NONE),
> +   VT(R8G8_SNORM,   BYTE,   EXT_G8R8_SNORM | EXT_FORMAT, SWIZ(X, Y, 
> 0, 1), NONE),
> V_(R8G8_UINT,UNSIGNED_BYTE,  NONE),
> V_(R8G8_SINT,BYTE,   NONE),
> V_(R8G8_USCALED, UNSIGNED_BYTE,  NONE),
> @@ -156,8 +156,9 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
> V_(A8B8G8R8_UNORM,   UNSIGNED_BYTE, NONE),
>  
> V_(R8G8B8A8_UNORM,   UNSIGNED_BYTE, A8B8G8R8),
> -   V_(R8G8B8A8_SNORM,   BYTE,  A8B8G8R8),
> +   VT(R8G8B8A8_SNORM,   BYTE,  EXT_A8B8G8R8_SNORM | EXT_FORMAT, 
> SWIZ(X, Y, Z, 1), NONE),
> _T(R8G8B8X8_UNORM,   X8B8G8R8,  SWIZ(X, Y, Z, W), X8B8G8R8),
> +   _T(R8G8B8X8_SNORM,   EXT_X8B8G8R8_SNORM | EXT_FORMAT, SWIZ(X, Y, Z, W), 
> NONE),
> V_(R8G8B8A8_UINT,UNSIGNED_BYTE, A8B8G8R8),
> V_(R8G8B8A8_SINT,BYTE,  A8B8G8R8),
> V_(R8G8B8A8_USCALED, UNSIGNED_BYTE, A8B8G8R8),
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
> b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index e310c16..c7c4c95 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -459,7 +459,8 @@ etna_screen_get_timestamp(struct pipe_screen *pscreen)
>  }
>  
>  static bool
> -gpu_supports_texure_format(struct etna_screen *screen, uint32_t fmt)
> +gpu_supports_texure_format(struct etna_screen *screen, uint32_t fmt,
> +   enum pipe_format format)
>  {
> if (fmt == TEXTURE_FORMAT_ETC1)
>return VIV_FEATURE(screen, chipFeatures, ETC1_TEXTURE_COMPRESSION);
> @@ -470,6 +471,9 @@ gpu_supports_texure_format(struct etna_screen *screen, 
> uint32_t fmt)
> if (fmt & EXT_FORMAT)
>return VIV_FEATURE(screen, chipMinorFeatures1, HALTI0);
>  
> +   if (util_format_is_snorm(format))
> +  return VIV_FEATURE(screen, chipMinorFeatures2, HALTI1);
> +
> return true;
>  }
>  
> @@ -514,7 +518,7 @@ etna_screen_is_format_supported(struct pipe_screen 
> *pscreen,
> if (usage & PIPE_BIND_SAMPLER_VIEW) {
>uint32_t fmt = translate_texture_format(format);
>  
> -  if (!gpu_supports_texure_format(screen, fmt))
> +  if (!gpu_supports_texure_format(screen, fmt, format))
>   fmt = ETNA_NO_MATCH;
>  
>if (sample_count < 2 && fmt != ETNA_NO_MATCH)
> -- 
> 2.9.4
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] etnaviv: add support for extended texture formats

2017-06-22 Thread Wladimir J. van der Laan
On Wed, Jun 21, 2017 at 10:36:45PM +0200, Christian Gmeiner wrote:
> Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com>

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_format.c  | 2 +-
>  src/gallium/drivers/etnaviv/etnaviv_format.h  | 1 +
>  src/gallium/drivers/etnaviv/etnaviv_screen.c  | 3 +++
>  src/gallium/drivers/etnaviv/etnaviv_texture.c | 8 +---
>  4 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
> b/src/gallium/drivers/etnaviv/etnaviv_format.c
> index 7c24386..e9cd104 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
> @@ -231,7 +231,7 @@ 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
> +   /* XXX with swizzle on newer chips we can
>  * support much more */
> if (!formats[fmt].present)
>return ETNA_NO_MATCH;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.h 
> b/src/gallium/drivers/etnaviv/etnaviv_format.h
> index 549dfda..1170d79 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.h
> @@ -31,6 +31,7 @@
>  #include 
>  
>  #define ETNA_NO_MATCH (~0)
> +#define EXT_FORMAT (1 << 31)
>  
>  uint32_t
>  translate_texture_format(enum pipe_format fmt);
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
> b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index 6c0735e..a69aef0 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -467,6 +467,9 @@ gpu_supports_texure_format(struct etna_screen *screen, 
> uint32_t fmt)
> if (fmt >= TEXTURE_FORMAT_DXT1 && fmt <= TEXTURE_FORMAT_DXT4_DXT5)
>return VIV_FEATURE(screen, chipFeatures, DXT_TEXTURE_COMPRESSION);
>  
> +   if (fmt & EXT_FORMAT)
> +  return VIV_FEATURE(screen, chipMinorFeatures1, HALTI0);
> +
> return true;
>  }
>  
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c 
> b/src/gallium/drivers/etnaviv/etnaviv_texture.c
> index df77829..f973bcb 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_texture.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c
> @@ -161,6 +161,8 @@ etna_create_sampler_view(struct pipe_context *pctx, 
> struct pipe_resource *prsc,
> struct etna_sampler_view *sv = CALLOC_STRUCT(etna_sampler_view);
> struct etna_resource *res = etna_resource(prsc);
> struct etna_context *ctx = etna_context(pctx);
> +   const uint32_t format = translate_texture_format(so->format);
> +   const bool ext = !!(format & EXT_FORMAT);
>  
> if (!sv)
>return NULL;
> @@ -191,8 +193,7 @@ etna_create_sampler_view(struct pipe_context *pctx, 
> struct pipe_resource *prsc,
> sv->base.context = pctx;
>  
> /* merged with sampler state */
> -   sv->TE_SAMPLER_CONFIG0 =
> -  
> VIVS_TE_SAMPLER_CONFIG0_FORMAT(translate_texture_format(sv->base.format));
> +   sv->TE_SAMPLER_CONFIG0 = COND(!ext, 
> VIVS_TE_SAMPLER_CONFIG0_FORMAT(format));
> sv->TE_SAMPLER_CONFIG0_MASK = 0x;
>  
> switch (sv->base.target) {
> @@ -215,7 +216,8 @@ etna_create_sampler_view(struct pipe_context *pctx, 
> struct pipe_resource *prsc,
>return NULL;
> }
>  
> -   sv->TE_SAMPLER_CONFIG1 = VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_R(so->swizzle_r) 
> |
> +   sv->TE_SAMPLER_CONFIG1 = COND(ext, 
> VIVS_TE_SAMPLER_CONFIG1_FORMAT_EXT(format)) |
> +VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_R(so->swizzle_r) 
> |
>  VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_G(so->swizzle_g) 
> |
>  VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_B(so->swizzle_b) 
> |
>  VIVS_TE_SAMPLER_CONFIG1_SWIZZLE_A(so->swizzle_a) 
> |
> -- 
> 2.9.4
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] etnaviv: add R8G8 texture support

2017-06-22 Thread Wladimir J. van der Laan
On Wed, Jun 21, 2017 at 10:36:47PM +0200, Christian Gmeiner wrote:
> Passes texwrap GL_ARB_texture_rg piglit (with faked full texture rg support).

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> 
> Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_format.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
> b/src/gallium/drivers/etnaviv/etnaviv_format.c
> index 02b8d52..c9a8ce2 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
> @@ -120,7 +120,7 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
> _T(B5G5R5A1_UNORM, A1R5G5B5, SWIZ(X, Y, Z, W), A1R5G5B5),
> _T(B5G5R5X1_UNORM, X1R5G5B5, SWIZ(X, Y, Z, W), X1R5G5B5),
>  
> -   V_(R8G8_UNORM,   UNSIGNED_BYTE,  NONE),
> +   VT(R8G8_UNORM,   UNSIGNED_BYTE,  EXT_G8R8 | EXT_FORMAT, SWIZ(X, Y, 0, 1), 
> NONE),
> V_(R8G8_SNORM,   BYTE,   NONE),
> V_(R8G8_UINT,UNSIGNED_BYTE,  NONE),
> V_(R8G8_SINT,BYTE,   NONE),
> -- 
> 2.9.4
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/4] etnaviv: add support for swizzled texture formats

2017-06-26 Thread Wladimir J. van der Laan
On Sat, Jun 24, 2017 at 10:41:58AM +0200, Christian Gmeiner wrote:
> Hi
> 
> 2017-06-22 14:39 GMT+02:00 Wladimir J. van der Laan <laa...@gmail.com>:
> > On Wed, Jun 21, 2017 at 10:36:46PM +0200, Christian Gmeiner wrote:
> >> Passes all ext_texture_swizzle piglits.
> >
> > You seem to have dropped the check in etnaviv_screen.c for HALTI0 when 
> > texture
> > formats have implicit non-identity swizzle.
> > I do think that is necessary as those formats don't work on  >
> 
> Yeah I totally overlooked it :( What do you think about something like this:

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

> 
> >8---
> 
> From ad780e77bfac7ed5c5427ad4b850d3b596558f0a Mon Sep 17 00:00:00 2001
> From: Christian Gmeiner <christian.gmei...@gmail.com>
> Date: Fri, 16 Jun 2017 17:02:29 +0200
> Subject: [PATCH] etnaviv: add support for swizzled texture formats
> 
> Passes all ext_texture_swizzle piglits.
> 
> Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_format.c  | 103 
> ++
>  src/gallium/drivers/etnaviv/etnaviv_format.h  |   7 ++
>  src/gallium/drivers/etnaviv/etnaviv_screen.c  |  19 +++--
>  src/gallium/drivers/etnaviv/etnaviv_texture.c |   9 +--
>  4 files changed, 99 insertions(+), 39 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c
> b/src/gallium/drivers/etnaviv/etnaviv_format.c
> index e9cd1040b5..ee50b52962 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
> @@ -40,6 +40,7 @@ struct etna_format {
> unsigned tex;
> unsigned rs;
> boolean present;
> +   const unsigned char tex_swiz[4];
>  };
> 
>  #define RS_FORMAT_NONE ~0
> @@ -51,22 +52,31 @@ 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)
> 
> +#define SWIZ(x,y,z,w) {\
> +   PIPE_SWIZZLE_##x,   \
> +   PIPE_SWIZZLE_##y,   \
> +   PIPE_SWIZZLE_##z,   \
> +   PIPE_SWIZZLE_##w\
> +}
> +
>  /* vertex + texture */
> -#define VT(pipe, vtxfmt, texfmt, rsfmt)   \
> +#define VT(pipe, vtxfmt, texfmt, texswiz, rsfmt)  \
> [PIPE_FORMAT_##pipe] = {   \
>.vtx = VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_##vtxfmt, \
>.tex = TEXTURE_FORMAT_##texfmt, \
>.rs = RS_FORMAT_##rsfmt,\
>.present = 1,   \
> +  .tex_swiz = texswiz,\
> }
> 
>  /* texture-only */
> -#define _T(pipe, fmt, rsfmt)   \
> +#define _T(pipe, fmt, swiz, rsfmt) \
> [PIPE_FORMAT_##pipe] = {\
>.vtx = ETNA_NO_MATCH,\
>.tex = TEXTURE_FORMAT_##fmt, \
>.rs = RS_FORMAT_##rsfmt, \
>.present = 1,\
> +  .tex_swiz = swiz,\
> }
> 
>  /* vertex-only */
> @@ -87,9 +97,9 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
> V_(R8_USCALED, UNSIGNED_BYTE, NONE),
> V_(R8_SSCALED, BYTE,  NONE),
> 
> -   _T(A8_UNORM, A8, NONE),
> -   _T(L8_UNORM, L8, NONE),
> -   _T(I8_UNORM, I8, NONE),
> +   _T(A8_UNORM, A8, SWIZ(X, Y, Z, W), NONE),
> +   _T(L8_UNORM, L8, SWIZ(X, Y, Z, W), NONE),
> +   _T(I8_UNORM, I8, SWIZ(X, Y, Z, W), NONE),
> 
> /* 16-bit */
> V_(R16_UNORM,   UNSIGNED_SHORT, NONE),
> @@ -100,15 +110,15 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
> V_(R16_SSCALED, SHORT,  NONE),
> V_(R16_FLOAT,   HALF_FLOAT, NONE),
> 
> -   _T(B4G4R4A4_UNORM, A4R4G4B4, A4R4G4B4),
> -   _T(B4G4R4X4_UNORM, X4R4G4B4, X4R4G4B4),
> +   _T(B4G4R4A4_UNORM, A4R4G4B4, SWIZ(X, Y, Z, W), A4R4G4B4),
> +   _T(B4G4R4X4_UNORM, X4R4G4B4, SWIZ(X, Y, Z, W), X4R4G4B4),
> 
> -   _T(L8A8_UNORM, A8L8, NONE),
> +   _T(L8A8_UNORM, A8L8, SWIZ(X, Y, Z, W), NONE),
> 
> -   _T(Z16_UNORM,  D16,  A4R4G4B4),
> -   _T(B5G6R5_UNORM,   R5G6B5,   R5G6B5),
> -   _T(B5G5R5A1_UNORM, A1R5G5B5, A1R5G5B5),
> -   _T(B5G5R5X1_UNORM, X1R5G5B5, X1R5G5B5),
> +   _T(Z16_UNORM,  D16,  SWIZ(X, Y, Z, W), A4R4G4B4),
> +   _T(B5G6R5_UNORM,   R5G6B5,   SWIZ(X, Y, Z, W), R5G6B5),
> +   _T(B5G5R5A1_UNORM, A1R5G5B5, SWIZ(X, Y, Z, W), A1R5G5B5),
> +   _T(B5G5R5X1_UNORM, X1R5G5B5, SWIZ(X, Y, Z, W), X1R5G5B5),
> 
> V_(R8G8_UNORM,   UNSIGNED_BYTE,  NONE),
> V_(R8G8_SNORM,   BYTE,   NONE),
> @@ -147,25 +157,25 @@ static struct etna_format formats[PIPE_FORMAT_C

Re: [Mesa-dev] [PATCHv2] etnaviv: Add support for ETC2 texture compression

2017-06-27 Thread Wladimir J. van der Laan
> I can confirm that 11 bit stuff works on the GC2000 . I used piglit's
> oes_compressed_etc2_texture-miptree_gles3 for verification.
> How have you tested these formats?

I rendered the example images from
https://github.com/Ericsson/ETCPACK/tree/master/testing/testvectors_correct/pkm,
which displayed fine, both the 11 and 8 bit variants.

Haven't checked pixel-for-pixel though.

Wladimir

> 
> For instance I get the following fails:
> debian@cubox:~/ac_mesa$
> /home/debian/piglit/bin/oes_compressed_etc2_texture-miptree_gles3 rgb8
> -auto -fbo
> Probe color at (16,0)
>   Left: 0.53 0.20 0.00 1.00
>   Right: 0.87 0.60 0.33 1.00
> PIGLIT: {"result": "fail" }
> debian@cubox:~/ac_mesa$
> /home/debian/piglit/bin/oes_compressed_etc2_texture-miptree_gles3
> rgb8-punchthrough-alpha1 -auto -fbo
> Probe color at (6,0)
>   Left: 0.73 0.40 0.00 1.00
>   Right: 0.13 0.07 0.00 1.00
> PIGLIT: {"result": "fail" }
> 
> With that fact I think we need to find out what is broken with the non
> 11 bit formats on GC2000 and if everything works on your platform. I
> am not
> sure if we should advertise the broken formats (on gpus with HALTI0).
> 
> 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] [PATCHv2] etnaviv: Add support for ETC2 texture compression

2017-06-27 Thread Wladimir J. van der Laan
On Tue, Jun 27, 2017 at 05:31:52PM +0200, Wladimir J. van der Laan wrote:

> > sure if we should advertise the broken formats (on gpus with HALTI0).

FWIW, I did check on both GC2000 and GC3000, so HALTI0 should be ok.

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 Thread Wladimir J. van der Laan

> 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


[Mesa-dev] [PATCH 4/3] etnaviv: Add support for ETC2 texture compression

2017-05-16 Thread Wladimir J. van der Laan
Add support for ETC2 compressed textures in the etnaviv driver.
These are available on GC2000+.

One step closer towards GL ES 3 support.
---
 src/gallium/drivers/etnaviv/etnaviv_format.c | 11 +++
 1 file changed, 11 insertions(+)

Mesa does not export the ETC2 formats without OpenGL ES 3, so to test, use: 

export MESA_GLES_VERSION_OVERRIDE=3.0

Currently no distinction is being made between RGB and SRGB formats. I'm still
researching the state bits concerned with that.

diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
b/src/gallium/drivers/etnaviv/etnaviv_format.c
index dbedda3..7d110c8 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
@@ -257,6 +257,17 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
_T(DXT3_RGBA, DXT2_DXT3, NONE),
_T(DXT5_RGBA, DXT4_DXT5, NONE),
 
+   _TE(ETC2_RGB8,   NONE, NONE, SWIZ_XYZW), /* Extd. format NONE doubles 
as ETC2_RGB8 */
+   _TE(ETC2_SRGB8,  NONE, NONE, SWIZ_XYZW),
+   _TE(ETC2_RGB8A1, RGB8_PUNCHTHROUGH_ALPHA1_ETC2, NONE, SWIZ_XYZW),
+   _TE(ETC2_SRGB8A1,RGB8_PUNCHTHROUGH_ALPHA1_ETC2, NONE, SWIZ_XYZW),
+   _TE(ETC2_RGBA8,  RGBA8_ETC2_EAC, NONE, SWIZ_XYZW),
+   _TE(ETC2_SRGBA8, RGBA8_ETC2_EAC, NONE, SWIZ_XYZW),
+   _TE(ETC2_R11_UNORM,  R11_EAC, NONE, SWIZ_XYZW),
+   _TE(ETC2_R11_SNORM,  SIGNED_R11_EAC, NONE, SWIZ_XYZW),
+   _TE(ETC2_RG11_UNORM, RG11_EAC, NONE, SWIZ_XYZW),
+   _TE(ETC2_RG11_SNORM, SIGNED_RG11_EAC, NONE, SWIZ_XYZW),
+
/* YUV */
_T(YUYV, YUY2, YUY2),
_T(UYVY, UYVY, NONE),
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 1/6] etnaviv: always do cpu_fini in transfer_unmap

2017-05-31 Thread Wladimir J. van der Laan
On Fri, May 19, 2017 at 11:41:07AM +0200, Lucas Stach wrote:
> The cpu_fini() call pushes the buffer back into the GPU domain, which needs
> to be done for all buffers, not just the ones with CPU written content. The
> etnaviv kernel driver currently doesn't validate this, but may start to do
> so at a later point in time. If there is a temporary resource the fini needs
> to happen before the RS uses this one as the source for the upload.
> 
> Also remove an invalid comment about flushing CPU caches, cpu_fini takes
> care of everything involved in this.

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

> Fixes: c9e8b49b885 ("etnaviv: gallium driver for Vivante GPUs")
> Cc: mesa-sta...@lists.freedesktop.org
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_transfer.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c 
> b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> index 1a5aa7fc043c..4809b04ff95f 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> @@ -70,6 +70,9 @@ etna_transfer_unmap(struct pipe_context *pctx, struct 
> pipe_transfer *ptrans)
> if (rsc->texture && !etna_resource_newer(rsc, 
> etna_resource(rsc->texture)))
>rsc = etna_resource(rsc->texture); /* switch to using the texture 
> resource */
>  
> +   if (trans->rsc)
> +  etna_bo_cpu_fini(etna_resource(trans->rsc)->bo);
> +
> if (ptrans->usage & PIPE_TRANSFER_WRITE) {
>if (trans->rsc) {
>   /* We have a temporary resource due to either tile status or
> @@ -105,15 +108,15 @@ etna_transfer_unmap(struct pipe_context *pctx, struct 
> pipe_transfer *ptrans)
>}
>  
>rsc->seqno++;
> -  etna_bo_cpu_fini(rsc->bo);
>  
>if (rsc->base.bind & PIPE_BIND_SAMPLER_VIEW) {
> - /* XXX do we need to flush the CPU cache too or start a write 
> barrier
> -  * to make sure the GPU sees it? */
>   ctx->dirty |= ETNA_DIRTY_TEXTURE_CACHES;
>}
> }
>  
> +   if (!trans->rsc)
> +  etna_bo_cpu_fini(rsc->bo);
> +
> pipe_resource_reference(>rsc, NULL);
> pipe_resource_reference(>resource, NULL);
> slab_free(>transfer_pool, trans);
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 6/6] etnaviv: upgrade DISCARD_RANGE to DISCARD_WHOLE_RESOURCE if possible

2017-06-08 Thread Wladimir J. van der Laan
Hello Lucas,

On Thu, Jun 08, 2017 at 10:26:04AM +0200, Lucas Stach wrote:
> Hi Wladimir,
> 
> did you also review this patch? It's the last one of this series missing
> review.

Sorry, no, I missed it somehow.
Looks obviously correct to me, and matches the code from VC4 (apart from the 
coherent which you mention), so

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

> Am Freitag, den 19.05.2017, 11:41 +0200 schrieb Lucas Stach:
> > Stolen from VC4. As we don't do any fancy reallocation tricks yet, it's
> > possible to upgrade also coherent mappings and shared resources.
> > 
> > Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> > ---
> >  src/gallium/drivers/etnaviv/etnaviv_transfer.c | 14 ++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c 
> > b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> > index 05cdbc599956..fe57aa4d17b2 100644
> > --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> > +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> > @@ -148,6 +148,20 @@ etna_transfer_map(struct pipe_context *pctx, struct 
> > pipe_resource *prsc,
> >  
> > assert(level <= prsc->last_level);
> >  
> > +   /* Upgrade DISCARD_RANGE to WHOLE_RESOURCE if the whole resource is
> > +* being mapped. If we add buffer reallocation to avoid CPU/GPU sync 
> > this
> > +* check needs to be extended to coherent mappings and shared resources.
> > +*/
> > +   if ((usage & PIPE_TRANSFER_DISCARD_RANGE) &&
> > +   !(usage & PIPE_TRANSFER_UNSYNCHRONIZED) &&
> > +   prsc->last_level == 0 &&
> > +   prsc->width0 == box->width &&
> > +   prsc->height0 == box->height &&
> > +   prsc->depth0 == box->depth &&
> > +   prsc->array_size == 1) {
> > +  usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
> > +   }
> > +
> > if (rsc->texture && !etna_resource_newer(rsc, 
> > etna_resource(rsc->texture))) {
> >/* We have a texture resource which is the same age or newer than the
> > * render resource. Use the texture resource, which avoids bouncing
> 
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] etnaviv: don't flush resource to self without TS

2017-06-06 Thread Wladimir J. van der Laan
On Tue, Jun 06, 2017 at 12:38:23PM +0200, Lucas Stach wrote:
> From: Lucas Stach <d...@lynxeye.de>
> 
> A resolve to self is only necessary if the resource is fast cleared, so
> there is never a need to do so if there is no TS allocated.
> 
> Signed-off-by: Lucas Stach <d...@lynxeye.de>

Does this take into account the case on GC2000, where there can be a texture 
resource
that is out of date with the rendered-to resource?

If so:
Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.h 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.h
> index a8d42ee1a09f..1084103386ef 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.h
> @@ -102,7 +102,7 @@ etna_resource_older(struct etna_resource *a, struct 
> etna_resource *b)
>  static inline bool
>  etna_resource_needs_flush(struct etna_resource *res)
>  {
> -   return (int)(res->seqno - res->flush_seqno) > 0;
> +   return res->ts_bo && ((int)(res->seqno - res->flush_seqno) > 0);
>  }
>  
>  /* is the resource only used on the sampler? */
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/6] etnaviv: slim down resource waiting

2017-06-06 Thread Wladimir J. van der Laan
On Fri, May 19, 2017 at 11:41:08AM +0200, Lucas Stach wrote:
> cpu_prep() already does all the required waiting, so the only thing that
> needs to be done is flushing the commandstream, if a GPU write is pending.

Looks good to me.

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_clear_blit.c |  5 +++--
>  src/gallium/drivers/etnaviv/etnaviv_resource.c   | 16 
>  src/gallium/drivers/etnaviv/etnaviv_resource.h   |  3 ---
>  src/gallium/drivers/etnaviv/etnaviv_transfer.c   |  5 +++--
>  4 files changed, 6 insertions(+), 23 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c 
> b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> index ae1c5862880f..ea416bf192f3 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> @@ -528,8 +528,9 @@ etna_try_rs_blit(struct pipe_context *pctx,
>  
>  manual:
> if (src->layout == ETNA_LAYOUT_TILED && dst->layout == ETNA_LAYOUT_TILED) 
> {
> -  etna_resource_wait(pctx, dst);
> -  etna_resource_wait(pctx, src);
> +  if ((src->status & ETNA_PENDING_WRITE) ||
> +  (dst->status & ETNA_PENDING_WRITE))
> + pctx->flush(pctx, NULL, 0);
>return etna_manual_blit(dst, dst_lev, dst_offset, src, src_lev, 
> src_offset, blit_info);
> }
>  
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 1341e1ea2314..9aa1aa617a51 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -429,22 +429,6 @@ etna_resource_used(struct etna_context *ctx, struct 
> pipe_resource *prsc,
>  }
>  
>  void
> -etna_resource_wait(struct pipe_context *pctx, struct etna_resource *rsc)
> -{
> -   if (rsc->status & ETNA_PENDING_WRITE) {
> -  struct pipe_fence_handle *fence;
> -  struct pipe_screen *pscreen = pctx->screen;
> -
> -  pctx->flush(pctx, , 0);
> -
> -  if (!pscreen->fence_finish(pscreen, pctx, fence, 50ULL))
> - BUG("fence timed out (hung GPU?)");
> -
> -  pscreen->fence_reference(pscreen, , NULL);
> -   }
> -}
> -
> -void
>  etna_resource_screen_init(struct pipe_screen *pscreen)
>  {
> pscreen->can_create_resource = etna_screen_can_create_resource;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.h 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.h
> index a8d42ee1a09f..913316f193c2 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.h
> @@ -124,9 +124,6 @@ void
>  etna_resource_used(struct etna_context *ctx, struct pipe_resource *prsc,
> enum etna_resource_status status);
>  
> -void
> -etna_resource_wait(struct pipe_context *ctx, struct etna_resource *rsc);
> -
>  static inline void
>  resource_read(struct etna_context *ctx, struct pipe_resource *prsc)
>  {
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c 
> b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> index 4809b04ff95f..269bd498f89f 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> @@ -199,8 +199,9 @@ etna_transfer_map(struct pipe_context *pctx, struct 
> pipe_resource *prsc,
> /* Always sync if we have the temporary resource.  The PIPE_TRANSFER_READ
>  * case could be optimised if we knew whether the resource has outstanding
>  * rendering. */
> -   if (usage & PIPE_TRANSFER_READ || trans->rsc)
> -  etna_resource_wait(pctx, rsc);
> +   if ((usage & PIPE_TRANSFER_READ || trans->rsc) &&
> +   rsc->status & ETNA_PENDING_WRITE)
> +  pctx->flush(pctx, NULL, 0);
>  
> /* XXX we don't handle PIPE_TRANSFER_FLUSH_EXPLICIT; this flag can be 
> ignored
>  * when mapping in-place,
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] glmark2 segfault on imx6

2017-06-13 Thread Wladimir J. van der Laan
Hello Fabio,

Can you get a traceback using gdb?

That'd be very useful to find out where in the driver this crash happens.

Regards,
Wladimir

On Tue, Jun 13, 2017 at 04:20:23PM -0300, Fabio Estevam wrote:
> Hi,
> 
> I am running kernel 4.11.4 with Etnaviv 17.1.2 on a imx6qsabresd board
> and when I try to run glmark I am getting a segmentation fault:
> 
> # glmark2-es2-drm
> ** Failed to set swap interval. Results may be bounded above by refresh rate.
> ===
> glmark2 2014.03
> ===
> OpenGL Information
> GL_VENDOR: etnaviv
> GL_RENDERER:   Gallium 0.4 on Vivante GC2000 rev 5108
> GL_VERSION:OpenGL ES 2.0 Mesa 17.1.2
> ===
> ** Failed to set swap interval. Results may be bounded above by refresh rate.
> [build] use-vbo=false:Segmentation fault
> #
> 
> strace log can be found here:
> https://paste.ubuntu.com/24851027/
> 
> This used to work before. Does anyone have any suggestions?
> 
> Thanks
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/6] etnaviv: honor PIPE_TRANSFER_UNSYNCHRONIZED flag

2017-06-06 Thread Wladimir J. van der Laan
On Fri, May 19, 2017 at 11:41:09AM +0200, Lucas Stach wrote:
> This gets rid of quite a bit of CPU/GPU sync on frequent vertex buffer
> uploads and I haven't seen any of the issues mentioned in the comment,
> so this one seems stale.

Interesting. I don't quite remember what prompted adding this, it may have to
do with other hacks to support single-vertex-stream GPUs which have since been
removed, so it's likely stale.

In any case heeding PIPE_TRANSFER_UNSYNCHRONIZED makes sense. It should not just
be ignored because the driver thinks it knows better.

> Ignore the flag if there exists a temporary resource, as those ones are
> never busy.

OK. 

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_transfer.c | 22 ++
>  1 file changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c 
> b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> index 269bd498f89f..a2cd4e6234dd 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> @@ -114,7 +114,7 @@ etna_transfer_unmap(struct pipe_context *pctx, struct 
> pipe_transfer *ptrans)
>}
> }
>  
> -   if (!trans->rsc)
> +   if (!trans->rsc && !(ptrans->usage & PIPE_TRANSFER_UNSYNCHRONIZED))
>etna_bo_cpu_fini(rsc->bo);
>  
> pipe_resource_reference(>rsc, NULL);
> @@ -260,19 +260,17 @@ etna_transfer_map(struct pipe_context *pctx, struct 
> pipe_resource *prsc,
> (rsc->layout == ETNA_LAYOUT_TILED &&
>  util_format_is_compressed(prsc->format));
>  
> -   /* Ignore PIPE_TRANSFER_UNSYNCHRONIZED and PIPE_TRANSFER_DONTBLOCK here.
> -* It appears that Gallium operates the index/vertex buffers in a
> -* circular fashion, and the CPU can catch up with the GPU and starts
> -* overwriting yet-to-be-processed entries, causing rendering corruption. 
> */
> -   uint32_t prep_flags = 0;
> +   if (trans->rsc || !(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
> +  uint32_t prep_flags = 0;
>  
> -   if (usage & PIPE_TRANSFER_READ)
> -  prep_flags |= DRM_ETNA_PREP_READ;
> -   if (usage & PIPE_TRANSFER_WRITE)
> -  prep_flags |= DRM_ETNA_PREP_WRITE;
> +  if (usage & PIPE_TRANSFER_READ)
> + prep_flags |= DRM_ETNA_PREP_READ;
> +  if (usage & PIPE_TRANSFER_WRITE)
> + prep_flags |= DRM_ETNA_PREP_WRITE;
>  
> -   if (etna_bo_cpu_prep(rsc->bo, prep_flags))
> -  goto fail_prep;
> +  if (etna_bo_cpu_prep(rsc->bo, prep_flags))
> + goto fail_prep;
> +   }
>  
> /* map buffer object */
> void *mapped = etna_bo_map(rsc->bo);
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/6] etnaviv: don't read back resource if transfer discards contents

2017-06-06 Thread Wladimir J. van der Laan
On Fri, May 19, 2017 at 11:41:10AM +0200, Lucas Stach wrote:
> Reduces bandwidth usage of transfers which discard the buffer contents,
> as well as skipping unnecessary command stream flushes and CPU/GPU
> synchronization.

Looks obviously correct. The contents of the temporary resource
don't matter if DISCARD_WHOLE_RESOURCE.

Reviewed-By: Wladimir J. van der Laan

> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_transfer.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c 
> b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> index a2cd4e6234dd..f7871f485371 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> @@ -188,7 +188,9 @@ etna_transfer_map(struct pipe_context *pctx, struct 
> pipe_resource *prsc,
>   return NULL;
>}
>  
> -  etna_copy_resource(pctx, trans->rsc, prsc, level, 
> trans->rsc->last_level);
> +  if (!(usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE))
> + etna_copy_resource(pctx, trans->rsc, prsc, level,
> +trans->rsc->last_level);
>  
>/* Switch to using the temporary resource instead */
>rsc = etna_resource(trans->rsc);
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/6] etnaviv: simplify transfer tiling handling

2017-06-06 Thread Wladimir J. van der Laan
On Fri, May 19, 2017 at 11:41:11AM +0200, Lucas Stach wrote:
> There is no need to special case compressed resources, as they are already
> marked as linear on allocation. With that out of the way, there is room to
> cut down on the number of if clauses used.

Code change looks good to me. Resource layout is explicit, and not dependent
on the compressed-ness of the texture format.

Reviewed-By: Wladimir J. van der Laan <laa...@gmail.com>

> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_transfer.c | 70 
> +++---
>  1 file changed, 29 insertions(+), 41 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c 
> b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> index f7871f485371..05cdbc599956 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> @@ -85,21 +85,19 @@ etna_transfer_unmap(struct pipe_context *pctx, struct 
> pipe_transfer *ptrans)
>   struct etna_resource_level *res_level = >levels[ptrans->level];
>   void *mapped = etna_bo_map(rsc->bo) + res_level->offset;
>  
> - if (rsc->layout == ETNA_LAYOUT_LINEAR || rsc->layout == 
> ETNA_LAYOUT_TILED) {
> -if (rsc->layout == ETNA_LAYOUT_TILED && 
> !util_format_is_compressed(rsc->base.format)) {
> -   etna_texture_tile(
> -  mapped + ptrans->box.z * res_level->layer_stride,
> -  trans->staging, ptrans->box.x, ptrans->box.y,
> -  res_level->stride, ptrans->box.width, ptrans->box.height,
> -  ptrans->stride, 
> util_format_get_blocksize(rsc->base.format));
> -} else { /* non-tiled or compressed format */
> -   util_copy_box(mapped, rsc->base.format, res_level->stride,
> - res_level->layer_stride, ptrans->box.x,
> - ptrans->box.y, ptrans->box.z, ptrans->box.width,
> - ptrans->box.height, ptrans->box.depth,
> - trans->staging, ptrans->stride,
> - ptrans->layer_stride, 0, 0, 0 /* src x,y,z */);
> -}

> + if (rsc->layout == ETNA_LAYOUT_TILED) {
> +etna_texture_tile(
> +   mapped + ptrans->box.z * res_level->layer_stride,
> +   trans->staging, ptrans->box.x, ptrans->box.y,
> +   res_level->stride, ptrans->box.width, ptrans->box.height,
> +   ptrans->stride, util_format_get_blocksize(rsc->base.format));
> + } else if (rsc->layout == ETNA_LAYOUT_LINEAR) {
> +util_copy_box(mapped, rsc->base.format, res_level->stride,
> +  res_level->layer_stride, ptrans->box.x,
> +  ptrans->box.y, ptrans->box.z, ptrans->box.width,
> +  ptrans->box.height, ptrans->box.depth,
> +  trans->staging, ptrans->stride,
> +  ptrans->layer_stride, 0, 0, 0 /* src x,y,z */);
>   } else {
>  BUG("unsupported tiling %i", rsc->layout);
>   }
> @@ -255,13 +253,6 @@ etna_transfer_map(struct pipe_context *pctx, struct 
> pipe_resource *prsc,
>PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE is set.
>  */
>  
> -   /* No need to allocate a buffer for copying if the resource is not in use,
> -* and no tiling is needed, can just return a direct pointer.
> -*/
> -   bool in_place = rsc->layout == ETNA_LAYOUT_LINEAR ||
> -   (rsc->layout == ETNA_LAYOUT_TILED &&
> -util_format_is_compressed(prsc->format));
> -
> if (trans->rsc || !(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
>uint32_t prep_flags = 0;
>  
> @@ -281,7 +272,7 @@ etna_transfer_map(struct pipe_context *pctx, struct 
> pipe_resource *prsc,
>  
> *out_transfer = ptrans;
>  
> -   if (in_place) {
> +   if (rsc->layout == ETNA_LAYOUT_LINEAR) {
>ptrans->stride = res_level->stride;
>ptrans->layer_stride = res_level->layer_stride;
>  
> @@ -308,24 +299,21 @@ etna_transfer_map(struct pipe_context *pctx, struct 
> pipe_resource *prsc,
>   goto fail;
>  
>if (usage & PIPE_TRANSFER_READ) {
> - /* untile or copy resource for reading */
> - if (rsc->layout == ETNA_LAYOUT_LINEAR || rsc->layout == 
> ETNA_LAYOUT_TILED) {
> -if (rsc->layout == ETNA_LAYOUT_TILED && 
&g

Re: [Mesa-dev] [PATCH 01/11] etnaviv: fill in layer_stride for imported resources

2017-06-27 Thread Wladimir J. van der Laan
On Fri, Jun 23, 2017 at 05:50:18PM +0200, Lucas Stach wrote:
> The layer stride information is used in various parts of the driver,
> so it needs to be present regardless if the driver allocated the
> buffer itself or merely imported it from an external source.

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 1c098445b17a..dfd087071193 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -352,6 +352,8 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
>  
> level->padded_width = align(level->width, paddingX);
> level->padded_height = align(level->height, paddingY);
> +   level->layer_stride = level->stride * 
> util_format_get_nblocksy(prsc->format,
> +  
> level->padded_height);
>  
> /* The DDX must give us a BO which conforms to our padding size.
>  * The stride of the BO must be greater or equal to our padded
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCHv2] etnaviv: Add support for ETC2 texture compression

2017-06-27 Thread Wladimir J. van der Laan
Add support for ETC2 compressed textures in the etnaviv driver.

One step closer towards GL ES 3 support.

For now, treat SRGB and RGB formats the same. It looks like these are
distinguished using a different bit in sampler state, and not part of
the format, but I have not yet been able to confirm this for sure.
---
 src/gallium/drivers/etnaviv/etnaviv_format.c | 11 +++
 1 file changed, 11 insertions(+)

This is rebased to the new version of the extended texture patchset.

diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
b/src/gallium/drivers/etnaviv/etnaviv_format.c
index c7c032a..cb67060 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
@@ -234,6 +234,17 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
_T(DXT3_RGBA, DXT2_DXT3, SWIZ(X, Y, Z, W), NONE),
_T(DXT5_RGBA, DXT4_DXT5, SWIZ(X, Y, Z, W), NONE),
 
+   _T(ETC2_RGB8,   EXT_NONE | EXT_FORMAT,  SWIZ(X, 
Y, Z, W), NONE), /* Extd. format NONE doubles as ETC2_RGB8 */
+   _T(ETC2_SRGB8,  EXT_NONE | EXT_FORMAT,  SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_RGB8A1, EXT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | EXT_FORMAT, SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_SRGB8A1,EXT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | EXT_FORMAT, SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_RGBA8,  EXT_RGBA8_ETC2_EAC | EXT_FORMAT,SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_SRGBA8, EXT_RGBA8_ETC2_EAC | EXT_FORMAT,SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_R11_UNORM,  EXT_R11_EAC | EXT_FORMAT,   SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_R11_SNORM,  EXT_SIGNED_R11_EAC | EXT_FORMAT,SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_RG11_UNORM, EXT_RG11_EAC | EXT_FORMAT,  SWIZ(X, 
Y, Z, W), NONE),
+   _T(ETC2_RG11_SNORM, EXT_SIGNED_RG11_EAC | EXT_FORMAT,   SWIZ(X, 
Y, Z, W), NONE),
+
/* YUV */
_T(YUYV, YUY2, SWIZ(X, Y, Z, W), YUY2),
_T(UYVY, UYVY, SWIZ(X, Y, Z, W), NONE),
-- 
2.7.4

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


Re: [Mesa-dev] [PATCHv2] etnaviv: Add support for ETC2 texture compression

2017-06-27 Thread Wladimir J. van der Laan
On Tue, Jun 27, 2017 at 02:54:56PM +0200, Wladimir J. van der Laan wrote:
> Add support for ETC2 compressed textures in the etnaviv driver.
> 
> One step closer towards GL ES 3 support.
> 
> For now, treat SRGB and RGB formats the same. It looks like these are
> distinguished using a different bit in sampler state, and not part of
> the format, but I have not yet been able to confirm this for sure.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_format.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> This is rebased to the new version of the extended texture patchset.
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c 
> b/src/gallium/drivers/etnaviv/etnaviv_format.c
> index c7c032a..cb67060 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
> @@ -234,6 +234,17 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
> _T(DXT3_RGBA, DXT2_DXT3, SWIZ(X, Y, Z, W), NONE),
> _T(DXT5_RGBA, DXT4_DXT5, SWIZ(X, Y, Z, W), NONE),
>  
> +   _T(ETC2_RGB8,   EXT_NONE | EXT_FORMAT,  
> SWIZ(X, Y, Z, W), NONE), /* Extd. format NONE doubles as ETC2_RGB8 */
> +   _T(ETC2_SRGB8,  EXT_NONE | EXT_FORMAT,  
> SWIZ(X, Y, Z, W), NONE),
> +   _T(ETC2_RGB8A1, EXT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | EXT_FORMAT, 
> SWIZ(X, Y, Z, W), NONE),
> +   _T(ETC2_SRGB8A1,EXT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | EXT_FORMAT, 
> SWIZ(X, Y, Z, W), NONE),
> +   _T(ETC2_RGBA8,  EXT_RGBA8_ETC2_EAC | EXT_FORMAT,
> SWIZ(X, Y, Z, W), NONE),
> +   _T(ETC2_SRGBA8, EXT_RGBA8_ETC2_EAC | EXT_FORMAT,
> SWIZ(X, Y, Z, W), NONE),
> +   _T(ETC2_R11_UNORM,  EXT_R11_EAC | EXT_FORMAT,   
> SWIZ(X, Y, Z, W), NONE),
> +   _T(ETC2_R11_SNORM,  EXT_SIGNED_R11_EAC | EXT_FORMAT,
> SWIZ(X, Y, Z, W), NONE),
> +   _T(ETC2_RG11_UNORM, EXT_RG11_EAC | EXT_FORMAT,  
> SWIZ(X, Y, Z, W), NONE),
> +   _T(ETC2_RG11_SNORM, EXT_SIGNED_RG11_EAC | EXT_FORMAT,   
> SWIZ(X, Y, Z, W), NONE),
> +
> /* YUV */
> _T(YUYV, YUY2, SWIZ(X, Y, Z, W), YUY2),
> _T(UYVY, UYVY, SWIZ(X, Y, Z, W), NONE),
> -- 
> 2.7.4
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] etnaviv: support tile aligned RS blits

2017-09-19 Thread Wladimir J. van der Laan
On Fri, Sep 15, 2017 at 06:00:52PM +0200, Lucas Stach wrote:
> The RS can blit abitrary tile aligned subregions of a resource by
> adjusting the buffer offset.

Thanks for doing this.

Comments inline,

> Signed-off-by: Lucas Stach 
> ---
>  src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 75 
> +---
>  1 file changed, 67 insertions(+), 8 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c 
> b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> index 92c91073434a..6734968ee4ed 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> @@ -358,6 +358,38 @@ etna_manual_blit(struct etna_resource *dst, struct 
> etna_resource_level *dst_lev,
> return true;
>  }
>  
> +static inline size_t
> +etna_compute_tileoffset(const struct pipe_box *box, enum pipe_format format,
> +size_t stride, enum etna_surface_layout layout)
> +{
> +   size_t offset;
> +   unsigned x = box->x, y = box->y;
> +
> +   switch (layout) {
> +   case ETNA_LAYOUT_LINEAR:
> +  offset = y * stride + x * util_format_get_blocksize(format);
> +  break;
> +   case ETNA_LAYOUT_MULTI_TILED:
> +  y >>= 1;
> +  /* fall-through */
> +   case ETNA_LAYOUT_TILED:
> +  offset = (y & ~0x03) * stride +
> +   util_format_get_blocksize(format) * ((x & ~0x03) << 2);
> +  break;
> +   case ETNA_LAYOUT_MULTI_SUPERTILED:
> +  y >>= 1;
> +  /* fall-through */
> +   case ETNA_LAYOUT_SUPER_TILED:
> +  offset = (y & ~0x3f) * stride +
> +   util_format_get_blocksize(format) * ((x & ~0x3f) << 6);
> +  break;
> +   default:
> +  unreachable("invalid resource layout");
> +   }
> +
> +   return offset;

Maybe add assertions that the passed-in coordinates are really tile-aligned
for the layout type, this could catch some bugs.

> +}
> +
>  static bool
>  etna_try_rs_blit(struct pipe_context *pctx,
>   const struct pipe_blit_info *blit_info)
> @@ -399,14 +431,32 @@ etna_try_rs_blit(struct pipe_context *pctx,
> unsigned dst_format = etna_compatible_rs_format(blit_info->dst.format);
> if (translate_rs_format(src_format) == ETNA_NO_MATCH ||
> translate_rs_format(dst_format) == ETNA_NO_MATCH ||
> -   blit_info->scissor_enable || blit_info->src.box.x != 0 ||
> -   blit_info->src.box.y != 0 || blit_info->dst.box.x != 0 ||
> -   blit_info->dst.box.y != 0 ||
> +   blit_info->scissor_enable ||
> blit_info->dst.box.depth != blit_info->src.box.depth ||
> blit_info->dst.box.depth != 1) {
>return FALSE;
> }
>  
> +   unsigned w_mask, h_mask;
> +
> +   if (src->layout & ETNA_LAYOUT_BIT_SUPER) {
> +  w_mask = h_mask = 0x3f;
> +   } else {
> +  w_mask = ETNA_RS_WIDTH_MASK;
> +  h_mask = ((ETNA_RS_HEIGHT_MASK + 1) * ctx->screen->specs.pixel_pipes - 
> 1);
> +   }
> +   if ((blit_info->src.box.x & w_mask) || (blit_info->src.box.y & h_mask))
> +  return FALSE;
> +
> +   if (dst->layout & ETNA_LAYOUT_BIT_SUPER) {
> +  w_mask = h_mask = 0x3f;
> +   } else {
> +  w_mask = ETNA_RS_WIDTH_MASK;
> +  h_mask = ((ETNA_RS_HEIGHT_MASK + 1) * ctx->screen->specs.pixel_pipes - 
> 1);
> +   }
> +   if ((blit_info->dst.box.x & w_mask) || (blit_info->dst.box.y & h_mask))
> +  return FALSE;
> +
> /* Ensure that the Z coordinate is sane */
> if (dst->base.target != PIPE_TEXTURE_CUBE)
>assert(blit_info->dst.box.z == 0);
> @@ -426,10 +476,18 @@ etna_try_rs_blit(struct pipe_context *pctx,
> assert(blit_info->dst.box.x + blit_info->dst.box.width <= 
> dst_lev->padded_width);
> assert(blit_info->dst.box.y + blit_info->dst.box.height <= 
> dst_lev->padded_height);
>  
> -   unsigned src_offset =
> -  src_lev->offset + blit_info->src.box.z * src_lev->layer_stride;
> -   unsigned dst_offset =
> -  dst_lev->offset + blit_info->dst.box.z * dst_lev->layer_stride;
> +   unsigned src_offset = src_lev->offset +
> + blit_info->src.box.z * src_lev->layer_stride +
> + etna_compute_tileoffset(_info->src.box,
> + blit_info->src.format,
> + src_lev->stride,
> + src->layout);

Maybe include the z-computation in etna_compute_tileoffset as
well - this would be future-compatible with formats have 3D tiles instead of 
a stack of 2D ones (thinking of ASTC).

> +   unsigned dst_offset = dst_lev->offset +
> + blit_info->dst.box.z * dst_lev->layer_stride +
> + etna_compute_tileoffset(_info->dst.box,
> + blit_info->dst.format,
> + dst_lev->stride,
> + dst->layout);
>  
> if 

Re: [Mesa-dev] [PATCH 2/3] etnaviv: add resource subregion copy

2017-09-19 Thread Wladimir J. van der Laan
On Fri, Sep 15, 2017 at 06:00:53PM +0200, Lucas Stach wrote:
> This is useful if we only need to copy part of a larger resource, mostly
> when using the RS engine to de-/tile on pipe transfers.
> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 27 
> 
>  src/gallium/drivers/etnaviv/etnaviv_clear_blit.h |  5 +
>  2 files changed, 32 insertions(+)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c 
> b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> index 6734968ee4ed..4dd86c3506d7 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> @@ -716,6 +716,33 @@ etna_copy_resource(struct pipe_context *pctx, struct 
> pipe_resource *dst,
>  }
>  
>  void
> +etna_copy_resource_box(struct pipe_context *pctx, struct pipe_resource *dst,
> +   struct pipe_resource *src, int level,
> +   struct pipe_box *box)
> +{
> +   assert(src->format == dst->format);
> +   assert(src->array_size == dst->array_size);
> +
> +   struct pipe_blit_info blit = {};
> +   blit.mask = util_format_get_mask(dst->format);
> +   blit.filter = PIPE_TEX_FILTER_NEAREST;
> +   blit.src.resource = src;
> +   blit.src.format = src->format;
> +   blit.src.box = *box;
> +   blit.dst.resource = dst;
> +   blit.dst.format = dst->format;
> +   blit.dst.box = *box;
> +
> +   blit.dst.box.depth = blit.src.box.depth = 1;
> +   blit.src.level = blit.dst.level = level;
> +
> +   for (int layer = 0; layer < dst->array_size; layer++) {
> +  blit.src.box.z = blit.dst.box.z = layer;
> +  pctx->blit(pctx, );
> +   }
> +}
> +
> +void
>  etna_clear_blit_init(struct pipe_context *pctx)
>  {
> pctx->clear = etna_clear;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h 
> b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h
> index 73d07044b2b3..9bba6236b4db 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.h
> @@ -43,6 +43,11 @@ etna_copy_resource(struct pipe_context *pctx, struct 
> pipe_resource *dst,
> struct pipe_resource *src, int first_level, int 
> last_level);
>  
>  void
> +etna_copy_resource_box(struct pipe_context *pctx, struct pipe_resource *dst,
> +   struct pipe_resource *src, int level,
> +   struct pipe_box *box);
> +
> +void
>  etna_clear_blit_init(struct pipe_context *pctx);
>  
>  #endif
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] etnaviv: fix 16bpp clears

2017-09-22 Thread Wladimir J. van der Laan
On Fri, Sep 22, 2017 at 11:24:08AM +0200, Lucas Stach wrote:
> util_pack_color may leave undefined values in the upper half of the packed
> integer. As our hardware needs the upper 16 bits to mirror the lower 16bits,
> this breaks clears of those formats if the undefined values aren't masked off.
> 
> I've only observed the issue with R5G6B5_UNORM surfaces, other 16bpp
> formats seem to work fine.

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> 
> Fixes: d6aa2ba2b2 (etnaviv: replace translate_clear_color with 
> util_pack_color)
> Cc: mesa-sta...@lists.freedesktop.org
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c 
> b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> index 971403c45476..c85ada926699 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> @@ -106,7 +106,7 @@ pack_rgba(enum pipe_format format, const float *rgba)
> union util_color uc;
> util_pack_color(rgba, format, );
> if (util_format_get_blocksize(format) == 2)
> -  return uc.ui[0] << 16 | uc.ui[0];
> +  return uc.ui[0] << 16 | (uc.ui[0] & 0x);
> else
>return uc.ui[0];
>  }
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] etnaviv: Add missing includes after 6ace0b8

2017-09-22 Thread Wladimir J. van der Laan
Add missing includes after 6ace0b8 (etnaviv: don't enable RT
full-overwrite when logicop is enabled), otherwise the etnaviv driver
won't build because of missing macros.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_blend.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_blend.c 
b/src/gallium/drivers/etnaviv/etnaviv_blend.c
index 7301841..1b432bd 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_blend.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_blend.c
@@ -27,7 +27,9 @@
 #include "etnaviv_blend.h"
 
 #include "etnaviv_context.h"
+#include "etnaviv_screen.h"
 #include "etnaviv_translate.h"
+#include "hw/common.xml.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 1/2] etnaviv: move sw get_driver_query_info(..)

2017-09-19 Thread Wladimir J. van der Laan
On Tue, Sep 19, 2017 at 06:16:04PM +0200, Christian Gmeiner wrote:
> This change makes etna_get_driver_query_info(..) more generic
> and puts the knowledge of supported queries directly besides
> the implementation.
> 
> Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com>

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_query.c| 15 +++
>  src/gallium/drivers/etnaviv/etnaviv_query_sw.c | 21 +
>  src/gallium/drivers/etnaviv/etnaviv_query_sw.h |  4 
>  3 files changed, 28 insertions(+), 12 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_query.c 
> b/src/gallium/drivers/etnaviv/etnaviv_query.c
> index 617e47562d..16adb8c21f 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_query.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_query.c
> @@ -81,21 +81,12 @@ static int
>  etna_get_driver_query_info(struct pipe_screen *pscreen, unsigned index,
> struct pipe_driver_query_info *info)
>  {
> -   struct pipe_driver_query_info list[] = {
> -  {"prims-emitted", PIPE_QUERY_PRIMITIVES_EMITTED, { 0 }},
> -  {"draw-calls", ETNA_QUERY_DRAW_CALLS, { 0 }},
> -  {"rs-operations", ETNA_QUERY_RS_OPERATIONS, { 0 }},
> -   };
> +   int nr_sw_queries = etna_sw_get_driver_query_info(pscreen, 0, NULL);
>  
> if (!info)
> -  return ARRAY_SIZE(list);
> +  return nr_sw_queries;
>  
> -   if (index >= ARRAY_SIZE(list))
> -  return 0;
> -
> -   *info = list[index];
> -
> -   return 1;
> +   return etna_sw_get_driver_query_info(pscreen, index, info);
>  }
>  
>  static void
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_sw.c 
> b/src/gallium/drivers/etnaviv/etnaviv_query_sw.c
> index 213c61f38b..90f4a65826 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_query_sw.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_query_sw.c
> @@ -124,3 +124,24 @@ etna_sw_create_query(struct etna_context *ctx, unsigned 
> query_type)
>  
> return q;
>  }
> +
> +int
> +etna_sw_get_driver_query_info(struct pipe_screen *pscreen, unsigned index,
> +  struct pipe_driver_query_info *info)
> +{
> +   static const struct pipe_driver_query_info list[] = {
> +  {"prims-emitted", PIPE_QUERY_PRIMITIVES_EMITTED, { 0 }},
> +  {"draw-calls", ETNA_QUERY_DRAW_CALLS, { 0 }},
> +  {"rs-operations", ETNA_QUERY_RS_OPERATIONS, { 0 }},
> +   };
> +
> +   if (!info)
> +  return ARRAY_SIZE(list);
> +
> +   if (index >= ARRAY_SIZE(list))
> +  return 0;
> +
> +   *info = list[index];
> +
> +   return 1;
> +}
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_sw.h 
> b/src/gallium/drivers/etnaviv/etnaviv_query_sw.h
> index 9de2bc60f9..f07d0f5915 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_query_sw.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_query_sw.h
> @@ -44,4 +44,8 @@ etna_sw_query(struct etna_query *q)
>  struct etna_query *
>  etna_sw_create_query(struct etna_context *ctx, unsigned query_type);
>  
> +int
> +etna_sw_get_driver_query_info(struct pipe_screen *pscreen, unsigned index,
> +  struct pipe_driver_query_info *info);
> +
>  #endif
> -- 
> 2.13.5
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] etnaviv: move sw query defines to etnaviv_query_sw.h

2017-09-19 Thread Wladimir J. van der Laan
On Tue, Sep 19, 2017 at 06:16:05PM +0200, Christian Gmeiner wrote:
> Also add new define ETNA_SW_QUERY_BASE.
> 
> Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com>

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com> 

> ---
>  src/gallium/drivers/etnaviv/etnaviv_query.h| 3 +--
>  src/gallium/drivers/etnaviv/etnaviv_query_sw.h | 3 +++
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_query.h 
> b/src/gallium/drivers/etnaviv/etnaviv_query.h
> index cebd66238e..e099e10f7c 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_query.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_query.h
> @@ -53,8 +53,7 @@ etna_query(struct pipe_query *pq)
> return (struct etna_query *)pq;
>  }
>  
> -#define ETNA_QUERY_DRAW_CALLS(PIPE_QUERY_DRIVER_SPECIFIC + 0)
> -#define ETNA_QUERY_RS_OPERATIONS (PIPE_QUERY_DRIVER_SPECIFIC + 1)
> +#define ETNA_SW_QUERY_BASE   (PIPE_QUERY_DRIVER_SPECIFIC + 0)
>  
>  void
>  etna_query_screen_init(struct pipe_screen *pscreen);
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_sw.h 
> b/src/gallium/drivers/etnaviv/etnaviv_query_sw.h
> index f07d0f5915..9321147094 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_query_sw.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_query_sw.h
> @@ -30,6 +30,9 @@
>  
>  #include "etnaviv_query.h"
>  
> +#define ETNA_QUERY_DRAW_CALLS(ETNA_SW_QUERY_BASE + 0)
> +#define ETNA_QUERY_RS_OPERATIONS (ETNA_SW_QUERY_BASE + 1)
> +
>  struct etna_sw_query {
> struct etna_query base;
> uint64_t begin_value, end_value;
> -- 
> 2.13.5
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 1/2] etnaviv: fix varying interpolation

2017-09-19 Thread Wladimir J. van der Laan
On Fri, Sep 15, 2017 at 06:04:49PM +0200, Lucas Stach wrote:
> It seems that newer cores don't use the PA_ATTRIBUTES to decide if the
> varying should bypass the flat shading, but derive this from the component
> use. This fixes flat shading on GC880+.
> 
> VARYING_COMPONENT_USE_POINTCOORD is a bit of a misnomer now, as it isn't
> only used for pointcoords, but missing a better name I left it as-is.
> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
> v2: fix invalid vreg assignment
> ---
>  src/gallium/drivers/etnaviv/etnaviv_compiler.c | 23 ++-
>  1 file changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c 
> b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> index 165ab74298a4..d86d0561503a 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> @@ -2607,6 +2607,7 @@ etna_link_shader(struct etna_shader_link_info *info,
>const struct etna_shader_inout *fsio = >infile.reg[idx];
>const struct etna_shader_inout *vsio = etna_shader_vs_lookup(vs, fsio);
>struct etna_varying *varying;
> +  bool interpolate = fsio->semantic.Name != TGSI_SEMANTIC_COLOR;
>  
>assert(fsio->reg > 0 && fsio->reg <= ARRAY_SIZE(info->varyings));
>  
> @@ -2616,28 +2617,24 @@ etna_link_shader(struct etna_shader_link_info *info,
>varying = >varyings[fsio->reg - 1];
>varying->num_components = fsio->num_components;
>  
> -  if (fsio->semantic.Name == TGSI_SEMANTIC_COLOR) /* colors affected by 
> flat shading */
> +  if (interpolate) /* colors affected by flat shading */
>   varying->pa_attributes = 0x200;
>else /* texture coord or other bypasses flat shading */
>   varying->pa_attributes = 0x2f1;
>  
> -  if (fsio->semantic.Name == TGSI_SEMANTIC_PCOORD) {
> - varying->use[0] = VARYING_COMPONENT_USE_POINTCOORD_X;
> - varying->use[1] = VARYING_COMPONENT_USE_POINTCOORD_Y;
> - varying->use[2] = VARYING_COMPONENT_USE_USED;
> - varying->use[3] = VARYING_COMPONENT_USE_USED;
> - varying->reg = 0; /* replaced by point coord -- doesn't matter */
> +  varying->use[0] = interpolate ? VARYING_COMPONENT_USE_POINTCOORD_X : 
> VARYING_COMPONENT_USE_USED;
> +  varying->use[1] = interpolate ? VARYING_COMPONENT_USE_POINTCOORD_Y : 
> VARYING_COMPONENT_USE_USED;
> +  varying->use[2] = VARYING_COMPONENT_USE_USED;
> +  varying->use[3] = VARYING_COMPONENT_USE_USED;
> +
> +
> +  if (fsio->semantic.Name == TGSI_SEMANTIC_PCOORD)
>   continue;
> -  }
>  
>if (vsio == NULL)
>   return true; /* not found -- link error */
>  
> -  varying->use[0] = VARYING_COMPONENT_USE_USED;
> -  varying->use[1] = VARYING_COMPONENT_USE_USED;
> -  varying->use[2] = VARYING_COMPONENT_USE_USED;
> -  varying->use[3] = VARYING_COMPONENT_USE_USED;
> -  varying->reg = vsio->reg;
> +  varying->reg = vsio->reg; /* replaced by point coord -- doesn't matter 
> */
> }
>  
> assert(info->num_varyings == fs->infile.num_reg);
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 2/2] etnaviv: remove flat shading workaround

2017-09-19 Thread Wladimir J. van der Laan
On Fri, Sep 15, 2017 at 06:04:50PM +0200, Lucas Stach wrote:
> It turned out not to be a hardware bug, but the shader compiler
> emitting wrong varying component use information. With that fixed
> we can turn flat shading back on.
> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> Reviewed-by: Philipp Zabel <p.za...@pengutronix.de>

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_rasterizer.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c 
> b/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c
> index 4990fd180257..56f2735e8a18 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c
> @@ -38,10 +38,6 @@ etna_rasterizer_state_create(struct pipe_context *pctx,
> struct etna_rasterizer_state *cs;
> struct etna_context *ctx = etna_context(pctx);
>  
> -/* Disregard flatshading on GC880+, as a HW bug there seem to disable all
> - * varying interpolation if it's enabled */
> -   bool flatshade = ctx->screen->model < 880 ? so->flatshade : false;
> -
> if (so->fill_front != so->fill_back)
>DBG("Different front and back fill mode not supported");
>  
> @@ -51,7 +47,7 @@ etna_rasterizer_state_create(struct pipe_context *pctx,
>  
> cs->base = *so;
>  
> -   cs->PA_CONFIG = (flatshade ? VIVS_PA_CONFIG_SHADE_MODEL_FLAT : 
> VIVS_PA_CONFIG_SHADE_MODEL_SMOOTH) |
> +   cs->PA_CONFIG = (so->flatshade ? VIVS_PA_CONFIG_SHADE_MODEL_FLAT : 
> VIVS_PA_CONFIG_SHADE_MODEL_SMOOTH) |
> translate_cull_face(so->cull_face, so->front_ccw) |
> translate_polygon_mode(so->fill_front) |
> COND(so->point_quad_rasterization, 
> VIVS_PA_CONFIG_POINT_SPRITE_ENABLE) |
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/6] gallium: plumb context priority through to driver

2017-10-05 Thread Wladimir J. van der Laan
On Wed, Oct 04, 2017 at 11:44:32AM -0400, Rob Clark wrote:
> Signed-off-by: Rob Clark <robdcl...@gmail.com>

Reviewed etnaviv change only.

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_screen.c|  1 +
>  src/gallium/drivers/freedreno/freedreno_screen.c|  1 +
>  src/gallium/drivers/i915/i915_screen.c  |  1 +
>  src/gallium/drivers/llvmpipe/lp_screen.c|  1 +
>  src/gallium/drivers/nouveau/nv30/nv30_screen.c  |  1 +
>  src/gallium/drivers/nouveau/nv50/nv50_screen.c  |  1 +
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c  |  1 +
>  src/gallium/drivers/r300/r300_screen.c  |  1 +
>  src/gallium/drivers/r600/r600_pipe.c|  1 +
>  src/gallium/drivers/radeonsi/si_pipe.c  |  1 +
>  src/gallium/drivers/softpipe/sp_screen.c|  1 +
>  src/gallium/drivers/svga/svga_screen.c  |  1 +
>  src/gallium/drivers/swr/swr_screen.cpp  |  1 +
>  src/gallium/drivers/vc4/vc4_screen.c|  1 +
>  src/gallium/drivers/virgl/virgl_screen.c|  1 +
>  src/gallium/include/pipe/p_defines.h| 21 
> +
>  src/gallium/include/state_tracker/st_api.h  |  2 ++
>  src/gallium/state_trackers/dri/dri_context.c| 11 +++
>  src/gallium/state_trackers/dri/dri_query_renderer.c |  8 +++-
>  src/mesa/state_tracker/st_manager.c |  5 +
>  20 files changed, 61 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
> b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index 42905ab0620..16bd4b7c0fb 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -264,6 +264,7 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum 
> pipe_cap param)
> case PIPE_CAP_QUERY_SO_OVERFLOW:
> case PIPE_CAP_MEMOBJ:
> case PIPE_CAP_LOAD_CONSTBUF:
> +   case PIPE_CAP_CONTEXT_PRIORITY_MASK:
>return 0;
>  
> /* Stream output. */
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] etnaviv: rework TS enable to be a derived state

2017-10-14 Thread Wladimir J. van der Laan
On Thu, Oct 12, 2017 at 04:07:48PM +0200, Lucas Stach wrote:
> Draw operations should not use the TS if the TS buffer content is invalid,
> as this leads to wrong rendering or even GPU hangs. As the TS valid status
> can change between draws (clear operations changing it to valid,

> blits using the RS to the color or ZS buffer changing it to invalid), the
> TS_MEM_CONFIG must be updated before each draw if the status has changed.
> This fixes the remaining TS related piglit failures (regressions of a
> standard run against a piglit run with TS completely disabled).
> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>

Keeping the TS memory config state up to date with our internal state is a good 
idea.

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>


> ---
>  src/gallium/drivers/etnaviv/etnaviv_clear_blit.c |  5 +--
>  src/gallium/drivers/etnaviv/etnaviv_context.h|  1 +
>  src/gallium/drivers/etnaviv/etnaviv_state.c  | 42 
> ++--
>  3 files changed, 43 insertions(+), 5 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c 
> b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> index c62287b1339a..7b3fc1822ba5 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> @@ -130,7 +130,7 @@ etna_blit_clear_color(struct pipe_context *pctx, struct 
> pipe_surface *dst,
>}
>  
>surf->level->ts_valid = true;
> -  ctx->dirty |= ETNA_DIRTY_TS;
> +  ctx->dirty |= ETNA_DIRTY_TS | ETNA_DIRTY_DERIVE_TS;
> } else if (unlikely(new_clear_value != surf->level->clear_value)) { /* 
> Queue normal RS clear for non-TS surfaces */
>/* If clear color changed, re-generate stored command */
>etna_rs_gen_clear_surface(ctx, surf, new_clear_value);
> @@ -189,7 +189,7 @@ etna_blit_clear_zs(struct pipe_context *pctx, struct 
> pipe_surface *dst,
>}
>  
>surf->level->ts_valid = true;
> -  ctx->dirty |= ETNA_DIRTY_TS;
> +  ctx->dirty |= ETNA_DIRTY_TS | ETNA_DIRTY_DERIVE_TS;
> } else {
>if (unlikely(new_clear_value != surf->level->clear_value)) { /* Queue 
> normal RS clear for non-TS surfaces */
>   /* If clear depth value changed, re-generate stored command */
> @@ -612,6 +612,7 @@ etna_try_rs_blit(struct pipe_context *pctx,
> resource_written(ctx, >base);
> dst->seqno++;
> dst->levels[blit_info->dst.level].ts_valid = false;
> +   ctx->dirty |= ETNA_DIRTY_DERIVE_TS;
>  
> return TRUE;
>  
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h 
> b/src/gallium/drivers/etnaviv/etnaviv_context.h
> index 2c9b24dfd439..bf2b265f5ee4 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_context.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
> @@ -124,6 +124,7 @@ struct etna_context {
>ETNA_DIRTY_SHADER  = (1 << 16),
>ETNA_DIRTY_TS  = (1 << 17),
>ETNA_DIRTY_TEXTURE_CACHES  = (1 << 18),
> +  ETNA_DIRTY_DERIVE_TS   = (1 << 19),
> } dirty;
>  
> uint32_t prim_hwsupport;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c 
> b/src/gallium/drivers/etnaviv/etnaviv_state.c
> index fc3d9f108fac..34bcb1906991 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_state.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_state.c
> @@ -165,7 +165,6 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
>cs->PE_COLOR_STRIDE = cbuf->surf.stride;
>  
>if (cbuf->surf.ts_size) {
> - ts_mem_config |= VIVS_TS_MEM_CONFIG_COLOR_FAST_CLEAR;
>   cs->TS_COLOR_CLEAR_VALUE = cbuf->level->clear_value;
>  
>   cs->TS_COLOR_STATUS_BASE = cbuf->ts_reloc;
> @@ -231,7 +230,6 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
>cs->PE_DEPTH_NORMALIZE = fui(exp2f(depth_bits) - 1.0f);
>  
>if (zsbuf->surf.ts_size) {
> - ts_mem_config |= VIVS_TS_MEM_CONFIG_DEPTH_FAST_CLEAR;
>   cs->TS_DEPTH_CLEAR_VALUE = zsbuf->level->clear_value;
>  
>   cs->TS_DEPTH_STATUS_BASE = zsbuf->ts_reloc;
> @@ -325,7 +323,7 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
> cs->PE_LOGIC_OP = VIVS_PE_LOGIC_OP_SINGLE_BUFFER(ctx->specs.single_buffer 
> ? 2 : 0);
>  
> ctx->framebuffer_s = *sv; /* keep copy of original structure */
> -   ctx->dirty |= ETNA_DIRTY_FRAMEBUFFER;
> +   ctx->dirty |= ETNA_DIRTY_FRAMEBUFFER | ETNA_DIRTY_DERIVE_TS;
>  }
>  
>  static void
> @@ -572,6 +570,41 @@ etna_vertex_elements_state_bind(struct pipe_context 
>

Re: [Mesa-dev] [PATCH 1/2] etnaviv: skip unused vertex attributes when assigning VS inputs

2017-10-14 Thread Wladimir J. van der Laan
On Thu, Oct 12, 2017 at 04:07:47PM +0200, Lucas Stach wrote:
> When not all of the vertex attributes are actually used in the shader,
> we end up with some inputs without an assigned reg. Those are marked
> as invalid and must be skipped when assigning the inputs, as those would
> overwrite other valid inputs otherwise.
> 
> Fixes piglit drawpixels and a bunch of other tests using the st_draw path.
> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3 1/2] etnaviv: fix varying interpolation

2017-09-26 Thread Wladimir J. van der Laan
Hello Lucas,

On Fri, Sep 22, 2017 at 11:27:36AM +0200, Lucas Stach wrote:
> It seems that newer cores don't use the PA_ATTRIBUTES to decide if the
> varying should bypass the flat shading, but derive this from the component
> use. This fixes flat shading on GC880+.
> 
> VARYING_COMPONENT_USE_POINTCOORD is a bit of a misnomer now, as it isn't
> only used for pointcoords, but missing a better name I left it as-is.

I was just looking at recent command streams, and it appears that the blob
uses VARYING_COMPONENT_USE_UNUSED even for active components.
I've not seen it use VARYING_COMPONENT_USE_USED at all anymore.

Maybe that works instead of using the POINTCOORD for this? I'm glad
this solved the issue, and I'm ok with merging this as-is, but I have never
seen the blob use POINTCOORD for non-pointcoords and feel it would potentially
interfere with point sprites in some cases.

Regards,
Wladimir

> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>
> Reviewed-by: Philipp Zabel <p.za...@pengutronix.de>
> Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>
> ---
> v2: fix invalid vreg assignment
> v3: fix missed negation, improve variable naming
> ---
>  src/gallium/drivers/etnaviv/etnaviv_compiler.c | 22 ++
>  1 file changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c 
> b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> index 165ab74298a4..0f6a5d23425d 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> @@ -2607,6 +2607,7 @@ etna_link_shader(struct etna_shader_link_info *info,
>const struct etna_shader_inout *fsio = >infile.reg[idx];
>const struct etna_shader_inout *vsio = etna_shader_vs_lookup(vs, fsio);
>struct etna_varying *varying;
> +  bool interpolate_always = fsio->semantic.Name != TGSI_SEMANTIC_COLOR;
>  
>assert(fsio->reg > 0 && fsio->reg <= ARRAY_SIZE(info->varyings));
>  
> @@ -2616,27 +2617,24 @@ etna_link_shader(struct etna_shader_link_info *info,
>varying = >varyings[fsio->reg - 1];
>varying->num_components = fsio->num_components;
>  
> -  if (fsio->semantic.Name == TGSI_SEMANTIC_COLOR) /* colors affected by 
> flat shading */
> +  if (!interpolate_always) /* colors affected by flat shading */
>   varying->pa_attributes = 0x200;
>else /* texture coord or other bypasses flat shading */
>   varying->pa_attributes = 0x2f1;
>  
> -  if (fsio->semantic.Name == TGSI_SEMANTIC_PCOORD) {
> - varying->use[0] = VARYING_COMPONENT_USE_POINTCOORD_X;
> - varying->use[1] = VARYING_COMPONENT_USE_POINTCOORD_Y;
> - varying->use[2] = VARYING_COMPONENT_USE_USED;
> - varying->use[3] = VARYING_COMPONENT_USE_USED;
> - varying->reg = 0; /* replaced by point coord -- doesn't matter */
> +  varying->use[0] = interpolate_always ? 
> VARYING_COMPONENT_USE_POINTCOORD_X : VARYING_COMPONENT_USE_USED;
> +  varying->use[1] = interpolate_always ? 
> VARYING_COMPONENT_USE_POINTCOORD_Y : VARYING_COMPONENT_USE_USED;
> +  varying->use[2] = VARYING_COMPONENT_USE_USED;
> +  varying->use[3] = VARYING_COMPONENT_USE_USED;
> +
> +
> +  /* point coord is position output from VS, so has no dedicated reg */
> +  if (fsio->semantic.Name == TGSI_SEMANTIC_PCOORD)
>   continue;
> -  }
>  
>if (vsio == NULL)
>   return true; /* not found -- link error */
>  
> -  varying->use[0] = VARYING_COMPONENT_USE_USED;
> -  varying->use[1] = VARYING_COMPONENT_USE_USED;
> -  varying->use[2] = VARYING_COMPONENT_USE_USED;
> -  varying->use[3] = VARYING_COMPONENT_USE_USED;
>varying->reg = vsio->reg;
> }
>  
> -- 
> 2.11.0
> 
> ___
> etnaviv mailing list
> etna...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2] etnaviv: Do GC3000 resolve-in-place when possible

2017-09-30 Thread Wladimir J. van der Laan
If an RS blit is done with source exactly the same as destination, and
the hardware supports this, do an in-place resolve. This only fills in
tiles that have not been rendered to using information from the TS.

This is the same as the blob does and potentially saves significant
bandwidth when doing i.MX6qp scanout using PRE, and when rendering to
textures (though here using sampler TS would be even better).

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_clear_blit.c |  1 +
 src/gallium/drivers/etnaviv/etnaviv_emit.c   |  9 -
 src/gallium/drivers/etnaviv/etnaviv_rs.c | 17 ++---
 src/gallium/drivers/etnaviv/etnaviv_rs.h |  2 ++
 4 files changed, 25 insertions(+), 4 deletions(-)

This depends (for updating the rnndb headers) on Lucas Stach's patch
"etnaviv: update HW headers and fix provoking vertex".

diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c 
b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
index c85ada9..c62287b 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
@@ -591,6 +591,7 @@ etna_try_rs_blit(struct pipe_context *pctx,
   .source = src->bo,
   .source_offset = src_offset,
   .source_stride = src_lev->stride,
+  .source_padded_width = src_lev->padded_width,
   .source_padded_height = src_lev->padded_height,
   .dest_format = translate_rs_format(dst_format),
   .dest_tiling = dst->layout,
diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c 
b/src/gallium/drivers/etnaviv/etnaviv_emit.c
index c2117d5..707b1e7 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
@@ -173,7 +173,14 @@ etna_submit_rs_state(struct etna_context *ctx,
 
ctx->stats.rs_operations++;
 
-   if (screen->specs.pixel_pipes == 1) {
+   if (cs->RS_KICKER_INPLACE) {
+  etna_cmd_stream_reserve(stream, 6);
+  etna_coalesce_start(stream, );
+  /* 0/1 */ EMIT_STATE(RS_EXTRA_CONFIG, cs->RS_EXTRA_CONFIG);
+  /* 2/3 */ EMIT_STATE(RS_SOURCE_STRIDE, cs->RS_SOURCE_STRIDE);
+  /* 4/5 */ EMIT_STATE(RS_KICKER_INPLACE, cs->RS_KICKER_INPLACE);
+  etna_coalesce_end(stream, );
+   } else if (screen->specs.pixel_pipes == 1) {
   etna_cmd_stream_reserve(stream, 22);
   etna_coalesce_start(stream, );
   /* 0/1 */ EMIT_STATE(RS_CONFIG, cs->RS_CONFIG);
diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.c 
b/src/gallium/drivers/etnaviv/etnaviv_rs.c
index 5c108a6..c9072c2 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_rs.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_rs.c
@@ -118,10 +118,21 @@ etna_compile_rs_state(struct etna_context *ctx, struct 
compiled_rs_state *cs,
cs->RS_FILL_VALUE[3] = rs->clear_value[3];
cs->RS_EXTRA_CONFIG = VIVS_RS_EXTRA_CONFIG_AA(rs->aa) |
  VIVS_RS_EXTRA_CONFIG_ENDIAN(rs->endian_mode);
-   /* TODO: cs->RS_UNK016B0 = s->size / 64 ?
-* The blob does this consistently but there seems to be no currently 
supported
-* model that needs it.
+
+   /* If source the same as destination, and the hardware supports this,
+* do an in-place resolve to fill in unrendered tiles.
 */
+   if (ctx->specs.single_buffer && rs->source == rs->dest &&
+ rs->source_offset == rs->dest_offset &&
+ rs->source_format == rs->dest_format &&
+ rs->source_tiling == rs->dest_tiling &&
+ rs->source_stride == rs->dest_stride &&
+ !rs->downsample_x && !rs->downsample_y &&
+ !rs->swap_rb && !rs->flip &&
+ !rs->clear_mode && rs->source_padded_width) {
+  /* Total number of tiles (same as for autodisable) */
+  cs->RS_KICKER_INPLACE = rs->source_padded_width * 
rs->source_padded_height / 16;
+   }
 }
 
 void
diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.h 
b/src/gallium/drivers/etnaviv/etnaviv_rs.h
index ec5b659..171d3fa 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_rs.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_rs.h
@@ -43,6 +43,7 @@ struct rs_state {
struct etna_bo *source;
uint32_t source_offset;
uint32_t source_stride;
+   uint32_t source_padded_width; /* total padded width (only needed for 
source) */
uint32_t source_padded_height; /* total padded height */
struct etna_bo *dest;
uint32_t dest_offset;
@@ -69,6 +70,7 @@ struct compiled_rs_state {
uint32_t RS_FILL_VALUE[4];
uint32_t RS_EXTRA_CONFIG;
uint32_t RS_PIPE_OFFSET[2];
+   uint32_t RS_KICKER_INPLACE; /* Set if source is destination */
 
struct etna_reloc source[2];
struct etna_reloc dest[2];
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH] etnaviv: Do GC3000 resolve-in-place when possible

2017-09-30 Thread Wladimir J. van der Laan
On Fri, Sep 29, 2017 at 06:00:13PM +0200, Wladimir J. van der Laan wrote:
> If an RS blit is done with source exactly the same as destination, and
> the hardware supports this, do an in-place resolve.
> 
> This is the same as the blob does and potentially saves significant
> bandwidth when doing i.MX6qp scanout using PRE, and when rendering to
> textures (though here using sampler TS would be even better).
> 
> Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_emit.c |  9 -
>  src/gallium/drivers/etnaviv/etnaviv_rs.c   | 16 +---
>  src/gallium/drivers/etnaviv/etnaviv_rs.h   |  1 +
>  3 files changed, 22 insertions(+), 4 deletions(-)
> 

> +   if (ctx->specs.single_buffer && rs->source == rs->dest &&
> + rs->source_offset == rs->dest_offset &&
> + rs->source_format == rs->dest_format &&
> + rs->source_tiling == rs->dest_tiling &&
> + rs->source_stride == rs->dest_stride &&
> + !rs->downsample_x && !rs->downsample_y &&
> + !rs->swap_rb && !rs->flip &&
> + !rs->clear_mode) {
> +   cs->RS_KICKER_INPLACE = (rs->width / 4) * (rs->height / 4);

On second thought this computation is wrong in case of padding, the value we 
need here is
same as the autodisable tile count:

> surf->surf.padded_width * surf->surf.padded_height / 16

Will send a revised patch asap.

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


[Mesa-dev] [PATCH 0/2] etnaviv: Support opcode bit 6 assembler, add DP2 instruction

2017-10-01 Thread Wladimir J. van der Laan
Support opcodes with bit 6 set in assembler, then use that to add the DP2
instruction, supported with HALTI2.

Wladimir J. van der Laan (2):
  etnaviv: Support opcodes with bit 6 set in assembler
  etnaviv: Add support for DP2 instruction

 src/gallium/drivers/etnaviv/etnaviv_asm.c  | 5 -
 src/gallium/drivers/etnaviv/etnaviv_compiler.c | 3 ++-
 src/gallium/drivers/etnaviv/etnaviv_disasm.c   | 1 +
 src/gallium/drivers/etnaviv/etnaviv_internal.h | 2 ++
 src/gallium/drivers/etnaviv/etnaviv_screen.c   | 2 ++
 5 files changed, 11 insertions(+), 2 deletions(-)

-- 
2.7.4

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


[Mesa-dev] [PATCH 1/2] etnaviv: Support opcodes with bit 6 set in assembler

2017-10-01 Thread Wladimir J. van der Laan
Support opcodes with bit 6 set in assembler, and assert that only ops
0x00..0x7f are used.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_asm.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_asm.c 
b/src/gallium/drivers/etnaviv/etnaviv_asm.c
index 7d6270c..8ef4dc9 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_asm.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_asm.c
@@ -68,7 +68,9 @@ etna_assemble(uint32_t *out, const struct etna_inst *inst)
if (!check_uniforms(inst))
   BUG("error: generating instruction that accesses two different 
uniforms");
 
-   out[0] = VIV_ISA_WORD_0_OPCODE(inst->opcode) |
+   assert(!(inst->opcode&~0x7f));
+
+   out[0] = VIV_ISA_WORD_0_OPCODE(inst->opcode & 0x3f) |
 VIV_ISA_WORD_0_COND(inst->cond) |
 COND(inst->sat, VIV_ISA_WORD_0_SAT) |
 COND(inst->dst.use, VIV_ISA_WORD_0_DST_USE) |
@@ -88,6 +90,7 @@ etna_assemble(uint32_t *out, const struct etna_inst *inst)
 VIV_ISA_WORD_2_SRC0_RGROUP(inst->src[0].rgroup) |
 COND(inst->src[1].use, VIV_ISA_WORD_2_SRC1_USE) |
 VIV_ISA_WORD_2_SRC1_REG(inst->src[1].reg) |
+COND(inst->opcode & 0x40, VIV_ISA_WORD_2_OPCODE_BIT6) |
 VIV_ISA_WORD_2_SRC1_SWIZ(inst->src[1].swiz) |
 COND(inst->src[1].neg, VIV_ISA_WORD_2_SRC1_NEG) |
 COND(inst->src[1].abs, VIV_ISA_WORD_2_SRC1_ABS) |
-- 
2.7.4

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


[Mesa-dev] [PATCH 2/2] etnaviv: Add support for DP2 instruction

2017-10-01 Thread Wladimir J. van der Laan
A two-component dot product instruction is supported with HALTI2, use it
on hardware that supports it.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_compiler.c | 3 ++-
 src/gallium/drivers/etnaviv/etnaviv_disasm.c   | 1 +
 src/gallium/drivers/etnaviv/etnaviv_internal.h | 2 ++
 src/gallium/drivers/etnaviv/etnaviv_screen.c   | 2 ++
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c 
b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
index 2a2af45..5d327dd 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
@@ -1752,6 +1752,7 @@ static const struct instr_translater 
translaters[TGSI_OPCODE_LAST] = {
INSTR(RSQ, trans_instr, .opc = INST_OPCODE_RSQ, .src = {2, -1, -1}),
INSTR(MUL, trans_instr, .opc = INST_OPCODE_MUL, .src = {0, 1, -1}),
INSTR(ADD, trans_instr, .opc = INST_OPCODE_ADD, .src = {0, 2, -1}),
+   INSTR(DP2, trans_instr, .opc = INST_OPCODE_DP2, .src = {0, 1, -1}),
INSTR(DP3, trans_instr, .opc = INST_OPCODE_DP3, .src = {0, 1, -1}),
INSTR(DP4, trans_instr, .opc = INST_OPCODE_DP4, .src = {0, 1, -1}),
INSTR(DST, trans_instr, .opc = INST_OPCODE_DST, .src = {0, 1, -1}),
@@ -2293,7 +2294,7 @@ etna_compile_shader(struct etna_shader_variant *v)
   .lower_POW = true,
   .lower_EXP = true,
   .lower_LOG = true,
-  .lower_DP2 = true,
+  .lower_DP2 = !specs->has_halti2_instructions,
   .lower_TRUNC = true,
};
 
diff --git a/src/gallium/drivers/etnaviv/etnaviv_disasm.c 
b/src/gallium/drivers/etnaviv/etnaviv_disasm.c
index 918d24e..9ae99da 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_disasm.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_disasm.c
@@ -513,6 +513,7 @@ static const struct opc_info {
OPC(AND),
OPC(XOR),
OPC(NOT),
+   OPC(DP2),
 };
 
 static void
diff --git a/src/gallium/drivers/etnaviv/etnaviv_internal.h 
b/src/gallium/drivers/etnaviv/etnaviv_internal.h
index a6544f6..896bbf5 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_internal.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_internal.h
@@ -72,6 +72,8 @@ struct etna_specs {
unsigned has_shader_range_registers : 1;
/* has the new sin/cos/log functions */
unsigned has_new_transcendentals : 1;
+   /* has the new dp2/dpX_norm instructions, among others */
+   unsigned has_halti2_instructions : 1;
/* supports single-buffer rendering with multiple pixel pipes */
unsigned single_buffer : 1;
/* has unified uniforms memory */
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index ea2581b..84da2a2 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -701,6 +701,8 @@ etna_get_specs(struct etna_screen *screen)
   VIV_FEATURE(screen, chipMinorFeatures1, NON_POWER_OF_TWO);
screen->specs.has_new_transcendentals =
   VIV_FEATURE(screen, chipMinorFeatures3, HAS_FAST_TRANSCENDENTALS);
+   screen->specs.has_halti2_instructions =
+  VIV_FEATURE(screen, chipMinorFeatures4, HALTI2);
 
if (VIV_FEATURE(screen, chipMinorFeatures3, INSTRUCTION_CACHE)) {
   /* GC3000 - this core is capable of loading shaders from
-- 
2.7.4

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


[Mesa-dev] [PATCH v2 2/2] etnaviv: Set up unknown GC3000 states

2017-10-01 Thread Wladimir J. van der Laan
Set up new states that the blob started setting for GC3000 consistently.

This makes sure that when another test or driver leaves the GPU in
unpredictable state, these states are set up correctly for our
rendering.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_context.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c 
b/src/gallium/drivers/etnaviv/etnaviv_context.c
index 45fc465..67aab6a 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -317,8 +317,19 @@ etna_cmd_stream_reset_notify(struct etna_cmd_stream 
*stream, void *priv)
etna_set_state(stream, VIVS_GL_VERTEX_ELEMENT_CONFIG, 0x0001);
etna_set_state(stream, VIVS_RA_EARLY_DEPTH, 0x0031);
etna_set_state(stream, VIVS_PA_W_CLIP_LIMIT, 0x3401);
+   etna_set_state(stream, VIVS_PA_FLAGS, 0x); /* blob sets 
ZCONVERT_BYPASS on GC3000, this messes up z for us */
+   etna_set_state(stream, VIVS_RA_UNK00E0C, 0x);
etna_set_state(stream, VIVS_PA_VIEWPORT_UNK00A80, 0x38a01404);
etna_set_state(stream, VIVS_PA_VIEWPORT_UNK00A84, fui(8192.0));
+   etna_set_state(stream, VIVS_PA_ZFARCLIPPING, 0x);
+   etna_set_state(stream, VIVS_PE_ALPHA_COLOR_EXT0, 0x);
+   etna_set_state(stream, VIVS_PE_ALPHA_COLOR_EXT1, 0x);
+   etna_set_state(stream, VIVS_RA_HDEPTH_CONTROL, 0x7000);
+   etna_set_state(stream, VIVS_PE_STENCIL_CONFIG_EXT2, 0x);
+   etna_set_state(stream, VIVS_GL_UNK03834, 0x);
+   etna_set_state(stream, VIVS_GL_UNK03838, 0x);
+   etna_set_state(stream, VIVS_GL_UNK03854, 0x);
+   etna_set_state(stream, VIVS_PS_CONTROL_EXT, 0x);
 
/* Enable SINGLE_BUFFER for resolve, if supported */
etna_set_state(stream, VIVS_RS_SINGLE_BUFFER, 
COND(ctx->specs.single_buffer, VIVS_RS_SINGLE_BUFFER_ENABLE));
-- 
2.7.4

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


[Mesa-dev] [PATCH v2 1/2] etnaviv: Fix point sprite rendering on GC3000

2017-10-01 Thread Wladimir J. van der Laan
Setting PA_VIEWPORT_UNK state correctly is necessary to make point sprite
rendering on GC3000 work.

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_context.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c 
b/src/gallium/drivers/etnaviv/etnaviv_context.c
index 2ca09ce..45fc465 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -317,6 +317,8 @@ etna_cmd_stream_reset_notify(struct etna_cmd_stream 
*stream, void *priv)
etna_set_state(stream, VIVS_GL_VERTEX_ELEMENT_CONFIG, 0x0001);
etna_set_state(stream, VIVS_RA_EARLY_DEPTH, 0x0031);
etna_set_state(stream, VIVS_PA_W_CLIP_LIMIT, 0x3401);
+   etna_set_state(stream, VIVS_PA_VIEWPORT_UNK00A80, 0x38a01404);
+   etna_set_state(stream, VIVS_PA_VIEWPORT_UNK00A84, fui(8192.0));
 
/* Enable SINGLE_BUFFER for resolve, if supported */
etna_set_state(stream, VIVS_RS_SINGLE_BUFFER, 
COND(ctx->specs.single_buffer, VIVS_RS_SINGLE_BUFFER_ENABLE));
-- 
2.7.4

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


[Mesa-dev] [PATCH v2 0/2] etnaviv: Set up GC3000 states, fix point sprite rendering

2017-10-01 Thread Wladimir J. van der Laan
Set up new states that the blob started setting for GC3000 consistently.

This makes sure that when another test or driver leaves the GPU in
unpredictable state, these states are set up correctly for our
rendering.

Also, setting PA_VIEWPORT_UNK00A84 to fui(8192.0) is necessary
to make point sprite rendering on GC3000 work.

Wladimir J. van der Laan (2):
  etnaviv: Fix point sprite rendering on GC3000
  etnaviv: Set up unknown GC3000 states

 src/gallium/drivers/etnaviv/etnaviv_context.c | 13 +
 1 file changed, 13 insertions(+)

-- 
2.7.4

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


Re: [Mesa-dev] [PATCH] etnaviv: Set up GC3000 states, fix point sprite rendering

2017-10-01 Thread Wladimir J. van der Laan
On Sun, Oct 01, 2017 at 01:46:05PM +0200, Christian Gmeiner wrote:
> Okay.. hopefully we do not forget to remove them here when it gets
> used during state emission like PE_ALPHA_COLOR_EXT0. But I
> am fine with that change and will shut up.

Yes, it should be removed then. Though if I understand correctly, nothing bad
will happen if we forget, except a one-time-per-frame spurious state emission.

In a way this serves as a reminder to figure out what those states do and move
them with the right state object instead of globally. 

PE_ALPHA_COLOR_EXTx is the exception in the bunch in that we know what it does
(just not when it gets used). Likely you're going to need to set it with the
half-float render targets.

> >> > Also, setting PA_VIEWPORT_UNK00A84 to fui(8192.0) is necessary
> >> > to make point sprite rendering on GC3000 work.
> >>
> >> I would prefer a patch that only sets PA_VIEWPORT_UNK00A84 to fix point
> >> sprite rendering on GC3000.
> >
> > Yeah, splitting up this patch into 2 would be good style.
> >
> 
> It would good style but I take this patch as it is.

Ok, sent a split-up version, up to you which one you take.

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


Re: [Mesa-dev] [PATCH] etnaviv: fix bogus flush requests in transfer handling

2017-09-29 Thread Wladimir J. van der Laan
On Fri, Sep 29, 2017 at 03:40:11PM +0200, Lucas Stach wrote:
> The logic to decide if we need to flush the GPU command stream was broken
> and hard to reason about. Fix and clarify this.
> 
> Fixes the data sync subtests from piglit arb_vertex_buffer_object.
> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_transfer.c | 15 ++-
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] etnaviv: Do GC3000 resolve-in-place when possible

2017-09-29 Thread Wladimir J. van der Laan
If an RS blit is done with source exactly the same as destination, and
the hardware supports this, do an in-place resolve.

This is the same as the blob does and potentially saves significant
bandwidth when doing i.MX6qp scanout using PRE, and when rendering to
textures (though here using sampler TS would be even better).

Signed-off-by: Wladimir J. van der Laan <laa...@gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_emit.c |  9 -
 src/gallium/drivers/etnaviv/etnaviv_rs.c   | 16 +---
 src/gallium/drivers/etnaviv/etnaviv_rs.h   |  1 +
 3 files changed, 22 insertions(+), 4 deletions(-)

This depends (for updating the rnndb headers) on Lucas Stach's patch
"etnaviv: update HW headers and fix provoking vertex".

diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c 
b/src/gallium/drivers/etnaviv/etnaviv_emit.c
index c2117d5..707b1e7 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
@@ -173,7 +173,14 @@ etna_submit_rs_state(struct etna_context *ctx,
 
ctx->stats.rs_operations++;
 
-   if (screen->specs.pixel_pipes == 1) {
+   if (cs->RS_KICKER_INPLACE) {
+  etna_cmd_stream_reserve(stream, 6);
+  etna_coalesce_start(stream, );
+  /* 0/1 */ EMIT_STATE(RS_EXTRA_CONFIG, cs->RS_EXTRA_CONFIG);
+  /* 2/3 */ EMIT_STATE(RS_SOURCE_STRIDE, cs->RS_SOURCE_STRIDE);
+  /* 4/5 */ EMIT_STATE(RS_KICKER_INPLACE, cs->RS_KICKER_INPLACE);
+  etna_coalesce_end(stream, );
+   } else if (screen->specs.pixel_pipes == 1) {
   etna_cmd_stream_reserve(stream, 22);
   etna_coalesce_start(stream, );
   /* 0/1 */ EMIT_STATE(RS_CONFIG, cs->RS_CONFIG);
diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.c 
b/src/gallium/drivers/etnaviv/etnaviv_rs.c
index 5c108a6..7e90ab7 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_rs.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_rs.c
@@ -118,10 +118,20 @@ etna_compile_rs_state(struct etna_context *ctx, struct 
compiled_rs_state *cs,
cs->RS_FILL_VALUE[3] = rs->clear_value[3];
cs->RS_EXTRA_CONFIG = VIVS_RS_EXTRA_CONFIG_AA(rs->aa) |
  VIVS_RS_EXTRA_CONFIG_ENDIAN(rs->endian_mode);
-   /* TODO: cs->RS_UNK016B0 = s->size / 64 ?
-* The blob does this consistently but there seems to be no currently 
supported
-* model that needs it.
+
+   /* Is source the same as destination, if so do an in-place resolve if
+* the hardware supports this.
 */
+   if (ctx->specs.single_buffer && rs->source == rs->dest &&
+ rs->source_offset == rs->dest_offset &&
+ rs->source_format == rs->dest_format &&
+ rs->source_tiling == rs->dest_tiling &&
+ rs->source_stride == rs->dest_stride &&
+ !rs->downsample_x && !rs->downsample_y &&
+ !rs->swap_rb && !rs->flip &&
+ !rs->clear_mode) {
+   cs->RS_KICKER_INPLACE = (rs->width / 4) * (rs->height / 4);
+   }
 }
 
 void
diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.h 
b/src/gallium/drivers/etnaviv/etnaviv_rs.h
index ec5b659..b354a26 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_rs.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_rs.h
@@ -69,6 +69,7 @@ struct compiled_rs_state {
uint32_t RS_FILL_VALUE[4];
uint32_t RS_EXTRA_CONFIG;
uint32_t RS_PIPE_OFFSET[2];
+   uint32_t RS_KICKER_INPLACE; /* Set if source is destination */
 
struct etna_reloc source[2];
struct etna_reloc dest[2];
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH] etnaviv: update HW headers and fix provoking vertex

2017-09-29 Thread Wladimir J. van der Laan
On Fri, Sep 29, 2017 at 03:40:49PM +0200, Lucas Stach wrote:
> Now that the real meaning of the 2 bits in PA_SYSTEM_MODE is known,
> we can set them according to the rasterizer state, which fixes uses
> that are setting provoking vertex first.
> 
> Signed-off-by: Lucas Stach <l.st...@pengutronix.de>

Thanks for figuring this one out

Reviewed-by: Wladimir J. van der Laan <laa...@gmail.com>: Wladimir J. van der 
Laan <laa...@gmail.com>

> ---
>  src/gallium/drivers/etnaviv/etnaviv_rasterizer.c |  3 +-
>  src/gallium/drivers/etnaviv/hw/cmdstream.xml.h   |  8 +--
>  src/gallium/drivers/etnaviv/hw/common.xml.h  | 18 +++---
>  src/gallium/drivers/etnaviv/hw/isa.xml.h |  4 +-
>  src/gallium/drivers/etnaviv/hw/state.xml.h   | 14 ++---
>  src/gallium/drivers/etnaviv/hw/state_3d.xml.h| 79 
> +++-
>  6 files changed, 75 insertions(+), 51 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c 
> b/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c
> index 56f2735e8a18..c8627b1a9ab4 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_rasterizer.c
> @@ -61,7 +61,8 @@ etna_rasterizer_state_create(struct pipe_context *pctx,
> /* XXX anything else? */
> /* XXX bottom_edge_rule */
> cs->PA_SYSTEM_MODE =
> -  COND(so->half_pixel_center, VIVS_PA_SYSTEM_MODE_UNK0 | 
> VIVS_PA_SYSTEM_MODE_UNK4);
> +  COND(!so->flatshade_first, VIVS_PA_SYSTEM_MODE_PROVOKING_VERTEX_LAST) |
> +  COND(so->half_pixel_center, VIVS_PA_SYSTEM_MODE_HALF_PIXEL_CENTER);
>  
> /* so->scissor overrides the scissor, defaulting to the whole framebuffer,
>  * with the scissor state */
> diff --git a/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h 
> b/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
> index d4da03016ea5..f8d76b010582 100644
> --- a/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
> +++ b/src/gallium/drivers/etnaviv/hw/cmdstream.xml.h
> @@ -8,11 +8,11 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
>  git clone git://0x04.net/rules-ng-ng
>  
>  The rules-ng-ng source files this header was generated from are:
> -- cmdstream.xml (  14313 bytes, from 2016-11-17 18:46:23)
> -- copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
> -- common.xml(  23473 bytes, from 2017-01-07 14:27:54)
> +- cmdstream.xml (  15289 bytes, from 2017-09-29 11:52:39)
> +- copyright.xml (   1597 bytes, from 2016-12-08 16:37:56)
> +- common.xml    (  23529 bytes, from 2017-09-29 11:52:39)
>  
> -Copyright (C) 2012-2016 by the following authors:
> +Copyright (C) 2012-2017 by the following authors:
>  - Wladimir J. van der Laan <laa...@gmail.com>
>  - Christian Gmeiner <christian.gmei...@gmail.com>
>  - Lucas Stach <l.st...@pengutronix.de>
> diff --git a/src/gallium/drivers/etnaviv/hw/common.xml.h 
> b/src/gallium/drivers/etnaviv/hw/common.xml.h
> index 8b73fd812896..85c4990b61ae 100644
> --- a/src/gallium/drivers/etnaviv/hw/common.xml.h
> +++ b/src/gallium/drivers/etnaviv/hw/common.xml.h
> @@ -8,13 +8,13 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
>  git clone git://0x04.net/rules-ng-ng
>  
>  The rules-ng-ng source files this header was generated from are:
> -- state.xml (  19930 bytes, from 2017-01-07 14:27:54)
> -- common.xml(  23473 bytes, from 2017-01-07 14:27:54)
> -- state_hi.xml  (  26403 bytes, from 2017-01-07 14:27:54)
> -- copyright.xml (   1597 bytes, from 2016-10-29 07:29:22)
> -- state_2d.xml  (  51552 bytes, from 2016-10-29 07:29:22)
> -- state_3d.xml  (  66964 bytes, from 2017-04-13 12:38:05)
> -- state_vg.xml  (   5975 bytes, from 2016-10-29 07:29:22)
> +- state.xml (  20229 bytes, from 2017-09-29 11:52:39)
> +- common.xml(  23529 bytes, from 2017-09-29 11:52:39)
> +- state_hi.xml  (  26403 bytes, from 2017-03-09 15:43:43)
> +- copyright.xml (   1597 bytes, from 2016-12-08 16:37:56)
> +- state_2d.xml  (  51552 bytes, from 2016-12-08 16:37:56)
> +- state_3d.xml  (  68429 bytes, from 2017-09-29 11:55:19)
> +- state_vg.xml  (   5975 bytes, from 2016-12-08 16:37:56)
>  
>  Copyright (C) 2012-2017 by the following authors:
>  - Wladimir J. van der Laan <laa...@gmail.com>
> @@ -247,7 +247,7 @@ DEALINGS IN THE SOFTWARE.
>  #define chipMinorFeatures3_UNK24 0x0100
>  #define chipMinorFeatures3_UNK25 0x0200
>  #define chipMinorFeatures3_NEW_HZ0x0400
> -#define chipMinorFeatures3_UNK27 0x0800
> +#define chipMinorFeatures3_PE_DITHER_FIX 0x0800
>  #define chipMinorFeatures3_UNK28 0x1

  1   2   3   >