Re: [Mesa-dev] [PATCH 1/4] etnaviv: extend etna_resource with an addressing mode

2019-01-24 Thread Lucas Stach
Am Donnerstag, den 24.01.2019, 07:31 +0100 schrieb Christian Gmeiner:
> Hi Lucas
> 
> Am Mo., 21. Jan. 2019 um 10:03 Uhr schrieb Lucas Stach 
> :
> > 
> > Hi Christian,
> > 
> > first of all, thanks for figuring this out. This is really nice
> > to finally know how it works.
> > 
> > Am Montag, den 21.01.2019, 07:49 +0100 schrieb Christian Gmeiner:
> > > Defines how sampler (and pixel pipes) needs to access the data
> > > represented with a resource. The used default is mode is
> > > ETNA_ADDRESSING_MODE_TILED.
> > 
> > Do you see any reason why we need a separate property for this? IMHO
> > etna_resource is already a bit too fat and from this set of patches I
> > can't see why we can't infer the addressing mode from the layout. Do
> > you have something specific in mind, that I don't see right now?
> > 
> 
> We are using ETNA_LAYOUT_LINEAR for compressed textures with an
> addressing mode of TILED (register value of 0). That is the root cause why
> was forced to add something new to etna_resource as I can not trust that
> ETNA_LAYOUT_LINEAR for sampler resources implies an linear addressing
> mode.

Ah, right. This had escaped my mind. With this out of the way, patch
looks good.

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


Re: [Mesa-dev] [PATCH 1/4] etnaviv: extend etna_resource with an addressing mode

2019-01-23 Thread Christian Gmeiner
Hi Lucas

Am Mo., 21. Jan. 2019 um 10:03 Uhr schrieb Lucas Stach :
>
> Hi Christian,
>
> first of all, thanks for figuring this out. This is really nice
> to finally know how it works.
>
> Am Montag, den 21.01.2019, 07:49 +0100 schrieb Christian Gmeiner:
> > Defines how sampler (and pixel pipes) needs to access the data
> > represented with a resource. The used default is mode is
> > ETNA_ADDRESSING_MODE_TILED.
>
> Do you see any reason why we need a separate property for this? IMHO
> etna_resource is already a bit too fat and from this set of patches I
> can't see why we can't infer the addressing mode from the layout. Do
> you have something specific in mind, that I don't see right now?
>

We are using ETNA_LAYOUT_LINEAR for compressed textures with an
addressing mode of TILED (register value of 0). That is the root cause why
was forced to add something new to etna_resource as I can not trust that
ETNA_LAYOUT_LINEAR for sampler resources implies an linear addressing
mode.

--
greets
--
Christian Gmeiner, MSc

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


Re: [Mesa-dev] [PATCH 1/4] etnaviv: extend etna_resource with an addressing mode

2019-01-21 Thread Lucas Stach
Hi Christian,

first of all, thanks for figuring this out. This is really nice
to finally know how it works.

Am Montag, den 21.01.2019, 07:49 +0100 schrieb Christian Gmeiner:
> Defines how sampler (and pixel pipes) needs to access the data
> represented with a resource. The used default is mode is
> ETNA_ADDRESSING_MODE_TILED.

Do you see any reason why we need a separate property for this? IMHO
etna_resource is already a bit too fat and from this set of patches I
can't see why we can't infer the addressing mode from the layout. Do
you have something specific in mind, that I don't see right now?

Regards,
Lucas

