1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 3bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 4bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 5bf215546Sopenharmony_ci * on the rights to use, copy, modify, merge, publish, distribute, sub 6bf215546Sopenharmony_ci * license, and/or sell copies of the Software, and to permit persons to whom 7bf215546Sopenharmony_ci * the Software is furnished to do so, subject to the following conditions: 8bf215546Sopenharmony_ci * 9bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 10bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 11bf215546Sopenharmony_ci * Software. 12bf215546Sopenharmony_ci * 13bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 16bf215546Sopenharmony_ci * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 17bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 18bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 19bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE. 20bf215546Sopenharmony_ci * 21bf215546Sopenharmony_ci * Authors: 22bf215546Sopenharmony_ci * Adam Rak <adam.rak@streamnovation.com> 23bf215546Sopenharmony_ci */ 24bf215546Sopenharmony_ci#ifndef EVERGREEN_COMPUTE_INTERNAL_H 25bf215546Sopenharmony_ci#define EVERGREEN_COMPUTE_INTERNAL_H 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ci#include "ac_binary.h" 28bf215546Sopenharmony_ci#include "r600_asm.h" 29bf215546Sopenharmony_ci#ifdef HAVE_OPENCL 30bf215546Sopenharmony_ci#include <llvm-c/Core.h> 31bf215546Sopenharmony_ci#endif 32bf215546Sopenharmony_ci 33bf215546Sopenharmony_cistruct r600_shader_reloc { 34bf215546Sopenharmony_ci char name[32]; 35bf215546Sopenharmony_ci uint64_t offset; 36bf215546Sopenharmony_ci}; 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_cistruct r600_shader_binary { 39bf215546Sopenharmony_ci unsigned code_size; 40bf215546Sopenharmony_ci unsigned config_size; 41bf215546Sopenharmony_ci /** The number of bytes of config information for each global symbol. 42bf215546Sopenharmony_ci */ 43bf215546Sopenharmony_ci unsigned config_size_per_symbol; 44bf215546Sopenharmony_ci unsigned rodata_size; 45bf215546Sopenharmony_ci unsigned global_symbol_count; 46bf215546Sopenharmony_ci unsigned reloc_count; 47bf215546Sopenharmony_ci 48bf215546Sopenharmony_ci /** Shader code */ 49bf215546Sopenharmony_ci unsigned char *code; 50bf215546Sopenharmony_ci 51bf215546Sopenharmony_ci /** Config/Context register state that accompanies this shader. 52bf215546Sopenharmony_ci * This is a stream of dword pairs. First dword contains the 53bf215546Sopenharmony_ci * register address, the second dword contains the value.*/ 54bf215546Sopenharmony_ci unsigned char *config; 55bf215546Sopenharmony_ci 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_ci /** Constant data accessed by the shader. This will be uploaded 58bf215546Sopenharmony_ci * into a constant buffer. */ 59bf215546Sopenharmony_ci unsigned char *rodata; 60bf215546Sopenharmony_ci 61bf215546Sopenharmony_ci /** List of symbol offsets for the shader */ 62bf215546Sopenharmony_ci uint64_t *global_symbol_offsets; 63bf215546Sopenharmony_ci 64bf215546Sopenharmony_ci struct r600_shader_reloc *relocs; 65bf215546Sopenharmony_ci 66bf215546Sopenharmony_ci /** Disassembled shader in a string. */ 67bf215546Sopenharmony_ci char *disasm_string; 68bf215546Sopenharmony_ci}; 69bf215546Sopenharmony_ci 70bf215546Sopenharmony_cistruct r600_pipe_compute { 71bf215546Sopenharmony_ci struct r600_context *ctx; 72bf215546Sopenharmony_ci 73bf215546Sopenharmony_ci struct r600_shader_binary binary; 74bf215546Sopenharmony_ci 75bf215546Sopenharmony_ci enum pipe_shader_ir ir_type; 76bf215546Sopenharmony_ci 77bf215546Sopenharmony_ci /* tgsi selector */ 78bf215546Sopenharmony_ci struct r600_pipe_shader_selector *sel; 79bf215546Sopenharmony_ci 80bf215546Sopenharmony_ci struct r600_resource *code_bo; 81bf215546Sopenharmony_ci struct r600_bytecode bc; 82bf215546Sopenharmony_ci 83bf215546Sopenharmony_ci unsigned local_size; 84bf215546Sopenharmony_ci unsigned private_size; 85bf215546Sopenharmony_ci unsigned input_size; 86bf215546Sopenharmony_ci struct r600_resource *kernel_param; 87bf215546Sopenharmony_ci 88bf215546Sopenharmony_ci#ifdef HAVE_OPENCL 89bf215546Sopenharmony_ci LLVMContextRef llvm_ctx; 90bf215546Sopenharmony_ci#endif 91bf215546Sopenharmony_ci}; 92bf215546Sopenharmony_ci 93bf215546Sopenharmony_cistruct r600_resource* r600_compute_buffer_alloc_vram(struct r600_screen *screen, unsigned size); 94bf215546Sopenharmony_ci 95bf215546Sopenharmony_ci#endif 96