Re: [Mesa-dev] [PATCH 2/4] etnaviv: use surface format directly

2018-11-15 Thread Philipp Zabel
On Thu, 2018-11-15 at 15:37 +0100, Lucas Stach wrote:
> There is no need to do the detour over the resource behind the
> surface to get the format. Use the surface format directly.
> 
> Signed-off-by: Lucas Stach 
> ---
>  src/gallium/drivers/etnaviv/etnaviv_blend.c   | 2 +-
>  src/gallium/drivers/etnaviv/etnaviv_context.c | 9 ++---
>  2 files changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_blend.c 
> b/src/gallium/drivers/etnaviv/etnaviv_blend.c
> index 9c23411d4ff7..1792fd0fdd67 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_blend.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_blend.c
> @@ -117,7 +117,7 @@ etna_update_blend(struct etna_context *ctx)
> uint32_t colormask;
>  
> if (pfb->cbufs[0] &&
> -   translate_rs_format_rb_swap(pfb->cbufs[0]->texture->format)) {
> +   translate_rs_format_rb_swap(pfb->cbufs[0]->format)) {

There is another instance of this in etna_update_blend_color() below.

With that added,
Reviewed-by: Philipp Zabel 

>colormask = rt0->colormask & (PIPE_MASK_A | PIPE_MASK_G);
>if (rt0->colormask & PIPE_MASK_R)
>   colormask |= PIPE_MASK_B;
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c 
> b/src/gallium/drivers/etnaviv/etnaviv_context.c
> index 1c305d82a0fc..aa7425662898 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_context.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
> @@ -212,13 +212,8 @@ etna_draw_vbo(struct pipe_context *pctx, const struct 
> pipe_draw_info *info)
> ctx->dirty |= ETNA_DIRTY_INDEX_BUFFER;
>  
> struct etna_shader_key key = {};
> -   struct etna_surface *cbuf = etna_surface(pfb->cbufs[0]);
> -
> -   if (cbuf) {
> -  struct etna_resource *res = etna_resource(cbuf->base.texture);
> -
> -  key.frag_rb_swap = !!translate_rs_format_rb_swap(res->base.format);
> -   }
> +   if (pfb->cbufs[0])
> +  key.frag_rb_swap = 
> !!translate_rs_format_rb_swap(pfb->cbufs[0]->format);
>  
> if (!etna_get_vs(ctx, key) || !etna_get_fs(ctx, key)) {
>BUG("compiled shaders are not okay");

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


[Mesa-dev] [PATCH 2/4] etnaviv: use surface format directly

2018-11-15 Thread Lucas Stach
There is no need to do the detour over the resource behind the
surface to get the format. Use the surface format directly.

Signed-off-by: Lucas Stach 
---
 src/gallium/drivers/etnaviv/etnaviv_blend.c   | 2 +-
 src/gallium/drivers/etnaviv/etnaviv_context.c | 9 ++---
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_blend.c 
b/src/gallium/drivers/etnaviv/etnaviv_blend.c
index 9c23411d4ff7..1792fd0fdd67 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_blend.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_blend.c
@@ -117,7 +117,7 @@ etna_update_blend(struct etna_context *ctx)
uint32_t colormask;
 
if (pfb->cbufs[0] &&
-   translate_rs_format_rb_swap(pfb->cbufs[0]->texture->format)) {
+   translate_rs_format_rb_swap(pfb->cbufs[0]->format)) {
   colormask = rt0->colormask & (PIPE_MASK_A | PIPE_MASK_G);
   if (rt0->colormask & PIPE_MASK_R)
  colormask |= PIPE_MASK_B;
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c 
b/src/gallium/drivers/etnaviv/etnaviv_context.c
index 1c305d82a0fc..aa7425662898 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -212,13 +212,8 @@ etna_draw_vbo(struct pipe_context *pctx, const struct 
pipe_draw_info *info)
ctx->dirty |= ETNA_DIRTY_INDEX_BUFFER;
 
struct etna_shader_key key = {};
-   struct etna_surface *cbuf = etna_surface(pfb->cbufs[0]);
-
-   if (cbuf) {
-  struct etna_resource *res = etna_resource(cbuf->base.texture);
-
-  key.frag_rb_swap = !!translate_rs_format_rb_swap(res->base.format);
-   }
+   if (pfb->cbufs[0])
+  key.frag_rb_swap = !!translate_rs_format_rb_swap(pfb->cbufs[0]->format);
 
if (!etna_get_vs(ctx, key) || !etna_get_fs(ctx, key)) {
   BUG("compiled shaders are not okay");
-- 
2.19.1

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