Re: [Intel-gfx] [PATCH v3 35/37] drm/i915: Introduce GEM_OBJECT_SETPARAM with I915_PARAM_MEMORY_REGION

Niranjan Vishwanathapura
2019-10-01T06:28:32Z

On Fri, Aug 09, 2019 at 11:26:41PM +0100, Matthew Auld wrote:
>From: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
>
>This call will specify which memory region an object should be placed.
>
>Note that changing the object's backing storage should be immediately
>done after an object is created or if it's not yet in use, otherwise
>this will fail on a busy object.
>
>Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
>Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

>diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.h b/drivers/gpu/drm/i915/gem/i915_gem_context.h
>index 106e2ccf7a4c..1cfcf1e6bbb9 100644
>--- a/drivers/gpu/drm/i915/gem/i915_gem_context.h
>+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.h
>@@ -157,6 +157,8 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,
> struct drm_file *file_priv);
> int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data,
> struct drm_file *file_priv);

This function declaration can be removed and can be declared static.

>+int i915_gem_setparam_ioctl(struct drm_device *dev, void *data,
>+ struct drm_file *file);
> int i915_gem_context_reset_stats_ioctl(struct drm_device *dev, void *data,
> struct drm_file *file);
>

>diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
>index fb84aed10825..75d79c17e91b 100644
>--- a/include/uapi/drm/i915_drm.h
>+++ b/include/uapi/drm/i915_drm.h
>@@ -360,6 +360,7 @@ typedef struct _drm_i915_sarea {
> #define DRM_I915_GEM_VM_CREATE 0x3a
> #define DRM_I915_GEM_VM_DESTROY 0x3b
> #define DRM_I915_GEM_MMAP_OFFSET DRM_I915_GEM_MMAP_GTT
>+#define DRM_I915_GEM_OBJECT_SETPARAM DRM_I915_GEM_CONTEXT_SETPARAM
> /* Must be kept compact -- no holes */
>
> #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
>@@ -423,6 +424,7 @@ typedef struct _drm_i915_sarea {
> #define DRM_IOCTL_I915_GEM_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_VM_CREATE, struct drm_i915_gem_vm_control)
> #define DRM_IOCTL_I915_GEM_VM_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_VM_DESTROY, struct drm_i915_gem_vm_control)
> #define DRM_IOCTL_I915_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_OFFSET, struct drm_i915_gem_mmap_offset)
>+#define DRM_IOCTL_I915_GEM_OBJECT_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_OBJECT_SETPARAM, struct drm_i915_gem_object_param)
>
> /* Allow drivers to submit batchbuffers directly to hardware, relying
> * on the security mechanisms provided by hardware.
>@@ -1601,6 +1603,27 @@ struct drm_i915_gem_context_param {
> __u64 value;
> };
>
>+struct drm_i915_gem_object_param {
>+ /** Handle for the object */
>+ __u32 handle;
>+
>+ __u32 size;
>+
>+ /** Set the memory region for the object listed in preference order
>+ * as an array of region ids within data. To force an object
>+ * to a particular memory region, set the region as the sole entry.
>+ *
>+ * Valid region ids are derived from the id field of
>+ * struct drm_i915_memory_region_info.
>+ * See struct drm_i915_query_memory_region_info.
>+ */
>+#define I915_OBJECT_PARAM (1ull<<32)
>+#define I915_PARAM_MEMORY_REGION 0x1
>+ __u64 param;
>+
>+ __u64 data;
>+};
>+

May be another class that probably can use this GET/SETPARAM interface is the address space (vm).
Probably we can allow user to query for PPGTT size of vm object (not just context).
Not related to this patch series, but another type/class definition here (I915_VM_PARAM?).
We probably should define these classes in one place.

Niranjana

> /**
> * Context SSEU programming
> *
>--
>2.20.1
>
>_______________________________________________
>Intel-gfx mailing list
>Intel-gfx@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/intel-gfx