[Mesa-dev] [PATCH 05/21] gallium: add sparse buffer interface and capability

Nicolai Hähnle nhaehnle at gmail.com
Wed Feb 8 12:42:47 UTC 2017


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

TODO fill out caps in all drivers
---
 src/gallium/docs/source/context.rst  |  9 +++++++++
 src/gallium/docs/source/screen.rst   |  3 +++
 src/gallium/include/pipe/p_context.h | 13 +++++++++++++
 src/gallium/include/pipe/p_defines.h |  2 ++
 src/gallium/include/pipe/p_screen.h  |  1 -
 5 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
index d8b2560..b47b75b 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -593,6 +593,15 @@ are set.
 
 
 
+.. _resource_commit:
+
+resource_commit
+%%%%%%%%%%%%%%%
+
+This function changes the commitment of a part of a sparse resource.
+
+
+
 .. _pipe_transfer:
 
 PIPE_TRANSFER
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 4f5b4bb..e8aeb2e 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -376,6 +376,9 @@ The integer capabilities:
 * ``PIPE_CAP_DOUBLES``: Whether double precision floating-point operations
   are supported.
 * ``PIPE_CAP_INT64``: Whether 64-bit integer operations are supported.
+* ``PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE``: The page size of sparse buffers in
+  bytes, or 0 if sparse buffers are not supported. The page size must be at
+  most 64KB.
 
 
 .. _pipe_capf:
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 45098c9..85a80d7 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -574,6 +574,19 @@ struct pipe_context {
    void (*memory_barrier)(struct pipe_context *, unsigned flags);
 
    /**
+    * Change the commitment status of a part of the given resource, which must
+    * have been created with the PIPE_RESOURCE_FLAG_SPARSE bit.
+    *
+    * \param level The texture level whose commitment should be changed.
+    * \param box The region of the resource whose commitment should be changed.
+    * \param commit Whether memory should be committed or un-committed.
+    *
+    * \return false if out of memory, true on success.
+    */
+   bool (*resource_commit)(struct pipe_context *, struct pipe_resource *,
+                           unsigned level, struct pipe_box *box, bool commit);
+
+   /**
     * Creates a video codec for a specific video format/profile
     */
    struct pipe_video_codec *(*create_video_codec)( struct pipe_context *context,
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 9915957..d01deea 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -458,6 +458,7 @@ enum pipe_flush_flags
 #define PIPE_RESOURCE_FLAG_MAP_PERSISTENT (1 << 0)
 #define PIPE_RESOURCE_FLAG_MAP_COHERENT   (1 << 1)
 #define PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY (1 << 2)
+#define PIPE_RESOURCE_FLAG_SPARSE                (1 << 3)
 #define PIPE_RESOURCE_FLAG_DRV_PRIV    (1 << 16) /* driver/winsys private */
 #define PIPE_RESOURCE_FLAG_ST_PRIV     (1 << 24) /* state-tracker/winsys private */
 
@@ -754,6 +755,7 @@ enum pipe_cap
    PIPE_CAP_TGSI_MUL_ZERO_WINS,
    PIPE_CAP_DOUBLES,
    PIPE_CAP_INT64,
+   PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE,
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index b6203f1..ee0b041 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -236,7 +236,6 @@ struct pipe_screen {
    void (*resource_destroy)(struct pipe_screen *,
 			    struct pipe_resource *pt);
 
-
    /**
     * Do any special operations to ensure frontbuffer contents are
     * displayed, eg copy fake frontbuffer.
-- 
2.9.3



More information about the mesa-dev mailing list