[Mesa-dev] [PATCH] gallium: add Tegra renderonly support

Ilia Mirkin imirkin at alum.mit.edu
Fri Jan 13 14:38:09 UTC 2017


Note, I'm only commenting on the nouveau bits:

On Fri, Jan 13, 2017 at 2:47 AM, Alexandre Courbot <acourbot at nvidia.com> wrote:
> diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
> index 17052b26e9c8..95dcaad94396 100644
> --- a/src/gallium/drivers/nouveau/nouveau_buffer.c
> +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
> @@ -128,6 +128,9 @@ nouveau_buffer_destroy(struct pipe_screen *pscreen,
>
>     util_range_destroy(&res->valid_buffer_range);
>
> +   if (res->scanout)
> +       renderonly_scanout_destroy(res->scanout);
> +
>     FREE(res);
>
>     NOUVEAU_DRV_STAT(nouveau_screen(pscreen), buf_obj_current_count, -1);
> diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.h b/src/gallium/drivers/nouveau/nouveau_buffer.h
> index 3a33fae9ce2f..c01fda4f3a78 100644
> --- a/src/gallium/drivers/nouveau/nouveau_buffer.h
> +++ b/src/gallium/drivers/nouveau/nouveau_buffer.h
> @@ -50,6 +50,8 @@ struct nv04_resource {
>
>     /* buffer range that has been initialized */
>     struct util_range valid_buffer_range;
> +
> +   struct renderonly_scanout *scanout;

You can't have a buffer that's scanned out. This field belongs in the
miptree. (And you don't really care about nv30, so just put it in
nv50_miptree.)

>  };
>
>  void
> diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
> index 28c4760af20c..f2c9ec14aa4f 100644
> --- a/src/gallium/drivers/nouveau/nouveau_screen.h
> +++ b/src/gallium/drivers/nouveau/nouveau_screen.h
> @@ -2,6 +2,7 @@
>  #define __NOUVEAU_SCREEN_H__
>
>  #include "pipe/p_screen.h"
> +#include "renderonly/renderonly.h"
>  #include "util/u_memory.h"
>
>  #ifdef DEBUG
> @@ -59,6 +60,8 @@ struct nouveau_screen {
>        unsigned profiles_present;
>     } firmware_info;
>
> +   struct renderonly ro;
> +
>  #ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
>     union {
>        uint64_t v[29];
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
> index f2e304fde621..29e95a6f9a89 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
> @@ -189,6 +189,9 @@ nv50_miptree_get_handle(struct pipe_screen *pscreen,
>     if (!mt || !mt->base.bo)
>        return false;
>
> +   if (renderonly_get_handle(mt->base.scanout, whandle))
> +      return TRUE;
> +
>     stride = mt->level[0].pitch;
>
>     return nouveau_screen_bo_get_handle(pscreen,
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
> index 9bafe3d835db..ad2291be23dc 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
> @@ -8,12 +8,26 @@ static struct pipe_resource *
>  nvc0_resource_create(struct pipe_screen *screen,
>                       const struct pipe_resource *templ)
>  {
> +   struct nouveau_screen *scr = nouveau_screen(screen);
> +   struct pipe_resource *pres;
> +
>     switch (templ->target) {
>     case PIPE_BUFFER:
> -      return nouveau_buffer_create(screen, templ);
> +       pres = nouveau_buffer_create(screen, templ);
> +       break;
>     default:
> -      return nvc0_miptree_create(screen, templ);
> +       pres = nvc0_miptree_create(screen, templ);
> +       break;
>     }
> +
> +   if (pres) {
> +       struct nv04_resource *res = nv04_resource(pres);
> +
> +       if (templ->bind & PIPE_BIND_SCANOUT)
> +           res->scanout = renderonly_scanout_for_resource(pres, &scr->ro);

This condition can only happen for templ->target != PIPE_BUFFER.

Without checking what this function does... what will it do for the
regular desktop GPU setup?

> +   }
> +
> +   return pres;
>  }
>
>  static struct pipe_resource *


More information about the mesa-dev mailing list