From 7a62f6e3a3ec065dbb4c133b6b19d0bae7af1b8a Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 30 Jul 2022 08:12:21 -0700 Subject: [PATCH] freedreno/drm: Combine upper and lower 32b of OR val The original reason it was split was because of libdrm ABI. But that no longer applies since we pulled it into mesa. While we are at it, remove the c++ workaround. Signed-off-by: Rob Clark Part-of: --- src/freedreno/drm/freedreno_ringbuffer.h | 27 +++++++++++------------- src/freedreno/drm/msm/msm_ringbuffer.c | 4 ++-- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/freedreno/drm/freedreno_ringbuffer.h b/src/freedreno/drm/freedreno_ringbuffer.h index 2a07f98e5ad..903e22d78a3 100644 --- a/src/freedreno/drm/freedreno_ringbuffer.h +++ b/src/freedreno/drm/freedreno_ringbuffer.h @@ -196,13 +196,12 @@ fd_ringbuffer_emit(struct fd_ringbuffer *ring, uint32_t data) struct fd_reloc { struct fd_bo *bo; uint64_t iova; + uint64_t orval; #define FD_RELOC_READ 0x0001 #define FD_RELOC_WRITE 0x0002 #define FD_RELOC_DUMP 0x0004 uint32_t offset; - uint32_t orlo; int32_t shift; - uint32_t orhi; /* used for a5xx+ */ }; /* We always mark BOs for write, instead of tracking it across reloc @@ -278,10 +277,9 @@ OUT_RING(struct fd_ringbuffer *ring, uint32_t data) /* * NOTE: OUT_RELOC() is 2 dwords (64b) on a5xx+ */ -#ifndef __cplusplus static inline void OUT_RELOC(struct fd_ringbuffer *ring, struct fd_bo *bo, uint32_t offset, - uint64_t or, int32_t shift) + uint64_t orval, int32_t shift) { if (LOG_DWORDS) { fprintf(stderr, "ring[%p]: OUT_RELOC %04x: %p+%u << %d", ring, @@ -296,19 +294,18 @@ OUT_RELOC(struct fd_ringbuffer *ring, struct fd_bo *bo, uint32_t offset, else iova <<= shift; - iova |= or ; + iova |= orval; - fd_ringbuffer_reloc(ring, &(struct fd_reloc){ - .bo = bo, - .iova = iova, - .offset = offset, - .orlo = or - , - .shift = shift, - .orhi = or >> 32, - }); + struct fd_reloc reloc = { + .bo = bo, + .iova = iova, + .orval = orval, + .offset = offset, + .shift = shift, + }; + + fd_ringbuffer_reloc(ring, &reloc); } -#endif static inline void OUT_RB(struct fd_ringbuffer *ring, struct fd_ringbuffer *target) diff --git a/src/freedreno/drm/msm/msm_ringbuffer.c b/src/freedreno/drm/msm/msm_ringbuffer.c index bcacf310417..84ad20b41f8 100644 --- a/src/freedreno/drm/msm/msm_ringbuffer.c +++ b/src/freedreno/drm/msm/msm_ringbuffer.c @@ -503,7 +503,7 @@ msm_ringbuffer_emit_reloc(struct fd_ringbuffer *ring, (struct drm_msm_gem_submit_reloc){ .reloc_idx = reloc_idx, .reloc_offset = reloc->offset, - .or = reloc->orlo, + .or = reloc->orval, .shift = reloc->shift, .submit_offset = offset_bytes(ring->cur, ring->start) + msm_ring->offset, @@ -516,7 +516,7 @@ msm_ringbuffer_emit_reloc(struct fd_ringbuffer *ring, (struct drm_msm_gem_submit_reloc){ .reloc_idx = reloc_idx, .reloc_offset = reloc->offset, - .or = reloc->orhi, + .or = reloc->orval >> 32, .shift = reloc->shift - 32, .submit_offset = offset_bytes(ring->cur, ring->start) + msm_ring->offset,