Re: [PATCH v2 1/2] drm: allow limiting the scatter list size.

From: Gerd Hoffmann
Date: Mon Sep 07 2020 - 02:39:16 EST


> > + /**
> > + * @max_segment:
> > + *
> > + * Max size for scatter list segments. When unset the default
> > + * (SCATTERLIST_MAX_SEGMENT) is used.
> > + */
> > + size_t max_segment;
>
> Is there no better place for this then "at the bottom"? drm_device is a
> huge structure, piling stuff up randomly doesn't make it better :-)

Moved next to the other gem fields for now (v3 posted).

> I think ideally we'd have a gem substruct like we have on the modeset side
> at least.

Phew, that'll be quite some churn in the tree. And there aren't that many
gem-related fields in struct drm_device.

So you are looking for something like below (header changes only)?

take care,
Gerd

diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index c455ef404ca6..950167ede98a 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -299,22 +299,8 @@ struct drm_device {
/** @mode_config: Current mode config */
struct drm_mode_config mode_config;

- /** @object_name_lock: GEM information */
- struct mutex object_name_lock;
-
- /** @object_name_idr: GEM information */
- struct idr object_name_idr;
-
- /** @vma_offset_manager: GEM information */
- struct drm_vma_offset_manager *vma_offset_manager;
-
- /**
- * @max_segment:
- *
- * Max size for scatter list segments for GEM objects. When
- * unset the default (SCATTERLIST_MAX_SEGMENT) is used.
- */
- size_t max_segment;
+ /** @gem_config: Current GEM config */
+ struct drm_gem_config gem_config;

/** @vram_mm: VRAM MM memory manager */
struct drm_vram_mm *vram_mm;
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 337a48321705..74129fb29fb8 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -39,6 +39,25 @@

#include <drm/drm_vma_manager.h>

+struct drm_gem_config {
+ /** @object_name_lock: GEM information */
+ struct mutex object_name_lock;
+
+ /** @object_name_idr: GEM information */
+ struct idr object_name_idr;
+
+ /** @vma_offset_manager: GEM information */
+ struct drm_vma_offset_manager *vma_offset_manager;
+
+ /**
+ * @max_segment:
+ *
+ * Max size for scatter list segments for GEM objects. When
+ * unset the default (SCATTERLIST_MAX_SEGMENT) is used.
+ */
+ size_t max_segment;
+};
+
struct drm_gem_object;

/**