All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/doc/rfc: drop the i915_gem_lmem.h header
@ 2021-05-11 17:03 ` Matthew Auld
  0 siblings, 0 replies; 12+ messages in thread
From: Matthew Auld @ 2021-05-11 17:03 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter, dri-devel

The proper headers have now landed in include/uapi/drm/i915_drm.h, so we
can drop i915_gem_lmem.h and instead just reference the real headers for
pulling in the kernel doc.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 Documentation/gpu/rfc/i915_gem_lmem.h   | 237 ------------------------
 Documentation/gpu/rfc/i915_gem_lmem.rst |   6 +-
 2 files changed, 3 insertions(+), 240 deletions(-)
 delete mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h

diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
deleted file mode 100644
index d9c61bea0556..000000000000
--- a/Documentation/gpu/rfc/i915_gem_lmem.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/**
- * enum drm_i915_gem_memory_class - Supported memory classes
- */
-enum drm_i915_gem_memory_class {
-	/** @I915_MEMORY_CLASS_SYSTEM: System memory */
-	I915_MEMORY_CLASS_SYSTEM = 0,
-	/** @I915_MEMORY_CLASS_DEVICE: Device local-memory */
-	I915_MEMORY_CLASS_DEVICE,
-};
-
-/**
- * struct drm_i915_gem_memory_class_instance - Identify particular memory region
- */
-struct drm_i915_gem_memory_class_instance {
-	/** @memory_class: See enum drm_i915_gem_memory_class */
-	__u16 memory_class;
-
-	/** @memory_instance: Which instance */
-	__u16 memory_instance;
-};
-
-/**
- * struct drm_i915_memory_region_info - Describes one region as known to the
- * driver.
- *
- * Note that we reserve some stuff here for potential future work. As an example
- * we might want expose the capabilities for a given region, which could include
- * things like if the region is CPU mappable/accessible, what are the supported
- * mapping types etc.
- *
- * Note that to extend struct drm_i915_memory_region_info and struct
- * drm_i915_query_memory_regions in the future the plan is to do the following:
- *
- * .. code-block:: C
- *
- *	struct drm_i915_memory_region_info {
- *		struct drm_i915_gem_memory_class_instance region;
- *		union {
- *			__u32 rsvd0;
- *			__u32 new_thing1;
- *		};
- *		...
- *		union {
- *			__u64 rsvd1[8];
- *			struct {
- *				__u64 new_thing2;
- *				__u64 new_thing3;
- *				...
- *			};
- *		};
- *	};
- *
- * With this things should remain source compatible between versions for
- * userspace, even as we add new fields.
- *
- * Note this is using both struct drm_i915_query_item and struct drm_i915_query.
- * For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS
- * at &drm_i915_query_item.query_id.
- */
-struct drm_i915_memory_region_info {
-	/** @region: The class:instance pair encoding */
-	struct drm_i915_gem_memory_class_instance region;
-
-	/** @rsvd0: MBZ */
-	__u32 rsvd0;
-
-	/** @probed_size: Memory probed by the driver (-1 = unknown) */
-	__u64 probed_size;
-
-	/** @unallocated_size: Estimate of memory remaining (-1 = unknown) */
-	__u64 unallocated_size;
-
-	/** @rsvd1: MBZ */
-	__u64 rsvd1[8];
-};
-
-/**
- * struct drm_i915_query_memory_regions
- *
- * The region info query enumerates all regions known to the driver by filling
- * in an array of struct drm_i915_memory_region_info structures.
- *
- * Example for getting the list of supported regions:
- *
- * .. code-block:: C
- *
- *	struct drm_i915_query_memory_regions *info;
- *	struct drm_i915_query_item item = {
- *		.query_id = DRM_I915_QUERY_MEMORY_REGIONS;
- *	};
- *	struct drm_i915_query query = {
- *		.num_items = 1,
- *		.items_ptr = (uintptr_t)&item,
- *	};
- *	int err, i;
- *
- *	// First query the size of the blob we need, this needs to be large
- *	// enough to hold our array of regions. The kernel will fill out the
- *	// item.length for us, which is the number of bytes we need.
- *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
- *	if (err) ...
- *
- *	info = calloc(1, item.length);
- *	// Now that we allocated the required number of bytes, we call the ioctl
- *	// again, this time with the data_ptr pointing to our newly allocated
- *	// blob, which the kernel can then populate with the all the region info.
- *	item.data_ptr = (uintptr_t)&info,
- *
- *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
- *	if (err) ...
- *
- *	// We can now access each region in the array
- *	for (i = 0; i < info->num_regions; i++) {
- *		struct drm_i915_memory_region_info mr = info->regions[i];
- *		u16 class = mr.region.class;
- *		u16 instance = mr.region.instance;
- *
- *		....
- *	}
- *
- *	free(info);
- */
-struct drm_i915_query_memory_regions {
-	/** @num_regions: Number of supported regions */
-	__u32 num_regions;
-
-	/** @rsvd: MBZ */
-	__u32 rsvd[3];
-
-	/** @regions: Info about each supported region */
-	struct drm_i915_memory_region_info regions[];
-};
-
-#define DRM_I915_GEM_CREATE_EXT		0xdeadbeaf
-#define DRM_IOCTL_I915_GEM_CREATE_EXT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext)
-
-/**
- * struct drm_i915_gem_create_ext - Existing gem_create behaviour, with added
- * extension support using struct i915_user_extension.
- *
- * Note that in the future we want to have our buffer flags here, at least for
- * the stuff that is immutable. Previously we would have two ioctls, one to
- * create the object with gem_create, and another to apply various parameters,
- * however this creates some ambiguity for the params which are considered
- * immutable. Also in general we're phasing out the various SET/GET ioctls.
- */
-struct drm_i915_gem_create_ext {
-	/**
-	 * @size: Requested size for the object.
-	 *
-	 * The (page-aligned) allocated size for the object will be returned.
-	 *
-	 * Note that for some devices we have might have further minimum
-	 * page-size restrictions(larger than 4K), like for device local-memory.
-	 * However in general the final size here should always reflect any
-	 * rounding up, if for example using the I915_GEM_CREATE_EXT_MEMORY_REGIONS
-	 * extension to place the object in device local-memory.
-	 */
-	__u64 size;
-	/**
-	 * @handle: Returned handle for the object.
-	 *
-	 * Object handles are nonzero.
-	 */
-	__u32 handle;
-	/** @flags: MBZ */
-	__u32 flags;
-	/**
-	 * @extensions: The chain of extensions to apply to this object.
-	 *
-	 * This will be useful in the future when we need to support several
-	 * different extensions, and we need to apply more than one when
-	 * creating the object. See struct i915_user_extension.
-	 *
-	 * If we don't supply any extensions then we get the same old gem_create
-	 * behaviour.
-	 *
-	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
-	 * struct drm_i915_gem_create_ext_memory_regions.
-	 */
-#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
-	__u64 extensions;
-};
-
-/**
- * struct drm_i915_gem_create_ext_memory_regions - The
- * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
- *
- * Set the object with the desired set of placements/regions in priority
- * order. Each entry must be unique and supported by the device.
- *
- * This is provided as an array of struct drm_i915_gem_memory_class_instance, or
- * an equivalent layout of class:instance pair encodings. See struct
- * drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to
- * query the supported regions for a device.
- *
- * As an example, on discrete devices, if we wish to set the placement as
- * device local-memory we can do something like:
- *
- * .. code-block:: C
- *
- *	struct drm_i915_gem_memory_class_instance region_lmem = {
- *              .memory_class = I915_MEMORY_CLASS_DEVICE,
- *              .memory_instance = 0,
- *      };
- *      struct drm_i915_gem_create_ext_memory_regions regions = {
- *              .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS },
- *              .regions = (uintptr_t)&region_lmem,
- *              .num_regions = 1,
- *      };
- *      struct drm_i915_gem_create_ext create_ext = {
- *              .size = 16 * PAGE_SIZE,
- *              .extensions = (uintptr_t)&regions,
- *      };
- *
- *      int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
- *      if (err) ...
- *
- * At which point we get the object handle in &drm_i915_gem_create_ext.handle,
- * along with the final object size in &drm_i915_gem_create_ext.size, which
- * should account for any rounding up, if required.
- */
-struct drm_i915_gem_create_ext_memory_regions {
-	/** @base: Extension link. See struct i915_user_extension. */
-	struct i915_user_extension base;
-
-	/** @pad: MBZ */
-	__u32 pad;
-	/** @num_regions: Number of elements in the @regions array. */
-	__u32 num_regions;
-	/**
-	 * @regions: The regions/placements array.
-	 *
-	 * An array of struct drm_i915_gem_memory_class_instance.
-	 */
-	__u64 regions;
-};
diff --git a/Documentation/gpu/rfc/i915_gem_lmem.rst b/Documentation/gpu/rfc/i915_gem_lmem.rst
index 1d344c593018..675ba8620d66 100644
--- a/Documentation/gpu/rfc/i915_gem_lmem.rst
+++ b/Documentation/gpu/rfc/i915_gem_lmem.rst
@@ -48,7 +48,7 @@ particular instance, since we can have more than one per class.
 In the future we also want to expose more information which can further
 describe the capabilities of a region.
 
-.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
+.. kernel-doc:: include/uapi/drm/i915_drm.h
         :functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
 
 GEM_CREATE_EXT
@@ -61,7 +61,7 @@ Side note: We also need to support PXP[1] in the near future, which is also
 applicable to integrated platforms, and adds its own gem_create_ext extension,
 which basically lets userspace mark a buffer as "protected".
 
-.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
+.. kernel-doc:: include/uapi/drm/i915_drm.h
         :functions: drm_i915_gem_create_ext
 
 I915_GEM_CREATE_EXT_MEMORY_REGIONS
@@ -73,7 +73,7 @@ them each to use the class/instance encoding, as per the output of the regions
 query. Having the list in priority order will be useful in the future when
 placing an object, say during eviction.
 
-.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
+.. kernel-doc:: include/uapi/drm/i915_drm.h
         :functions: drm_i915_gem_create_ext_memory_regions
 
 One fair criticism here is that this seems a little over-engineered[2]. If we
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Intel-gfx] [PATCH] drm/doc/rfc: drop the i915_gem_lmem.h header
@ 2021-05-11 17:03 ` Matthew Auld
  0 siblings, 0 replies; 12+ messages in thread
From: Matthew Auld @ 2021-05-11 17:03 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter, dri-devel

The proper headers have now landed in include/uapi/drm/i915_drm.h, so we
can drop i915_gem_lmem.h and instead just reference the real headers for
pulling in the kernel doc.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 Documentation/gpu/rfc/i915_gem_lmem.h   | 237 ------------------------
 Documentation/gpu/rfc/i915_gem_lmem.rst |   6 +-
 2 files changed, 3 insertions(+), 240 deletions(-)
 delete mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h

diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
deleted file mode 100644
index d9c61bea0556..000000000000
--- a/Documentation/gpu/rfc/i915_gem_lmem.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/**
- * enum drm_i915_gem_memory_class - Supported memory classes
- */
-enum drm_i915_gem_memory_class {
-	/** @I915_MEMORY_CLASS_SYSTEM: System memory */
-	I915_MEMORY_CLASS_SYSTEM = 0,
-	/** @I915_MEMORY_CLASS_DEVICE: Device local-memory */
-	I915_MEMORY_CLASS_DEVICE,
-};
-
-/**
- * struct drm_i915_gem_memory_class_instance - Identify particular memory region
- */
-struct drm_i915_gem_memory_class_instance {
-	/** @memory_class: See enum drm_i915_gem_memory_class */
-	__u16 memory_class;
-
-	/** @memory_instance: Which instance */
-	__u16 memory_instance;
-};
-
-/**
- * struct drm_i915_memory_region_info - Describes one region as known to the
- * driver.
- *
- * Note that we reserve some stuff here for potential future work. As an example
- * we might want expose the capabilities for a given region, which could include
- * things like if the region is CPU mappable/accessible, what are the supported
- * mapping types etc.
- *
- * Note that to extend struct drm_i915_memory_region_info and struct
- * drm_i915_query_memory_regions in the future the plan is to do the following:
- *
- * .. code-block:: C
- *
- *	struct drm_i915_memory_region_info {
- *		struct drm_i915_gem_memory_class_instance region;
- *		union {
- *			__u32 rsvd0;
- *			__u32 new_thing1;
- *		};
- *		...
- *		union {
- *			__u64 rsvd1[8];
- *			struct {
- *				__u64 new_thing2;
- *				__u64 new_thing3;
- *				...
- *			};
- *		};
- *	};
- *
- * With this things should remain source compatible between versions for
- * userspace, even as we add new fields.
- *
- * Note this is using both struct drm_i915_query_item and struct drm_i915_query.
- * For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS
- * at &drm_i915_query_item.query_id.
- */
-struct drm_i915_memory_region_info {
-	/** @region: The class:instance pair encoding */
-	struct drm_i915_gem_memory_class_instance region;
-
-	/** @rsvd0: MBZ */
-	__u32 rsvd0;
-
-	/** @probed_size: Memory probed by the driver (-1 = unknown) */
-	__u64 probed_size;
-
-	/** @unallocated_size: Estimate of memory remaining (-1 = unknown) */
-	__u64 unallocated_size;
-
-	/** @rsvd1: MBZ */
-	__u64 rsvd1[8];
-};
-
-/**
- * struct drm_i915_query_memory_regions
- *
- * The region info query enumerates all regions known to the driver by filling
- * in an array of struct drm_i915_memory_region_info structures.
- *
- * Example for getting the list of supported regions:
- *
- * .. code-block:: C
- *
- *	struct drm_i915_query_memory_regions *info;
- *	struct drm_i915_query_item item = {
- *		.query_id = DRM_I915_QUERY_MEMORY_REGIONS;
- *	};
- *	struct drm_i915_query query = {
- *		.num_items = 1,
- *		.items_ptr = (uintptr_t)&item,
- *	};
- *	int err, i;
- *
- *	// First query the size of the blob we need, this needs to be large
- *	// enough to hold our array of regions. The kernel will fill out the
- *	// item.length for us, which is the number of bytes we need.
- *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
- *	if (err) ...
- *
- *	info = calloc(1, item.length);
- *	// Now that we allocated the required number of bytes, we call the ioctl
- *	// again, this time with the data_ptr pointing to our newly allocated
- *	// blob, which the kernel can then populate with the all the region info.
- *	item.data_ptr = (uintptr_t)&info,
- *
- *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
- *	if (err) ...
- *
- *	// We can now access each region in the array
- *	for (i = 0; i < info->num_regions; i++) {
- *		struct drm_i915_memory_region_info mr = info->regions[i];
- *		u16 class = mr.region.class;
- *		u16 instance = mr.region.instance;
- *
- *		....
- *	}
- *
- *	free(info);
- */
-struct drm_i915_query_memory_regions {
-	/** @num_regions: Number of supported regions */
-	__u32 num_regions;
-
-	/** @rsvd: MBZ */
-	__u32 rsvd[3];
-
-	/** @regions: Info about each supported region */
-	struct drm_i915_memory_region_info regions[];
-};
-
-#define DRM_I915_GEM_CREATE_EXT		0xdeadbeaf
-#define DRM_IOCTL_I915_GEM_CREATE_EXT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext)
-
-/**
- * struct drm_i915_gem_create_ext - Existing gem_create behaviour, with added
- * extension support using struct i915_user_extension.
- *
- * Note that in the future we want to have our buffer flags here, at least for
- * the stuff that is immutable. Previously we would have two ioctls, one to
- * create the object with gem_create, and another to apply various parameters,
- * however this creates some ambiguity for the params which are considered
- * immutable. Also in general we're phasing out the various SET/GET ioctls.
- */
-struct drm_i915_gem_create_ext {
-	/**
-	 * @size: Requested size for the object.
-	 *
-	 * The (page-aligned) allocated size for the object will be returned.
-	 *
-	 * Note that for some devices we have might have further minimum
-	 * page-size restrictions(larger than 4K), like for device local-memory.
-	 * However in general the final size here should always reflect any
-	 * rounding up, if for example using the I915_GEM_CREATE_EXT_MEMORY_REGIONS
-	 * extension to place the object in device local-memory.
-	 */
-	__u64 size;
-	/**
-	 * @handle: Returned handle for the object.
-	 *
-	 * Object handles are nonzero.
-	 */
-	__u32 handle;
-	/** @flags: MBZ */
-	__u32 flags;
-	/**
-	 * @extensions: The chain of extensions to apply to this object.
-	 *
-	 * This will be useful in the future when we need to support several
-	 * different extensions, and we need to apply more than one when
-	 * creating the object. See struct i915_user_extension.
-	 *
-	 * If we don't supply any extensions then we get the same old gem_create
-	 * behaviour.
-	 *
-	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
-	 * struct drm_i915_gem_create_ext_memory_regions.
-	 */
-#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
-	__u64 extensions;
-};
-
-/**
- * struct drm_i915_gem_create_ext_memory_regions - The
- * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
- *
- * Set the object with the desired set of placements/regions in priority
- * order. Each entry must be unique and supported by the device.
- *
- * This is provided as an array of struct drm_i915_gem_memory_class_instance, or
- * an equivalent layout of class:instance pair encodings. See struct
- * drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to
- * query the supported regions for a device.
- *
- * As an example, on discrete devices, if we wish to set the placement as
- * device local-memory we can do something like:
- *
- * .. code-block:: C
- *
- *	struct drm_i915_gem_memory_class_instance region_lmem = {
- *              .memory_class = I915_MEMORY_CLASS_DEVICE,
- *              .memory_instance = 0,
- *      };
- *      struct drm_i915_gem_create_ext_memory_regions regions = {
- *              .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS },
- *              .regions = (uintptr_t)&region_lmem,
- *              .num_regions = 1,
- *      };
- *      struct drm_i915_gem_create_ext create_ext = {
- *              .size = 16 * PAGE_SIZE,
- *              .extensions = (uintptr_t)&regions,
- *      };
- *
- *      int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
- *      if (err) ...
- *
- * At which point we get the object handle in &drm_i915_gem_create_ext.handle,
- * along with the final object size in &drm_i915_gem_create_ext.size, which
- * should account for any rounding up, if required.
- */
-struct drm_i915_gem_create_ext_memory_regions {
-	/** @base: Extension link. See struct i915_user_extension. */
-	struct i915_user_extension base;
-
-	/** @pad: MBZ */
-	__u32 pad;
-	/** @num_regions: Number of elements in the @regions array. */
-	__u32 num_regions;
-	/**
-	 * @regions: The regions/placements array.
-	 *
-	 * An array of struct drm_i915_gem_memory_class_instance.
-	 */
-	__u64 regions;
-};
diff --git a/Documentation/gpu/rfc/i915_gem_lmem.rst b/Documentation/gpu/rfc/i915_gem_lmem.rst
index 1d344c593018..675ba8620d66 100644
--- a/Documentation/gpu/rfc/i915_gem_lmem.rst
+++ b/Documentation/gpu/rfc/i915_gem_lmem.rst
@@ -48,7 +48,7 @@ particular instance, since we can have more than one per class.
 In the future we also want to expose more information which can further
 describe the capabilities of a region.
 
