[Mesa-dev] [PATCH v2 10/25] radeon/winsys: add sparse buffer interface

Nicolai Hähnle nhaehnle at gmail.com
Tue Mar 28 09:12:00 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
 src/gallium/drivers/radeon/radeon_winsys.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h
index 812c036..924ad9c 100644
--- a/src/gallium/drivers/radeon/radeon_winsys.h
+++ b/src/gallium/drivers/radeon/radeon_winsys.h
@@ -46,33 +46,36 @@ enum radeon_bo_domain { /* bitfield */
     RADEON_DOMAIN_GTT  = 2,
     RADEON_DOMAIN_VRAM = 4,
     RADEON_DOMAIN_VRAM_GTT = RADEON_DOMAIN_VRAM | RADEON_DOMAIN_GTT
 };
 
 enum radeon_bo_flag { /* bitfield */
     RADEON_FLAG_GTT_WC =        (1 << 0),
     RADEON_FLAG_CPU_ACCESS =    (1 << 1),
     RADEON_FLAG_NO_CPU_ACCESS = (1 << 2),
     RADEON_FLAG_HANDLE =        (1 << 3), /* the buffer most not be suballocated */
+    RADEON_FLAG_SPARSE =        (1 << 4),
 };
 
 enum radeon_bo_usage { /* bitfield */
     RADEON_USAGE_READ = 2,
     RADEON_USAGE_WRITE = 4,
     RADEON_USAGE_READWRITE = RADEON_USAGE_READ | RADEON_USAGE_WRITE,
 
     /* The winsys ensures that the CS submission will be scheduled after
      * previously flushed CSs referencing this BO in a conflicting way.
      */
     RADEON_USAGE_SYNCHRONIZED = 8
 };
 
+#define RADEON_SPARSE_PAGE_SIZE (64 * 1024)
+
 enum ring_type {
     RING_GFX = 0,
     RING_COMPUTE,
     RING_DMA,
     RING_UVD,
     RING_VCE,
     RING_LAST,
 };
 
 enum radeon_value_id {
@@ -500,20 +503,34 @@ struct radeon_winsys {
      * \param whandle   A winsys handle pointer.
      * \param stride    A stride of the buffer in bytes, for texturing.
      * \return          true on success.
      */
     bool (*buffer_get_handle)(struct pb_buffer *buf,
                               unsigned stride, unsigned offset,
                               unsigned slice_size,
                               struct winsys_handle *whandle);
 
     /**
+     * Change the commitment of a (64KB-page aligned) region of the given
+     * sparse buffer.
+     *
+     * \warning There is no automatic synchronization with command submission.
+     *
+     * \note Only implemented by the amdgpu winsys.
+     *
+     * \return false on out of memory or other failure, true on success.
+     */
+    bool (*buffer_commit)(struct pb_buffer *buf,
+                          uint64_t offset, uint64_t size,
+                          bool commit);
+
+    /**
      * Return the virtual address of a buffer.
      *
      * When virtual memory is not in use, this is the offset relative to the
      * relocation base (non-zero for sub-allocated buffers).
      *
      * \param buf       A winsys buffer object
      * \return          virtual address
      */
     uint64_t (*buffer_get_virtual_address)(struct pb_buffer *buf);
 
-- 
2.9.3



More information about the mesa-dev mailing list