From 25f948d4d9910f9400af36abe2ffe0c7aec90cb4 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 7 Apr 2021 15:34:22 +0200 Subject: [PATCH] panfrost: Add an helper to emit fragment jobs Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- src/panfrost/lib/pan_cs.c | 22 ++++++++++++++++++++++ src/panfrost/lib/pan_cs.h | 6 ++++++ 2 files changed, 28 insertions(+) diff --git a/src/panfrost/lib/pan_cs.c b/src/panfrost/lib/pan_cs.c index 4ec1b4c09e0..34a20808365 100644 --- a/src/panfrost/lib/pan_cs.c +++ b/src/panfrost/lib/pan_cs.c @@ -913,3 +913,25 @@ pan_emit_bifrost_tiler(const struct panfrost_device *dev, tiler.sample_pattern = pan_sample_pattern(nr_samples); } } + +void +pan_emit_fragment_job(const struct panfrost_device *dev, + const struct pan_fb_info *fb, + mali_ptr fbd, + void *out) +{ + pan_section_pack(out, FRAGMENT_JOB, HEADER, header) { + header.type = MALI_JOB_TYPE_FRAGMENT; + header.index = 1; + } + + pan_section_pack(out, FRAGMENT_JOB, PAYLOAD, payload) { + payload.bound_min_x = fb->extent.minx >> MALI_TILE_SHIFT; + payload.bound_min_y = fb->extent.miny >> MALI_TILE_SHIFT; + + /* Batch max values are inclusive, we need to subtract 1. */ + payload.bound_max_x = fb->extent.maxx >> MALI_TILE_SHIFT; + payload.bound_max_y = fb->extent.maxy >> MALI_TILE_SHIFT; + payload.framebuffer = fbd; + } +} diff --git a/src/panfrost/lib/pan_cs.h b/src/panfrost/lib/pan_cs.h index 22eaf3ef1ce..f013a2a943f 100644 --- a/src/panfrost/lib/pan_cs.h +++ b/src/panfrost/lib/pan_cs.h @@ -136,4 +136,10 @@ pan_emit_bifrost_tiler(const struct panfrost_device *dev, mali_ptr heap, void *out); +void +pan_emit_fragment_job(const struct panfrost_device *dev, + const struct pan_fb_info *fb, + mali_ptr fbd, + void *out); + #endif