File: amd_cs_radv.h

package info (click to toggle)
intel-gpu-tools 2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 62,024 kB
  • sloc: xml: 769,439; ansic: 348,692; python: 8,307; yacc: 2,781; perl: 1,196; sh: 1,178; lex: 487; asm: 227; makefile: 27; lisp: 11
file content (112 lines) | stat: -rw-r--r-- 2,540 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* SPDX-License-Identifier: MIT
 * Copyright 2024 Advanced Micro Devices, Inc.
 */

#ifndef AMD_CS_RADV
#define AMD_CS_RADV

#include "amd_ip_blocks.h"
#define AMDGPU_CS_GANG_SIZE	4

enum amdgpu_ctx_priority_radv {
	AMDGPU_IGT_CTX_PRIORITY_LOW = 0,
	AMDGPU_IGT_CTX_PRIORITY_MEDIUM,
	AMDGPU_IGT_CTX_PRIORITY_HIGH,
	AMDGPU_IGT_CTX_PRIORITY_REALTIME,
};

struct amdgpu_cs_ib_info_radv {
	int64_t flags;
	uint64_t ib_mc_address;
	uint32_t size;
	enum amd_ip_block_type ip_type;
};

enum { MAX_RINGS_PER_TYPE = 8 };

struct amdgpu_fence_radv {
	struct amdgpu_cs_fence fence;
};

struct amdgpu_winsys_bo_radv {
	amdgpu_va_handle va_handle;
	uint64_t vmc_addr;
	uint64_t size;
	bool is_virtual;
	uint8_t priority;

	union {
		/* physical bo */
		struct {
			amdgpu_bo_handle bo;
			uint32_t bo_handle;
		};
		/* virtual bo */
		struct {
			uint32_t range_count;
			uint32_t range_capacity;
			struct amdgpu_winsys_bo_radv **bos;
			uint32_t bo_count;
			uint32_t bo_capacity;
		};
	};
};


struct amdgpu_ctx_radv {
	amdgpu_context_handle ctx;
	struct amdgpu_fence_radv last_submission[AMDGPU_HW_IP_NUM + 1][MAX_RINGS_PER_TYPE];
	struct amdgpu_winsys_bo_radv *fence_bo;

	uint32_t queue_syncobj[AMDGPU_HW_IP_NUM + 1][MAX_RINGS_PER_TYPE];
	bool queue_syncobj_wait[AMDGPU_HW_IP_NUM + 1][MAX_RINGS_PER_TYPE];
};



struct amdgpu_cs_request_radv {
	/** Specify HW IP block type to which to send the IB. */
	uint32_t ip_type;

	/** IP instance index if there are several IPs of the same type. */
	uint32_t ip_instance;

	/**
	 * Specify ring index of the IP. We could have several rings
	 * in the same IP. E.g. 0 for SDMA0 and 1 for SDMA1.
	 */
	uint32_t ring;

	/**
	 * BO list handles used by this request.
	 */
	struct drm_amdgpu_bo_list_entry *handles;
	uint32_t num_handles;

	/** Number of IBs to submit in the field ibs. */
	uint32_t number_of_ibs;

	/**
	 * IBs to submit. Those IBs will be submitted together as single entity
	 */
	struct amdgpu_cs_ib_info_radv ibs[AMDGPU_CS_GANG_SIZE];
	/**
	 * The returned sequence number for the command submission
	 */
	uint64_t seq_no;
};

uint32_t
amdgpu_get_bo_handle(struct amdgpu_bo *bo);

uint32_t
amdgpu_ctx_radv_create(amdgpu_device_handle device,
		enum amdgpu_ctx_priority_radv priority, struct amdgpu_ctx_radv **rctx);
void
amdgpu_ctx_radv_destroy(amdgpu_device_handle device, struct amdgpu_ctx_radv *rwctx);

uint32_t
amdgpu_cs_submit_radv(amdgpu_device_handle device, struct amdgpu_ring_context *ring_context,
		struct amdgpu_cs_request_radv *request,  struct amdgpu_ctx_radv *ctx);

#endif