-.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
+.. kernel-doc:: include/uapi/drm/i915_drm.h
         :functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
 
 GEM_CREATE_EXT
@@ -61,7 +61,7 @@ Side note: We also need to support PXP[1] in the near future, which is also
 applicable to integrated platforms, and adds its own gem_create_ext extension,
 which basically lets userspace mark a buffer as "protected".
 
-.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
+.. kernel-doc:: include/uapi/drm/i915_drm.h
         :functions: drm_i915_gem_create_ext
 
 I915_GEM_CREATE_EXT_MEMORY_REGIONS
@@ -73,7 +73,7 @@ them each to use the class/instance encoding, as per the output of the regions
 query. Having the list in priority order will be useful in the future when
 placing an object, say during eviction.
 
-.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
+.. kernel-doc:: include/uapi/drm/i915_drm.h
         :functions: drm_i915_gem_create_ext_memory_regions
 
 One fair criticism here is that this seems a little over-engineered[2]. If we
-- 
2.26.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/doc/rfc: drop the i915_gem_lmem.h header
  2021-05-11 17:03 ` [Intel-gfx] " Matthew Auld
@ 2021-05-11 17:28   ` Daniel Vetter
  -1 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2021-05-11 17:28 UTC (permalink / raw)
  To: Matthew Auld; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Tue, May 11, 2021 at 06:03:56PM +0100, Matthew Auld wrote:
> The proper headers have now landed in include/uapi/drm/i915_drm.h, so we
> can drop i915_gem_lmem.h and instead just reference the real headers for
> pulling in the kernel doc.
> 
> Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

I guess we need to have a note that when we land the pciid for dg1 to move
all the remaining bits over to real docs and delete the i915 lmem rfc. But
everything in due time.
-Daniel

> ---
>  Documentation/gpu/rfc/i915_gem_lmem.h   | 237 ------------------------
>  Documentation/gpu/rfc/i915_gem_lmem.rst |   6 +-
>  2 files changed, 3 insertions(+), 240 deletions(-)
>  delete mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h
> 
> diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
> deleted file mode 100644
> index d9c61bea0556..000000000000
> --- a/Documentation/gpu/rfc/i915_gem_lmem.h
> +++ /dev/null
> @@ -1,237 +0,0 @@
> -/**
> - * enum drm_i915_gem_memory_class - Supported memory classes
> - */
> -enum drm_i915_gem_memory_class {
> -	/** @I915_MEMORY_CLASS_SYSTEM: System memory */
> -	I915_MEMORY_CLASS_SYSTEM = 0,
> -	/** @I915_MEMORY_CLASS_DEVICE: Device local-memory */
> -	I915_MEMORY_CLASS_DEVICE,
> -};
> -
> -/**
> - * struct drm_i915_gem_memory_class_instance - Identify particular memory region
> - */
> -struct drm_i915_gem_memory_class_instance {
> -	/** @memory_class: See enum drm_i915_gem_memory_class */
> -	__u16 memory_class;
> -
> -	/** @memory_instance: Which instance */
> -	__u16 memory_instance;
> -};
> -
> -/**
> - * struct drm_i915_memory_region_info - Describes one region as known to the
> - * driver.
> - *
> - * Note that we reserve some stuff here for potential future work. As an example
> - * we might want expose the capabilities for a given region, which could include
> - * things like if the region is CPU mappable/accessible, what are the supported
> - * mapping types etc.
> - *
> - * Note that to extend struct drm_i915_memory_region_info and struct
> - * drm_i915_query_memory_regions in the future the plan is to do the following:
> - *
> - * .. code-block:: C
> - *
> - *	struct drm_i915_memory_region_info {
> - *		struct drm_i915_gem_memory_class_instance region;
> - *		union {
> - *			__u32 rsvd0;
> - *			__u32 new_thing1;
> - *		};
> - *		...
> - *		union {
> - *			__u64 rsvd1[8];
> - *			struct {
> - *				__u64 new_thing2;
> - *				__u64 new_thing3;
> - *				...
> - *			};
> - *		};
> - *	};
> - *
> - * With this things should remain source compatible between versions for
> - * userspace, even as we add new fields.
> - *
> - * Note this is using both struct drm_i915_query_item and struct drm_i915_query.
> - * For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS
> - * at &drm_i915_query_item.query_id.
> - */
> -struct drm_i915_memory_region_info {
> -	/** @region: The class:instance pair encoding */
> -	struct drm_i915_gem_memory_class_instance region;
> -
> -	/** @rsvd0: MBZ */
> -	__u32 rsvd0;
> -
> -	/** @probed_size: Memory probed by the driver (-1 = unknown) */
> -	__u64 probed_size;
> -
> -	/** @unallocated_size: Estimate of memory remaining (-1 = unknown) */
> -	__u64 unallocated_size;
> -
> -	/** @rsvd1: MBZ */
> -	__u64 rsvd1[8];
> -};
> -
> -/**
> - * struct drm_i915_query_memory_regions
> - *
> - * The region info query enumerates all regions known to the driver by filling
> - * in an array of struct drm_i915_memory_region_info structures.
> - *
> - * Example for getting the list of supported regions:
> - *
> - * .. code-block:: C
> - *
> - *	struct drm_i915_query_memory_regions *info;
> - *	struct drm_i915_query_item item = {
> - *		.query_id = DRM_I915_QUERY_MEMORY_REGIONS;
> - *	};
> - *	struct drm_i915_query query = {
> - *		.num_items = 1,
> - *		.items_ptr = (uintptr_t)&item,
> - *	};
> - *	int err, i;
> - *
> - *	// First query the size of the blob we need, this needs to be large
> - *	// enough to hold our array of regions. The kernel will fill out the
> - *	// item.length for us, which is the number of bytes we need.
> - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> - *	if (err) ...
> - *
> - *	info = calloc(1, item.length);
> - *	// Now that we allocated the required number of bytes, we call the ioctl
> - *	// again, this time with the data_ptr pointing to our newly allocated
> - *	// blob, which the kernel can then populate with the all the region info.
> - *	item.data_ptr = (uintptr_t)&info,
> - *
> - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> - *	if (err) ...
> - *
> - *	// We can now access each region in the array
> - *	for (i = 0; i < info->num_regions; i++) {
> - *		struct drm_i915_memory_region_info mr = info->regions[i];
> - *		u16 class = mr.region.class;
> - *		u16 instance = mr.region.instance;
> - *
> - *		....
> - *	}
> - *
> - *	free(info);
> - */
> -struct drm_i915_query_memory_regions {
> -	/** @num_regions: Number of supported regions */
> -	__u32 num_regions;
> -
> -	/** @rsvd: MBZ */
> -	__u32 rsvd[3];
> -
> -	/** @regions: Info about each supported region */
> -	struct drm_i915_memory_region_info regions[];
> -};
> -
> -#define DRM_I915_GEM_CREATE_EXT		0xdeadbeaf
> -#define DRM_IOCTL_I915_GEM_CREATE_EXT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext)
> -
> -/**
> - * struct drm_i915_gem_create_ext - Existing gem_create behaviour, with added
> - * extension support using struct i915_user_extension.
> - *
> - * Note that in the future we want to have our buffer flags here, at least for
> - * the stuff that is immutable. Previously we would have two ioctls, one to
> - * create the object with gem_create, and another to apply various parameters,
> - * however this creates some ambiguity for the params which are considered
> - * immutable. Also in general we're phasing out the various SET/GET ioctls.
> - */
> -struct drm_i915_gem_create_ext {
> -	/**
> -	 * @size: Requested size for the object.
> -	 *
> -	 * The (page-aligned) allocated size for the object will be returned.
> -	 *
> -	 * Note that for some devices we have might have further minimum
> -	 * page-size restrictions(larger than 4K), like for device local-memory.
> -	 * However in general the final size here should always reflect any
> -	 * rounding up, if for example using the I915_GEM_CREATE_EXT_MEMORY_REGIONS
> -	 * extension to place the object in device local-memory.
> -	 */
> -	__u64 size;
> -	/**
> -	 * @handle: Returned handle for the object.
> -	 *
> -	 * Object handles are nonzero.
> -	 */
> -	__u32 handle;
> -	/** @flags: MBZ */
> -	__u32 flags;
> -	/**
> -	 * @extensions: The chain of extensions to apply to this object.
> -	 *
> -	 * This will be useful in the future when we need to support several
> -	 * different extensions, and we need to apply more than one when
> -	 * creating the object. See struct i915_user_extension.
> -	 *
> -	 * If we don't supply any extensions then we get the same old gem_create
> -	 * behaviour.
> -	 *
> -	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
> -	 * struct drm_i915_gem_create_ext_memory_regions.
> -	 */
> -#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
> -	__u64 extensions;
> -};
> -
> -/**
> - * struct drm_i915_gem_create_ext_memory_regions - The
> - * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
> - *
> - * Set the object with the desired set of placements/regions in priority
> - * order. Each entry must be unique and supported by the device.
> - *
> - * This is provided as an array of struct drm_i915_gem_memory_class_instance, or
> - * an equivalent layout of class:instance pair encodings. See struct
> - * drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to
> - * query the supported regions for a device.
> - *
> - * As an example, on discrete devices, if we wish to set the placement as
> - * device local-memory we can do something like:
> - *
> - * .. code-block:: C
> - *
> - *	struct drm_i915_gem_memory_class_instance region_lmem = {
> - *              .memory_class = I915_MEMORY_CLASS_DEVICE,
> - *              .memory_instance = 0,
> - *      };
> - *      struct drm_i915_gem_create_ext_memory_regions regions = {
> - *              .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS },
> - *              .regions = (uintptr_t)&region_lmem,
> - *              .num_regions = 1,
> - *      };
> - *      struct drm_i915_gem_create_ext create_ext = {
> - *              .size = 16 * PAGE_SIZE,
> - *              .extensions = (uintptr_t)&regions,
> - *      };
> - *
> - *      int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
> - *      if (err) ...
> - *
> - * At which point we get the object handle in &drm_i915_gem_create_ext.handle,
> - * along with the final object size in &drm_i915_gem_create_ext.size, which
> - * should account for any rounding up, if required.
> - */
> -struct drm_i915_gem_create_ext_memory_regions {
> -	/** @base: Extension link. See struct i915_user_extension. */
> -	struct i915_user_extension base;
> -
> -	/** @pad: MBZ */
> -	__u32 pad;
> -	/** @num_regions: Number of elements in the @regions array. */
> -	__u32 num_regions;
> -	/**
> -	 * @regions: The regions/placements array.
> -	 *
> -	 * An array of struct drm_i915_gem_memory_class_instance.
> -	 */
> -	__u64 regions;
> -};
> diff --git a/Documentation/gpu/rfc/i915_gem_lmem.rst b/Documentation/gpu/rfc/i915_gem_lmem.rst
> index 1d344c593018..675ba8620d66 100644
> --- a/Documentation/gpu/rfc/i915_gem_lmem.rst
> +++ b/Documentation/gpu/rfc/i915_gem_lmem.rst
> @@ -48,7 +48,7 @@ particular instance, since we can have more than one per class.
>  In the future we also want to expose more information which can further
>  describe the capabilities of a region.
>  
> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>          :functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
>  
>  GEM_CREATE_EXT
> @@ -61,7 +61,7 @@ Side note: We also need to support PXP[1] in the near future, which is also
>  applicable to integrated platforms, and adds its own gem_create_ext extension,
>  which basically lets userspace mark a buffer as "protected".
>  
> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>          :functions: drm_i915_gem_create_ext
>  
>  I915_GEM_CREATE_EXT_MEMORY_REGIONS
> @@ -73,7 +73,7 @@ them each to use the class/instance encoding, as per the output of the regions
>  query. Having the list in priority order will be useful in the future when
>  placing an object, say during eviction.
>  
> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>          :functions: drm_i915_gem_create_ext_memory_regions
>  
>  One fair criticism here is that this seems a little over-engineered[2]. If we
> -- 
> 2.26.3
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/doc/rfc: drop the i915_gem_lmem.h header
@ 2021-05-11 17:28   ` Daniel Vetter
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2021-05-11 17:28 UTC (permalink / raw)
  To: Matthew Auld; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Tue, May 11, 2021 at 06:03:56PM +0100, Matthew Auld wrote:
> The proper headers have now landed in include/uapi/drm/i915_drm.h, so we
> can drop i915_gem_lmem.h and instead just reference the real headers for
> pulling in the kernel doc.
> 
> Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

I guess we need to have a note that when we land the pciid for dg1 to move
all the remaining bits over to real docs and delete the i915 lmem rfc. But
everything in due time.
-Daniel

> ---
>  Documentation/gpu/rfc/i915_gem_lmem.h   | 237 ------------------------
>  Documentation/gpu/rfc/i915_gem_lmem.rst |   6 +-
>  2 files changed, 3 insertions(+), 240 deletions(-)
>  delete mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h
> 
> diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
> deleted file mode 100644
> index d9c61bea0556..000000000000
> --- a/Documentation/gpu/rfc/i915_gem_lmem.h
> +++ /dev/null
> @@ -1,237 +0,0 @@
> -/**
> - * enum drm_i915_gem_memory_class - Supported memory classes
> - */
> -enum drm_i915_gem_memory_class {
> -	/** @I915_MEMORY_CLASS_SYSTEM: System memory */
> -	I915_MEMORY_CLASS_SYSTEM = 0,
> -	/** @I915_MEMORY_CLASS_DEVICE: Device local-memory */
> -	I915_MEMORY_CLASS_DEVICE,
> -};
> -
> -/**
> - * struct drm_i915_gem_memory_class_instance - Identify particular memory region
> - */
> -struct drm_i915_gem_memory_class_instance {
> -	/** @memory_class: See enum drm_i915_gem_memory_class */
> -	__u16 memory_class;
> -
> -	/** @memory_instance: Which instance */
> -	__u16 memory_instance;
> -};
> -
> -/**
> - * struct drm_i915_memory_region_info - Describes one region as known to the
> - * driver.
> - *
> - * Note that we reserve some stuff here for potential future work. As an example
> - * we might want expose the capabilities for a given region, which could include
> - * things like if the region is CPU mappable/accessible, what are the supported
> - * mapping types etc.
> - *
> - * Note that to extend struct drm_i915_memory_region_info and struct
> - * drm_i915_query_memory_regions in the future the plan is to do the following:
> - *
> - * .. code-block:: C
> - *
> - *	struct drm_i915_memory_region_info {
> - *		struct drm_i915_gem_memory_class_instance region;
> - *		union {
> - *			__u32 rsvd0;
> - *			__u32 new_thing1;
> - *		};
> - *		...
> - *		union {
> - *			__u64 rsvd1[8];
> - *			struct {
> - *				__u64 new_thing2;
> - *				__u64 new_thing3;
> - *				...
> - *			};
> - *		};
> - *	};
> - *
> - * With this things should remain source compatible between versions for
> - * userspace, even as we add new fields.
> - *
> - * Note this is using both struct drm_i915_query_item and struct drm_i915_query.
> - * For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS
> - * at &drm_i915_query_item.query_id.
> - */
> -struct drm_i915_memory_region_info {
> -	/** @region: The class:instance pair encoding */
> -	struct drm_i915_gem_memory_class_instance region;
> -
> -	/** @rsvd0: MBZ */
> -	__u32 rsvd0;
> -
> -	/** @probed_size: Memory probed by the driver (-1 = unknown) */
> -	__u64 probed_size;
> -
> -	/** @unallocated_size: Estimate of memory remaining (-1 = unknown) */
> -	__u64 unallocated_size;
> -
> -	/** @rsvd1: MBZ */
> -	__u64 rsvd1[8];
> -};
> -
> -/**
> - * struct drm_i915_query_memory_regions
> - *
> - * The region info query enumerates all regions known to the driver by filling
> - * in an array of struct drm_i915_memory_region_info structures.
> - *
> - * Example for getting the list of supported regions:
> - *
> - * .. code-block:: C
> - *
> - *	struct drm_i915_query_memory_regions *info;
> - *	struct drm_i915_query_item item = {
> - *		.query_id = DRM_I915_QUERY_MEMORY_REGIONS;
> - *	};
> - *	struct drm_i915_query query = {
> - *		.num_items = 1,
> - *		.items_ptr = (uintptr_t)&item,
> - *	};
> - *	int err, i;
> - *
> - *	// First query the size of the blob we need, this needs to be large
> - *	// enough to hold our array of regions. The kernel will fill out the
> - *	// item.length for us, which is the number of bytes we need.
> - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> - *	if (err) ...
> - *
> - *	info = calloc(1, item.length);
> - *	// Now that we allocated the required number of bytes, we call the ioctl
> - *	// again, this time with the data_ptr pointing to our newly allocated
> - *	// blob, which the kernel can then populate with the all the region info.
> - *	item.data_ptr = (uintptr_t)&info,
> - *
> - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> - *	if (err) ...
> - *
> - *	// We can now access each region in the array
> - *	for (i = 0; i < info->num_regions; i++) {
> - *		struct drm_i915_memory_region_info mr = info->regions[i];
> - *		u16 class = mr.region.class;
> - *		u16 instance = mr.region.instance;
> - *
> - *		....
> - *	}
> - *
> - *	free(info);
> - */
> -struct drm_i915_query_memory_regions {
> -	/** @num_regions: Number of supported regions */
> -	__u32 num_regions;
> -
> -	/** @rsvd: MBZ */
> -	__u32 rsvd[3];
> -
> -	/** @regions: Info about each supported region */
> -	struct drm_i915_memory_region_info regions[];
> -};
> -
> -#define DRM_I915_GEM_CREATE_EXT		0xdeadbeaf
> -#define DRM_IOCTL_I915_GEM_CREATE_EXT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext)
> -
> -/**
> - * struct drm_i915_gem_create_ext - Existing gem_create behaviour, with added
> - * extension support using struct i915_user_extension.
> - *
> - * Note that in the future we want to have our buffer flags here, at least for
> - * the stuff that is immutable. Previously we would have two ioctls, one to
> - * create the object with gem_create, and another to apply various parameters,
> - * however this creates some ambiguity for the params which are considered
> - * immutable. Also in general we're phasing out the various SET/GET ioctls.
> - */
> -struct drm_i915_gem_create_ext {
> -	/**
> -	 * @size: Requested size for the object.
> -	 *
> -	 * The (page-aligned) allocated size for the object will be returned.
> -	 *
> -	 * Note that for some devices we have might have further minimum
> -	 * page-size restrictions(larger than 4K), like for device local-memory.
> -	 * However in general the final size here should always reflect any
> -	 * rounding up, if for example using the I915_GEM_CREATE_EXT_MEMORY_REGIONS
> -	 * extension to place the object in device local-memory.
> -	 */
> -	__u64 size;
> -	/**
> -	 * @handle: Returned handle for the object.
> -	 *
> -	 * Object handles are nonzero.
> -	 */
> -	__u32 handle;
> -	/** @flags: MBZ */
> -	__u32 flags;
> -	/**
> -	 * @extensions: The chain of extensions to apply to this object.
> -	 *
> -	 * This will be useful in the future when we need to support several
> -	 * different extensions, and we need to apply more than one when
> -	 * creating the object. See struct i915_user_extension.
> -	 *
> -	 * If we don't supply any extensions then we get the same old gem_create
> -	 * behaviour.
> -	 *
> -	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
> -	 * struct drm_i915_gem_create_ext_memory_regions.
> -	 */
> -#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
> -	__u64 extensions;
> -};
> -
> -/**
> - * struct drm_i915_gem_create_ext_memory_regions - The
> - * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
> - *
> - * Set the object with the desired set of placements/regions in priority
> - * order. Each entry must be unique and supported by the device.
> - *
> - * This is provided as an array of struct drm_i915_gem_memory_class_instance, or
> - * an equivalent layout of class:instance pair encodings. See struct
> - * drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to
> - * query the supported regions for a device.
> - *
> - * As an example, on discrete devices, if we wish to set the placement as
> - * device local-memory we can do something like:
> - *
> - * .. code-block:: C
> - *
> - *	struct drm_i915_gem_memory_class_instance region_lmem = {
> - *              .memory_class = I915_MEMORY_CLASS_DEVICE,
> - *              .memory_instance = 0,
> - *      };
> - *      struct drm_i915_gem_create_ext_memory_regions regions = {
> - *              .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS },
> - *              .regions = (uintptr_t)&region_lmem,
> - *              .num_regions = 1,
> - *      };
> - *      struct drm_i915_gem_create_ext create_ext = {
> - *              .size = 16 * PAGE_SIZE,
> - *              .extensions = (uintptr_t)&regions,
> - *      };
> - *
> - *      int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
> - *      if (err) ...
> - *
> - * At which point we get the object handle in &drm_i915_gem_create_ext.handle,
> - * along with the final object size in &drm_i915_gem_create_ext.size, which
> - * should account for any rounding up, if required.
> - */
> -struct drm_i915_gem_create_ext_memory_regions {
> -	/** @base: Extension link. See struct i915_user_extension. */
> -	struct i915_user_extension base;
> -
> -	/** @pad: MBZ */
> -	__u32 pad;
> -	/** @num_regions: Number of elements in the @regions array. */
> -	__u32 num_regions;
> -	/**
> -	 * @regions: The regions/placements array.
> -	 *
> -	 * An array of struct drm_i915_gem_memory_class_instance.
> -	 */
> -	__u64 regions;
> -};
> diff --git a/Documentation/gpu/rfc/i915_gem_lmem.rst b/Documentation/gpu/rfc/i915_gem_lmem.rst
> index 1d344c593018..675ba8620d66 100644
> --- a/Documentation/gpu/rfc/i915_gem_lmem.rst
> +++ b/Documentation/gpu/rfc/i915_gem_lmem.rst
> @@ -48,7 +48,7 @@ particular instance, since we can have more than one per class.
>  In the future we also want to expose more information which can further
>  describe the capabilities of a region.
>  
> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>          :functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
>  
>  GEM_CREATE_EXT
> @@ -61,7 +61,7 @@ Side note: We also need to support PXP[1] in the near future, which is also
>  applicable to integrated platforms, and adds its own gem_create_ext extension,
>  which basically lets userspace mark a buffer as "protected".
>  
> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>          :functions: drm_i915_gem_create_ext
>  
>  I915_GEM_CREATE_EXT_MEMORY_REGIONS
> @@ -73,7 +73,7 @@ them each to use the class/instance encoding, as per the output of the regions
>  query. Having the list in priority order will be useful in the future when
>  placing an object, say during eviction.
>  
> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>          :functions: drm_i915_gem_create_ext_memory_regions
>  
>  One fair criticism here is that this seems a little over-engineered[2]. If we
> -- 
> 2.26.3
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/doc/rfc: drop the i915_gem_lmem.h header
  2021-05-11 17:28   ` [Intel-gfx] " Daniel Vetter
