summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_job.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-06-10 12:36:47 -0700
committerEric Anholt <[email protected]>2015-06-17 23:53:49 -0700
commit9adcd2d80aceec90b9c3712b53d8e7839dc5634b (patch)
treeb844ba12669ff53c1fbdebfbf5f9f6409d9c1b1d /src/gallium/drivers/vc4/vc4_job.c
parent91c73a9a280b749a781cd3f071fc377fcb9758e1 (diff)
vc4: Move RCL generation into the kernel.
There weren't that many variations of RCL generation, and this lets us skip all the in-kernel validation for what we generated.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_job.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_job.c97
1 files changed, 91 insertions, 6 deletions
diff --git a/src/gallium/drivers/vc4/vc4_job.c b/src/gallium/drivers/vc4/vc4_job.c
index 76037162102..dcade15443a 100644
--- a/src/gallium/drivers/vc4/vc4_job.c
+++ b/src/gallium/drivers/vc4/vc4_job.c
@@ -33,7 +33,6 @@ void
vc4_job_init(struct vc4_context *vc4)
{
vc4_init_cl(vc4, &vc4->bcl);
- vc4_init_cl(vc4, &vc4->rcl);
vc4_init_cl(vc4, &vc4->shader_rec);
vc4_init_cl(vc4, &vc4->uniforms);
vc4_init_cl(vc4, &vc4->bo_handles);
@@ -50,7 +49,6 @@ vc4_job_reset(struct vc4_context *vc4)
vc4_bo_unreference(&referenced_bos[i]);
}
vc4_reset_cl(&vc4->bcl);
- vc4_reset_cl(&vc4->rcl);
vc4_reset_cl(&vc4->shader_rec);
vc4_reset_cl(&vc4->uniforms);
vc4_reset_cl(&vc4->bo_handles);
@@ -75,6 +73,70 @@ vc4_job_reset(struct vc4_context *vc4)
vc4->draw_max_y = 0;
}
+static void
+vc4_submit_setup_rcl_surface(struct vc4_context *vc4,
+ struct drm_vc4_submit_rcl_surface *submit_surf,
+ struct pipe_surface *psurf,
+ bool is_depth, bool is_write)
+{
+ struct vc4_surface *surf = vc4_surface(psurf);
+
+ if (!surf) {
+ submit_surf->hindex = ~0;
+ return;
+ }
+
+ struct vc4_resource *rsc = vc4_resource(psurf->texture);
+ submit_surf->hindex = vc4_gem_hindex(vc4, rsc->bo);
+ submit_surf->offset = surf->offset;
+
+ if (is_depth) {
+ submit_surf->bits =
+ VC4_SET_FIELD(VC4_LOADSTORE_TILE_BUFFER_ZS,
+ VC4_LOADSTORE_TILE_BUFFER_BUFFER);
+
+ } else {
+ submit_surf->bits =
+ VC4_SET_FIELD(VC4_LOADSTORE_TILE_BUFFER_COLOR,
+ VC4_LOADSTORE_TILE_BUFFER_BUFFER) |
+ VC4_SET_FIELD(vc4_rt_format_is_565(psurf->format) ?
+ VC4_LOADSTORE_TILE_BUFFER_BGR565 :
+ VC4_LOADSTORE_TILE_BUFFER_RGBA8888,
+ VC4_LOADSTORE_TILE_BUFFER_FORMAT);
+ }
+ submit_surf->bits |=
+ VC4_SET_FIELD(surf->tiling, VC4_LOADSTORE_TILE_BUFFER_TILING);
+
+ if (is_write)
+ rsc->writes++;
+}
+
+static void
+vc4_submit_setup_ms_rcl_surface(struct vc4_context *vc4,
+ struct drm_vc4_submit_rcl_surface *submit_surf,
+ struct pipe_surface *psurf)
+{
+ struct vc4_surface *surf = vc4_surface(psurf);
+
+ if (!surf) {
+ submit_surf->hindex = ~0;
+ return;
+ }
+
+ struct vc4_resource *rsc = vc4_resource(psurf->texture);
+ submit_surf->hindex = vc4_gem_hindex(vc4, rsc->bo);
+ submit_surf->offset = surf->offset;
+
+ submit_surf->bits =
+ VC4_SET_FIELD(vc4_rt_format_is_565(surf->base.format) ?
+ VC4_RENDER_CONFIG_FORMAT_BGR565 :
+ VC4_RENDER_CONFIG_FORMAT_RGBA8888,
+ VC4_RENDER_CONFIG_FORMAT) |
+ VC4_SET_FIELD(surf->tiling, VC4_RENDER_CONFIG_MEMORY_FORMAT);
+
+ rsc->writes++;
+}
+
/**
* Submits the job to the kernel and then reinitializes it.
*/
@@ -84,26 +146,49 @@ vc4_job_submit(struct vc4_context *vc4)
if (vc4_debug & VC4_DEBUG_CL) {
fprintf(stderr, "BCL:\n");
vc4_dump_cl(vc4->bcl.base, vc4->bcl.next - vc4->bcl.base, false);
- fprintf(stderr, "RCL:\n");
- vc4_dump_cl(vc4->rcl.base, vc4->rcl.next - vc4->rcl.base, true);
}
struct drm_vc4_submit_cl submit;
memset(&submit, 0, sizeof(submit));
+ cl_ensure_space(&vc4->bo_handles, 4 * sizeof(uint32_t));
+ cl_ensure_space(&vc4->bo_pointers, 4 * sizeof(struct vc4_bo *));
+
+ vc4_submit_setup_rcl_surface(vc4, &submit.color_read,
+ vc4->color_read, false, false);
+ vc4_submit_setup_ms_rcl_surface(vc4, &submit.color_ms_write,
+ vc4->color_write);
+ vc4_submit_setup_rcl_surface(vc4, &submit.zs_read,
+ vc4->zs_read, true, false);
+ vc4_submit_setup_rcl_surface(vc4, &submit.zs_write,
+ vc4->zs_write, true, true);
+
submit.bo_handles = (uintptr_t)vc4->bo_handles.base;
submit.bo_handle_count = (vc4->bo_handles.next -
vc4->bo_handles.base) / 4;
submit.bin_cl = (uintptr_t)vc4->bcl.base;
submit.bin_cl_size = vc4->bcl.next - vc4->bcl.base;
- submit.render_cl = (uintptr_t)vc4->rcl.base;
- submit.render_cl_size = vc4->rcl.next - vc4->rcl.base;
submit.shader_rec = (uintptr_t)vc4->shader_rec.base;
submit.shader_rec_size = vc4->shader_rec.next - vc4->shader_rec.base;
submit.shader_rec_count = vc4->shader_rec_count;
submit.uniforms = (uintptr_t)vc4->uniforms.base;
submit.uniforms_size = vc4->uniforms.next - vc4->uniforms.base;
+ assert(vc4->draw_min_x != ~0 && vc4->draw_min_y != ~0);
+ submit.min_x_tile = vc4->draw_min_x / 64;
+ submit.min_y_tile = vc4->draw_min_y / 64;
+ submit.max_x_tile = (vc4->draw_max_x - 1) / 64;
+ submit.max_y_tile = (vc4->draw_max_y - 1) / 64;
+ submit.width = vc4->draw_width;
+ submit.height = vc4->draw_height;
+ if (vc4->cleared) {
+ submit.flags |= VC4_SUBMIT_CL_USE_CLEAR_COLOR;
+ submit.clear_color[0] = vc4->clear_color[0];
+ submit.clear_color[1] = vc4->clear_color[1];
+ submit.clear_z = vc4->clear_depth;
+ submit.clear_s = vc4->clear_stencil;
+ }
+
if (!(vc4_debug & VC4_DEBUG_NORAST)) {
int ret;