freedreno: use MSM_BO_SCANOUT with scanout buffers
authorJonathan Marek <jonathan@marek.ca>
Mon, 19 Nov 2018 21:02:15 +0000 (16:02 -0500)
committerRob Clark <robdclark@gmail.com>
Tue, 27 Nov 2018 20:44:03 +0000 (15:44 -0500)
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
src/freedreno/drm/freedreno_drmif.h
src/freedreno/drm/msm_bo.c
src/gallium/drivers/freedreno/freedreno_resource.c

index 6468eac4a07caf9f0eba5b146ac94bcafc9919de..e12ab970c8f3c10472d0b172aa51e87ed615f1d2 100644 (file)
@@ -63,6 +63,7 @@ enum fd_param_id {
 #define DRM_FREEDRENO_GEM_CACHE_WBACKWA   0x00800000
 #define DRM_FREEDRENO_GEM_CACHE_MASK      0x00f00000
 #define DRM_FREEDRENO_GEM_GPUREADONLY     0x01000000
+#define DRM_FREEDRENO_GEM_SCANOUT         0x02000000
 
 /* bo access flags: (keep aligned to MSM_PREP_x) */
 #define DRM_FREEDRENO_PREP_READ           0x01
index da3315c9ab6aae6c4ac5bc612c297b11103ff6dc..d93dfbeab2e64875db2959b6ef94bc7a43f3348a 100644 (file)
@@ -142,6 +142,9 @@ int msm_bo_new_handle(struct fd_device *dev,
        };
        int ret;
 
+       if (flags & DRM_FREEDRENO_GEM_SCANOUT)
+               req.flags |= MSM_BO_SCANOUT;
+
        ret = drmCommandWriteRead(dev->fd, DRM_MSM_GEM_NEW,
                        &req, sizeof(req));
        if (ret)
index 54d738589626a6d2d3235f05f14afc5302121303..bd7be94c859130329a0b27c1650dee3b6b428c47 100644 (file)
@@ -99,7 +99,9 @@ realloc_bo(struct fd_resource *rsc, uint32_t size)
 {
        struct fd_screen *screen = fd_screen(rsc->base.screen);
        uint32_t flags = DRM_FREEDRENO_GEM_CACHE_WCOMBINE |
-                       DRM_FREEDRENO_GEM_TYPE_KMEM; /* TODO */
+                       DRM_FREEDRENO_GEM_TYPE_KMEM |
+                       COND(rsc->base.bind & PIPE_BIND_SCANOUT, DRM_FREEDRENO_GEM_SCANOUT);
+                       /* TODO other flags? */
 
        /* if we start using things other than write-combine,
         * be sure to check for PIPE_RESOURCE_FLAG_MAP_COHERENT