@ 2021-05-11 17:29     ` Daniel Vetter
  -1 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2021-05-11 17:29 UTC (permalink / raw)
  To: Matthew Auld; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Tue, May 11, 2021 at 07:28:08PM +0200, Daniel Vetter wrote:
> On Tue, May 11, 2021 at 06:03:56PM +0100, Matthew Auld wrote:
> > The proper headers have now landed in include/uapi/drm/i915_drm.h, so we
> > can drop i915_gem_lmem.h and instead just reference the real headers for
> > pulling in the kernel doc.
> > 
> > Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> I guess we need to have a note that when we land the pciid for dg1 to move
> all the remaining bits over to real docs and delete the i915 lmem rfc. But
> everything in due time.

One thing I forgot: The include stanza will I think result in the
explicitly included functions not showing up in the normal driver uapi
docs. Which I think is fine while we settle all this. Or do I get this
wrong?
-Daniel

> -Daniel
> 
> > ---
> >  Documentation/gpu/rfc/i915_gem_lmem.h   | 237 ------------------------
> >  Documentation/gpu/rfc/i915_gem_lmem.rst |   6 +-
> >  2 files changed, 3 insertions(+), 240 deletions(-)
> >  delete mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h
> > 
> > diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
> > deleted file mode 100644
> > index d9c61bea0556..000000000000
> > --- a/Documentation/gpu/rfc/i915_gem_lmem.h
> > +++ /dev/null
> > @@ -1,237 +0,0 @@
> > -/**
> > - * enum drm_i915_gem_memory_class - Supported memory classes
> > - */
> > -enum drm_i915_gem_memory_class {
> > -	/** @I915_MEMORY_CLASS_SYSTEM: System memory */
> > -	I915_MEMORY_CLASS_SYSTEM = 0,
> > -	/** @I915_MEMORY_CLASS_DEVICE: Device local-memory */
> > -	I915_MEMORY_CLASS_DEVICE,
> > -};
> > -
> > -/**
> > - * struct drm_i915_gem_memory_class_instance - Identify particular memory region
> > - */
> > -struct drm_i915_gem_memory_class_instance {
> > -	/** @memory_class: See enum drm_i915_gem_memory_class */
> > -	__u16 memory_class;
> > -
> > -	/** @memory_instance: Which instance */
> > -	__u16 memory_instance;
> > -};
> > -
> > -/**
> > - * struct drm_i915_memory_region_info - Describes one region as known to the
> > - * driver.
> > - *
> > - * Note that we reserve some stuff here for potential future work. As an example
> > - * we might want expose the capabilities for a given region, which could include
> > - * things like if the region is CPU mappable/accessible, what are the supported
> > - * mapping types etc.
> > - *
> > - * Note that to extend struct drm_i915_memory_region_info and struct
> > - * drm_i915_query_memory_regions in the future the plan is to do the following:
> > - *
> > - * .. code-block:: C
> > - *
> > - *	struct drm_i915_memory_region_info {
> > - *		struct drm_i915_gem_memory_class_instance region;
> > - *		union {
> > - *			__u32 rsvd0;
> > - *			__u32 new_thing1;
> > - *		};
> > - *		...
> > - *		union {
> > - *			__u64 rsvd1[8];
> > - *			struct {
> > - *				__u64 new_thing2;
> > - *				__u64 new_thing3;
> > - *				...
> > - *			};
> > - *		};
> > - *	};
> > - *
> > - * With this things should remain source compatible between versions for
> > - * userspace, even as we add new fields.
> > - *
> > - * Note this is using both struct drm_i915_query_item and struct drm_i915_query.
> > - * For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS
> > - * at &drm_i915_query_item.query_id.
> > - */
> > -struct drm_i915_memory_region_info {
> > -	/** @region: The class:instance pair encoding */
> > -	struct drm_i915_gem_memory_class_instance region;
> > -
> > -	/** @rsvd0: MBZ */
> > -	__u32 rsvd0;
> > -
> > -	/** @probed_size: Memory probed by the driver (-1 = unknown) */
> > -	__u64 probed_size;
> > -
> > -	/** @unallocated_size: Estimate of memory remaining (-1 = unknown) */
> > -	__u64 unallocated_size;
> > -
> > -	/** @rsvd1: MBZ */
> > -	__u64 rsvd1[8];
> > -};
> > -
> > -/**
> > - * struct drm_i915_query_memory_regions
> > - *
> > - * The region info query enumerates all regions known to the driver by filling
> > - * in an array of struct drm_i915_memory_region_info structures.
> > - *
> > - * Example for getting the list of supported regions:
> > - *
> > - * .. code-block:: C
> > - *
> > - *	struct drm_i915_query_memory_regions *info;
> > - *	struct drm_i915_query_item item = {
> > - *		.query_id = DRM_I915_QUERY_MEMORY_REGIONS;
> > - *	};
> > - *	struct drm_i915_query query = {
> > - *		.num_items = 1,
> > - *		.items_ptr = (uintptr_t)&item,
> > - *	};
> > - *	int err, i;
> > - *
> > - *	// First query the size of the blob we need, this needs to be large
> > - *	// enough to hold our array of regions. The kernel will fill out the
> > - *	// item.length for us, which is the number of bytes we need.
> > - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> > - *	if (err) ...
> > - *
> > - *	info = calloc(1, item.length);
> > - *	// Now that we allocated the required number of bytes, we call the ioctl
> > - *	// again, this time with the data_ptr pointing to our newly allocated
> > - *	// blob, which the kernel can then populate with the all the region info.
> > - *	item.data_ptr = (uintptr_t)&info,
> > - *
> > - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> > - *	if (err) ...
> > - *
> > - *	// We can now access each region in the array
> > - *	for (i = 0; i < info->num_regions; i++) {
> > - *		struct drm_i915_memory_region_info mr = info->regions[i];
> > - *		u16 class = mr.region.class;
> > - *		u16 instance = mr.region.instance;
> > - *
> > - *		....
> > - *	}
> > - *
> > - *	free(info);
> > - */
> > -struct drm_i915_query_memory_regions {
> > -	/** @num_regions: Number of supported regions */
> > -	__u32 num_regions;
> > -
> > -	/** @rsvd: MBZ */
> > -	__u32 rsvd[3];
> > -
> > -	/** @regions: Info about each supported region */
> > -	struct drm_i915_memory_region_info regions[];
> > -};
> > -
> > -#define DRM_I915_GEM_CREATE_EXT		0xdeadbeaf
> > -#define DRM_IOCTL_I915_GEM_CREATE_EXT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext)
> > -
> > -/**
> > - * struct drm_i915_gem_create_ext - Existing gem_create behaviour, with added
> > - * extension support using struct i915_user_extension.
> > - *
> > - * Note that in the future we want to have our buffer flags here, at least for
> > - * the stuff that is immutable. Previously we would have two ioctls, one to
> > - * create the object with gem_create, and another to apply various parameters,
> > - * however this creates some ambiguity for the params which are considered
> > - * immutable. Also in general we're phasing out the various SET/GET ioctls.
> > - */
> > -struct drm_i915_gem_create_ext {
> > -	/**
> > -	 * @size: Requested size for the object.
> > -	 *
> > -	 * The (page-aligned) allocated size for the object will be returned.
> > -	 *
> > -	 * Note that for some devices we have might have further minimum
> > -	 * page-size restrictions(larger than 4K), like for device local-memory.
> > -	 * However in general the final size here should always reflect any
> > -	 * rounding up, if for example using the I915_GEM_CREATE_EXT_MEMORY_REGIONS
> > -	 * extension to place the object in device local-memory.
> > -	 */
> > -	__u64 size;
> > -	/**
> > -	 * @handle: Returned handle for the object.
> > -	 *
> > -	 * Object handles are nonzero.
> > -	 */
> > -	__u32 handle;
> > -	/** @flags: MBZ */
> > -	__u32 flags;
> > -	/**
> > -	 * @extensions: The chain of extensions to apply to this object.
> > -	 *
> > -	 * This will be useful in the future when we need to support several
> > -	 * different extensions, and we need to apply more than one when
> > -	 * creating the object. See struct i915_user_extension.
> > -	 *
> > -	 * If we don't supply any extensions then we get the same old gem_create
> > -	 * behaviour.
> > -	 *
> > -	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
> > -	 * struct drm_i915_gem_create_ext_memory_regions.
> > -	 */
> > -#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
> > -	__u64 extensions;
> > -};
> > -
> > -/**
> > - * struct drm_i915_gem_create_ext_memory_regions - The
> > - * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
> > - *
> > - * Set the object with the desired set of placements/regions in priority
> > - * order. Each entry must be unique and supported by the device.
> > - *
> > - * This is provided as an array of struct drm_i915_gem_memory_class_instance, or
> > - * an equivalent layout of class:instance pair encodings. See struct
> > - * drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to
> > - * query the supported regions for a device.
> > - *
> > - * As an example, on discrete devices, if we wish to set the placement as
> > - * device local-memory we can do something like:
> > - *
> > - * .. code-block:: C
> > - *
> > - *	struct drm_i915_gem_memory_class_instance region_lmem = {
> > - *              .memory_class = I915_MEMORY_CLASS_DEVICE,
> > - *              .memory_instance = 0,
> > - *      };
> > - *      struct drm_i915_gem_create_ext_memory_regions regions = {
> > - *              .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS },
> > - *              .regions = (uintptr_t)&region_lmem,
> > - *              .num_regions = 1,
> > - *      };
> > - *      struct drm_i915_gem_create_ext create_ext = {
> > - *              .size = 16 * PAGE_SIZE,
> > - *              .extensions = (uintptr_t)&regions,
> > - *      };
> > - *
> > - *      int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
> > - *      if (err) ...
> > - *
> > - * At which point we get the object handle in &drm_i915_gem_create_ext.handle,
> > - * along with the final object size in &drm_i915_gem_create_ext.size, which
> > - * should account for any rounding up, if required.
> > - */
> > -struct drm_i915_gem_create_ext_memory_regions {
> > -	/** @base: Extension link. See struct i915_user_extension. */
> > -	struct i915_user_extension base;
> > -
> > -	/** @pad: MBZ */
> > -	__u32 pad;
> > -	/** @num_regions: Number of elements in the @regions array. */
> > -	__u32 num_regions;
> > -	/**
> > -	 * @regions: The regions/placements array.
> > -	 *
> > -	 * An array of struct drm_i915_gem_memory_class_instance.
> > -	 */
> > -	__u64 regions;
> > -};
> > diff --git a/Documentation/gpu/rfc/i915_gem_lmem.rst b/Documentation/gpu/rfc/i915_gem_lmem.rst
> > index 1d344c593018..675ba8620d66 100644
> > --- a/Documentation/gpu/rfc/i915_gem_lmem.rst
> > +++ b/Documentation/gpu/rfc/i915_gem_lmem.rst
> > @@ -48,7 +48,7 @@ particular instance, since we can have more than one per class.
> >  In the future we also want to expose more information which can further
> >  describe the capabilities of a region.
> >  
> > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> >          :functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
> >  
> >  GEM_CREATE_EXT
> > @@ -61,7 +61,7 @@ Side note: We also need to support PXP[1] in the near future, which is also
> >  applicable to integrated platforms, and adds its own gem_create_ext extension,
> >  which basically lets userspace mark a buffer as "protected".
> >  
> > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> >          :functions: drm_i915_gem_create_ext
> >  
> >  I915_GEM_CREATE_EXT_MEMORY_REGIONS
> > @@ -73,7 +73,7 @@ them each to use the class/instance encoding, as per the output of the regions
> >  query. Having the list in priority order will be useful in the future when
> >  placing an object, say during eviction.
> >  
> > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> >          :functions: drm_i915_gem_create_ext_memory_regions
> >  
> >  One fair criticism here is that this seems a little over-engineered[2]. If we
> > -- 
> > 2.26.3
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/doc/rfc: drop the i915_gem_lmem.h header
@ 2021-05-11 17:29     ` Daniel Vetter
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2021-05-11 17:29 UTC (permalink / raw)
  To: Matthew Auld; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Tue, May 11, 2021 at 07:28:08PM +0200, Daniel Vetter wrote:
