1bf215546Sopenharmony_ci/**********************************************************
2bf215546Sopenharmony_ci * Copyright 2008-2009 VMware, Inc.  All rights reserved.
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person
5bf215546Sopenharmony_ci * obtaining a copy of this software and associated documentation
6bf215546Sopenharmony_ci * files (the "Software"), to deal in the Software without
7bf215546Sopenharmony_ci * restriction, including without limitation the rights to use, copy,
8bf215546Sopenharmony_ci * modify, merge, publish, distribute, sublicense, and/or sell copies
9bf215546Sopenharmony_ci * of the Software, and to permit persons to whom the Software is
10bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions:
11bf215546Sopenharmony_ci *
12bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be
13bf215546Sopenharmony_ci * included in all copies or substantial portions of the Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16bf215546Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18bf215546Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19bf215546Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20bf215546Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21bf215546Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22bf215546Sopenharmony_ci * SOFTWARE.
23bf215546Sopenharmony_ci *
24bf215546Sopenharmony_ci **********************************************************/
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_ci#ifndef SVGA_BUFFER_H
27bf215546Sopenharmony_ci#define SVGA_BUFFER_H
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ci
30bf215546Sopenharmony_ci#include "pipe/p_compiler.h"
31bf215546Sopenharmony_ci#include "pipe/p_state.h"
32bf215546Sopenharmony_ci#include "util/u_transfer.h"
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci#include "svga_screen_cache.h"
35bf215546Sopenharmony_ci#include "svga_screen.h"
36bf215546Sopenharmony_ci#include "svga_cmd.h"
37bf215546Sopenharmony_ci#include "svga_context.h"
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ci
40bf215546Sopenharmony_ci/**
41bf215546Sopenharmony_ci * Maximum number of discontiguous ranges
42bf215546Sopenharmony_ci */
43bf215546Sopenharmony_ci#define SVGA_BUFFER_MAX_RANGES 32
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_ci
46bf215546Sopenharmony_cistruct svga_context;
47bf215546Sopenharmony_cistruct svga_winsys_buffer;
48bf215546Sopenharmony_cistruct svga_winsys_surface;
49bf215546Sopenharmony_ci
50bf215546Sopenharmony_cistruct svga_buffer_range
51bf215546Sopenharmony_ci{
52bf215546Sopenharmony_ci   unsigned start;
53bf215546Sopenharmony_ci   unsigned end;
54bf215546Sopenharmony_ci};
55bf215546Sopenharmony_ci
56bf215546Sopenharmony_cistruct svga_3d_update_gb_image;
57bf215546Sopenharmony_ci
58bf215546Sopenharmony_ci/**
59bf215546Sopenharmony_ci * This structure describes the bind flags and cache key associated
60bf215546Sopenharmony_ci * with the host surface.
61bf215546Sopenharmony_ci */
62bf215546Sopenharmony_cistruct svga_buffer_surface
63bf215546Sopenharmony_ci{
64bf215546Sopenharmony_ci   struct list_head list;
65bf215546Sopenharmony_ci   unsigned bind_flags;
66bf215546Sopenharmony_ci   struct svga_host_surface_cache_key key;
67bf215546Sopenharmony_ci   struct svga_winsys_surface *handle;
68bf215546Sopenharmony_ci   enum svga_surface_state surface_state;
69bf215546Sopenharmony_ci};
70bf215546Sopenharmony_ci
71bf215546Sopenharmony_ci/**
72bf215546Sopenharmony_ci * SVGA pipe buffer.
73bf215546Sopenharmony_ci */
74bf215546Sopenharmony_cistruct svga_buffer
75bf215546Sopenharmony_ci{
76bf215546Sopenharmony_ci   struct pipe_resource b;
77bf215546Sopenharmony_ci
78bf215546Sopenharmony_ci   /** This is a superset of b.b.bind */
79bf215546Sopenharmony_ci   unsigned bind_flags;
80bf215546Sopenharmony_ci
81bf215546Sopenharmony_ci   /**
82bf215546Sopenharmony_ci    * Regular (non DMA'able) memory.
83bf215546Sopenharmony_ci    *
84bf215546Sopenharmony_ci    * Used for user buffers or for buffers which we know before hand that can
85bf215546Sopenharmony_ci    * never be used by the virtual hardware directly, such as constant buffers.
86bf215546Sopenharmony_ci    */
87bf215546Sopenharmony_ci   void *swbuf;
88bf215546Sopenharmony_ci
89bf215546Sopenharmony_ci   /**
90bf215546Sopenharmony_ci    * Whether swbuf was created by the user or not.
91bf215546Sopenharmony_ci    */
92bf215546Sopenharmony_ci   boolean user;
93bf215546Sopenharmony_ci
94bf215546Sopenharmony_ci   /**
95bf215546Sopenharmony_ci    * Whether swbuf is used for this buffer.
96bf215546Sopenharmony_ci    */
97bf215546Sopenharmony_ci   boolean use_swbuf;
98bf215546Sopenharmony_ci
99bf215546Sopenharmony_ci   /**
100bf215546Sopenharmony_ci    * Creation key for the host surface handle.
101bf215546Sopenharmony_ci    *
102bf215546Sopenharmony_ci    * This structure describes all the host surface characteristics so that it
103bf215546Sopenharmony_ci    * can be looked up in cache, since creating a host surface is often a slow
104bf215546Sopenharmony_ci    * operation.
105bf215546Sopenharmony_ci    */
106bf215546Sopenharmony_ci   struct svga_host_surface_cache_key key;
107bf215546Sopenharmony_ci
108bf215546Sopenharmony_ci   /**
109bf215546Sopenharmony_ci    * Host surface handle.
110bf215546Sopenharmony_ci    *
111bf215546Sopenharmony_ci    * This is a platform independent abstraction for host SID. We create when
112bf215546Sopenharmony_ci    * trying to bind.
113bf215546Sopenharmony_ci    *
114bf215546Sopenharmony_ci    * Only set for non-user buffers.
115bf215546Sopenharmony_ci    */
116bf215546Sopenharmony_ci   struct svga_winsys_surface *handle;
117bf215546Sopenharmony_ci
118bf215546Sopenharmony_ci   /**
119bf215546Sopenharmony_ci    * List of surfaces created for this buffer resource to support
120bf215546Sopenharmony_ci    * incompatible bind flags.
121bf215546Sopenharmony_ci    */
122bf215546Sopenharmony_ci   struct list_head surfaces;
123bf215546Sopenharmony_ci
124bf215546Sopenharmony_ci   /* Current surface structure */
125bf215546Sopenharmony_ci   struct svga_buffer_surface *bufsurf;
126bf215546Sopenharmony_ci
127bf215546Sopenharmony_ci   /**
128bf215546Sopenharmony_ci    * Information about ongoing and past map operations.
129bf215546Sopenharmony_ci    */
130bf215546Sopenharmony_ci   struct {
131bf215546Sopenharmony_ci      /**
132bf215546Sopenharmony_ci       * Number of concurrent mappings.
133bf215546Sopenharmony_ci       */
134bf215546Sopenharmony_ci      unsigned count;
135bf215546Sopenharmony_ci
136bf215546Sopenharmony_ci      /**
137bf215546Sopenharmony_ci       * Dirty ranges.
138bf215546Sopenharmony_ci       *
139bf215546Sopenharmony_ci       * Ranges that were touched by the application and need to be uploaded to
140bf215546Sopenharmony_ci       * the host.
141bf215546Sopenharmony_ci       *
142bf215546Sopenharmony_ci       * This information will be copied into dma.boxes, when emiting the
143bf215546Sopenharmony_ci       * SVGA3dCmdSurfaceDMA command.
144bf215546Sopenharmony_ci       */
145bf215546Sopenharmony_ci      struct svga_buffer_range ranges[SVGA_BUFFER_MAX_RANGES];
146bf215546Sopenharmony_ci      unsigned num_ranges;
147bf215546Sopenharmony_ci   } map;
148bf215546Sopenharmony_ci
149bf215546Sopenharmony_ci   /**
150bf215546Sopenharmony_ci    * Information about uploaded version of user buffers.
151bf215546Sopenharmony_ci    */
152bf215546Sopenharmony_ci   struct {
153bf215546Sopenharmony_ci      struct pipe_resource *buffer;
154bf215546Sopenharmony_ci
155bf215546Sopenharmony_ci      /**
156bf215546Sopenharmony_ci       * We combine multiple user buffers into the same hardware buffer. This
157bf215546Sopenharmony_ci       * is the relative offset within that buffer.
158bf215546Sopenharmony_ci       */
159bf215546Sopenharmony_ci      unsigned offset;
160bf215546Sopenharmony_ci
161bf215546Sopenharmony_ci      /**
162bf215546Sopenharmony_ci       * Range of user buffer that is uploaded in @buffer at @offset.
163bf215546Sopenharmony_ci       */
164bf215546Sopenharmony_ci      unsigned start;
165bf215546Sopenharmony_ci      unsigned end;
166bf215546Sopenharmony_ci   } uploaded;
167bf215546Sopenharmony_ci
168bf215546Sopenharmony_ci   /**
169bf215546Sopenharmony_ci    * DMA'ble memory.
170bf215546Sopenharmony_ci    *
171bf215546Sopenharmony_ci    * A piece of GMR memory, with the same size of the buffer. It is created
172bf215546Sopenharmony_ci    * when mapping the buffer, and will be used to upload vertex data to the
173bf215546Sopenharmony_ci    * host.
174bf215546Sopenharmony_ci    *
175bf215546Sopenharmony_ci    * Only set for non-user buffers.
176bf215546Sopenharmony_ci    */
177bf215546Sopenharmony_ci   struct svga_winsys_buffer *hwbuf;
178bf215546Sopenharmony_ci
179bf215546Sopenharmony_ci   /**
180bf215546Sopenharmony_ci    * Information about pending DMA uploads.
181bf215546Sopenharmony_ci    *
182bf215546Sopenharmony_ci    */
183bf215546Sopenharmony_ci   struct {
184bf215546Sopenharmony_ci      /**
185bf215546Sopenharmony_ci       * Whether this buffer has an unfinished DMA upload command.
186bf215546Sopenharmony_ci       *
187bf215546Sopenharmony_ci       * If not set then the rest of the information is null.
188bf215546Sopenharmony_ci       */
189bf215546Sopenharmony_ci      boolean pending;
190bf215546Sopenharmony_ci
191bf215546Sopenharmony_ci      SVGA3dSurfaceDMAFlags flags;
192bf215546Sopenharmony_ci
193bf215546Sopenharmony_ci      /**
194bf215546Sopenharmony_ci       * Pointer to the DMA copy box *inside* the command buffer.
195bf215546Sopenharmony_ci       */
196bf215546Sopenharmony_ci      SVGA3dCopyBox *boxes;
197bf215546Sopenharmony_ci
198bf215546Sopenharmony_ci      /**
199bf215546Sopenharmony_ci       * Pointer to the sequence of update commands
200bf215546Sopenharmony_ci       * *inside* the command buffer.
201bf215546Sopenharmony_ci       */
202bf215546Sopenharmony_ci      struct svga_3d_update_gb_image *updates;
203bf215546Sopenharmony_ci
204bf215546Sopenharmony_ci      /**
205bf215546Sopenharmony_ci       * Context that has the pending DMA to this buffer.
206bf215546Sopenharmony_ci       */
207bf215546Sopenharmony_ci      struct svga_context *svga;
208bf215546Sopenharmony_ci   } dma;
209bf215546Sopenharmony_ci
210bf215546Sopenharmony_ci   /**
211bf215546Sopenharmony_ci    * Linked list head, used to gather all buffers with pending dma uploads on
212bf215546Sopenharmony_ci    * a context. It is only valid if the dma.pending is set above.
213bf215546Sopenharmony_ci    */
214bf215546Sopenharmony_ci   struct list_head head;
215bf215546Sopenharmony_ci
216bf215546Sopenharmony_ci   unsigned size;  /**< Approximate size in bytes */
217bf215546Sopenharmony_ci
218bf215546Sopenharmony_ci   boolean dirty;  /**< Need to do a readback before mapping? */
219bf215546Sopenharmony_ci   boolean uav;    /* Set if the buffer is bound to a uav */
220bf215546Sopenharmony_ci
221bf215546Sopenharmony_ci   /** In some cases we try to keep the results of the translate_indices()
222bf215546Sopenharmony_ci    * function from svga_draw_elements.c
223bf215546Sopenharmony_ci    */
224bf215546Sopenharmony_ci   struct {
225bf215546Sopenharmony_ci      enum pipe_prim_type orig_prim, new_prim;
226bf215546Sopenharmony_ci      struct pipe_resource *buffer;
227bf215546Sopenharmony_ci      unsigned index_size;
228bf215546Sopenharmony_ci      unsigned offset;  /**< first index */
229bf215546Sopenharmony_ci      unsigned count;   /**< num indices */
230bf215546Sopenharmony_ci   } translated_indices;
231bf215546Sopenharmony_ci};
232bf215546Sopenharmony_ci
233bf215546Sopenharmony_ci
234bf215546Sopenharmony_cistatic inline struct svga_buffer *
235bf215546Sopenharmony_cisvga_buffer(struct pipe_resource *resource)
236bf215546Sopenharmony_ci{
237bf215546Sopenharmony_ci   struct svga_buffer *buf = (struct svga_buffer *) resource;
238bf215546Sopenharmony_ci   assert(buf == NULL || buf->b.target == PIPE_BUFFER);
239bf215546Sopenharmony_ci   return buf;
240bf215546Sopenharmony_ci}
241bf215546Sopenharmony_ci
242bf215546Sopenharmony_ci
243bf215546Sopenharmony_ci/**
244bf215546Sopenharmony_ci * Returns TRUE for user buffers.  We may
245bf215546Sopenharmony_ci * decide to use an alternate upload path for these buffers.
246bf215546Sopenharmony_ci */
247bf215546Sopenharmony_cistatic inline boolean
248bf215546Sopenharmony_cisvga_buffer_is_user_buffer(struct pipe_resource *buffer)
249bf215546Sopenharmony_ci{
250bf215546Sopenharmony_ci   if (buffer) {
251bf215546Sopenharmony_ci      return svga_buffer(buffer)->user;
252bf215546Sopenharmony_ci   } else {
253bf215546Sopenharmony_ci      return FALSE;
254bf215546Sopenharmony_ci   }
255bf215546Sopenharmony_ci}
256bf215546Sopenharmony_ci
257bf215546Sopenharmony_ci/**
258bf215546Sopenharmony_ci * Returns a pointer to a struct svga_winsys_screen given a
259bf215546Sopenharmony_ci * struct svga_buffer.
260bf215546Sopenharmony_ci */
261bf215546Sopenharmony_cistatic inline struct svga_winsys_screen *
262bf215546Sopenharmony_cisvga_buffer_winsys_screen(struct svga_buffer *sbuf)
263bf215546Sopenharmony_ci{
264bf215546Sopenharmony_ci   return svga_screen(sbuf->b.screen)->sws;
265bf215546Sopenharmony_ci}
266bf215546Sopenharmony_ci
267bf215546Sopenharmony_ci
268bf215546Sopenharmony_ci/**
269bf215546Sopenharmony_ci * Returns whether a buffer has hardware storage that is
270bf215546Sopenharmony_ci * visible to the GPU.
271bf215546Sopenharmony_ci */
272bf215546Sopenharmony_cistatic inline boolean
273bf215546Sopenharmony_cisvga_buffer_has_hw_storage(struct svga_buffer *sbuf)
274bf215546Sopenharmony_ci{
275bf215546Sopenharmony_ci   if (svga_buffer_winsys_screen(sbuf)->have_gb_objects)
276bf215546Sopenharmony_ci      return (sbuf->handle ? TRUE : FALSE);
277bf215546Sopenharmony_ci   else
278bf215546Sopenharmony_ci      return (sbuf->hwbuf ? TRUE : FALSE);
279bf215546Sopenharmony_ci}
280bf215546Sopenharmony_ci
281bf215546Sopenharmony_ci/**
282bf215546Sopenharmony_ci * Map the hardware storage of a buffer.
283bf215546Sopenharmony_ci * \param flags  bitmask of PIPE_MAP_* flags
284bf215546Sopenharmony_ci */
285bf215546Sopenharmony_cistatic inline void *
286bf215546Sopenharmony_cisvga_buffer_hw_storage_map(struct svga_context *svga,
287bf215546Sopenharmony_ci                           struct svga_buffer *sbuf,
288bf215546Sopenharmony_ci                           unsigned flags, boolean *retry)
289bf215546Sopenharmony_ci{
290bf215546Sopenharmony_ci   struct svga_winsys_screen *sws = svga_buffer_winsys_screen(sbuf);
291bf215546Sopenharmony_ci
292bf215546Sopenharmony_ci   svga->hud.num_buffers_mapped++;
293bf215546Sopenharmony_ci
294bf215546Sopenharmony_ci   if (sws->have_gb_objects) {
295bf215546Sopenharmony_ci      struct svga_winsys_context *swc = svga->swc;
296bf215546Sopenharmony_ci      boolean rebind;
297bf215546Sopenharmony_ci      void *map;
298bf215546Sopenharmony_ci
299bf215546Sopenharmony_ci      if (swc->force_coherent) {
300bf215546Sopenharmony_ci         flags |= PIPE_MAP_PERSISTENT | PIPE_MAP_COHERENT;
301bf215546Sopenharmony_ci      }
302bf215546Sopenharmony_ci      map = swc->surface_map(swc, sbuf->handle, flags, retry, &rebind);
303bf215546Sopenharmony_ci      if (map && rebind) {
304bf215546Sopenharmony_ci         enum pipe_error ret;
305bf215546Sopenharmony_ci
306bf215546Sopenharmony_ci         ret = SVGA3D_BindGBSurface(swc, sbuf->handle);
307bf215546Sopenharmony_ci         if (ret != PIPE_OK) {
308bf215546Sopenharmony_ci            svga_context_flush(svga, NULL);
309bf215546Sopenharmony_ci            ret = SVGA3D_BindGBSurface(swc, sbuf->handle);
310bf215546Sopenharmony_ci            assert(ret == PIPE_OK);
311bf215546Sopenharmony_ci         }
312bf215546Sopenharmony_ci         svga_context_flush(svga, NULL);
313bf215546Sopenharmony_ci      }
314bf215546Sopenharmony_ci      return map;
315bf215546Sopenharmony_ci   } else {
316bf215546Sopenharmony_ci      *retry = FALSE;
317bf215546Sopenharmony_ci      return sws->buffer_map(sws, sbuf->hwbuf, flags);
318bf215546Sopenharmony_ci   }
319bf215546Sopenharmony_ci}
320bf215546Sopenharmony_ci
321bf215546Sopenharmony_ci/**
322bf215546Sopenharmony_ci * Unmap the hardware storage of a buffer.
323bf215546Sopenharmony_ci */
324bf215546Sopenharmony_cistatic inline void
325bf215546Sopenharmony_cisvga_buffer_hw_storage_unmap(struct svga_context *svga,
326bf215546Sopenharmony_ci                             struct svga_buffer *sbuf)
327bf215546Sopenharmony_ci{
328bf215546Sopenharmony_ci   struct svga_winsys_screen *sws = svga_buffer_winsys_screen(sbuf);
329bf215546Sopenharmony_ci
330bf215546Sopenharmony_ci   if (sws->have_gb_objects) {
331bf215546Sopenharmony_ci      struct svga_winsys_context *swc = svga->swc;
332bf215546Sopenharmony_ci      boolean rebind;
333bf215546Sopenharmony_ci
334bf215546Sopenharmony_ci      swc->surface_unmap(swc, sbuf->handle, &rebind);
335bf215546Sopenharmony_ci      if (rebind) {
336bf215546Sopenharmony_ci         SVGA_RETRY(svga, SVGA3D_BindGBSurface(swc, sbuf->handle));
337bf215546Sopenharmony_ci      }
338bf215546Sopenharmony_ci   } else
339bf215546Sopenharmony_ci      sws->buffer_unmap(sws, sbuf->hwbuf);
340bf215546Sopenharmony_ci
341bf215546Sopenharmony_ci   /* Mark the buffer surface as UPDATED */
342bf215546Sopenharmony_ci   assert(sbuf->bufsurf);
343bf215546Sopenharmony_ci   sbuf->bufsurf->surface_state = SVGA_SURFACE_STATE_UPDATED;
344bf215546Sopenharmony_ci}
345bf215546Sopenharmony_ci
346bf215546Sopenharmony_ci
347bf215546Sopenharmony_cistatic inline void
348bf215546Sopenharmony_cisvga_set_buffer_rendered_to(struct svga_buffer_surface *bufsurf)
349bf215546Sopenharmony_ci{
350bf215546Sopenharmony_ci   bufsurf->surface_state = SVGA_SURFACE_STATE_RENDERED;
351bf215546Sopenharmony_ci}
352bf215546Sopenharmony_ci
353bf215546Sopenharmony_ci
354bf215546Sopenharmony_cistatic inline boolean
355bf215546Sopenharmony_cisvga_was_buffer_rendered_to(const struct svga_buffer_surface *bufsurf)
356bf215546Sopenharmony_ci{
357bf215546Sopenharmony_ci   return (bufsurf->surface_state == SVGA_SURFACE_STATE_RENDERED);
358bf215546Sopenharmony_ci}
359bf215546Sopenharmony_ci
360bf215546Sopenharmony_ci
361bf215546Sopenharmony_cistruct pipe_resource *
362bf215546Sopenharmony_cisvga_user_buffer_create(struct pipe_screen *screen,
363bf215546Sopenharmony_ci                        void *ptr,
364bf215546Sopenharmony_ci                        unsigned bytes,
365bf215546Sopenharmony_ci                        unsigned usage);
366bf215546Sopenharmony_ci
367bf215546Sopenharmony_cistruct pipe_resource *
368bf215546Sopenharmony_cisvga_buffer_create(struct pipe_screen *screen,
369bf215546Sopenharmony_ci                   const struct pipe_resource *template);
370bf215546Sopenharmony_ci
371bf215546Sopenharmony_ci
372bf215546Sopenharmony_ci
373bf215546Sopenharmony_ci/**
374bf215546Sopenharmony_ci * Get the host surface handle for this buffer.
375bf215546Sopenharmony_ci *
376bf215546Sopenharmony_ci * This will ensure the host surface is updated, issuing DMAs as needed.
377bf215546Sopenharmony_ci *
378bf215546Sopenharmony_ci * NOTE: This may insert new commands in the context, so it *must* be called
379bf215546Sopenharmony_ci * before reserving command buffer space. And, in order to insert commands
380bf215546Sopenharmony_ci * it may need to call svga_context_flush().
381bf215546Sopenharmony_ci */
382bf215546Sopenharmony_cistruct svga_winsys_surface *
383bf215546Sopenharmony_cisvga_buffer_handle(struct svga_context *svga,
384bf215546Sopenharmony_ci                   struct pipe_resource *buf,
385bf215546Sopenharmony_ci                   unsigned tobind_flags);
386bf215546Sopenharmony_ci
387bf215546Sopenharmony_civoid
388bf215546Sopenharmony_cisvga_context_flush_buffers(struct svga_context *svga);
389bf215546Sopenharmony_ci
390bf215546Sopenharmony_cistruct svga_winsys_buffer *
391bf215546Sopenharmony_cisvga_winsys_buffer_create(struct svga_context *svga,
392bf215546Sopenharmony_ci                          unsigned alignment,
393bf215546Sopenharmony_ci                          unsigned usage,
394bf215546Sopenharmony_ci                          unsigned size);
395bf215546Sopenharmony_ci
396bf215546Sopenharmony_civoid
397bf215546Sopenharmony_cisvga_buffer_transfer_flush_region(struct pipe_context *pipe,
398bf215546Sopenharmony_ci                                  struct pipe_transfer *transfer,
399bf215546Sopenharmony_ci                                  const struct pipe_box *box);
400bf215546Sopenharmony_ci
401bf215546Sopenharmony_civoid
402bf215546Sopenharmony_cisvga_resource_destroy(struct pipe_screen *screen,
403bf215546Sopenharmony_ci                      struct pipe_resource *buf);
404bf215546Sopenharmony_ci
405bf215546Sopenharmony_civoid *
406bf215546Sopenharmony_cisvga_buffer_transfer_map(struct pipe_context *pipe,
407bf215546Sopenharmony_ci                         struct pipe_resource *resource,
408bf215546Sopenharmony_ci                         unsigned level,
409bf215546Sopenharmony_ci                         unsigned usage,
410bf215546Sopenharmony_ci                         const struct pipe_box *box,
411bf215546Sopenharmony_ci                         struct pipe_transfer **ptransfer);
412bf215546Sopenharmony_ci
413bf215546Sopenharmony_civoid
414bf215546Sopenharmony_cisvga_buffer_transfer_unmap(struct pipe_context *pipe,
415bf215546Sopenharmony_ci                           struct pipe_transfer *transfer);
416bf215546Sopenharmony_ci
417bf215546Sopenharmony_ci#endif /* SVGA_BUFFER_H */
418