1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright © 2016 Red Hat.
3bf215546Sopenharmony_ci * Copyright © 2016 Bas Nieuwenhuizen
4bf215546Sopenharmony_ci *
5bf215546Sopenharmony_ci * Based on radeon_winsys.h which is:
6bf215546Sopenharmony_ci * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
7bf215546Sopenharmony_ci * Copyright 2010 Marek Olšák <maraeo@gmail.com>
8bf215546Sopenharmony_ci *
9bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
10bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
11bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
12bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
14bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
15bf215546Sopenharmony_ci *
16bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
17bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
18bf215546Sopenharmony_ci * Software.
19bf215546Sopenharmony_ci *
20bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
23bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26bf215546Sopenharmony_ci * IN THE SOFTWARE.
27bf215546Sopenharmony_ci */
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ci#ifndef RADV_RADEON_WINSYS_H
30bf215546Sopenharmony_ci#define RADV_RADEON_WINSYS_H
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ci#include <stdbool.h>
33bf215546Sopenharmony_ci#include <stdint.h>
34bf215546Sopenharmony_ci#include <stdio.h>
35bf215546Sopenharmony_ci#include <stdlib.h>
36bf215546Sopenharmony_ci#include <string.h>
37bf215546Sopenharmony_ci#include "util/u_math.h"
38bf215546Sopenharmony_ci#include "util/u_memory.h"
39bf215546Sopenharmony_ci#include <vulkan/vulkan.h>
40bf215546Sopenharmony_ci#include "amd_family.h"
41bf215546Sopenharmony_ci
42bf215546Sopenharmony_cistruct radeon_info;
43bf215546Sopenharmony_cistruct ac_surf_info;
44bf215546Sopenharmony_cistruct radeon_surf;
45bf215546Sopenharmony_cistruct vk_sync_type;
46bf215546Sopenharmony_cistruct vk_sync_wait;
47bf215546Sopenharmony_cistruct vk_sync_signal;
48bf215546Sopenharmony_ci
49bf215546Sopenharmony_cienum radeon_bo_domain { /* bitfield */
50bf215546Sopenharmony_ci                        RADEON_DOMAIN_GTT = 2,
51bf215546Sopenharmony_ci                        RADEON_DOMAIN_VRAM = 4,
52bf215546Sopenharmony_ci                        RADEON_DOMAIN_VRAM_GTT = RADEON_DOMAIN_VRAM | RADEON_DOMAIN_GTT,
53bf215546Sopenharmony_ci                        RADEON_DOMAIN_GDS = 8,
54bf215546Sopenharmony_ci                        RADEON_DOMAIN_OA = 16,
55bf215546Sopenharmony_ci};
56bf215546Sopenharmony_ci
57bf215546Sopenharmony_cienum radeon_bo_flag { /* bitfield */
58bf215546Sopenharmony_ci                      RADEON_FLAG_GTT_WC = (1 << 0),
59bf215546Sopenharmony_ci                      RADEON_FLAG_CPU_ACCESS = (1 << 1),
60bf215546Sopenharmony_ci                      RADEON_FLAG_NO_CPU_ACCESS = (1 << 2),
61bf215546Sopenharmony_ci                      RADEON_FLAG_VIRTUAL = (1 << 3),
62bf215546Sopenharmony_ci                      RADEON_FLAG_VA_UNCACHED = (1 << 4),
63bf215546Sopenharmony_ci                      RADEON_FLAG_IMPLICIT_SYNC = (1 << 5),
64bf215546Sopenharmony_ci                      RADEON_FLAG_NO_INTERPROCESS_SHARING = (1 << 6),
65bf215546Sopenharmony_ci                      RADEON_FLAG_READ_ONLY = (1 << 7),
66bf215546Sopenharmony_ci                      RADEON_FLAG_32BIT = (1 << 8),
67bf215546Sopenharmony_ci                      RADEON_FLAG_PREFER_LOCAL_BO = (1 << 9),
68bf215546Sopenharmony_ci                      RADEON_FLAG_ZERO_VRAM = (1 << 10),
69bf215546Sopenharmony_ci                      RADEON_FLAG_REPLAYABLE = (1 << 11),
70bf215546Sopenharmony_ci};
71bf215546Sopenharmony_ci
72bf215546Sopenharmony_cienum radeon_ctx_priority {
73bf215546Sopenharmony_ci   RADEON_CTX_PRIORITY_INVALID = -1,
74bf215546Sopenharmony_ci   RADEON_CTX_PRIORITY_LOW = 0,
75bf215546Sopenharmony_ci   RADEON_CTX_PRIORITY_MEDIUM,
76bf215546Sopenharmony_ci   RADEON_CTX_PRIORITY_HIGH,
77bf215546Sopenharmony_ci   RADEON_CTX_PRIORITY_REALTIME,
78bf215546Sopenharmony_ci};
79bf215546Sopenharmony_ci
80bf215546Sopenharmony_cienum radeon_ctx_pstate {
81bf215546Sopenharmony_ci   RADEON_CTX_PSTATE_NONE = 0,
82bf215546Sopenharmony_ci   RADEON_CTX_PSTATE_STANDARD,
83bf215546Sopenharmony_ci   RADEON_CTX_PSTATE_MIN_SCLK,
84bf215546Sopenharmony_ci   RADEON_CTX_PSTATE_MIN_MCLK,
85bf215546Sopenharmony_ci   RADEON_CTX_PSTATE_PEAK,
86bf215546Sopenharmony_ci};
87bf215546Sopenharmony_ci
88bf215546Sopenharmony_cienum radeon_value_id {
89bf215546Sopenharmony_ci   RADEON_ALLOCATED_VRAM,
90bf215546Sopenharmony_ci   RADEON_ALLOCATED_VRAM_VIS,
91bf215546Sopenharmony_ci   RADEON_ALLOCATED_GTT,
92bf215546Sopenharmony_ci   RADEON_TIMESTAMP,
93bf215546Sopenharmony_ci   RADEON_NUM_BYTES_MOVED,
94bf215546Sopenharmony_ci   RADEON_NUM_EVICTIONS,
95bf215546Sopenharmony_ci   RADEON_NUM_VRAM_CPU_PAGE_FAULTS,
96bf215546Sopenharmony_ci   RADEON_VRAM_USAGE,
97bf215546Sopenharmony_ci   RADEON_VRAM_VIS_USAGE,
98bf215546Sopenharmony_ci   RADEON_GTT_USAGE,
99bf215546Sopenharmony_ci   RADEON_GPU_TEMPERATURE,
100bf215546Sopenharmony_ci   RADEON_CURRENT_SCLK,
101bf215546Sopenharmony_ci   RADEON_CURRENT_MCLK,
102bf215546Sopenharmony_ci};
103bf215546Sopenharmony_ci
104bf215546Sopenharmony_cistruct radeon_cmdbuf {
105bf215546Sopenharmony_ci   unsigned cdw;    /* Number of used dwords. */
106bf215546Sopenharmony_ci   unsigned max_dw; /* Maximum number of dwords. */
107bf215546Sopenharmony_ci   uint32_t *buf;   /* The base pointer of the chunk. */
108bf215546Sopenharmony_ci};
109bf215546Sopenharmony_ci
110bf215546Sopenharmony_ci#define RADEON_SURF_TYPE_MASK     0xFF
111bf215546Sopenharmony_ci#define RADEON_SURF_TYPE_SHIFT    0
112bf215546Sopenharmony_ci#define RADEON_SURF_TYPE_1D       0
113bf215546Sopenharmony_ci#define RADEON_SURF_TYPE_2D       1
114bf215546Sopenharmony_ci#define RADEON_SURF_TYPE_3D       2
115bf215546Sopenharmony_ci#define RADEON_SURF_TYPE_CUBEMAP  3
116bf215546Sopenharmony_ci#define RADEON_SURF_TYPE_1D_ARRAY 4
117bf215546Sopenharmony_ci#define RADEON_SURF_TYPE_2D_ARRAY 5
118bf215546Sopenharmony_ci#define RADEON_SURF_MODE_MASK     0xFF
119bf215546Sopenharmony_ci#define RADEON_SURF_MODE_SHIFT    8
120bf215546Sopenharmony_ci
121bf215546Sopenharmony_ci#define RADEON_SURF_GET(v, field)                                                                  \
122bf215546Sopenharmony_ci   (((v) >> RADEON_SURF_##field##_SHIFT) & RADEON_SURF_##field##_MASK)
123bf215546Sopenharmony_ci#define RADEON_SURF_SET(v, field) (((v)&RADEON_SURF_##field##_MASK) << RADEON_SURF_##field##_SHIFT)
124bf215546Sopenharmony_ci#define RADEON_SURF_CLR(v, field)                                                                  \
125bf215546Sopenharmony_ci   ((v) & ~(RADEON_SURF_##field##_MASK << RADEON_SURF_##field##_SHIFT))
126bf215546Sopenharmony_ci
127bf215546Sopenharmony_cienum radeon_bo_layout {
128bf215546Sopenharmony_ci   RADEON_LAYOUT_LINEAR = 0,
129bf215546Sopenharmony_ci   RADEON_LAYOUT_TILED,
130bf215546Sopenharmony_ci   RADEON_LAYOUT_SQUARETILED,
131bf215546Sopenharmony_ci
132bf215546Sopenharmony_ci   RADEON_LAYOUT_UNKNOWN
133bf215546Sopenharmony_ci};
134bf215546Sopenharmony_ci
135bf215546Sopenharmony_ci/* Tiling info for display code, DRI sharing, and other data. */
136bf215546Sopenharmony_cistruct radeon_bo_metadata {
137bf215546Sopenharmony_ci   /* Tiling flags describing the texture layout for display code
138bf215546Sopenharmony_ci    * and DRI sharing.
139bf215546Sopenharmony_ci    */
140bf215546Sopenharmony_ci   union {
141bf215546Sopenharmony_ci      struct {
142bf215546Sopenharmony_ci         enum radeon_bo_layout microtile;
143bf215546Sopenharmony_ci         enum radeon_bo_layout macrotile;
144bf215546Sopenharmony_ci         unsigned pipe_config;
145bf215546Sopenharmony_ci         unsigned bankw;
146bf215546Sopenharmony_ci         unsigned bankh;
147bf215546Sopenharmony_ci         unsigned tile_split;
148bf215546Sopenharmony_ci         unsigned mtilea;
149bf215546Sopenharmony_ci         unsigned num_banks;
150bf215546Sopenharmony_ci         unsigned stride;
151bf215546Sopenharmony_ci         bool scanout;
152bf215546Sopenharmony_ci      } legacy;
153bf215546Sopenharmony_ci
154bf215546Sopenharmony_ci      struct {
155bf215546Sopenharmony_ci         /* surface flags */
156bf215546Sopenharmony_ci         unsigned swizzle_mode : 5;
157bf215546Sopenharmony_ci         bool scanout;
158bf215546Sopenharmony_ci         uint32_t dcc_offset_256b;
159bf215546Sopenharmony_ci         uint32_t dcc_pitch_max;
160bf215546Sopenharmony_ci         bool dcc_independent_64b_blocks;
161bf215546Sopenharmony_ci         bool dcc_independent_128b_blocks;
162bf215546Sopenharmony_ci         unsigned dcc_max_compressed_block_size;
163bf215546Sopenharmony_ci      } gfx9;
164bf215546Sopenharmony_ci   } u;
165bf215546Sopenharmony_ci
166bf215546Sopenharmony_ci   /* Additional metadata associated with the buffer, in bytes.
167bf215546Sopenharmony_ci    * The maximum size is 64 * 4. This is opaque for the winsys & kernel.
168bf215546Sopenharmony_ci    * Supported by amdgpu only.
169bf215546Sopenharmony_ci    */
170bf215546Sopenharmony_ci   uint32_t size_metadata;
171bf215546Sopenharmony_ci   uint32_t metadata[64];
172bf215546Sopenharmony_ci};
173bf215546Sopenharmony_ci
174bf215546Sopenharmony_cistruct radeon_winsys_ctx;
175bf215546Sopenharmony_ci
176bf215546Sopenharmony_cistruct radeon_winsys_bo {
177bf215546Sopenharmony_ci   uint64_t va;
178bf215546Sopenharmony_ci   bool is_local;
179bf215546Sopenharmony_ci   bool vram_no_cpu_access;
180bf215546Sopenharmony_ci   bool use_global_list;
181bf215546Sopenharmony_ci   enum radeon_bo_domain initial_domain;
182bf215546Sopenharmony_ci};
183bf215546Sopenharmony_ci
184bf215546Sopenharmony_cistruct radv_winsys_bo_list {
185bf215546Sopenharmony_ci   struct radeon_winsys_bo **bos;
186bf215546Sopenharmony_ci   unsigned count;
187bf215546Sopenharmony_ci};
188bf215546Sopenharmony_ci
189bf215546Sopenharmony_cistruct radv_winsys_submit_info {
190bf215546Sopenharmony_ci   enum amd_ip_type ip_type;
191bf215546Sopenharmony_ci   int queue_index;
192bf215546Sopenharmony_ci   unsigned cs_count;
193bf215546Sopenharmony_ci   struct radeon_cmdbuf **cs_array;
194bf215546Sopenharmony_ci   struct radeon_cmdbuf *initial_preamble_cs;
195bf215546Sopenharmony_ci   struct radeon_cmdbuf *continue_preamble_cs;
196bf215546Sopenharmony_ci};
197bf215546Sopenharmony_ci
198bf215546Sopenharmony_ci/* Kernel effectively allows 0-31. This sets some priorities for fixed
199bf215546Sopenharmony_ci * functionality buffers */
200bf215546Sopenharmony_cienum {
201bf215546Sopenharmony_ci   RADV_BO_PRIORITY_APPLICATION_MAX = 28,
202bf215546Sopenharmony_ci
203bf215546Sopenharmony_ci   /* virtual buffers have 0 priority since the priority is not used. */
204bf215546Sopenharmony_ci   RADV_BO_PRIORITY_VIRTUAL = 0,
205bf215546Sopenharmony_ci
206bf215546Sopenharmony_ci   RADV_BO_PRIORITY_METADATA = 10,
207bf215546Sopenharmony_ci   /* This should be considerably lower than most of the stuff below,
208bf215546Sopenharmony_ci    * but how much lower is hard to say since we don't know application
209bf215546Sopenharmony_ci    * assignments. Put it pretty high since it is GTT anyway. */
210bf215546Sopenharmony_ci   RADV_BO_PRIORITY_QUERY_POOL = 29,
211bf215546Sopenharmony_ci
212bf215546Sopenharmony_ci   RADV_BO_PRIORITY_DESCRIPTOR = 30,
213bf215546Sopenharmony_ci   RADV_BO_PRIORITY_UPLOAD_BUFFER = 30,
214bf215546Sopenharmony_ci   RADV_BO_PRIORITY_FENCE = 30,
215bf215546Sopenharmony_ci   RADV_BO_PRIORITY_SHADER = 31,
216bf215546Sopenharmony_ci   RADV_BO_PRIORITY_SCRATCH = 31,
217bf215546Sopenharmony_ci   RADV_BO_PRIORITY_CS = 31,
218bf215546Sopenharmony_ci};
219bf215546Sopenharmony_ci
220bf215546Sopenharmony_cistruct radeon_winsys {
221bf215546Sopenharmony_ci   void (*destroy)(struct radeon_winsys *ws);
222bf215546Sopenharmony_ci
223bf215546Sopenharmony_ci   void (*query_info)(struct radeon_winsys *ws, struct radeon_info *info);
224bf215546Sopenharmony_ci
225bf215546Sopenharmony_ci   uint64_t (*query_value)(struct radeon_winsys *ws, enum radeon_value_id value);
226bf215546Sopenharmony_ci
227bf215546Sopenharmony_ci   bool (*read_registers)(struct radeon_winsys *ws, unsigned reg_offset, unsigned num_registers,
228bf215546Sopenharmony_ci                          uint32_t *out);
229bf215546Sopenharmony_ci
230bf215546Sopenharmony_ci   const char *(*get_chip_name)(struct radeon_winsys *ws);
231bf215546Sopenharmony_ci
232bf215546Sopenharmony_ci   VkResult (*buffer_create)(struct radeon_winsys *ws, uint64_t size, unsigned alignment,
233bf215546Sopenharmony_ci                             enum radeon_bo_domain domain, enum radeon_bo_flag flags,
234bf215546Sopenharmony_ci                             unsigned priority, uint64_t address, struct radeon_winsys_bo **out_bo);
235bf215546Sopenharmony_ci
236bf215546Sopenharmony_ci   void (*buffer_destroy)(struct radeon_winsys *ws, struct radeon_winsys_bo *bo);
237bf215546Sopenharmony_ci   void *(*buffer_map)(struct radeon_winsys_bo *bo);
238bf215546Sopenharmony_ci
239bf215546Sopenharmony_ci   VkResult (*buffer_from_ptr)(struct radeon_winsys *ws, void *pointer, uint64_t size,
240bf215546Sopenharmony_ci                               unsigned priority, struct radeon_winsys_bo **out_bo);
241bf215546Sopenharmony_ci
242bf215546Sopenharmony_ci   VkResult (*buffer_from_fd)(struct radeon_winsys *ws, int fd, unsigned priority,
243bf215546Sopenharmony_ci                              struct radeon_winsys_bo **out_bo, uint64_t *alloc_size);
244bf215546Sopenharmony_ci
245bf215546Sopenharmony_ci   bool (*buffer_get_fd)(struct radeon_winsys *ws, struct radeon_winsys_bo *bo, int *fd);
246bf215546Sopenharmony_ci
247bf215546Sopenharmony_ci   bool (*buffer_get_flags_from_fd)(struct radeon_winsys *ws, int fd,
248bf215546Sopenharmony_ci                                    enum radeon_bo_domain *domains, enum radeon_bo_flag *flags);
249bf215546Sopenharmony_ci
250bf215546Sopenharmony_ci   void (*buffer_unmap)(struct radeon_winsys_bo *bo);
251bf215546Sopenharmony_ci
252bf215546Sopenharmony_ci   void (*buffer_set_metadata)(struct radeon_winsys *ws, struct radeon_winsys_bo *bo,
253bf215546Sopenharmony_ci                               struct radeon_bo_metadata *md);
254bf215546Sopenharmony_ci   void (*buffer_get_metadata)(struct radeon_winsys *ws, struct radeon_winsys_bo *bo,
255bf215546Sopenharmony_ci                               struct radeon_bo_metadata *md);
256bf215546Sopenharmony_ci
257bf215546Sopenharmony_ci   VkResult (*buffer_virtual_bind)(struct radeon_winsys *ws, struct radeon_winsys_bo *parent,
258bf215546Sopenharmony_ci                                   uint64_t offset, uint64_t size, struct radeon_winsys_bo *bo,
259bf215546Sopenharmony_ci                                   uint64_t bo_offset);
260bf215546Sopenharmony_ci
261bf215546Sopenharmony_ci   VkResult (*buffer_make_resident)(struct radeon_winsys *ws, struct radeon_winsys_bo *bo,
262bf215546Sopenharmony_ci                                    bool resident);
263bf215546Sopenharmony_ci
264bf215546Sopenharmony_ci   VkResult (*ctx_create)(struct radeon_winsys *ws, enum radeon_ctx_priority priority,
265bf215546Sopenharmony_ci                          struct radeon_winsys_ctx **ctx);
266bf215546Sopenharmony_ci   void (*ctx_destroy)(struct radeon_winsys_ctx *ctx);
267bf215546Sopenharmony_ci
268bf215546Sopenharmony_ci   bool (*ctx_wait_idle)(struct radeon_winsys_ctx *ctx, enum amd_ip_type amd_ip_type, int ring_index);
269bf215546Sopenharmony_ci
270bf215546Sopenharmony_ci   int (*ctx_set_pstate)(struct radeon_winsys_ctx *ctx, uint32_t pstate);
271bf215546Sopenharmony_ci
272bf215546Sopenharmony_ci   enum radeon_bo_domain (*cs_domain)(const struct radeon_winsys *ws);
273bf215546Sopenharmony_ci
274bf215546Sopenharmony_ci   struct radeon_cmdbuf *(*cs_create)(struct radeon_winsys *ws, enum amd_ip_type amd_ip_type);
275bf215546Sopenharmony_ci
276bf215546Sopenharmony_ci   void (*cs_destroy)(struct radeon_cmdbuf *cs);
277bf215546Sopenharmony_ci
278bf215546Sopenharmony_ci   void (*cs_reset)(struct radeon_cmdbuf *cs);
279bf215546Sopenharmony_ci
280bf215546Sopenharmony_ci   VkResult (*cs_finalize)(struct radeon_cmdbuf *cs);
281bf215546Sopenharmony_ci
282bf215546Sopenharmony_ci   void (*cs_grow)(struct radeon_cmdbuf *cs, size_t min_size);
283bf215546Sopenharmony_ci
284bf215546Sopenharmony_ci   VkResult (*cs_submit)(struct radeon_winsys_ctx *ctx, uint32_t submit_count,
285bf215546Sopenharmony_ci                         const struct radv_winsys_submit_info *submits, uint32_t wait_count,
286bf215546Sopenharmony_ci                         const struct vk_sync_wait *waits, uint32_t signal_count,
287bf215546Sopenharmony_ci                         const struct vk_sync_signal *signals, bool can_patch);
288bf215546Sopenharmony_ci
289bf215546Sopenharmony_ci   void (*cs_add_buffer)(struct radeon_cmdbuf *cs, struct radeon_winsys_bo *bo);
290bf215546Sopenharmony_ci
291bf215546Sopenharmony_ci   void (*cs_add_buffers)(struct radeon_cmdbuf *to, struct radeon_cmdbuf *from);
292bf215546Sopenharmony_ci
293bf215546Sopenharmony_ci   void (*cs_execute_secondary)(struct radeon_cmdbuf *parent, struct radeon_cmdbuf *child,
294bf215546Sopenharmony_ci                                bool allow_ib2);
295bf215546Sopenharmony_ci
296bf215546Sopenharmony_ci   void (*cs_dump)(struct radeon_cmdbuf *cs, FILE *file, const int *trace_ids, int trace_id_count);
297bf215546Sopenharmony_ci
298bf215546Sopenharmony_ci   void (*dump_bo_ranges)(struct radeon_winsys *ws, FILE *file);
299bf215546Sopenharmony_ci
300bf215546Sopenharmony_ci   void (*dump_bo_log)(struct radeon_winsys *ws, FILE *file);
301bf215546Sopenharmony_ci
302bf215546Sopenharmony_ci   int (*surface_init)(struct radeon_winsys *ws, const struct ac_surf_info *surf_info,
303bf215546Sopenharmony_ci                       struct radeon_surf *surf);
304bf215546Sopenharmony_ci
305bf215546Sopenharmony_ci   int (*get_fd)(struct radeon_winsys *ws);
306bf215546Sopenharmony_ci
307bf215546Sopenharmony_ci   const struct vk_sync_type *const *(*get_sync_types)(struct radeon_winsys *ws);
308bf215546Sopenharmony_ci};
309bf215546Sopenharmony_ci
310bf215546Sopenharmony_cistatic inline void
311bf215546Sopenharmony_ciradeon_emit(struct radeon_cmdbuf *cs, uint32_t value)
312bf215546Sopenharmony_ci{
313bf215546Sopenharmony_ci   cs->buf[cs->cdw++] = value;
314bf215546Sopenharmony_ci}
315bf215546Sopenharmony_ci
316bf215546Sopenharmony_cistatic inline void
317bf215546Sopenharmony_ciradeon_emit_array(struct radeon_cmdbuf *cs, const uint32_t *values, unsigned count)
318bf215546Sopenharmony_ci{
319bf215546Sopenharmony_ci   memcpy(cs->buf + cs->cdw, values, count * 4);
320bf215546Sopenharmony_ci   cs->cdw += count;
321bf215546Sopenharmony_ci}
322bf215546Sopenharmony_ci
323bf215546Sopenharmony_cistatic inline uint64_t
324bf215546Sopenharmony_ciradv_buffer_get_va(struct radeon_winsys_bo *bo)
325bf215546Sopenharmony_ci{
326bf215546Sopenharmony_ci   return bo->va;
327bf215546Sopenharmony_ci}
328bf215546Sopenharmony_ci
329bf215546Sopenharmony_cistatic inline void
330bf215546Sopenharmony_ciradv_cs_add_buffer(struct radeon_winsys *ws, struct radeon_cmdbuf *cs, struct radeon_winsys_bo *bo)
331bf215546Sopenharmony_ci{
332bf215546Sopenharmony_ci   if (bo->use_global_list)
333bf215546Sopenharmony_ci      return;
334bf215546Sopenharmony_ci
335bf215546Sopenharmony_ci   ws->cs_add_buffer(cs, bo);
336bf215546Sopenharmony_ci}
337bf215546Sopenharmony_ci
338bf215546Sopenharmony_ci#endif /* RADV_RADEON_WINSYS_H */
339