> 
> > Signed-off-by: Christian Gmeiner 
> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 17 +++--
>  src/gallium/drivers/etnaviv/etnaviv_resource.h |  9 -
>  src/gallium/drivers/etnaviv/etnaviv_texture.c  |  1 +
>  src/gallium/drivers/etnaviv/etnaviv_transfer.c |  3 ++-
>  4 files changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index c0091288030..9a7ebf3064e 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -188,7 +188,8 @@ static bool is_rs_align(struct etna_screen *screen,
>  /* Create a new resource object, using the given template info */
>  struct pipe_resource *
>  etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
> -uint64_t modifier, const struct pipe_resource *templat)
> +enum etna_resource_addressing_mode mode, uint64_t 
> modifier,
> +const struct pipe_resource *templat)
>  {
> struct etna_screen *screen = etna_screen(pscreen);
> struct etna_resource *rsc;
> @@ -280,6 +281,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned 
> layout,
> rsc->base.nr_samples = nr_samples;
> rsc->layout = layout;
> rsc->halign = halign;
> +   rsc->addressing_mode = mode;
>  
> pipe_reference_init(>base.reference, 1);
> list_inithead(>list);
> @@ -316,12 +318,14 @@ etna_resource_create(struct pipe_screen *pscreen,
>  {
> struct etna_screen *screen = etna_screen(pscreen);
>  
> -   /* 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.
> +   /* Figure out what tiling and address mode 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;
> +   enum etna_resource_addressing_mode mode = ETNA_ADDRESSING_MODE_TILED;
> +
> if (etna_resource_sampler_only(templat)) {
>    /* The buffer is only used for texturing, so create something
> * directly compatible with the sampler.  Such a buffer can
> @@ -364,7 +368,7 @@ etna_resource_create(struct pipe_screen *pscreen,
>    layout = ETNA_LAYOUT_LINEAR;
>  
> /* modifier is only used for scanout surfaces, so safe to use LINEAR here 
> */
> -   return etna_resource_alloc(pscreen, layout, DRM_FORMAT_MOD_LINEAR, 
> templat);
> +   return etna_resource_alloc(pscreen, layout, mode, DRM_FORMAT_MOD_LINEAR, 
> templat);
>  }
>  
>  enum modifier_priority {
> @@ -445,7 +449,7 @@ etna_resource_create_modifiers(struct pipe_screen 
> *pscreen,
> tmpl.bind |= PIPE_BIND_SCANOUT;
>  
> return etna_resource_alloc(pscreen, modifier_to_layout(modifier),
> -  modifier, );
> +  ETNA_ADDRESSING_MODE_TILED, modifier, );
>  }
>  
>  static void
> @@ -518,6 +522,7 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
> rsc->seqno = 1;
> rsc->layout = modifier_to_layout(handle->modifier);
> rsc->halign = TEXTURE_HALIGN_FOUR;
> +   rsc->addressing_mode = ETNA_ADDRESSING_MODE_TILED;
>  
>  
> level->width = tmpl->width0;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.h 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.h
> index 11ccf8f7bcb..75aa80b3d7a 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.h
> @@ -49,6 +49,11 @@ struct etna_resource_level {
> bool ts_valid;
>  };
>  
> +enum etna_resource_addressing_mode {
> +   ETNA_ADDRESSING_MODE_TILED = 0,
> +   ETNA_ADDRESSING_MODE_LINEAR,
> +};
> +
>  /* status of queued up but not flushed reads and write operations.
>   * In _transfer_map() we need to know if queued up rendering needs
>   * to be flushed to preserve the order of cpu and gpu access. */
> @@ -66,6 +71,7 @@ struct etna_resource {
> /* only lod 0 used for non-texture buffers */
> /* Layout for surface (tiled, multitiled, split tiled, ...) */
> enum etna_surface_layout 

[Mesa-dev] [PATCH 1/4] etnaviv: extend etna_resource with an addressing mode

2019-01-20 Thread Christian Gmeiner
Defines how sampler (and pixel pipes) needs to access the data
represented with a resource. The used default is mode is
ETNA_ADDRESSING_MODE_TILED.

Signed-off-by: Christian Gmeiner 
---
 src/gallium/drivers/etnaviv/etnaviv_resource.c | 17 +++--
 src/gallium/drivers/etnaviv/etnaviv_resource.h |  9 -
 src/gallium/drivers/etnaviv/etnaviv_texture.c  |  1 +
 src/gallium/drivers/etnaviv/etnaviv_transfer.c |  3 ++-
 4 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index c0091288030..9a7ebf3064e 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -188,7 +188,8 @@ static bool is_rs_align(struct etna_screen *screen,
 /* Create a new resource object, using the given template info */
 struct pipe_resource *
 etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
-uint64_t modifier, const struct pipe_resource *templat)
+enum etna_resource_addressing_mode mode, uint64_t modifier,
+const struct pipe_resource *templat)
 {
struct etna_screen *screen = etna_screen(pscreen);
struct etna_resource *rsc;
@@ -280,6 +281,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned 
layout,
rsc->base.nr_samples = nr_samples;
rsc->layout = layout;
rsc->halign = halign;
+   rsc->addressing_mode = mode;
 
pipe_reference_init(>base.reference, 1);
list_inithead(>list);
@@ -316,12 +318,14 @@ etna_resource_create(struct pipe_screen *pscreen,
 {
struct etna_screen *screen = etna_screen(pscreen);
 
-   /* 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.
+   /* Figure out what tiling and address mode 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;
+   enum etna_resource_addressing_mode mode = ETNA_ADDRESSING_MODE_TILED;
+
if (etna_resource_sampler_only(templat)) {
   /* The buffer is only used for texturing, so create something
* directly compatible with the sampler.  Such a buffer can
@@ -364,7 +368,7 @@ etna_resource_create(struct pipe_screen *pscreen,
   layout = ETNA_LAYOUT_LINEAR;
 
/* modifier is only used for scanout surfaces, so safe to use LINEAR here */
-   return etna_resource_alloc(pscreen, layout, DRM_FORMAT_MOD_LINEAR, templat);
+   return etna_resource_alloc(pscreen, layout, mode, DRM_FORMAT_MOD_LINEAR, 
templat);
 }
 
 enum modifier_priority {
@@ -445,7 +449,7 @@ etna_resource_create_modifiers(struct pipe_screen *pscreen,
tmpl.bind |= PIPE_BIND_SCANOUT;
 
return etna_resource_alloc(pscreen, modifier_to_layout(modifier),
-  modifier, );
+  ETNA_ADDRESSING_MODE_TILED, modifier, );
 }
 
 static void
@@ -518,6 +522,7 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
rsc->seqno = 1;
rsc->layout = modifier_to_layout(handle->modifier);
rsc->halign = TEXTURE_HALIGN_FOUR;
+   rsc->addressing_mode = ETNA_ADDRESSING_MODE_TILED;
 
 
level->width = tmpl->width0;
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.h 
b/src/gallium/drivers/etnaviv/etnaviv_resource.h
index 11ccf8f7bcb..75aa80b3d7a 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.h
@@ -49,6 +49,11 @@ struct etna_resource_level {
bool ts_valid;
 };
 
+enum etna_resource_addressing_mode {
+   ETNA_ADDRESSING_MODE_TILED = 0,
+   ETNA_ADDRESSING_MODE_LINEAR,
+};
+
 /* status of queued up but not flushed reads and write operations.
  * In _transfer_map() we need to know if queued up rendering needs
  * to be flushed to preserve the order of cpu and gpu access. */
@@ -66,6 +71,7 @@ struct etna_resource {
/* only lod 0 used for non-texture buffers */
/* Layout for surface (tiled, multitiled, split tiled, ...) */
enum etna_surface_layout layout;
+   enum etna_resource_addressing_mode addressing_mode;
/* Horizontal alignment for texture unit (TEXTURE_HALIGN_*) */
unsigned halign;
struct etna_bo *bo; /* Surface video memory */
@@ -155,7 +161,8 @@ etna_screen_resource_alloc_ts(struct pipe_screen *pscreen,
 
 struct pipe_resource *
 etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
-uint64_t modifier, const struct pipe_resource *templat);
+enum etna_resource_addressing_mode mode, uint64_t modifier,
+const struct pipe_resource *templat);
 
 void
 etna_resource_screen_init(struct pipe_screen *pscreen);
diff --git