panfrost: Add support for the CSF job frontend

CSF-specific implementation of the job-frontend helpers.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Antonino Maniscalco <antonino.maniscalco@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26358>
This commit is contained in:
Alyssa Rosenzweig
2023-11-15 17:58:54 +01:00
committed by Marge Bot
parent e6a97a2b4a
commit 447075eeee
7 changed files with 1190 additions and 1 deletions

View File

@@ -63,6 +63,8 @@ foreach ver : panfrost_versions
files_panfrost_vx = ['pan_cmdstream.c', pan_packers]
if ver in ['4', '5', '6', '7', '9']
files_panfrost_vx += ['pan_jm.c']
elif ver in ['10']
files_panfrost_vx += ['pan_csf.c']
endif
libpanfrost_versions += static_library(
'panfrost-v' + ver, files_panfrost_vx,

View File

@@ -46,6 +46,7 @@
#include "pan_bo.h"
#include "pan_cmdstream.h"
#include "pan_context.h"
#include "pan_csf.h"
#include "pan_indirect_dispatch.h"
#include "pan_jm.h"
#include "pan_job.h"
@@ -60,6 +61,8 @@
* functions. */
#if PAN_ARCH <= 9
#define JOBX(__suffix) GENX(jm_##__suffix)
#elif PAN_ARCH <= 10
#define JOBX(__suffix) GENX(csf_##__suffix)
#else
#error "Unsupported arch"
#endif

View File

@@ -40,7 +40,7 @@
#include "util/u_prim.h"
#define PAN_GPU_INDIRECTS (PAN_ARCH == 7)
#define PAN_GPU_INDIRECTS (PAN_ARCH == 7 || PAN_ARCH >= 10)
struct panfrost_rasterizer {
struct pipe_rasterizer_state base;

View File

@@ -50,6 +50,8 @@
#include "compiler/shader_enums.h"
#include "midgard/midgard_compile.h"
#include "pan_csf.h"
#define SET_BIT(lval, bit, cond) \
if (cond) \
lval |= (bit); \
@@ -230,6 +232,10 @@ struct panfrost_context {
int in_sync_fd;
uint32_t in_sync_obj;
union {
struct panfrost_csf_context csf;
};
};
/* Corresponds to the CSO */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,96 @@
/*
* Copyright (C) 2023 Collabora Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#ifndef __PAN_CSF_H__
#define __PAN_CSF_H__
#include "compiler/shader_enums.h"
#include "pan_bo.h"
#include "pan_mempool.h"
struct cs_builder;
struct panfrost_csf_batch {
/* CS related fields. */
struct {
/* CS builder. */
struct cs_builder *builder;
/* CS state, written through the CS, and checked when PAN_MESA_DEBUG=sync.
*/
struct panfrost_ptr state;
} cs;
/* Pool used to allocate CS chunks. */
struct panfrost_pool cs_chunk_pool;
};
struct panfrost_csf_context {
uint32_t group_handle;
struct {
uint32_t handle;
struct panfrost_bo *desc_bo;
} heap;
/* Temporary geometry buffer. Used as a FIFO by the tiler. */
struct panfrost_bo *tmp_geom_bo;
};
#if defined(PAN_ARCH) && PAN_ARCH >= 10
#include "genxml/gen_macros.h"
struct panfrost_batch;
struct panfrost_context;
struct pan_fb_info;
struct pipe_draw_info;
struct pipe_grid_info;
struct pipe_draw_start_count_bias;
void GENX(csf_init_context)(struct panfrost_context *ctx);
void GENX(csf_cleanup_context)(struct panfrost_context *ctx);
void GENX(csf_init_batch)(struct panfrost_batch *batch);
void GENX(csf_cleanup_batch)(struct panfrost_batch *batch);
int GENX(csf_submit_batch)(struct panfrost_batch *batch);
void GENX(csf_preload_fb)(struct panfrost_batch *batch, struct pan_fb_info *fb);
void GENX(csf_emit_fragment_job)(struct panfrost_batch *batch,
const struct pan_fb_info *pfb);
void GENX(csf_emit_batch_end)(struct panfrost_batch *batch);
void GENX(csf_launch_xfb)(struct panfrost_batch *batch,
const struct pipe_draw_info *info, unsigned count);
void GENX(csf_launch_grid)(struct panfrost_batch *batch,
const struct pipe_grid_info *info);
void GENX(csf_launch_draw)(struct panfrost_batch *batch,
const struct pipe_draw_info *info,
unsigned drawid_offset,
const struct pipe_draw_start_count_bias *draw,
unsigned vertex_count);
#endif /* PAN_ARCH >= 10 */
#endif /* __PAN_CSF_H__ */

View File

@@ -28,6 +28,7 @@
#include "pipe/p_state.h"
#include "util/u_dynarray.h"
#include "pan_csf.h"
#include "pan_desc.h"
#include "pan_jm.h"
#include "pan_mempool.h"
@@ -218,6 +219,7 @@ struct panfrost_batch {
/* Job frontend specific fields. */
union {
struct panfrost_jm_batch jm;
struct panfrost_csf_batch csf;
};
};