summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2018-11-19 16:02:15 -0500
committerRob Clark <[email protected]>2018-11-27 15:44:03 -0500
commite68cd912518b924e025947adf7c3accc69993bba (patch)
tree2116f3e888af09b44da860adf612a6bab6b944ff
parent3ed4aad524b32d999ee3a999ef60da0ecb727a49 (diff)
freedreno: use MSM_BO_SCANOUT with scanout buffers
Signed-off-by: Jonathan Marek <[email protected]>
-rw-r--r--src/freedreno/drm/freedreno_drmif.h1
-rw-r--r--src/freedreno/drm/msm_bo.c3
-rw-r--r--src/gallium/drivers/freedreno/freedreno_resource.c4
3 files changed, 7 insertions, 1 deletions
diff --git a/src/freedreno/drm/freedreno_drmif.h b/src/freedreno/drm/freedreno_drmif.h
index 6468eac4a07..e12ab970c8f 100644
--- a/src/freedreno/drm/freedreno_drmif.h
+++ b/src/freedreno/drm/freedreno_drmif.h
@@ -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
diff --git a/src/freedreno/drm/msm_bo.c b/src/freedreno/drm/msm_bo.c
index da3315c9ab6..d93dfbeab2e 100644
--- a/src/freedreno/drm/msm_bo.c
+++ b/src/freedreno/drm/msm_bo.c
@@ -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)
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 54d73858962..bd7be94c859 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -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