From 76d56752ccff5bca3a0808705d5da76f186afb33 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Apr 2015 13:35:57 -0700 Subject: [PATCH] vc4: Allow submitting jobs with no bin CL in validation. For blitting, we want to fire off an RCL-only job. This takes a bit of tweaking in our validation and the simulator support (and corresponding new code in the kernel). --- src/gallium/drivers/vc4/kernel/vc4_drv.h | 1 + src/gallium/drivers/vc4/kernel/vc4_gem.c | 2 ++ src/gallium/drivers/vc4/kernel/vc4_validate.c | 9 ++++++--- src/gallium/drivers/vc4/vc4_simulator.c | 18 ++++++++++-------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/vc4/kernel/vc4_drv.h b/src/gallium/drivers/vc4/kernel/vc4_drv.h index 12a3ceff725..325f944bf25 100644 --- a/src/gallium/drivers/vc4/kernel/vc4_drv.h +++ b/src/gallium/drivers/vc4/kernel/vc4_drv.h @@ -162,6 +162,7 @@ vc4_validate_cl(struct drm_device *dev, void *unvalidated, uint32_t len, bool is_bin, + bool has_bin, struct vc4_exec_info *exec); int diff --git a/src/gallium/drivers/vc4/kernel/vc4_gem.c b/src/gallium/drivers/vc4/kernel/vc4_gem.c index c9a75733d6d..ac29ab35dbc 100644 --- a/src/gallium/drivers/vc4/kernel/vc4_gem.c +++ b/src/gallium/drivers/vc4/kernel/vc4_gem.c @@ -130,6 +130,7 @@ vc4_cl_validate(struct drm_device *dev, struct vc4_exec_info *exec) bin, args->bin_cl_size, true, + args->bin_cl_size != 0, exec); if (ret) goto fail; @@ -139,6 +140,7 @@ vc4_cl_validate(struct drm_device *dev, struct vc4_exec_info *exec) render, args->render_cl_size, false, + args->bin_cl_size != 0, exec); if (ret) goto fail; diff --git a/src/gallium/drivers/vc4/kernel/vc4_validate.c b/src/gallium/drivers/vc4/kernel/vc4_validate.c index aeac29e036f..2d04a4a7b9a 100644 --- a/src/gallium/drivers/vc4/kernel/vc4_validate.c +++ b/src/gallium/drivers/vc4/kernel/vc4_validate.c @@ -702,6 +702,7 @@ vc4_validate_cl(struct drm_device *dev, void *unvalidated, uint32_t len, bool is_bin, + bool has_bin, struct vc4_exec_info *exec) { uint32_t dst_offset = 0; @@ -772,7 +773,7 @@ vc4_validate_cl(struct drm_device *dev, if (is_bin) { exec->ct0ea = exec->ct0ca + dst_offset; - if (!exec->found_start_tile_binning_packet) { + if (has_bin && !exec->found_start_tile_binning_packet) { DRM_ERROR("Bin CL missing VC4_PACKET_START_TILE_BINNING\n"); return -EINVAL; } @@ -786,8 +787,10 @@ vc4_validate_cl(struct drm_device *dev, * increment from the bin CL. Otherwise a later submit would * have render execute immediately. */ - if (!exec->found_wait_on_semaphore_packet) { - DRM_ERROR("Render CL missing VC4_PACKET_WAIT_ON_SEMAPHORE\n"); + if (exec->found_wait_on_semaphore_packet != has_bin) { + DRM_ERROR("Render CL %s VC4_PACKET_WAIT_ON_SEMAPHORE\n", + exec->found_wait_on_semaphore_packet ? + "has" : "missing"); return -EINVAL; } exec->ct1ea = exec->ct1ca + dst_offset; diff --git a/src/gallium/drivers/vc4/vc4_simulator.c b/src/gallium/drivers/vc4/vc4_simulator.c index cd8cc5bb56c..2f72e722fc5 100644 --- a/src/gallium/drivers/vc4/vc4_simulator.c +++ b/src/gallium/drivers/vc4/vc4_simulator.c @@ -151,14 +151,16 @@ vc4_simulator_flush(struct vc4_context *vc4, struct drm_vc4_submit_cl *args) if (ret) return ret; - int bfc = simpenrose_do_binning(exec.ct0ca, exec.ct0ea); - if (bfc != 1) { - fprintf(stderr, "Binning returned %d flushes, should be 1.\n", - bfc); - fprintf(stderr, "Relocated binning command list:\n"); - vc4_dump_cl(screen->simulator_mem_base + exec.ct0ca, - exec.ct0ea - exec.ct0ca, false); - abort(); + if (exec.ct0ca != exec.ct0ea) { + int bfc = simpenrose_do_binning(exec.ct0ca, exec.ct0ea); + if (bfc != 1) { + fprintf(stderr, "Binning returned %d flushes, should be 1.\n", + bfc); + fprintf(stderr, "Relocated binning command list:\n"); + vc4_dump_cl(screen->simulator_mem_base + exec.ct0ca, + exec.ct0ea - exec.ct0ca, false); + abort(); + } } int rfc = simpenrose_do_rendering(exec.ct1ca, exec.ct1ea); if (rfc != 1) { -- 2.30.2