> On Tue, May 11, 2021 at 06:03:56PM +0100, Matthew Auld wrote:
> > The proper headers have now landed in include/uapi/drm/i915_drm.h, so we
> > can drop i915_gem_lmem.h and instead just reference the real headers for
> > pulling in the kernel doc.
> > 
> > Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> I guess we need to have a note that when we land the pciid for dg1 to move
> all the remaining bits over to real docs and delete the i915 lmem rfc. But
> everything in due time.

One thing I forgot: The include stanza will I think result in the
explicitly included functions not showing up in the normal driver uapi
docs. Which I think is fine while we settle all this. Or do I get this
wrong?
-Daniel

> -Daniel
> 
> > ---
> >  Documentation/gpu/rfc/i915_gem_lmem.h   | 237 ------------------------
> >  Documentation/gpu/rfc/i915_gem_lmem.rst |   6 +-
> >  2 files changed, 3 insertions(+), 240 deletions(-)
> >  delete mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h
> > 
> > diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
> > deleted file mode 100644
> > index d9c61bea0556..000000000000
> > --- a/Documentation/gpu/rfc/i915_gem_lmem.h
> > +++ /dev/null
> > @@ -1,237 +0,0 @@
> > -/**
> > - * enum drm_i915_gem_memory_class - Supported memory classes
> > - */
> > -enum drm_i915_gem_memory_class {
> > -	/** @I915_MEMORY_CLASS_SYSTEM: System memory */
> > -	I915_MEMORY_CLASS_SYSTEM = 0,
> > -	/** @I915_MEMORY_CLASS_DEVICE: Device local-memory */
> > -	I915_MEMORY_CLASS_DEVICE,
> > -};
> > -
> > -/**
> > - * struct drm_i915_gem_memory_class_instance - Identify particular memory region
> > - */
> > -struct drm_i915_gem_memory_class_instance {
> > -	/** @memory_class: See enum drm_i915_gem_memory_class */
> > -	__u16 memory_class;
> > -
> > -	/** @memory_instance: Which instance */
> > -	__u16 memory_instance;
> > -};
> > -
> > -/**
> > - * struct drm_i915_memory_region_info - Describes one region as known to the
> > - * driver.
> > - *
> > - * Note that we reserve some stuff here for potential future work. As an example
> > - * we might want expose the capabilities for a given region, which could include
> > - * things like if the region is CPU mappable/accessible, what are the supported
> > - * mapping types etc.
> > - *
> > - * Note that to extend struct drm_i915_memory_region_info and struct
> > - * drm_i915_query_memory_regions in the future the plan is to do the following:
> > - *
> > - * .. code-block:: C
> > - *
> > - *	struct drm_i915_memory_region_info {
> > - *		struct drm_i915_gem_memory_class_instance region;
> > - *		union {
> > - *			__u32 rsvd0;
> > - *			__u32 new_thing1;
> > - *		};
> > - *		...
> > - *		union {
> > - *			__u64 rsvd1[8];
> > - *			struct {
> > - *				__u64 new_thing2;
> > - *				__u64 new_thing3;
> > - *				...
> > - *			};
> > - *		};
> > - *	};
> > - *
> > - * With this things should remain source compatible between versions for
> > - * userspace, even as we add new fields.
> > - *
> > - * Note this is using both struct drm_i915_query_item and struct drm_i915_query.
> > - * For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS
> > - * at &drm_i915_query_item.query_id.
> > - */
> > -struct drm_i915_memory_region_info {
> > -	/** @region: The class:instance pair encoding */
> > -	struct drm_i915_gem_memory_class_instance region;
> > -
> > -	/** @rsvd0: MBZ */
> > -	__u32 rsvd0;
> > -
> > -	/** @probed_size: Memory probed by the driver (-1 = unknown) */
> > -	__u64 probed_size;
> > -
> > -	/** @unallocated_size: Estimate of memory remaining (-1 = unknown) */
> > -	__u64 unallocated_size;
> > -
> > -	/** @rsvd1: MBZ */
> > -	__u64 rsvd1[8];
> > -};
> > -
> > -/**
> > - * struct drm_i915_query_memory_regions
> > - *
> > - * The region info query enumerates all regions known to the driver by filling
> > - * in an array of struct drm_i915_memory_region_info structures.
> > - *
> > - * Example for getting the list of supported regions:
> > - *
> > - * .. code-block:: C
> > - *
> > - *	struct drm_i915_query_memory_regions *info;
> > - *	struct drm_i915_query_item item = {
> > - *		.query_id = DRM_I915_QUERY_MEMORY_REGIONS;
> > - *	};
> > - *	struct drm_i915_query query = {
> > - *		.num_items = 1,
> > - *		.items_ptr = (uintptr_t)&item,
> > - *	};
> > - *	int err, i;
> > - *
> > - *	// First query the size of the blob we need, this needs to be large
> > - *	// enough to hold our array of regions. The kernel will fill out the
> > - *	// item.length for us, which is the number of bytes we need.
> > - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> > - *	if (err) ...
> > - *
> > - *	info = calloc(1, item.length);
> > - *	// Now that we allocated the required number of bytes, we call the ioctl
> > - *	// again, this time with the data_ptr pointing to our newly allocated
> > - *	// blob, which the kernel can then populate with the all the region info.
> > - *	item.data_ptr = (uintptr_t)&info,
> > - *
> > - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> > - *	if (err) ...
> > - *
> > - *	// We can now access each region in the array
> > - *	for (i = 0; i < info->num_regions; i++) {
> > - *		struct drm_i915_memory_region_info mr = info->regions[i];
> > - *		u16 class = mr.region.class;
> > - *		u16 instance = mr.region.instance;
> > - *
> > - *		....
> > - *	}
> > - *
> > - *	free(info);
> > - */
> > -struct drm_i915_query_memory_regions {
> > -	/** @num_regions: Number of supported regions */
> > -	__u32 num_regions;
> > -
> > -	/** @rsvd: MBZ */
> > -	__u32 rsvd[3];
> > -
> > -	/** @regions: Info about each supported region */
> > -	struct drm_i915_memory_region_info regions[];
> > -};
> > -
> > -#define DRM_I915_GEM_CREATE_EXT		0xdeadbeaf
> > -#define DRM_IOCTL_I915_GEM_CREATE_EXT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext)
> > -
> > -/**
> > - * struct drm_i915_gem_create_ext - Existing gem_create behaviour, with added
> > - * extension support using struct i915_user_extension.
> > - *
> > - * Note that in the future we want to have our buffer flags here, at least for
> > - * the stuff that is immutable. Previously we would have two ioctls, one to
> > - * create the object with gem_create, and another to apply various parameters,
> > - * however this creates some ambiguity for the params which are considered
> > - * immutable. Also in general we're phasing out the various SET/GET ioctls.
> > - */
> > -struct drm_i915_gem_create_ext {
> > -	/**
> > -	 * @size: Requested size for the object.
> > -	 *
> > -	 * The (page-aligned) allocated size for the object will be returned.
> > -	 *
> > -	 * Note that for some devices we have might have further minimum
> > -	 * page-size restrictions(larger than 4K), like for device local-memory.
> > -	 * However in general the final size here should always reflect any
> > -	 * rounding up, if for example using the I915_GEM_CREATE_EXT_MEMORY_REGIONS
> > -	 * extension to place the object in device local-memory.
> > -	 */
> > -	__u64 size;
> > -	/**
> > -	 * @handle: Returned handle for the object.
> > -	 *
> > -	 * Object handles are nonzero.
> > -	 */
> > -	__u32 handle;
> > -	/** @flags: MBZ */
> > -	__u32 flags;
> > -	/**
> > -	 * @extensions: The chain of extensions to apply to this object.
> > -	 *
> > -	 * This will be useful in the future when we need to support several
> > -	 * different extensions, and we need to apply more than one when
> > -	 * creating the object. See struct i915_user_extension.
> > -	 *
> > -	 * If we don't supply any extensions then we get the same old gem_create
> > -	 * behaviour.
> > -	 *
> > -	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
> > -	 * struct drm_i915_gem_create_ext_memory_regions.
> > -	 */
> > -#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
> > -	__u64 extensions;
> > -};
> > -
> > -/**
> > - * struct drm_i915_gem_create_ext_memory_regions - The
> > - * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
> > - *
> > - * Set the object with the desired set of placements/regions in priority
> > - * order. Each entry must be unique and supported by the device.
> > - *
> > - * This is provided as an array of struct drm_i915_gem_memory_class_instance, or
> > - * an equivalent layout of class:instance pair encodings. See struct
> > - * drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to
> > - * query the supported regions for a device.
> > - *
> > - * As an example, on discrete devices, if we wish to set the placement as
> > - * device local-memory we can do something like:
> > - *
> > - * .. code-block:: C
> > - *
> > - *	struct drm_i915_gem_memory_class_instance region_lmem = {
> > - *              .memory_class = I915_MEMORY_CLASS_DEVICE,
> > - *              .memory_instance = 0,
> > - *      };
> > - *      struct drm_i915_gem_create_ext_memory_regions regions = {
> > - *              .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS },
> > - *              .regions = (uintptr_t)&region_lmem,
> > - *              .num_regions = 1,
> > - *      };
> > - *      struct drm_i915_gem_create_ext create_ext = {
> > - *              .size = 16 * PAGE_SIZE,
> > - *              .extensions = (uintptr_t)&regions,
> > - *      };
> > - *
> > - *      int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
> > - *      if (err) ...
> > - *
> > - * At which point we get the object handle in &drm_i915_gem_create_ext.handle,
> > - * along with the final object size in &drm_i915_gem_create_ext.size, which
> > - * should account for any rounding up, if required.
> > - */
> > -struct drm_i915_gem_create_ext_memory_regions {
> > -	/** @base: Extension link. See struct i915_user_extension. */
> > -	struct i915_user_extension base;
> > -
> > -	/** @pad: MBZ */
> > -	__u32 pad;
> > -	/** @num_regions: Number of elements in the @regions array. */
> > -	__u32 num_regions;
> > -	/**
> > -	 * @regions: The regions/placements array.
> > -	 *
> > -	 * An array of struct drm_i915_gem_memory_class_instance.
> > -	 */
> > -	__u64 regions;
> > -};
> > diff --git a/Documentation/gpu/rfc/i915_gem_lmem.rst b/Documentation/gpu/rfc/i915_gem_lmem.rst
> > index 1d344c593018..675ba8620d66 100644
> > --- a/Documentation/gpu/rfc/i915_gem_lmem.rst
> > +++ b/Documentation/gpu/rfc/i915_gem_lmem.rst
> > @@ -48,7 +48,7 @@ particular instance, since we can have more than one per class.
> >  In the future we also want to expose more information which can further
> >  describe the capabilities of a region.
> >  
> > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> >          :functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
> >  
> >  GEM_CREATE_EXT
> > @@ -61,7 +61,7 @@ Side note: We also need to support PXP[1] in the near future, which is also
> >  applicable to integrated platforms, and adds its own gem_create_ext extension,
> >  which basically lets userspace mark a buffer as "protected".
> >  
> > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> >          :functions: drm_i915_gem_create_ext
> >  
> >  I915_GEM_CREATE_EXT_MEMORY_REGIONS
> > @@ -73,7 +73,7 @@ them each to use the class/instance encoding, as per the output of the regions
> >  query. Having the list in priority order will be useful in the future when
> >  placing an object, say during eviction.
> >  
> > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> >          :functions: drm_i915_gem_create_ext_memory_regions
> >  
> >  One fair criticism here is that this seems a little over-engineered[2]. If we
> > -- 
> > 2.26.3
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/doc/rfc: drop the i915_gem_lmem.h header
  2021-05-11 17:03 ` [Intel-gfx] " Matthew Auld
  (?)
  (?)
@ 2021-05-11 20:44 ` Patchwork
  -1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2021-05-11 20:44 UTC (permalink / raw)
  To: Matthew Auld; +Cc: intel-gfx

