Path: blob/21.2-virgl/src/gallium/drivers/radeonsi/si_pm4.h
4570 views
/*1* Copyright 2012 Advanced Micro Devices, Inc.2* All Rights Reserved.3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* on the rights to use, copy, modify, merge, publish, distribute, sub8* license, and/or sell copies of the Software, and to permit persons to whom9* the Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice (including the next12* paragraph) shall be included in all copies or substantial portions of the13* Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL18* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,19* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR20* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE21* USE OR OTHER DEALINGS IN THE SOFTWARE.22*/2324#ifndef SI_PM4_H25#define SI_PM4_H2627#include "radeon/radeon_winsys.h"2829#ifdef __cplusplus30extern "C" {31#endif3233#define SI_PM4_MAX_DW 1763435// forward defines36struct si_context;3738/* State atoms are callbacks which write a sequence of packets into a GPU39* command buffer (AKA indirect buffer, AKA IB, AKA command stream, AKA CS).40*/41struct si_atom {42void (*emit)(struct si_context *ctx);43};4445struct si_pm4_state {46/* PKT3_SET_*_REG handling */47unsigned last_opcode;48unsigned last_reg;49unsigned last_pm4;5051/* commands for the DE */52unsigned ndw;53uint32_t pm4[SI_PM4_MAX_DW];5455/* For shader states only */56struct si_shader *shader;57struct si_atom atom;58};5960void si_pm4_cmd_add(struct si_pm4_state *state, uint32_t dw);61void si_pm4_set_reg(struct si_pm4_state *state, unsigned reg, uint32_t val);6263void si_pm4_clear_state(struct si_pm4_state *state);64void si_pm4_free_state(struct si_context *sctx, struct si_pm4_state *state, unsigned idx);6566void si_pm4_emit(struct si_context *sctx, struct si_pm4_state *state);67void si_pm4_reset_emitted(struct si_context *sctx, bool first_cs);6869#ifdef __cplusplus70}71#endif7273#endif747576