radeonsi_pm4.h revision f2c95d93db197fe175d510436d7f4fa45aed1180
18a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/* 28a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * Copyright 2012 Advanced Micro Devices, Inc. 38a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * 48a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * Permission is hereby granted, free of charge, to any person obtaining a 58a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * copy of this software and associated documentation files (the "Software"), 68a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * to deal in the Software without restriction, including without limitation 78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * on the rights to use, copy, modify, merge, publish, distribute, sub 88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * license, and/or sell copies of the Software, and to permit persons to whom 98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * the Software is furnished to do so, subject to the following conditions: 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * The above copyright notice and this permission notice (including the next 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * paragraph) shall be included in all copies or substantial portions of the 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * Software. 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * USE OR OTHER DEALINGS IN THE SOFTWARE. 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * Authors: 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * Christian König <christian.koenig@amd.com> 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */ 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef RADEONSI_PM4_H 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define RADEONSI_PM4_H 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "../../winsys/radeon/drm/radeon_winsys.h" 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SI_PM4_MAX_DW 128 338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SI_PM4_MAX_BO 32 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SI_PM4_MAX_RELOCS 4 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// forward defines 378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comstruct r600_context; 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comstruct si_pm4_state 408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com{ 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com /* PKT3_SET_*_REG handling */ 428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com unsigned last_opcode; 438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com unsigned last_reg; 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com unsigned last_pm4; 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com /* flush flags for SURFACE_SYNC */ 478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com uint32_t cp_coher_cntl; 488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com /* commands for the DE */ 508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com unsigned ndw; 518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com uint32_t pm4[SI_PM4_MAX_DW]; 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com /* BO's referenced by this state */ 548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com unsigned nbo; 558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com struct si_resource *bo[SI_PM4_MAX_BO]; 568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com enum radeon_bo_usage bo_usage[SI_PM4_MAX_BO]; 578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com /* relocs for shader data */ 598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com unsigned nrelocs; 608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com unsigned relocs[SI_PM4_MAX_RELOCS]; 618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_cmd_begin(struct si_pm4_state *state, unsigned opcode); 648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_cmd_add(struct si_pm4_state *state, uint32_t dw); 658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_cmd_end(struct si_pm4_state *state, bool predicate); 668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_set_reg(struct si_pm4_state *state, unsigned reg, uint32_t val); 688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_add_bo(struct si_pm4_state *state, 698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com struct si_resource *bo, 708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com enum radeon_bo_usage usage); 718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_sh_data_begin(struct si_pm4_state *state); 738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_sh_data_add(struct si_pm4_state *state, uint32_t dw); 748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_sh_data_end(struct si_pm4_state *state, unsigned reg); 758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_inval_shader_cache(struct si_pm4_state *state); 778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_inval_texture_cache(struct si_pm4_state *state); 788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_inval_vertex_cache(struct si_pm4_state *state); 798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_inval_fb_cache(struct si_pm4_state *state, unsigned nr_cbufs); 808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_inval_zsbuf_cache(struct si_pm4_state *state); 818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_free_state(struct r600_context *rctx, 838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com struct si_pm4_state *state, 848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com unsigned idx); 858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comuint32_t si_pm4_sync_flags(struct r600_context *rctx); 878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comunsigned si_pm4_dirty_dw(struct r600_context *rctx); 888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_emit(struct r600_context *rctx, struct si_pm4_state *state); 898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_emit_dirty(struct r600_context *rctx); 908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comvoid si_pm4_reset_emitted(struct r600_context *rctx); 915c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com 925c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com#endif 935c80ea17d4e4a795bfaeb260fc27e952ba471f1dreed@android.com