gallium/screen: Add pipe_screen::resource_get_param
authorJordan Justen <jordan.l.justen@intel.com>
Thu, 1 Aug 2019 20:30:21 +0000 (13:30 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Tue, 13 Aug 2019 08:12:24 +0000 (01:12 -0700)
This function retrieves individual parameters selected by enum
pipe_resource_param. It can be used as a more direct alternative to
pipe_screen::resource_get_handle.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_screen.h

index 86cc9d80ac9f3e6ac04da80554b4dae86263e9a0..0c79cac5cff1d59df73182f945be097b66bab9c1 100644 (file)
@@ -1026,6 +1026,21 @@ enum pipe_compute_cap
    PIPE_COMPUTE_CAP_MAX_VARIABLE_THREADS_PER_BLOCK,
 };
 
+/**
+ * Resource parameters. They can be queried using
+ * pipe_screen::get_resource_param.
+ */
+enum pipe_resource_param
+{
+   PIPE_RESOURCE_PARAM_NPLANES,
+   PIPE_RESOURCE_PARAM_STRIDE,
+   PIPE_RESOURCE_PARAM_OFFSET,
+   PIPE_RESOURCE_PARAM_MODIFIER,
+   PIPE_RESOURCE_PARAM_HANDLE_TYPE_SHARED,
+   PIPE_RESOURCE_PARAM_HANDLE_TYPE_KMS,
+   PIPE_RESOURCE_PARAM_HANDLE_TYPE_FD,
+};
+
 /**
  * Types of parameters for pipe_context::set_context_param.
  */
index 9bd24772299391f01891158101ab8ce73d3d37f6..ac2087921d75e57106348b58c89efdb53c7de551 100644 (file)
@@ -262,6 +262,16 @@ struct pipe_screen {
                                struct winsys_handle *handle,
                                unsigned usage);
 
+   /**
+    * Get info for the given pipe resource without the need to get a
+    * winsys_handle.
+    */
+   bool (*resource_get_param)(struct pipe_screen *screen,
+                              struct pipe_resource *resource,
+                              unsigned int plane,
+                              enum pipe_resource_param param,
+                              uint64_t *value);
+
    /**
     * Get stride and offset for the given pipe resource without the need to get
     * a winsys_handle.