diff options
author | Rob Clark <[email protected]> | 2019-01-09 13:03:43 -0500 |
---|---|---|
committer | Rob Clark <[email protected]> | 2019-01-10 14:21:39 -0500 |
commit | 04aff7e42b88fdd251617436a589ea0be2f44093 (patch) | |
tree | 5f3f877600e8515a212b7fb7a4b19ce1fa5ff464 /src | |
parent | 286de96af86b4a70de71dfc763aebc039669400d (diff) |
freedreno: make cmdstream bo's read-only to GPU
If nothing else, this will make problems with cmdstream getting blit
over with pixels easier to track down (ie. faults when it first happens
rather than strange failures later from corrupted cmdstream when a
stateobj is later reused).
(NOTE this somewhat depends on the kernel supporting the flag, and the
iommu implementation. But the worst case is just that the cmdstream
ends up writeable as before.)
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/freedreno/drm/msm_bo.c | 3 | ||||
-rw-r--r-- | src/freedreno/drm/msm_ringbuffer_sp.c | 13 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/freedreno/drm/msm_bo.c b/src/freedreno/drm/msm_bo.c index fd9955ea805..da2609903c1 100644 --- a/src/freedreno/drm/msm_bo.c +++ b/src/freedreno/drm/msm_bo.c @@ -166,6 +166,9 @@ int msm_bo_new_handle(struct fd_device *dev, if (flags & DRM_FREEDRENO_GEM_SCANOUT) req.flags |= MSM_BO_SCANOUT; + if (flags & DRM_FREEDRENO_GEM_GPUREADONLY) + req.flags |= MSM_BO_GPU_READONLY; + ret = drmCommandWriteRead(dev->fd, DRM_MSM_GEM_NEW, &req, sizeof(req)); if (ret) diff --git a/src/freedreno/drm/msm_ringbuffer_sp.c b/src/freedreno/drm/msm_ringbuffer_sp.c index 228740d783b..2b8f531721e 100644 --- a/src/freedreno/drm/msm_ringbuffer_sp.c +++ b/src/freedreno/drm/msm_ringbuffer_sp.c @@ -186,8 +186,8 @@ msm_submit_suballoc_ring_bo(struct fd_submit *submit, if (!suballoc_bo) { // TODO possibly larger size for streaming bo? - msm_ring->ring_bo = fd_bo_new_ring( - submit->pipe->dev, 0x8000, 0); + msm_ring->ring_bo = fd_bo_new_ring(submit->pipe->dev, + 0x8000, DRM_FREEDRENO_GEM_GPUREADONLY); msm_ring->offset = 0; } else { msm_ring->ring_bo = fd_bo_ref(suballoc_bo); @@ -225,7 +225,8 @@ msm_submit_sp_new_ringbuffer(struct fd_submit *submit, uint32_t size, size = INIT_SIZE; msm_ring->offset = 0; - msm_ring->ring_bo = fd_bo_new_ring(submit->pipe->dev, size, 0); + msm_ring->ring_bo = fd_bo_new_ring(submit->pipe->dev, size, + DRM_FREEDRENO_GEM_GPUREADONLY); } if (!msm_ringbuffer_sp_init(msm_ring, size, flags)) @@ -375,7 +376,8 @@ msm_ringbuffer_sp_grow(struct fd_ringbuffer *ring, uint32_t size) finalize_current_cmd(ring); fd_bo_del(msm_ring->ring_bo); - msm_ring->ring_bo = fd_bo_new_ring(pipe->dev, size, 0); + msm_ring->ring_bo = fd_bo_new_ring(pipe->dev, size, + DRM_FREEDRENO_GEM_GPUREADONLY); ring->start = fd_bo_map(msm_ring->ring_bo); ring->end = &(ring->start[size/4]); @@ -558,7 +560,8 @@ msm_ringbuffer_sp_new_object(struct fd_pipe *pipe, uint32_t size) msm_ring->u.pipe = pipe; msm_ring->offset = 0; - msm_ring->ring_bo = fd_bo_new_ring(pipe->dev, size, 0); + msm_ring->ring_bo = fd_bo_new_ring(pipe->dev, size, + DRM_FREEDRENO_GEM_GPUREADONLY); msm_ring->base.refcnt = 1; return msm_ringbuffer_sp_init(msm_ring, size, _FD_RINGBUFFER_OBJECT); |