== Series Details ==

Series: drm/doc/rfc: drop the i915_gem_lmem.h header
URL   : https://patchwork.freedesktop.org/series/90040/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
098d9b88764e drm/doc/rfc: drop the i915_gem_lmem.h header
-:15: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#15: 
deleted file mode 100644

total: 0 errors, 1 warnings, 0 checks, 24 lines checked


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/doc/rfc: drop the i915_gem_lmem.h header
  2021-05-11 17:03 ` [Intel-gfx] " Matthew Auld
                   ` (2 preceding siblings ...)
  (?)
@ 2021-05-11 21:15 ` Patchwork
  -1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2021-05-11 21:15 UTC (permalink / raw)
  To: Matthew Auld; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 9352 bytes --]

== Series Details ==

Series: drm/doc/rfc: drop the i915_gem_lmem.h header
URL   : https://patchwork.freedesktop.org/series/90040/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10071 -> Patchwork_20103
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_20103 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_20103, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/index.html

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_20103:

### IGT changes ###

#### Possible regressions ####

  * igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
    - fi-elk-e7500:       [PASS][1] -> [FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-elk-e7500/igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-elk-e7500/igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a.html
    - fi-bsw-kefka:       [PASS][3] -> [FAIL][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-bsw-kefka/igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-bsw-kefka/igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a.html

  
Known issues
------------

  Here are the changes found in Patchwork_20103 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_fence@basic-await@vcs0:
    - fi-bsw-n3050:       [PASS][5] -> [FAIL][6] ([i915#3457]) +1 similar issue
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-bsw-n3050/igt@gem_exec_fence@basic-await@vcs0.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-bsw-n3050/igt@gem_exec_fence@basic-await@vcs0.html

  * igt@gem_exec_fence@basic-await@vecs0:
    - fi-glk-dsi:         [PASS][7] -> [FAIL][8] ([i915#3457])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-glk-dsi/igt@gem_exec_fence@basic-await@vecs0.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-glk-dsi/igt@gem_exec_fence@basic-await@vecs0.html

  * igt@gem_exec_fence@nb-await@vecs0:
    - fi-bsw-kefka:       [PASS][9] -> [FAIL][10] ([i915#3457]) +1 similar issue
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-bsw-kefka/igt@gem_exec_fence@nb-await@vecs0.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-bsw-kefka/igt@gem_exec_fence@nb-await@vecs0.html
    - fi-bsw-nick:        [PASS][11] -> [FAIL][12] ([i915#3457])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-bsw-nick/igt@gem_exec_fence@nb-await@vecs0.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-bsw-nick/igt@gem_exec_fence@nb-await@vecs0.html

  * igt@kms_frontbuffer_tracking@basic:
    - fi-icl-u2:          [PASS][13] -> [FAIL][14] ([i915#49])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-icl-u2/igt@kms_frontbuffer_tracking@basic.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-icl-u2/igt@kms_frontbuffer_tracking@basic.html

  
#### Possible fixes ####

  * igt@gem_exec_fence@nb-await@rcs0:
    - fi-bsw-nick:        [FAIL][15] ([i915#3457]) -> [PASS][16] +1 similar issue
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-bsw-nick/igt@gem_exec_fence@nb-await@rcs0.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-bsw-nick/igt@gem_exec_fence@nb-await@rcs0.html

  * igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence:
    - fi-ilk-650:         [FAIL][17] -> [PASS][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-ilk-650/igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-ilk-650/igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence.html
    - fi-bsw-kefka:       [FAIL][19] -> [PASS][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-bsw-kefka/igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-bsw-kefka/igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
    - fi-bwr-2160:        [FAIL][21] -> [PASS][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-bwr-2160/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-bwr-2160/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html

  
#### Warnings ####

  * igt@gem_exec_gttfill@basic:
    - fi-ilk-650:         [FAIL][23] -> [FAIL][24] ([i915#3457])
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-ilk-650/igt@gem_exec_gttfill@basic.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-ilk-650/igt@gem_exec_gttfill@basic.html

  * igt@i915_module_load@reload:
    - fi-elk-e7500:       [DMESG-FAIL][25] ([i915#3457]) -> [DMESG-WARN][26] ([i915#3457])
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-elk-e7500/igt@i915_module_load@reload.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-elk-e7500/igt@i915_module_load@reload.html

  * igt@i915_selftest@live@execlists:
    - fi-cfl-8109u:       [DMESG-FAIL][27] ([i915#3462]) -> [INCOMPLETE][28] ([i915#3462])
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-cfl-8109u/igt@i915_selftest@live@execlists.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-cfl-8109u/igt@i915_selftest@live@execlists.html
    - fi-icl-u2:          [INCOMPLETE][29] ([i915#2782] / [i915#3462]) -> [DMESG-FAIL][30] ([i915#3462])
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-icl-u2/igt@i915_selftest@live@execlists.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-icl-u2/igt@i915_selftest@live@execlists.html
    - fi-tgl-u2:          [INCOMPLETE][31] ([i915#3462]) -> [DMESG-FAIL][32] ([i915#3462])
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-tgl-u2/igt@i915_selftest@live@execlists.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-tgl-u2/igt@i915_selftest@live@execlists.html

  * igt@runner@aborted:
    - fi-kbl-x1275:       [FAIL][33] ([i915#1436] / [i915#3363]) -> [FAIL][34] ([i915#1436] / [i915#2426] / [i915#3363])
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-kbl-x1275/igt@runner@aborted.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-kbl-x1275/igt@runner@aborted.html
    - fi-cfl-8700k:       [FAIL][35] ([i915#3363]) -> [FAIL][36] ([i915#2426] / [i915#3363])
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-cfl-8700k/igt@runner@aborted.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-cfl-8700k/igt@runner@aborted.html
    - fi-cfl-8109u:       [FAIL][37] ([i915#2426] / [i915#3363]) -> [FAIL][38] ([i915#3363])
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-cfl-8109u/igt@runner@aborted.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-cfl-8109u/igt@runner@aborted.html
    - fi-icl-u2:          [FAIL][39] ([i915#2782] / [i915#3363]) -> [FAIL][40] ([i915#2426] / [i915#2782] / [i915#3363])
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10071/fi-icl-u2/igt@runner@aborted.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/fi-icl-u2/igt@runner@aborted.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
  [i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
  [i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
  [i915#2782]: https://gitlab.freedesktop.org/drm/intel/issues/2782
  [i915#2932]: https://gitlab.freedesktop.org/drm/intel/issues/2932
  [i915#2966]: https://gitlab.freedesktop.org/drm/intel/issues/2966
  [i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363
  [i915#3457]: https://gitlab.freedesktop.org/drm/intel/issues/3457
  [i915#3462]: https://gitlab.freedesktop.org/drm/intel/issues/3462
  [i915#49]: https://gitlab.freedesktop.org/drm/intel/issues/49


Participating hosts (46 -> 41)
------------------------------

  Missing    (5): fi-rkl-11500t fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-bdw-samus 


Build changes
-------------

  * Linux: CI_DRM_10071 -> Patchwork_20103

  CI-20190529: 20190529
  CI_DRM_10071: 77fc6f68ed347b0a4c6969f6adac70026d5b1449 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_6082: 355269577baef0c5d8114e8851acaeac657e4fe6 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_20103: 098d9b88764e8a9f93c9f06842365d544b71846e @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

098d9b88764e drm/doc/rfc: drop the i915_gem_lmem.h header

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20103/index.html

[-- Attachment #1.2: Type: text/html, Size: 11869 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/doc/rfc: drop the i915_gem_lmem.h header
  2021-05-11 17:29     ` [Intel-gfx] " Daniel Vetter
@ 2021-05-12  7:38       ` Matthew Auld
  -1 siblings, 0 replies; 12+ messages in thread
From: Matthew Auld @ 2021-05-12  7:38 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Daniel Vetter, intel-gfx, dri-devel

On 11/05/2021 18:29, Daniel Vetter wrote:
> On Tue, May 11, 2021 at 07:28:08PM +0200, Daniel Vetter wrote:
>> On Tue, May 11, 2021 at 06:03:56PM +0100, Matthew Auld wrote:
>>> The proper headers have now landed in include/uapi/drm/i915_drm.h, so we
>>> can drop i915_gem_lmem.h and instead just reference the real headers for
>>> pulling in the kernel doc.
>>>
>>> Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>>
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>
>> I guess we need to have a note that when we land the pciid for dg1 to move
>> all the remaining bits over to real docs and delete the i915 lmem rfc. But
>> everything in due time.
> 
> One thing I forgot: The include stanza will I think result in the
> explicitly included functions not showing up in the normal driver uapi
> docs. Which I think is fine while we settle all this. Or do I get this
> wrong?

It all looks ok in the rendered html, but yeah the explicitly inlcuded 
functions/structs don't seem to link back to driver-uapi, and instead 
just link to the "local version" in i915_gem_lmem.

> -Daniel
> 
>> -Daniel
>>
>>> ---
>>>   Documentation/gpu/rfc/i915_gem_lmem.h   | 237 ------------------------
>>>   Documentation/gpu/rfc/i915_gem_lmem.rst |   6 +-
>>>   2 files changed, 3 insertions(+), 240 deletions(-)
>>>   delete mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h
>>>
>>> diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
>>> deleted file mode 100644
>>> index d9c61bea0556..000000000000
>>> --- a/Documentation/gpu/rfc/i915_gem_lmem.h
>>> +++ /dev/null
>>> @@ -1,237 +0,0 @@
>>> -/**
>>> - * enum drm_i915_gem_memory_class - Supported memory classes
>>> - */
>>> -enum drm_i915_gem_memory_class {
>>> -	/** @I915_MEMORY_CLASS_SYSTEM: System memory */
>>> -	I915_MEMORY_CLASS_SYSTEM = 0,
>>> -	/** @I915_MEMORY_CLASS_DEVICE: Device local-memory */
>>> -	I915_MEMORY_CLASS_DEVICE,
>>> -};
>>> -
>>> -/**
>>> - * struct drm_i915_gem_memory_class_instance - Identify particular memory region
>>> - */
>>> -struct drm_i915_gem_memory_class_instance {
>>> -	/** @memory_class: See enum drm_i915_gem_memory_class */
>>> -	__u16 memory_class;
>>> -
>>> -	/** @memory_instance: Which instance */
>>> -	__u16 memory_instance;
>>> -};
>>> -
>>> -/**
>>> - * struct drm_i915_memory_region_info - Describes one region as known to the
>>> - * driver.
>>> - *
>>> - * Note that we reserve some stuff here for potential future work. As an example
>>> - * we might want expose the capabilities for a given region, which could include
>>> - * things like if the region is CPU mappable/accessible, what are the supported
>>> - * mapping types etc.
>>> - *
>>> - * Note that to extend struct drm_i915_memory_region_info and struct
>>> - * drm_i915_query_memory_regions in the future the plan is to do the following:
>>> - *
>>> - * .. code-block:: C
>>> - *
>>> - *	struct drm_i915_memory_region_info {
>>> - *		struct drm_i915_gem_memory_class_instance region;
>>> - *		union {
>>> - *			__u32 rsvd0;
>>> - *			__u32 new_thing1;
>>> - *		};
>>> - *		...
>>> - *		union {
>>> - *			__u64 rsvd1[8];
>>> - *			struct {
>>> - *				__u64 new_thing2;
>>> - *				__u64 new_thing3;
>>> - *				...
>>> - *			};
>>> - *		};
>>> - *	};
>>> - *
>>> - * With this things should remain source compatible between versions for
>>> - * userspace, even as we add new fields.
>>> - *
>>> - * Note this is using both struct drm_i915_query_item and struct drm_i915_query.
>>> - * For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS
>>> - * at &drm_i915_query_item.query_id.
>>> - */
>>> -struct drm_i915_memory_region_info {
>>> -	/** @region: The class:instance pair encoding */
>>> -	struct drm_i915_gem_memory_class_instance region;
>>> -
>>> -	/** @rsvd0: MBZ */
>>> -	__u32 rsvd0;
>>> -
>>> -	/** @probed_size: Memory probed by the driver (-1 = unknown) */
>>> -	__u64 probed_size;
>>> -
>>> -	/** @unallocated_size: Estimate of memory remaining (-1 = unknown) */
>>> -	__u64 unallocated_size;
>>> -
>>> -	/** @rsvd1: MBZ */
>>> -	__u64 rsvd1[8];
>>> -};
>>> -
>>> -/**
>>> - * struct drm_i915_query_memory_regions
>>> - *
>>> - * The region info query enumerates all regions known to the driver by filling
>>> - * in an array of struct drm_i915_memory_region_info structures.
>>> - *
>>> - * Example for getting the list of supported regions:
>>> - *
>>> - * .. code-block:: C
>>> - *
>>> - *	struct drm_i915_query_memory_regions *info;
>>> - *	struct drm_i915_query_item item = {
>>> - *		.query_id = DRM_I915_QUERY_MEMORY_REGIONS;
>>> - *	};
>>> - *	struct drm_i915_query query = {
>>> - *		.num_items = 1,
>>> - *		.items_ptr = (uintptr_t)&item,
>>> - *	};
>>> - *	int err, i;
>>> - *
>>> - *	// First query the size of the blob we need, this needs to be large
>>> - *	// enough to hold our array of regions. The kernel will fill out the
>>> - *	// item.length for us, which is the number of bytes we need.
>>> - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
>>> - *	if (err) ...
>>> - *
>>> - *	info = calloc(1, item.length);
>>> - *	// Now that we allocated the required number of bytes, we call the ioctl
>>> - *	// again, this time with the data_ptr pointing to our newly allocated
>>> - *	// blob, which the kernel can then populate with the all the region info.
>>> - *	item.data_ptr = (uintptr_t)&info,
>>> - *
>>> - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
>>> - *	if (err) ...
>>> - *
>>> - *	// We can now access each region in the array
>>> - *	for (i = 0; i < info->num_regions; i++) {
>>> - *		struct drm_i915_memory_region_info mr = info->regions[i];
>>> - *		u16 class = mr.region.class;
>>> - *		u16 instance = mr.region.instance;
>>> - *
>>> - *		....
>>> - *	}
>>> - *
>>> - *	free(info);
>>> - */
>>> -struct drm_i915_query_memory_regions {
>>> -	/** @num_regions: Number of supported regions */
>>> -	__u32 num_regions;
>>> -
>>> -	/** @rsvd: MBZ */
>>> -	__u32 rsvd[3];
>>> -
>>> -	/** @regions: Info about each supported region */
>>> -	struct drm_i915_memory_region_info regions[];
>>> -};
>>> -
>>> -#define DRM_I915_GEM_CREATE_EXT		0xdeadbeaf
>>> -#define DRM_IOCTL_I915_GEM_CREATE_EXT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext)
>>> -
>>> -/**
>>> - * struct drm_i915_gem_create_ext - Existing gem_create behaviour, with added
>>> - * extension support using struct i915_user_extension.
>>> - *
>>> - * Note that in the future we want to have our buffer flags here, at least for
>>> - * the stuff that is immutable. Previously we would have two ioctls, one to
>>> - * create the object with gem_create, and another to apply various parameters,
>>> - * however this creates some ambiguity for the params which are considered
>>> - * immutable. Also in general we're phasing out the various SET/GET ioctls.
>>> - */
>>> -struct drm_i915_gem_create_ext {
>>> -	/**
>>> -	 * @size: Requested size for the object.
>>> -	 *
>>> -	 * The (page-aligned) allocated size for the object will be returned.
>>> -	 *
>>> -	 * Note that for some devices we have might have further minimum
>>> -	 * page-size restrictions(larger than 4K), like for device local-memory.
>>> -	 * However in general the final size here should always reflect any
>>> -	 * rounding up, if for example using the I915_GEM_CREATE_EXT_MEMORY_REGIONS
>>> -	 * extension to place the object in device local-memory.
>>> -	 */
>>> -	__u64 size;
>>> -	/**
>>> -	 * @handle: Returned handle for the object.
>>> -	 *
>>> -	 * Object handles are nonzero.
>>> -	 */
>>> -	__u32 handle;
>>> -	/** @flags: MBZ */
>>> -	__u32 flags;
>>> -	/**
>>> -	 * @extensions: The chain of extensions to apply to this object.
>>> -	 *
>>> -	 * This will be useful in the future when we need to support several
>>> -	 * different extensions, and we need to apply more than one when
>>> -	 * creating the object. See struct i915_user_extension.
>>> -	 *
>>> -	 * If we don't supply any extensions then we get the same old gem_create
>>> -	 * behaviour.
>>> -	 *
>>> -	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
>>> -	 * struct drm_i915_gem_create_ext_memory_regions.
>>> -	 */
>>> -#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
>>> -	__u64 extensions;
>>> -};
>>> -
>>> -/**
>>> - * struct drm_i915_gem_create_ext_memory_regions - The
>>> - * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
>>> - *
>>> - * Set the object with the desired set of placements/regions in priority
>>> - * order. Each entry must be unique and supported by the device.
>>> - *
>>> - * This is provided as an array of struct drm_i915_gem_memory_class_instance, or
>>> - * an equivalent layout of class:instance pair encodings. See struct
>>> - * drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to
>>> - * query the supported regions for a device.
>>> - *
>>> - * As an example, on discrete devices, if we wish to set the placement as
>>> - * device local-memory we can do something like:
>>> - *
>>> - * .. code-block:: C
>>> - *
>>> - *	struct drm_i915_gem_memory_class_instance region_lmem = {
>>> - *              .memory_class = I915_MEMORY_CLASS_DEVICE,
>>> - *              .memory_instance = 0,
>>> - *      };
>>> - *      struct drm_i915_gem_create_ext_memory_regions regions = {
>>> - *              .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS },
>>> - *              .regions = (uintptr_t)&region_lmem,
>>> - *              .num_regions = 1,
>>> - *      };
>>> - *      struct drm_i915_gem_create_ext create_ext = {
>>> - *              .size = 16 * PAGE_SIZE,
>>> - *              .extensions = (uintptr_t)&regions,
>>> - *      };
>>> - *
>>> - *      int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
>>> - *      if (err) ...
>>> - *
>>> - * At which point we get the object handle in &drm_i915_gem_create_ext.handle,
>>> - * along with the final object size in &drm_i915_gem_create_ext.size, which
>>> - * should account for any rounding up, if required.
>>> - */
>>> -struct drm_i915_gem_create_ext_memory_regions {
>>> -	/** @base: Extension link. See struct i915_user_extension. */
>>> -	struct i915_user_extension base;
>>> -
>>> -	/** @pad: MBZ */
>>> -	__u32 pad;
>>> -	/** @num_regions: Number of elements in the @regions array. */
>>> -	__u32 num_regions;
>>> -	/**
>>> -	 * @regions: The regions/placements array.
>>> -	 *
>>> -	 * An array of struct drm_i915_gem_memory_class_instance.
>>> -	 */
>>> -	__u64 regions;
>>> -};
>>> diff --git a/Documentation/gpu/rfc/i915_gem_lmem.rst b/Documentation/gpu/rfc/i915_gem_lmem.rst
>>> index 1d344c593018..675ba8620d66 100644
>>> --- a/Documentation/gpu/rfc/i915_gem_lmem.rst
>>> +++ b/Documentation/gpu/rfc/i915_gem_lmem.rst
>>> @@ -48,7 +48,7 @@ particular instance, since we can have more than one per class.
>>>   In the future we also want to expose more information which can further
>>>   describe the capabilities of a region.
>>>   
>>> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
>>> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>>>           :functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
>>>   
>>>   GEM_CREATE_EXT
>>> @@ -61,7 +61,7 @@ Side note: We also need to support PXP[1] in the near future, which is also
>>>   applicable to integrated platforms, and adds its own gem_create_ext extension,
>>>   which basically lets userspace mark a buffer as "protected".
>>>   
>>> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
>>> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>>>           :functions: drm_i915_gem_create_ext
>>>   
>>>   I915_GEM_CREATE_EXT_MEMORY_REGIONS
>>> @@ -73,7 +73,7 @@ them each to use the class/instance encoding, as per the output of the regions
>>>   query. Having the list in priority order will be useful in the future when
>>>   placing an object, say during eviction.
>>>   
>>> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
>>> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>>>           :functions: drm_i915_gem_create_ext_memory_regions
>>>   
>>>   One fair criticism here is that this seems a little over-engineered[2]. If we
>>> -- 
>>> 2.26.3
>>>
>>
>> -- 
>> Daniel Vetter
>> Software Engineer, Intel Corporation
>> http://blog.ffwll.ch
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/doc/rfc: drop the i915_gem_lmem.h header
@ 2021-05-12  7:38       ` Matthew Auld
  0 siblings, 0 replies; 12+ messages in thread
