Path: blob/master/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
26517 views
/*1* Copyright 2022 Advanced Micro Devices, Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR17* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19* OTHER DEALINGS IN THE SOFTWARE.20*21*/22#ifndef __AMDGPU_CS_H__23#define __AMDGPU_CS_H__2425#include <linux/ww_mutex.h>26#include <drm/drm_exec.h>2728#include "amdgpu_job.h"29#include "amdgpu_bo_list.h"30#include "amdgpu_ring.h"3132#define AMDGPU_CS_GANG_SIZE 43334struct amdgpu_bo_va_mapping;3536struct amdgpu_cs_chunk {37uint32_t chunk_id;38uint32_t length_dw;39void *kdata;40};4142struct amdgpu_cs_post_dep {43struct drm_syncobj *syncobj;44struct dma_fence_chain *chain;45u64 point;46};4748struct amdgpu_cs_parser {49struct amdgpu_device *adev;50struct drm_file *filp;51struct amdgpu_ctx *ctx;5253/* chunks */54unsigned nchunks;55struct amdgpu_cs_chunk *chunks;5657/* scheduler job objects */58unsigned int gang_size;59unsigned int gang_leader_idx;60struct drm_sched_entity *entities[AMDGPU_CS_GANG_SIZE];61struct amdgpu_job *jobs[AMDGPU_CS_GANG_SIZE];62struct amdgpu_job *gang_leader;6364/* buffer objects */65struct drm_exec exec;66struct amdgpu_bo_list *bo_list;67struct amdgpu_mn *mn;68struct dma_fence *fence;69uint64_t bytes_moved_threshold;70uint64_t bytes_moved_vis_threshold;71uint64_t bytes_moved;72uint64_t bytes_moved_vis;7374/* user fence */75struct amdgpu_bo *uf_bo;7677unsigned num_post_deps;78struct amdgpu_cs_post_dep *post_deps;7980struct amdgpu_sync sync;81};8283int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,84uint64_t addr, struct amdgpu_bo **bo,85struct amdgpu_bo_va_mapping **mapping);8687#endif888990