From 46ad3561be0b820333a515941bfb220591402573 Mon Sep 17 00:00:00 2001 From: Nicolai Hähnle Date: Fri, 6 May 2016 12:34:25 -0500 Subject: radeon/winsys: add cs_check_space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/gallium/winsys/amdgpu') diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c index c8ce34de34d..639ffb5ce7c 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c @@ -603,6 +603,12 @@ static boolean amdgpu_cs_validate(struct radeon_winsys_cs *rcs) return TRUE; } +static bool amdgpu_cs_check_space(struct radeon_winsys_cs *rcs, unsigned dw) +{ + assert(rcs->cdw <= rcs->max_dw); + return rcs->max_dw - rcs->cdw >= dw; +} + static boolean amdgpu_cs_memory_below_limit(struct radeon_winsys_cs *rcs, uint64_t vram, uint64_t gtt) { struct amdgpu_cs *cs = amdgpu_cs(rcs); @@ -941,6 +947,7 @@ void amdgpu_cs_init_functions(struct amdgpu_winsys *ws) ws->base.cs_add_buffer = amdgpu_cs_add_buffer; ws->base.cs_lookup_buffer = amdgpu_cs_lookup_buffer; ws->base.cs_validate = amdgpu_cs_validate; + ws->base.cs_check_space = amdgpu_cs_check_space; ws->base.cs_memory_below_limit = amdgpu_cs_memory_below_limit; ws->base.cs_query_memory_usage = amdgpu_cs_query_memory_usage; ws->base.cs_get_buffer_list = amdgpu_cs_get_buffer_list; -- cgit v1.2.3