From 187f1c999f90c3bef5b657bf386f076436149c1c Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 4 Apr 2019 10:02:27 -0400 Subject: winsys/amdgpu: add REWIND emulation via INDIRECT_BUFFER into cs_check_space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Acked-by: Nicolai Hähnle --- src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 20 +++++++++++++------- src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 3 ++- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src/gallium/winsys') diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c index eb973bf8102..555150a7018 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c @@ -1031,7 +1031,8 @@ static bool amdgpu_cs_validate(struct radeon_cmdbuf *rcs) return true; } -static bool amdgpu_cs_check_space(struct radeon_cmdbuf *rcs, unsigned dw) +static bool amdgpu_cs_check_space(struct radeon_cmdbuf *rcs, unsigned dw, + bool force_chaining) { struct amdgpu_ib *ib = amdgpu_ib(rcs); struct amdgpu_cs *cs = amdgpu_cs_from_ib(ib); @@ -1048,16 +1049,21 @@ static bool amdgpu_cs_check_space(struct radeon_cmdbuf *rcs, unsigned dw) ib->max_check_space_size = MAX2(ib->max_check_space_size, safe_byte_size); - if (requested_size > amdgpu_ib_max_submit_dwords(ib->ib_type)) - return false; + /* If force_chaining is true, we can't return. We have to chain. */ + if (!force_chaining) { + if (requested_size > amdgpu_ib_max_submit_dwords(ib->ib_type)) + return false; - ib->max_ib_size = MAX2(ib->max_ib_size, requested_size); + ib->max_ib_size = MAX2(ib->max_ib_size, requested_size); - if (rcs->current.max_dw - rcs->current.cdw >= dw) - return true; + if (rcs->current.max_dw - rcs->current.cdw >= dw) + return true; + } - if (!amdgpu_cs_has_chaining(cs)) + if (!amdgpu_cs_has_chaining(cs)) { + assert(!force_chaining); return false; + } /* Allocate a new chunk */ if (rcs->num_prev >= rcs->max_prev) { diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c index 670d2f57de6..7de748a4aff 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c @@ -424,7 +424,8 @@ static bool radeon_drm_cs_validate(struct radeon_cmdbuf *rcs) return status; } -static bool radeon_drm_cs_check_space(struct radeon_cmdbuf *rcs, unsigned dw) +static bool radeon_drm_cs_check_space(struct radeon_cmdbuf *rcs, unsigned dw, + bool force_chaining) { assert(rcs->current.cdw <= rcs->current.max_dw); return rcs->current.max_dw - rcs->current.cdw >= dw; -- cgit v1.2.3