From: Matthew Auld @ 2021-05-12  7:38 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Daniel Vetter, intel-gfx, dri-devel

On 11/05/2021 18:29, Daniel Vetter wrote:
> On Tue, May 11, 2021 at 07:28:08PM +0200, Daniel Vetter wrote:
>> On Tue, May 11, 2021 at 06:03:56PM +0100, Matthew Auld wrote:
>>> The proper headers have now landed in include/uapi/drm/i915_drm.h, so we
>>> can drop i915_gem_lmem.h and instead just reference the real headers for
>>> pulling in the kernel doc.
>>>
>>> Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>>
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>
>> I guess we need to have a note that when we land the pciid for dg1 to move
>> all the remaining bits over to real docs and delete the i915 lmem rfc. But
>> everything in due time.
> 
> One thing I forgot: The include stanza will I think result in the
> explicitly included functions not showing up in the normal driver uapi
> docs. Which I think is fine while we settle all this. Or do I get this
> wrong?

It all looks ok in the rendered html, but yeah the explicitly inlcuded 
functions/structs don't seem to link back to driver-uapi, and instead 
just link to the "local version" in i915_gem_lmem.

> -Daniel
> 
>> -Daniel
>>
>>> ---
>>>   Documentation/gpu/rfc/i915_gem_lmem.h   | 237 ------------------------
>>>   Documentation/gpu/rfc/i915_gem_lmem.rst |   6 +-
>>>   2 files changed, 3 insertions(+), 240 deletions(-)
>>>   delete mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h
>>>
>>> diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
>>> deleted file mode 100644
>>> index d9c61bea0556..000000000000
>>> --- a/Documentation/gpu/rfc/i915_gem_lmem.h
>>> +++ /dev/null
>>> @@ -1,237 +0,0 @@
>>> -/**
>>> - * enum drm_i915_gem_memory_class - Supported memory classes
>>> - */
>>> -enum drm_i915_gem_memory_class {
>>> -	/** @I915_MEMORY_CLASS_SYSTEM: System memory */
>>> -	I915_MEMORY_CLASS_SYSTEM = 0,
>>> -	/** @I915_MEMORY_CLASS_DEVICE: Device local-memory */
>>> -	I915_MEMORY_CLASS_DEVICE,
>>> -};
>>> -
>>> -/**
>>> - * struct drm_i915_gem_memory_class_instance - Identify particular memory region
>>> - */
>>> -struct drm_i915_gem_memory_class_instance {
>>> -	/** @memory_class: See enum drm_i915_gem_memory_class */
>>> -	__u16 memory_class;
>>> -
>>> -	/** @memory_instance: Which instance */
>>> -	__u16 memory_instance;
>>> -};
>>> -
>>> -/**
>>> - * struct drm_i915_memory_region_info - Describes one region as known to the
>>> - * driver.
>>> - *
>>> - * Note that we reserve some stuff here for potential future work. As an example
>>> - * we might want expose the capabilities for a given region, which could include
>>> - * things like if the region is CPU mappable/accessible, what are the supported
>>> - * mapping types etc.
>>> - *
>>> - * Note that to extend struct drm_i915_memory_region_info and struct
>>> - * drm_i915_query_memory_regions in the future the plan is to do the following:
>>> - *
>>> - * .. code-block:: C
>>> - *
>>> - *	struct drm_i915_memory_region_info {
>>> - *		struct drm_i915_gem_memory_class_instance region;
>>> - *		union {
>>> - *			__u32 rsvd0;
>>> - *			__u32 new_thing1;
>>> - *		};
>>> - *		...
>>> - *		union {
>>> - *			__u64 rsvd1[8];
>>> - *			struct {
>>> - *				__u64 new_thing2;
>>> - *				__u64 new_thing3;
>>> - *				...
>>> - *			};
>>> - *		};
>>> - *	};
>>> - *
>>> - * With this things should remain source compatible between versions for
>>> - * userspace, even as we add new fields.
>>> - *
>>> - * Note this is using both struct drm_i915_query_item and struct drm_i915_query.
>>> - * For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS
>>> - * at &drm_i915_query_item.query_id.
>>> - */
>>> -struct drm_i915_memory_region_info {
>>> -	/** @region: The class:instance pair encoding */
>>> -	struct drm_i915_gem_memory_class_instance region;
>>> -
>>> -	/** @rsvd0: MBZ */
>>> -	__u32 rsvd0;
>>> -
>>> -	/** @probed_size: Memory probed by the driver (-1 = unknown) */
>>> -	__u64 probed_size;
>>> -
>>> -	/** @unallocated_size: Estimate of memory remaining (-1 = unknown) */
>>> -	__u64 unallocated_size;
>>> -
>>> -	/** @rsvd1: MBZ */
>>> -	__u64 rsvd1[8];
>>> -};
>>> -
>>> -/**
>>> - * struct drm_i915_query_memory_regions
>>> - *
>>> - * The region info query enumerates all regions known to the driver by filling
>>> - * in an array of struct drm_i915_memory_region_info structures.
>>> - *
>>> - * Example for getting the list of supported regions:
>>> - *
>>> - * .. code-block:: C
>>> - *
>>> - *	struct drm_i915_query_memory_regions *info;
>>> - *	struct drm_i915_query_item item = {
>>> - *		.query_id = DRM_I915_QUERY_MEMORY_REGIONS;
>>> - *	};
>>> - *	struct drm_i915_query query = {
>>> - *		.num_items = 1,
>>> - *		.items_ptr = (uintptr_t)&item,
>>> - *	};
>>> - *	int err, i;
>>> - *
>>> - *	// First query the size of the blob we need, this needs to be large
>>> - *	// enough to hold our array of regions. The kernel will fill out the
>>> - *	// item.length for us, which is the number of bytes we need.
>>> - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
>>> - *	if (err) ...
>>> - *
>>> - *	info = calloc(1, item.length);
>>> - *	// Now that we allocated the required number of bytes, we call the ioctl
>>> - *	// again, this time with the data_ptr pointing to our newly allocated
>>> - *	// blob, which the kernel can then populate with the all the region info.
>>> - *	item.data_ptr = (uintptr_t)&info,
>>> - *
>>> - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
>>> - *	if (err) ...
>>> - *
>>> - *	// We can now access each region in the array
>>> - *	for (i = 0; i < info->num_regions; i++) {
>>> - *		struct drm_i915_memory_region_info mr = info->regions[i];
>>> - *		u16 class = mr.region.class;
>>> - *		u16 instance = mr.region.instance;
>>> - *
>>> - *		....
>>> - *	}
>>> - *
>>> - *	free(info);
>>> - */
>>> -struct drm_i915_query_memory_regions {
>>> -	/** @num_regions: Number of supported regions */
>>> -	__u32 num_regions;
>>> -
>>> -	/** @rsvd: MBZ */
>>> -	__u32 rsvd[3];
>>> -
>>> -	/** @regions: Info about each supported region */
>>> -	struct drm_i915_memory_region_info regions[];
>>> -};
>>> -
>>> -#define DRM_I915_GEM_CREATE_EXT		0xdeadbeaf
>>> -#define DRM_IOCTL_I915_GEM_CREATE_EXT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext)
>>> -
>>> -/**
>>> - * struct drm_i915_gem_create_ext - Existing gem_create behaviour, with added
>>> - * extension support using struct i915_user_extension.
>>> - *
>>> - * Note that in the future we want to have our buffer flags here, at least for
>>> - * the stuff that is immutable. Previously we would have two ioctls, one to
>>> - * create the object with gem_create, and another to apply various parameters,
>>> - * however this creates some ambiguity for the params which are considered
>>> - * immutable. Also in general we're phasing out the various SET/GET ioctls.
>>> - */
>>> -struct drm_i915_gem_create_ext {
>>> -	/**
>>> -	 * @size: Requested size for the object.
>>> -	 *
>>> -	 * The (page-aligned) allocated size for the object will be returned.
>>> -	 *
>>> -	 * Note that for some devices we have might have further minimum
>>> -	 * page-size restrictions(larger than 4K), like for device local-memory.
>>> -	 * However in general the final size here should always reflect any
>>> -	 * rounding up, if for example using the I915_GEM_CREATE_EXT_MEMORY_REGIONS
>>> -	 * extension to place the object in device local-memory.
>>> -	 */
>>> -	__u64 size;
>>> -	/**
>>> -	 * @handle: Returned handle for the object.
>>> -	 *
>>> -	 * Object handles are nonzero.
>>> -	 */
>>> -	__u32 handle;
>>> -	/** @flags: MBZ */
>>> -	__u32 flags;
>>> -	/**
>>> -	 * @extensions: The chain of extensions to apply to this object.
>>> -	 *
>>> -	 * This will be useful in the future when we need to support several
>>> -	 * different extensions, and we need to apply more than one when
>>> -	 * creating the object. See struct i915_user_extension.
>>> -	 *
>>> -	 * If we don't supply any extensions then we get the same old gem_create
>>> -	 * behaviour.
>>> -	 *
>>> -	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
>>> -	 * struct drm_i915_gem_create_ext_memory_regions.
>>> -	 */
>>> -#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
>>> -	__u64 extensions;
>>> -};
>>> -
>>> -/**
>>> - * struct drm_i915_gem_create_ext_memory_regions - The
>>> - * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
>>> - *
>>> - * Set the object with the desired set of placements/regions in priority
>>> - * order. Each entry must be unique and supported by the device.
>>> - *
>>> - * This is provided as an array of struct drm_i915_gem_memory_class_instance, or
>>> - * an equivalent layout of class:instance pair encodings. See struct
>>> - * drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to
>>> - * query the supported regions for a device.
>>> - *
>>> - * As an example, on discrete devices, if we wish to set the placement as
>>> - * device local-memory we can do something like:
>>> - *
>>> - * .. code-block:: C
>>> - *
>>> - *	struct drm_i915_gem_memory_class_instance region_lmem = {
>>> - *              .memory_class = I915_MEMORY_CLASS_DEVICE,
>>> - *              .memory_instance = 0,
>>> - *      };
>>> - *      struct drm_i915_gem_create_ext_memory_regions regions = {
>>> - *              .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS },
>>> - *              .regions = (uintptr_t)&region_lmem,
>>> - *              .num_regions = 1,
>>> - *      };
>>> - *      struct drm_i915_gem_create_ext create_ext = {
>>> - *              .size = 16 * PAGE_SIZE,
>>> - *              .extensions = (uintptr_t)&regions,
>>> - *      };
>>> - *
>>> - *      int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
>>> - *      if (err) ...
>>> - *
>>> - * At which point we get the object handle in &drm_i915_gem_create_ext.handle,
>>> - * along with the final object size in &drm_i915_gem_create_ext.size, which
>>> - * should account for any rounding up, if required.
>>> - */
>>> -struct drm_i915_gem_create_ext_memory_regions {
>>> -	/** @base: Extension link. See struct i915_user_extension. */
>>> -	struct i915_user_extension base;
>>> -
>>> -	/** @pad: MBZ */
>>> -	__u32 pad;
>>> -	/** @num_regions: Number of elements in the @regions array. */
>>> -	__u32 num_regions;
>>> -	/**
>>> -	 * @regions: The regions/placements array.
>>> -	 *
>>> -	 * An array of struct drm_i915_gem_memory_class_instance.
>>> -	 */
>>> -	__u64 regions;
>>> -};
>>> diff --git a/Documentation/gpu/rfc/i915_gem_lmem.rst b/Documentation/gpu/rfc/i915_gem_lmem.rst
>>> index 1d344c593018..675ba8620d66 100644
>>> --- a/Documentation/gpu/rfc/i915_gem_lmem.rst
>>> +++ b/Documentation/gpu/rfc/i915_gem_lmem.rst
>>> @@ -48,7 +48,7 @@ particular instance, since we can have more than one per class.
>>>   In the future we also want to expose more information which can further
>>>   describe the capabilities of a region.
>>>   
>>> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
>>> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>>>           :functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
>>>   
>>>   GEM_CREATE_EXT
>>> @@ -61,7 +61,7 @@ Side note: We also need to support PXP[1] in the near future, which is also
>>>   applicable to integrated platforms, and adds its own gem_create_ext extension,
>>>   which basically lets userspace mark a buffer as "protected".
>>>   
>>> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
>>> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>>>           :functions: drm_i915_gem_create_ext
>>>   
>>>   I915_GEM_CREATE_EXT_MEMORY_REGIONS
>>> @@ -73,7 +73,7 @@ them each to use the class/instance encoding, as per the output of the regions
>>>   query. Having the list in priority order will be useful in the future when
>>>   placing an object, say during eviction.
>>>   
>>> -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
>>> +.. kernel-doc:: include/uapi/drm/i915_drm.h
>>>           :functions: drm_i915_gem_create_ext_memory_regions
>>>   
>>>   One fair criticism here is that this seems a little over-engineered[2]. If we
>>> -- 
>>> 2.26.3
>>>
>>
>> -- 
>> Daniel Vetter
>> Software Engineer, Intel Corporation
>> http://blog.ffwll.ch
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/doc/rfc: drop the i915_gem_lmem.h header
  2021-05-12  7:38       ` [Intel-gfx] " Matthew Auld
@ 2021-05-12  8:08         ` Daniel Vetter
  -1 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2021-05-12  8:08 UTC (permalink / raw)
  To: Matthew Auld; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Wed, May 12, 2021 at 08:38:55AM +0100, Matthew Auld wrote:
