[4/5] panfrost: Mark buffers as PANFROST_BO_HEAP

Submitted by Tomeu Vizoso on Aug. 5, 2019, 3:18 p.m.

Details

Message ID 20190805151836.12293-4-tomeu.vizoso@collabora.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Tomeu Vizoso Aug. 5, 2019, 3:18 p.m.
What we call GROWABLE in Mesa corresponds to the HEAP BO flag in the
kernel. These buffers cannot be memory mapped in the CPU side at the
moment, so make sure they are also marked INVISIBLE.

This allows us to allocate a big heap upfront (16MB) without actually
reserving space unless it's needed.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
 src/gallium/drivers/panfrost/pan_drm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
index a3f35aed4d0f..122bc5f3db36 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -91,11 +91,15 @@  panfrost_drm_create_bo(struct panfrost_screen *screen, size_t size,
         /* To maximize BO cache usage, don't allocate tiny BOs */
         size = MAX2(size, 4096);
 
+        /* GROWABLE BOs cannot be mmapped */
+        if (flags & PAN_ALLOCATE_GROWABLE)
+                assert(flags & PAN_ALLOCATE_INVISIBLE);
+
         unsigned translated_flags = 0;
 
         if (screen->kernel_version >= 1) {
-                //if (flags & PAN_ALLOCATE_GROWABLE)
-                //        translated_flags |= PANFROST_BO_HEAP;
+                if (flags & PAN_ALLOCATE_GROWABLE)
+                        translated_flags |= PANFROST_BO_HEAP;
                 if (!(flags & PAN_ALLOCATE_EXECUTE))
                         translated_flags |= PANFROST_BO_NOEXEC;
         }

Comments

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

On Mon, Aug 05, 2019 at 05:18:35PM +0200, Tomeu Vizoso wrote:
> What we call GROWABLE in Mesa corresponds to the HEAP BO flag in the
> kernel. These buffers cannot be memory mapped in the CPU side at the
> moment, so make sure they are also marked INVISIBLE.
> 
> This allows us to allocate a big heap upfront (16MB) without actually
> reserving space unless it's needed.
> 
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> ---
>  src/gallium/drivers/panfrost/pan_drm.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
> index a3f35aed4d0f..122bc5f3db36 100644
> --- a/src/gallium/drivers/panfrost/pan_drm.c
> +++ b/src/gallium/drivers/panfrost/pan_drm.c
> @@ -91,11 +91,15 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, size_t size,
>          /* To maximize BO cache usage, don't allocate tiny BOs */
>          size = MAX2(size, 4096);
>  
> +        /* GROWABLE BOs cannot be mmapped */
> +        if (flags & PAN_ALLOCATE_GROWABLE)
> +                assert(flags & PAN_ALLOCATE_INVISIBLE);
> +
>          unsigned translated_flags = 0;
>  
>          if (screen->kernel_version >= 1) {
> -                //if (flags & PAN_ALLOCATE_GROWABLE)
> -                //        translated_flags |= PANFROST_BO_HEAP;
> +                if (flags & PAN_ALLOCATE_GROWABLE)
> +                        translated_flags |= PANFROST_BO_HEAP;
>                  if (!(flags & PAN_ALLOCATE_EXECUTE))
>                          translated_flags |= PANFROST_BO_NOEXEC;
>          }
> -- 
> 2.20.1