> On 11/05/2021 18:29, Daniel Vetter wrote:
> > On Tue, May 11, 2021 at 07:28:08PM +0200, Daniel Vetter wrote:
> > > On Tue, May 11, 2021 at 06:03:56PM +0100, Matthew Auld wrote:
> > > > The proper headers have now landed in include/uapi/drm/i915_drm.h, so we
> > > > can drop i915_gem_lmem.h and instead just reference the real headers for
> > > > pulling in the kernel doc.
> > > > 
> > > > Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > > Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> > > 
> > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > 
> > > I guess we need to have a note that when we land the pciid for dg1 to move
> > > all the remaining bits over to real docs and delete the i915 lmem rfc. But
> > > everything in due time.
> > 
> > One thing I forgot: The include stanza will I think result in the
> > explicitly included functions not showing up in the normal driver uapi
> > docs. Which I think is fine while we settle all this. Or do I get this
> > wrong?
> 
> It all looks ok in the rendered html, but yeah the explicitly inlcuded
> functions/structs don't seem to link back to driver-uapi, and instead just
> link to the "local version" in i915_gem_lmem.

I think that's all ok. Thanks for checking.
-Daniel
> 
> > -Daniel
> > 
> > > -Daniel
> > > 
> > > > ---
> > > >   Documentation/gpu/rfc/i915_gem_lmem.h   | 237 ------------------------
> > > >   Documentation/gpu/rfc/i915_gem_lmem.rst |   6 +-
> > > >   2 files changed, 3 insertions(+), 240 deletions(-)
> > > >   delete mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h
> > > > 
> > > > diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
> > > > deleted file mode 100644
> > > > index d9c61bea0556..000000000000
> > > > --- a/Documentation/gpu/rfc/i915_gem_lmem.h
> > > > +++ /dev/null
> > > > @@ -1,237 +0,0 @@
> > > > -/**
> > > > - * enum drm_i915_gem_memory_class - Supported memory classes
> > > > - */
> > > > -enum drm_i915_gem_memory_class {
> > > > -	/** @I915_MEMORY_CLASS_SYSTEM: System memory */
> > > > -	I915_MEMORY_CLASS_SYSTEM = 0,
> > > > -	/** @I915_MEMORY_CLASS_DEVICE: Device local-memory */
> > > > -	I915_MEMORY_CLASS_DEVICE,
> > > > -};
> > > > -
> > > > -/**
> > > > - * struct drm_i915_gem_memory_class_instance - Identify particular memory region
> > > > - */
> > > > -struct drm_i915_gem_memory_class_instance {
> > > > -	/** @memory_class: See enum drm_i915_gem_memory_class */
> > > > -	__u16 memory_class;
> > > > -
> > > > -	/** @memory_instance: Which instance */
> > > > -	__u16 memory_instance;
> > > > -};
> > > > -
> > > > -/**
> > > > - * struct drm_i915_memory_region_info - Describes one region as known to the
> > > > - * driver.
> > > > - *
> > > > - * Note that we reserve some stuff here for potential future work. As an example
> > > > - * we might want expose the capabilities for a given region, which could include
> > > > - * things like if the region is CPU mappable/accessible, what are the supported
> > > > - * mapping types etc.
> > > > - *
> > > > - * Note that to extend struct drm_i915_memory_region_info and struct
> > > > - * drm_i915_query_memory_regions in the future the plan is to do the following:
> > > > - *
> > > > - * .. code-block:: C
> > > > - *
> > > > - *	struct drm_i915_memory_region_info {
> > > > - *		struct drm_i915_gem_memory_class_instance region;
> > > > - *		union {
> > > > - *			__u32 rsvd0;
> > > > - *			__u32 new_thing1;
> > > > - *		};
> > > > - *		...
> > > > - *		union {
> > > > - *			__u64 rsvd1[8];
> > > > - *			struct {
> > > > - *				__u64 new_thing2;
> > > > - *				__u64 new_thing3;
> > > > - *				...
> > > > - *			};
> > > > - *		};
> > > > - *	};
> > > > - *
> > > > - * With this things should remain source compatible between versions for
> > > > - * userspace, even as we add new fields.
> > > > - *
> > > > - * Note this is using both struct drm_i915_query_item and struct drm_i915_query.
> > > > - * For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS
> > > > - * at &drm_i915_query_item.query_id.
> > > > - */
> > > > -struct drm_i915_memory_region_info {
> > > > -	/** @region: The class:instance pair encoding */
> > > > -	struct drm_i915_gem_memory_class_instance region;
> > > > -
> > > > -	/** @rsvd0: MBZ */
> > > > -	__u32 rsvd0;
> > > > -
> > > > -	/** @probed_size: Memory probed by the driver (-1 = unknown) */
> > > > -	__u64 probed_size;
> > > > -
> > > > -	/** @unallocated_size: Estimate of memory remaining (-1 = unknown) */
> > > > -	__u64 unallocated_size;
> > > > -
> > > > -	/** @rsvd1: MBZ */
> > > > -	__u64 rsvd1[8];
> > > > -};
> > > > -
> > > > -/**
> > > > - * struct drm_i915_query_memory_regions
> > > > - *
> > > > - * The region info query enumerates all regions known to the driver by filling
> > > > - * in an array of struct drm_i915_memory_region_info structures.
> > > > - *
> > > > - * Example for getting the list of supported regions:
> > > > - *
> > > > - * .. code-block:: C
> > > > - *
> > > > - *	struct drm_i915_query_memory_regions *info;
> > > > - *	struct drm_i915_query_item item = {
> > > > - *		.query_id = DRM_I915_QUERY_MEMORY_REGIONS;
> > > > - *	};
> > > > - *	struct drm_i915_query query = {
> > > > - *		.num_items = 1,
> > > > - *		.items_ptr = (uintptr_t)&item,
> > > > - *	};
> > > > - *	int err, i;
> > > > - *
> > > > - *	// First query the size of the blob we need, this needs to be large
> > > > - *	// enough to hold our array of regions. The kernel will fill out the
> > > > - *	// item.length for us, which is the number of bytes we need.
> > > > - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> > > > - *	if (err) ...
> > > > - *
> > > > - *	info = calloc(1, item.length);
> > > > - *	// Now that we allocated the required number of bytes, we call the ioctl
> > > > - *	// again, this time with the data_ptr pointing to our newly allocated
> > > > - *	// blob, which the kernel can then populate with the all the region info.
> > > > - *	item.data_ptr = (uintptr_t)&info,
> > > > - *
> > > > - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> > > > - *	if (err) ...
> > > > - *
> > > > - *	// We can now access each region in the array
> > > > - *	for (i = 0; i < info->num_regions; i++) {
> > > > - *		struct drm_i915_memory_region_info mr = info->regions[i];
> > > > - *		u16 class = mr.region.class;
> > > > - *		u16 instance = mr.region.instance;
> > > > - *
> > > > - *		....
> > > > - *	}
> > > > - *
> > > > - *	free(info);
> > > > - */
> > > > -struct drm_i915_query_memory_regions {
> > > > -	/** @num_regions: Number of supported regions */
> > > > -	__u32 num_regions;
> > > > -
> > > > -	/** @rsvd: MBZ */
> > > > -	__u32 rsvd[3];
> > > > -
> > > > -	/** @regions: Info about each supported region */
> > > > -	struct drm_i915_memory_region_info regions[];
> > > > -};
> > > > -
> > > > -#define DRM_I915_GEM_CREATE_EXT		0xdeadbeaf
> > > > -#define DRM_IOCTL_I915_GEM_CREATE_EXT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext)
> > > > -
> > > > -/**
> > > > - * struct drm_i915_gem_create_ext - Existing gem_create behaviour, with added
> > > > - * extension support using struct i915_user_extension.
> > > > - *
> > > > - * Note that in the future we want to have our buffer flags here, at least for
> > > > - * the stuff that is immutable. Previously we would have two ioctls, one to
> > > > - * create the object with gem_create, and another to apply various parameters,
> > > > - * however this creates some ambiguity for the params which are considered
> > > > - * immutable. Also in general we're phasing out the various SET/GET ioctls.
> > > > - */
> > > > -struct drm_i915_gem_create_ext {
> > > > -	/**
> > > > -	 * @size: Requested size for the object.
> > > > -	 *
> > > > -	 * The (page-aligned) allocated size for the object will be returned.
> > > > -	 *
> > > > -	 * Note that for some devices we have might have further minimum
> > > > -	 * page-size restrictions(larger than 4K), like for device local-memory.
> > > > -	 * However in general the final size here should always reflect any
> > > > -	 * rounding up, if for example using the I915_GEM_CREATE_EXT_MEMORY_REGIONS
> > > > -	 * extension to place the object in device local-memory.
> > > > -	 */
> > > > -	__u64 size;
> > > > -	/**
> > > > -	 * @handle: Returned handle for the object.
> > > > -	 *
> > > > -	 * Object handles are nonzero.
> > > > -	 */
> > > > -	__u32 handle;
> > > > -	/** @flags: MBZ */
> > > > -	__u32 flags;
> > > > -	/**
> > > > -	 * @extensions: The chain of extensions to apply to this object.
> > > > -	 *
> > > > -	 * This will be useful in the future when we need to support several
> > > > -	 * different extensions, and we need to apply more than one when
> > > > -	 * creating the object. See struct i915_user_extension.
> > > > -	 *
> > > > -	 * If we don't supply any extensions then we get the same old gem_create
> > > > -	 * behaviour.
> > > > -	 *
> > > > -	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
> > > > -	 * struct drm_i915_gem_create_ext_memory_regions.
> > > > -	 */
> > > > -#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
> > > > -	__u64 extensions;
> > > > -};
> > > > -
> > > > -/**
> > > > - * struct drm_i915_gem_create_ext_memory_regions - The
> > > > - * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
> > > > - *
> > > > - * Set the object with the desired set of placements/regions in priority
> > > > - * order. Each entry must be unique and supported by the device.
> > > > - *
> > > > - * This is provided as an array of struct drm_i915_gem_memory_class_instance, or
> > > > - * an equivalent layout of class:instance pair encodings. See struct
> > > > - * drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to
> > > > - * query the supported regions for a device.
> > > > - *
> > > > - * As an example, on discrete devices, if we wish to set the placement as
> > > > - * device local-memory we can do something like:
> > > > - *
> > > > - * .. code-block:: C
> > > > - *
> > > > - *	struct drm_i915_gem_memory_class_instance region_lmem = {
> > > > - *              .memory_class = I915_MEMORY_CLASS_DEVICE,
> > > > - *              .memory_instance = 0,
> > > > - *      };
> > > > - *      struct drm_i915_gem_create_ext_memory_regions regions = {
> > > > - *              .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS },
> > > > - *              .regions = (uintptr_t)&region_lmem,
> > > > - *              .num_regions = 1,
> > > > - *      };
> > > > - *      struct drm_i915_gem_create_ext create_ext = {
> > > > - *              .size = 16 * PAGE_SIZE,
> > > > - *              .extensions = (uintptr_t)&regions,
> > > > - *      };
> > > > - *
> > > > - *      int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
> > > > - *      if (err) ...
> > > > - *
> > > > - * At which point we get the object handle in &drm_i915_gem_create_ext.handle,
> > > > - * along with the final object size in &drm_i915_gem_create_ext.size, which
> > > > - * should account for any rounding up, if required.
> > > > - */
> > > > -struct drm_i915_gem_create_ext_memory_regions {
> > > > -	/** @base: Extension link. See struct i915_user_extension. */
> > > > -	struct i915_user_extension base;
> > > > -
> > > > -	/** @pad: MBZ */
> > > > -	__u32 pad;
> > > > -	/** @num_regions: Number of elements in the @regions array. */
> > > > -	__u32 num_regions;
> > > > -	/**
> > > > -	 * @regions: The regions/placements array.
> > > > -	 *
> > > > -	 * An array of struct drm_i915_gem_memory_class_instance.
> > > > -	 */
> > > > -	__u64 regions;
> > > > -};
> > > > diff --git a/Documentation/gpu/rfc/i915_gem_lmem.rst b/Documentation/gpu/rfc/i915_gem_lmem.rst
> > > > index 1d344c593018..675ba8620d66 100644
> > > > --- a/Documentation/gpu/rfc/i915_gem_lmem.rst
> > > > +++ b/Documentation/gpu/rfc/i915_gem_lmem.rst
> > > > @@ -48,7 +48,7 @@ particular instance, since we can have more than one per class.
> > > >   In the future we also want to expose more information which can further
> > > >   describe the capabilities of a region.
> > > > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > > > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> > > >           :functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
> > > >   GEM_CREATE_EXT
> > > > @@ -61,7 +61,7 @@ Side note: We also need to support PXP[1] in the near future, which is also
> > > >   applicable to integrated platforms, and adds its own gem_create_ext extension,
> > > >   which basically lets userspace mark a buffer as "protected".
> > > > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > > > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> > > >           :functions: drm_i915_gem_create_ext
> > > >   I915_GEM_CREATE_EXT_MEMORY_REGIONS
> > > > @@ -73,7 +73,7 @@ them each to use the class/instance encoding, as per the output of the regions
> > > >   query. Having the list in priority order will be useful in the future when
> > > >   placing an object, say during eviction.
> > > > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > > > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> > > >           :functions: drm_i915_gem_create_ext_memory_regions
> > > >   One fair criticism here is that this seems a little over-engineered[2]. If we
> > > > -- 
> > > > 2.26.3
> > > > 
> > > 
> > > -- 
> > > Daniel Vetter
> > > Software Engineer, Intel Corporation
> > > http://blog.ffwll.ch
> > 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/doc/rfc: drop the i915_gem_lmem.h header
@ 2021-05-12  8:08         ` Daniel Vetter
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Vetter @ 2021-05-12  8:08 UTC (permalink / raw)
  To: Matthew Auld; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Wed, May 12, 2021 at 08:38:55AM +0100, Matthew Auld wrote:
> On 11/05/2021 18:29, Daniel Vetter wrote:
> > On Tue, May 11, 2021 at 07:28:08PM +0200, Daniel Vetter wrote:
> > > On Tue, May 11, 2021 at 06:03:56PM +0100, Matthew Auld wrote:
> > > > The proper headers have now landed in include/uapi/drm/i915_drm.h, so we
> > > > can drop i915_gem_lmem.h and instead just reference the real headers for
> > > > pulling in the kernel doc.
> > > > 
> > > > Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > > Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> > > 
> > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > 
> > > I guess we need to have a note that when we land the pciid for dg1 to move
> > > all the remaining bits over to real docs and delete the i915 lmem rfc. But
> > > everything in due time.
> > 
> > One thing I forgot: The include stanza will I think result in the
> > explicitly included functions not showing up in the normal driver uapi
> > docs. Which I think is fine while we settle all this. Or do I get this
> > wrong?
> 
> It all looks ok in the rendered html, but yeah the explicitly inlcuded
> functions/structs don't seem to link back to driver-uapi, and instead just
> link to the "local version" in i915_gem_lmem.

I think that's all ok. Thanks for checking.
-Daniel
> 
> > -Daniel
> > 
> > > -Daniel
> > > 
> > > > ---
> > > >   Documentation/gpu/rfc/i915_gem_lmem.h   | 237 ------------------------
> > > >   Documentation/gpu/rfc/i915_gem_lmem.rst |   6 +-
> > > >   2 files changed, 3 insertions(+), 240 deletions(-)
> > > >   delete mode 100644 Documentation/gpu/rfc/i915_gem_lmem.h
> > > > 
> > > > diff --git a/Documentation/gpu/rfc/i915_gem_lmem.h b/Documentation/gpu/rfc/i915_gem_lmem.h
> > > > deleted file mode 100644
> > > > index d9c61bea0556..000000000000
> > > > --- a/Documentation/gpu/rfc/i915_gem_lmem.h
> > > > +++ /dev/null
> > > > @@ -1,237 +0,0 @@
> > > > -/**
> > > > - * enum drm_i915_gem_memory_class - Supported memory classes
> > > > - */
> > > > -enum drm_i915_gem_memory_class {
> > > > -	/** @I915_MEMORY_CLASS_SYSTEM: System memory */
> > > > -	I915_MEMORY_CLASS_SYSTEM = 0,
> > > > -	/** @I915_MEMORY_CLASS_DEVICE: Device local-memory */
> > > > -	I915_MEMORY_CLASS_DEVICE,
> > > > -};
> > > > -
> > > > -/**
> > > > - * struct drm_i915_gem_memory_class_instance - Identify particular memory region
> > > > - */
> > > > -struct drm_i915_gem_memory_class_instance {
> > > > -	/** @memory_class: See enum drm_i915_gem_memory_class */
> > > > -	__u16 memory_class;
> > > > -
> > > > -	/** @memory_instance: Which instance */
> > > > -	__u16 memory_instance;
> > > > -};
> > > > -
> > > > -/**
> > > > - * struct drm_i915_memory_region_info - Describes one region as known to the
> > > > - * driver.
> > > > - *
> > > > - * Note that we reserve some stuff here for potential future work. As an example
> > > > - * we might want expose the capabilities for a given region, which could include
> > > > - * things like if the region is CPU mappable/accessible, what are the supported
> > > > - * mapping types etc.
> > > > - *
> > > > - * Note that to extend struct drm_i915_memory_region_info and struct
> > > > - * drm_i915_query_memory_regions in the future the plan is to do the following:
> > > > - *
> > > > - * .. code-block:: C
> > > > - *
> > > > - *	struct drm_i915_memory_region_info {
> > > > - *		struct drm_i915_gem_memory_class_instance region;
> > > > - *		union {
> > > > - *			__u32 rsvd0;
> > > > - *			__u32 new_thing1;
> > > > - *		};
> > > > - *		...
> > > > - *		union {
> > > > - *			__u64 rsvd1[8];
> > > > - *			struct {
> > > > - *				__u64 new_thing2;
> > > > - *				__u64 new_thing3;
> > > > - *				...
> > > > - *			};
> > > > - *		};
> > > > - *	};
> > > > - *
> > > > - * With this things should remain source compatible between versions for
> > > > - * userspace, even as we add new fields.
> > > > - *
> > > > - * Note this is using both struct drm_i915_query_item and struct drm_i915_query.
> > > > - * For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS
> > > > - * at &drm_i915_query_item.query_id.
> > > > - */
> > > > -struct drm_i915_memory_region_info {
> > > > -	/** @region: The class:instance pair encoding */
> > > > -	struct drm_i915_gem_memory_class_instance region;
> > > > -
> > > > -	/** @rsvd0: MBZ */
> > > > -	__u32 rsvd0;
> > > > -
> > > > -	/** @probed_size: Memory probed by the driver (-1 = unknown) */
> > > > -	__u64 probed_size;
> > > > -
> > > > -	/** @unallocated_size: Estimate of memory remaining (-1 = unknown) */
> > > > -	__u64 unallocated_size;
> > > > -
> > > > -	/** @rsvd1: MBZ */
> > > > -	__u64 rsvd1[8];
> > > > -};
> > > > -
> > > > -/**
> > > > - * struct drm_i915_query_memory_regions
> > > > - *
> > > > - * The region info query enumerates all regions known to the driver by filling
> > > > - * in an array of struct drm_i915_memory_region_info structures.
> > > > - *
> > > > - * Example for getting the list of supported regions:
> > > > - *
> > > > - * .. code-block:: C
> > > > - *
> > > > - *	struct drm_i915_query_memory_regions *info;
> > > > - *	struct drm_i915_query_item item = {
> > > > - *		.query_id = DRM_I915_QUERY_MEMORY_REGIONS;
> > > > - *	};
> > > > - *	struct drm_i915_query query = {
> > > > - *		.num_items = 1,
> > > > - *		.items_ptr = (uintptr_t)&item,
> > > > - *	};
> > > > - *	int err, i;
> > > > - *
> > > > - *	// First query the size of the blob we need, this needs to be large
> > > > - *	// enough to hold our array of regions. The kernel will fill out the
> > > > - *	// item.length for us, which is the number of bytes we need.
> > > > - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> > > > - *	if (err) ...
> > > > - *
> > > > - *	info = calloc(1, item.length);
> > > > - *	// Now that we allocated the required number of bytes, we call the ioctl
> > > > - *	// again, this time with the data_ptr pointing to our newly allocated
> > > > - *	// blob, which the kernel can then populate with the all the region info.
> > > > - *	item.data_ptr = (uintptr_t)&info,
> > > > - *
> > > > - *	err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
> > > > - *	if (err) ...
> > > > - *
> > > > - *	// We can now access each region in the array
> > > > - *	for (i = 0; i < info->num_regions; i++) {
> > > > - *		struct drm_i915_memory_region_info mr = info->regions[i];
> > > > - *		u16 class = mr.region.class;
> > > > - *		u16 instance = mr.region.instance;
> > > > - *
> > > > - *		....
> > > > - *	}
> > > > - *
> > > > - *	free(info);
> > > > - */
> > > > -struct drm_i915_query_memory_regions {
> > > > -	/** @num_regions: Number of supported regions */
> > > > -	__u32 num_regions;
> > > > -
> > > > -	/** @rsvd: MBZ */
> > > > -	__u32 rsvd[3];
> > > > -
> > > > -	/** @regions: Info about each supported region */
> > > > -	struct drm_i915_memory_region_info regions[];
> > > > -};
> > > > -
> > > > -#define DRM_I915_GEM_CREATE_EXT		0xdeadbeaf
> > > > -#define DRM_IOCTL_I915_GEM_CREATE_EXT	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE_EXT, struct drm_i915_gem_create_ext)
> > > > -
> > > > -/**
> > > > - * struct drm_i915_gem_create_ext - Existing gem_create behaviour, with added
> > > > - * extension support using struct i915_user_extension.
> > > > - *
> > > > - * Note that in the future we want to have our buffer flags here, at least for
> > > > - * the stuff that is immutable. Previously we would have two ioctls, one to
> > > > - * create the object with gem_create, and another to apply various parameters,
> > > > - * however this creates some ambiguity for the params which are considered
> > > > - * immutable. Also in general we're phasing out the various SET/GET ioctls.
> > > > - */
> > > > -struct drm_i915_gem_create_ext {
> > > > -	/**
> > > > -	 * @size: Requested size for the object.
> > > > -	 *
> > > > -	 * The (page-aligned) allocated size for the object will be returned.
> > > > -	 *
> > > > -	 * Note that for some devices we have might have further minimum
> > > > -	 * page-size restrictions(larger than 4K), like for device local-memory.
> > > > -	 * However in general the final size here should always reflect any
> > > > -	 * rounding up, if for example using the I915_GEM_CREATE_EXT_MEMORY_REGIONS
> > > > -	 * extension to place the object in device local-memory.
> > > > -	 */
> > > > -	__u64 size;
> > > > -	/**
> > > > -	 * @handle: Returned handle for the object.
> > > > -	 *
> > > > -	 * Object handles are nonzero.
> > > > -	 */
> > > > -	__u32 handle;
> > > > -	/** @flags: MBZ */
> > > > -	__u32 flags;
> > > > -	/**
> > > > -	 * @extensions: The chain of extensions to apply to this object.
> > > > -	 *
> > > > -	 * This will be useful in the future when we need to support several
> > > > -	 * different extensions, and we need to apply more than one when
> > > > -	 * creating the object. See struct i915_user_extension.
> > > > -	 *
> > > > -	 * If we don't supply any extensions then we get the same old gem_create
> > > > -	 * behaviour.
> > > > -	 *
> > > > -	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
> > > > -	 * struct drm_i915_gem_create_ext_memory_regions.
> > > > -	 */
> > > > -#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
> > > > -	__u64 extensions;
> > > > -};
> > > > -
> > > > -/**
> > > > - * struct drm_i915_gem_create_ext_memory_regions - The
> > > > - * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
> > > > - *
> > > > - * Set the object with the desired set of placements/regions in priority
> > > > - * order. Each entry must be unique and supported by the device.
> > > > - *
> > > > - * This is provided as an array of struct drm_i915_gem_memory_class_instance, or
> > > > - * an equivalent layout of class:instance pair encodings. See struct
> > > > - * drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to
> > > > - * query the supported regions for a device.
> > > > - *
> > > > - * As an example, on discrete devices, if we wish to set the placement as
> > > > - * device local-memory we can do something like:
> > > > - *
> > > > - * .. code-block:: C
> > > > - *
> > > > - *	struct drm_i915_gem_memory_class_instance region_lmem = {
> > > > - *              .memory_class = I915_MEMORY_CLASS_DEVICE,
> > > > - *              .memory_instance = 0,
> > > > - *      };
> > > > - *      struct drm_i915_gem_create_ext_memory_regions regions = {
> > > > - *              .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS },
> > > > - *              .regions = (uintptr_t)&region_lmem,
> > > > - *              .num_regions = 1,
> > > > - *      };
> > > > - *      struct drm_i915_gem_create_ext create_ext = {
> > > > - *              .size = 16 * PAGE_SIZE,
> > > > - *              .extensions = (uintptr_t)&regions,
> > > > - *      };
> > > > - *
> > > > - *      int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
> > > > - *      if (err) ...
> > > > - *
> > > > - * At which point we get the object handle in &drm_i915_gem_create_ext.handle,
> > > > - * along with the final object size in &drm_i915_gem_create_ext.size, which
> > > > - * should account for any rounding up, if required.
> > > > - */
> > > > -struct drm_i915_gem_create_ext_memory_regions {
> > > > -	/** @base: Extension link. See struct i915_user_extension. */
> > > > -	struct i915_user_extension base;
> > > > -
> > > > -	/** @pad: MBZ */
> > > > -	__u32 pad;
> > > > -	/** @num_regions: Number of elements in the @regions array. */
> > > > -	__u32 num_regions;
> > > > -	/**
> > > > -	 * @regions: The regions/placements array.
> > > > -	 *
> > > > -	 * An array of struct drm_i915_gem_memory_class_instance.
> > > > -	 */
> > > > -	__u64 regions;
> > > > -};
> > > > diff --git a/Documentation/gpu/rfc/i915_gem_lmem.rst b/Documentation/gpu/rfc/i915_gem_lmem.rst
> > > > index 1d344c593018..675ba8620d66 100644
> > > > --- a/Documentation/gpu/rfc/i915_gem_lmem.rst
> > > > +++ b/Documentation/gpu/rfc/i915_gem_lmem.rst
> > > > @@ -48,7 +48,7 @@ particular instance, since we can have more than one per class.
> > > >   In the future we also want to expose more information which can further
> > > >   describe the capabilities of a region.
> > > > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > > > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> > > >           :functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
> > > >   GEM_CREATE_EXT
> > > > @@ -61,7 +61,7 @@ Side note: We also need to support PXP[1] in the near future, which is also
> > > >   applicable to integrated platforms, and adds its own gem_create_ext extension,
> > > >   which basically lets userspace mark a buffer as "protected".
> > > > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > > > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> > > >           :functions: drm_i915_gem_create_ext
> > > >   I915_GEM_CREATE_EXT_MEMORY_REGIONS
> > > > @@ -73,7 +73,7 @@ them each to use the class/instance encoding, as per the output of the regions
> > > >   query. Having the list in priority order will be useful in the future when
> > > >   placing an object, say during eviction.
> > > > -.. kernel-doc:: Documentation/gpu/rfc/i915_gem_lmem.h
> > > > +.. kernel-doc:: include/uapi/drm/i915_drm.h
> > > >           :functions: drm_i915_gem_create_ext_memory_regions
> > > >   One fair criticism here is that this seems a little over-engineered[2]. If we
> > > > -- 
> > > > 2.26.3
> > > > 
> > > 
> > > -- 
> > > Daniel Vetter
> > > Software Engineer, Intel Corporation
> > > http://blog.ffwll.ch
> > 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-05-12  8:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 17:03 [PATCH] drm/doc/rfc: drop the i915_gem_lmem.h header Matthew Auld
2021-05-11 17:03 ` [Intel-gfx] " Matthew Auld
2021-05-11 17:28 ` Daniel Vetter
2021-05-11 17:28   ` [Intel-gfx] " Daniel Vetter
2021-05-11 17:29   ` Daniel Vetter
2021-05-11 17:29     ` [Intel-gfx] " Daniel Vetter
2021-05-12  7:38     ` Matthew Auld
2021-05-12  7:38       ` [Intel-gfx] " Matthew Auld
2021-05-12  8:08       ` Daniel Vetter
2021-05-12  8:08         ` [Intel-gfx] " Daniel Vetter
2021-05-11 20:44 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2021-05-11 21:15 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.