All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] drm: Move several files from DRM core into modules
@ 2021-10-20 13:19 Thomas Zimmermann
  2021-10-20 13:19 ` [PATCH 1/3] drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set Thomas Zimmermann
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2021-10-20 13:19 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, airlied, daniel; +Cc: dri-devel, Thomas Zimmermann

Move a number of files into modules and behind config options.

So far, early boot graphics was provided by fbdev. With simpledrm, and
possibly other generic DRM drivers, it's now possible to have general
early-boot output with DRM. This requires the DRM core to be linked into
the kernel binary image.

The reduction in size here is only ~1%, but the patchset is part of a
larger effort to reduce the size of the DRM core module.

Thomas Zimmermann (3):
  drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set
  drm: Link several object files into drm_kms_helper.ko
  drm: Move GEM memory managers into modules

 drivers/gpu/drm/Kconfig                |  4 ++--
 drivers/gpu/drm/Makefile               | 26 +++++++++++++++-----------
 drivers/gpu/drm/drm_gem_cma_helper.c   |  4 ++++
 drivers/gpu/drm/drm_gem_shmem_helper.c |  4 ++++
 drivers/gpu/drm/drm_irq.c              |  2 --
 5 files changed, 25 insertions(+), 15 deletions(-)

--
2.33.0


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

* [PATCH 1/3] drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set
  2021-10-20 13:19 [PATCH 0/3] drm: Move several files from DRM core into modules Thomas Zimmermann
@ 2021-10-20 13:19 ` Thomas Zimmermann
  2021-10-20 13:19 ` [PATCH 2/3] drm: Link several object files into drm_kms_helper.ko Thomas Zimmermann
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2021-10-20 13:19 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, airlied, daniel; +Cc: dri-devel, Thomas Zimmermann

All code in drm_irq.o is for legacy UMs drivers. Only build and link
the file if CONFIG_DRM_LEGACY has been enabled.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/Makefile  | 6 +++---
 drivers/gpu/drm/drm_irq.c | 2 --
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 12997ca5670d..6f07609fa453 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -4,7 +4,7 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
 drm-y       :=	drm_aperture.o drm_auth.o drm_cache.o \
-		drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
+		drm_file.o drm_gem.o drm_ioctl.o \
 		drm_drv.o \
 		drm_sysfs.o drm_hashtab.o drm_mm.o \
 		drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o drm_displayid.o \
@@ -21,8 +21,8 @@ drm-y       :=	drm_aperture.o drm_auth.o drm_cache.o \
 		drm_managed.o drm_vblank_work.o
 
 drm-$(CONFIG_DRM_LEGACY) += drm_agpsupport.o drm_bufs.o drm_context.o drm_dma.o \
-			    drm_legacy_misc.o drm_lock.o drm_memory.o drm_scatter.o \
-			    drm_vm.o
+			    drm_irq.o drm_legacy_misc.o drm_lock.o drm_memory.o \
+			    drm_scatter.o drm_vm.o
 drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 13e1d5c4ec82..d327638e15ee 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -66,7 +66,6 @@
 
 #include "drm_internal.h"
 
-#if IS_ENABLED(CONFIG_DRM_LEGACY)
 static int drm_legacy_irq_install(struct drm_device *dev, int irq)
 {
 	int ret;
@@ -203,4 +202,3 @@ int drm_legacy_irq_control(struct drm_device *dev, void *data,
 		return -EINVAL;
 	}
 }
-#endif
-- 
2.33.0


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

* [PATCH 2/3] drm: Link several object files into drm_kms_helper.ko
  2021-10-20 13:19 [PATCH 0/3] drm: Move several files from DRM core into modules Thomas Zimmermann
  2021-10-20 13:19 ` [PATCH 1/3] drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set Thomas Zimmermann
@ 2021-10-20 13:19 ` Thomas Zimmermann
  2021-10-20 13:19 ` [PATCH 3/3] drm: Move GEM memory managers into modules Thomas Zimmermann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2021-10-20 13:19 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, airlied, daniel; +Cc: dri-devel, Thomas Zimmermann

Several core DRM functions are not used by the DRM core. Link the
object files into the KMS helper library.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6f07609fa453..0f8dae0a21c5 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -8,16 +8,15 @@ drm-y       :=	drm_aperture.o drm_auth.o drm_cache.o \
 		drm_drv.o \
 		drm_sysfs.o drm_hashtab.o drm_mm.o \
 		drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o drm_displayid.o \
-		drm_encoder_slave.o \
 		drm_trace_points.o drm_prime.o \
-		drm_rect.o drm_vma_manager.o drm_flip_work.o \
+		drm_vma_manager.o \
 		drm_modeset_lock.o drm_atomic.o drm_bridge.o \
 		drm_framebuffer.o drm_connector.o drm_blend.o \
 		drm_encoder.o drm_mode_object.o drm_property.o \
 		drm_plane.o drm_color_mgmt.o drm_print.o \
 		drm_dumb_buffers.o drm_mode_config.o drm_vblank.o \
 		drm_syncobj.o drm_lease.o drm_writeback.o drm_client.o \
-		drm_client_modeset.o drm_atomic_uapi.o drm_hdcp.o \
+		drm_client_modeset.o drm_atomic_uapi.o \
 		drm_managed.o drm_vblank_work.o
 
 drm-$(CONFIG_DRM_LEGACY) += drm_agpsupport.o drm_bufs.o drm_context.o drm_dma.o \
@@ -43,14 +42,15 @@ drm_ttm_helper-y := drm_gem_ttm_helper.o
 obj-$(CONFIG_DRM_TTM_HELPER) += drm_ttm_helper.o
 
 drm_kms_helper-y := drm_bridge_connector.o drm_crtc_helper.o drm_dp_helper.o \
-		drm_dsc.o drm_probe_helper.o \
+		drm_dsc.o drm_encoder_slave.o drm_flip_work.o drm_hdcp.o \
+		drm_probe_helper.o \
 		drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \
 		drm_kms_helper_common.o drm_dp_dual_mode_helper.o \
 		drm_simple_kms_helper.o drm_modeset_helper.o \
 		drm_scdc_helper.o drm_gem_atomic_helper.o \
 		drm_gem_framebuffer_helper.o \
 		drm_atomic_state_helper.o drm_damage_helper.o \
-		drm_format_helper.o drm_self_refresh_helper.o
+		drm_format_helper.o drm_self_refresh_helper.o drm_rect.o
 
 drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o
 drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
-- 
2.33.0


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

* [PATCH 3/3] drm: Move GEM memory managers into modules
  2021-10-20 13:19 [PATCH 0/3] drm: Move several files from DRM core into modules Thomas Zimmermann
  2021-10-20 13:19 ` [PATCH 1/3] drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set Thomas Zimmermann
  2021-10-20 13:19 ` [PATCH 2/3] drm: Link several object files into drm_kms_helper.ko Thomas Zimmermann
@ 2021-10-20 13:19 ` Thomas Zimmermann
  2021-10-21 11:52 ` [PATCH 0/3] drm: Move several files from DRM core " Daniel Vetter
  2021-10-21 12:38 ` Jani Nikula
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2021-10-20 13:19 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, airlied, daniel; +Cc: dri-devel, Thomas Zimmermann

DRM core uses the GEM base object to access GEM functionality. It does
not depend on individual implementations. Move the code into modules.

Also move the CMA framebuffer helpers into the CMA's module, as they're
not usable without CMA.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/Kconfig                |  4 ++--
 drivers/gpu/drm/Makefile               | 10 +++++++---
 drivers/gpu/drm/drm_gem_cma_helper.c   |  4 ++++
 drivers/gpu/drm/drm_gem_shmem_helper.c |  4 ++++
 4 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index b91f0ce8154c..fb144617055b 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -212,7 +212,7 @@ config DRM_TTM_HELPER
 	  Helpers for ttm-based gem objects
 
 config DRM_GEM_CMA_HELPER
-	bool
+	tristate
 	depends on DRM
 	help
 	  Choose this if you need the GEM CMA helper functions
@@ -225,7 +225,7 @@ config DRM_KMS_CMA_HELPER
 	  Choose this if you need the KMS CMA helper functions
 
 config DRM_GEM_SHMEM_HELPER
-	bool
+	tristate
 	depends on DRM && MMU
 	help
 	  Choose this if you need the GEM shmem helper functions
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 0f8dae0a21c5..7f6eb11b6aac 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -24,8 +24,6 @@ drm-$(CONFIG_DRM_LEGACY) += drm_agpsupport.o drm_bufs.o drm_context.o drm_dma.o
 			    drm_scatter.o drm_vm.o
 drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
-drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
-drm-$(CONFIG_DRM_GEM_SHMEM_HELPER) += drm_gem_shmem_helper.o
 drm-$(CONFIG_DRM_PANEL) += drm_panel.o
 drm-$(CONFIG_OF) += drm_of.o
 drm-$(CONFIG_PCI) += drm_pci.o
@@ -35,6 +33,13 @@ drm-$(CONFIG_DRM_PRIVACY_SCREEN) += drm_privacy_screen.o drm_privacy_screen_x86.
 
 obj-$(CONFIG_DRM_DP_AUX_BUS) += drm_dp_aux_bus.o
 
+drm_cma_helper-y := drm_gem_cma_helper.o
+drm_cma_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
+obj-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_cma_helper.o
+
+drm_shmem_helper-y := drm_gem_shmem_helper.o
+obj-$(CONFIG_DRM_GEM_SHMEM_HELPER) += drm_shmem_helper.o
+
 drm_vram_helper-y := drm_gem_vram_helper.o
 obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o
 
@@ -54,7 +59,6 @@ drm_kms_helper-y := drm_bridge_connector.o drm_crtc_helper.o drm_dp_helper.o \
 
 drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o
 drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
-drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
 drm_kms_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
 drm_kms_helper-$(CONFIG_DRM_DP_CEC) += drm_dp_cec.o
 
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
index d53388199f34..6f7b3f8ec04d 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -13,6 +13,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/export.h>
 #include <linux/mm.h>
+#include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
 
@@ -578,3 +579,6 @@ drm_gem_cma_prime_import_sg_table_vmap(struct drm_device *dev,
 	return obj;
 }
 EXPORT_SYMBOL(drm_gem_cma_prime_import_sg_table_vmap);
+
+MODULE_DESCRIPTION("DRM CMA memory-management helpers");
+MODULE_LICENSE("GPL");
diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
index 0e0986dfbe0c..57ceecb3f4d8 100644
--- a/drivers/gpu/drm/drm_gem_shmem_helper.c
+++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
@@ -5,6 +5,7 @@
 
 #include <linux/dma-buf.h>
 #include <linux/export.h>
+#include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/shmem_fs.h>
 #include <linux/slab.h>
@@ -774,3 +775,6 @@ drm_gem_shmem_prime_import_sg_table(struct drm_device *dev,
 	return &shmem->base;
 }
 EXPORT_SYMBOL_GPL(drm_gem_shmem_prime_import_sg_table);
+
+MODULE_DESCRIPTION("DRM SHMEM memory-management helpers");
+MODULE_LICENSE("GPL v2");
-- 
2.33.0


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

* Re: [PATCH 0/3] drm: Move several files from DRM core into modules
  2021-10-20 13:19 [PATCH 0/3] drm: Move several files from DRM core into modules Thomas Zimmermann
                   ` (2 preceding siblings ...)
  2021-10-20 13:19 ` [PATCH 3/3] drm: Move GEM memory managers into modules Thomas Zimmermann
@ 2021-10-21 11:52 ` Daniel Vetter
  2021-10-21 12:21   ` Thomas Zimmermann
  2021-10-21 12:38 ` Jani Nikula
  4 siblings, 1 reply; 9+ messages in thread
From: Daniel Vetter @ 2021-10-21 11:52 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: maarten.lankhorst, mripard, airlied, daniel, dri-devel

On Wed, Oct 20, 2021 at 03:19:38PM +0200, Thomas Zimmermann wrote:
> Move a number of files into modules and behind config options.
> 
> So far, early boot graphics was provided by fbdev. With simpledrm, and
> possibly other generic DRM drivers, it's now possible to have general
> early-boot output with DRM. This requires the DRM core to be linked into
> the kernel binary image.
> 
> The reduction in size here is only ~1%, but the patchset is part of a
> larger effort to reduce the size of the DRM core module.
> 
> Thomas Zimmermann (3):
>   drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set
>   drm: Link several object files into drm_kms_helper.ko
>   drm: Move GEM memory managers into modules

Assuming it all compiles still in all combos, on the series:

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
>  drivers/gpu/drm/Kconfig                |  4 ++--
>  drivers/gpu/drm/Makefile               | 26 +++++++++++++++-----------
>  drivers/gpu/drm/drm_gem_cma_helper.c   |  4 ++++
>  drivers/gpu/drm/drm_gem_shmem_helper.c |  4 ++++
>  drivers/gpu/drm/drm_irq.c              |  2 --
>  5 files changed, 25 insertions(+), 15 deletions(-)
> 
> --
> 2.33.0
> 

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

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

* Re: [PATCH 0/3] drm: Move several files from DRM core into modules
  2021-10-21 11:52 ` [PATCH 0/3] drm: Move several files from DRM core " Daniel Vetter
@ 2021-10-21 12:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2021-10-21 12:21 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: maarten.lankhorst, mripard, airlied, dri-devel


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

Hi

Am 21.10.21 um 13:52 schrieb Daniel Vetter:
> On Wed, Oct 20, 2021 at 03:19:38PM +0200, Thomas Zimmermann wrote:
>> Move a number of files into modules and behind config options.
>>
>> So far, early boot graphics was provided by fbdev. With simpledrm, and
>> possibly other generic DRM drivers, it's now possible to have general
>> early-boot output with DRM. This requires the DRM core to be linked into
>> the kernel binary image.
>>
>> The reduction in size here is only ~1%, but the patchset is part of a
>> larger effort to reduce the size of the DRM core module.
>>
>> Thomas Zimmermann (3):
>>    drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set
>>    drm: Link several object files into drm_kms_helper.ko
>>    drm: Move GEM memory managers into modules
> 
> Assuming it all compiles still in all combos, on the series:
> 
> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Thanks for the A-b. I built with DRM_LEGACY set and unset.

The GEM changes shouldn't be affected by the config. With the CMA 
helpers in a separate module, we could maybe remove 
CONFIG_DRM_KMS_CMA_HELPER and link drm_fb_cma_helper.o if 
CONFIG_DRM_KMS_HELPER has been selected.

Best regards
Thomas

>>
>>   drivers/gpu/drm/Kconfig                |  4 ++--
>>   drivers/gpu/drm/Makefile               | 26 +++++++++++++++-----------
>>   drivers/gpu/drm/drm_gem_cma_helper.c   |  4 ++++
>>   drivers/gpu/drm/drm_gem_shmem_helper.c |  4 ++++
>>   drivers/gpu/drm/drm_irq.c              |  2 --
>>   5 files changed, 25 insertions(+), 15 deletions(-)
>>
>> --
>> 2.33.0
>>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH 0/3] drm: Move several files from DRM core into modules
  2021-10-20 13:19 [PATCH 0/3] drm: Move several files from DRM core into modules Thomas Zimmermann
                   ` (3 preceding siblings ...)
  2021-10-21 11:52 ` [PATCH 0/3] drm: Move several files from DRM core " Daniel Vetter
@ 2021-10-21 12:38 ` Jani Nikula
  2021-10-21 13:34   ` Thomas Zimmermann
  2021-10-21 16:51   ` Daniel Vetter
  4 siblings, 2 replies; 9+ messages in thread
From: Jani Nikula @ 2021-10-21 12:38 UTC (permalink / raw)
  To: Thomas Zimmermann, maarten.lankhorst, mripard, airlied, daniel
  Cc: dri-devel, Thomas Zimmermann

On Wed, 20 Oct 2021, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Move a number of files into modules and behind config options.
>
> So far, early boot graphics was provided by fbdev. With simpledrm, and
> possibly other generic DRM drivers, it's now possible to have general
> early-boot output with DRM. This requires the DRM core to be linked into
> the kernel binary image.
>
> The reduction in size here is only ~1%, but the patchset is part of a
> larger effort to reduce the size of the DRM core module.

I think the main problem is really that of organization. You have all of
the files under drivers/gpu/drm/ and the only way to know which module
the files belong to is to look at the Makefile and the Kconfig. It's not
obvious based on the file names or directory, at all. And there are
nearly a hundred drm_*.c files there!

We also seem to have stuff depend on DRM alone, while functionally they
should really depend on DRM_KMS_HELPER too.

The subdirectories under drm/ also don't have any distinction between
being part of drm core and helpers or drivers. We have lib, scheduler,
selftests, and ttm next to the drivers.

We should start adding drm_* subdirectories, and moving the modules
separate from drm core there. We should rename the current non-driver
directories drm_*. We need better structure.


BR,
Jani.




>
> Thomas Zimmermann (3):
>   drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set
>   drm: Link several object files into drm_kms_helper.ko
>   drm: Move GEM memory managers into modules
>
>  drivers/gpu/drm/Kconfig                |  4 ++--
>  drivers/gpu/drm/Makefile               | 26 +++++++++++++++-----------
>  drivers/gpu/drm/drm_gem_cma_helper.c   |  4 ++++
>  drivers/gpu/drm/drm_gem_shmem_helper.c |  4 ++++
>  drivers/gpu/drm/drm_irq.c              |  2 --
>  5 files changed, 25 insertions(+), 15 deletions(-)
>
> --
> 2.33.0
>

-- 
Jani Nikula, Intel Open Source Graphics Center

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

* Re: [PATCH 0/3] drm: Move several files from DRM core into modules
  2021-10-21 12:38 ` Jani Nikula
@ 2021-10-21 13:34   ` Thomas Zimmermann
  2021-10-21 16:51   ` Daniel Vetter
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2021-10-21 13:34 UTC (permalink / raw)
  To: Jani Nikula, maarten.lankhorst, mripard, airlied, daniel; +Cc: dri-devel


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

Hi

Am 21.10.21 um 14:38 schrieb Jani Nikula:
> On Wed, 20 Oct 2021, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> Move a number of files into modules and behind config options.
>>
>> So far, early boot graphics was provided by fbdev. With simpledrm, and
>> possibly other generic DRM drivers, it's now possible to have general
>> early-boot output with DRM. This requires the DRM core to be linked into
>> the kernel binary image.
>>
>> The reduction in size here is only ~1%, but the patchset is part of a
>> larger effort to reduce the size of the DRM core module.
> 
> I think the main problem is really that of organization. You have all of
> the files under drivers/gpu/drm/ and the only way to know which module
> the files belong to is to look at the Makefile and the Kconfig. It's not
> obvious based on the file names or directory, at all. And there are
> nearly a hundred drm_*.c files there!
> 
> We also seem to have stuff depend on DRM alone, while functionally they
> should really depend on DRM_KMS_HELPER too.

The point of my effort is to have a built-in simpledrm for early-boot 
graphics that requires only a minimal set of built-in dependency. Most 
of the 'advanced' features that native drivers use should go into 
modules. It's a bit unrealistic, but any progress is good.

> 
> The subdirectories under drm/ also don't have any distinction between
> being part of drm core and helpers or drivers. We have lib, scheduler,
> selftests, and ttm next to the drivers.
> 
> We should start adding drm_* subdirectories, and moving the modules
> separate from drm core there. We should rename the current non-driver
> directories drm_*. We need better structure.

Well, there are core functions and helpers. Often, both are in the same 
file and the core 'accidentally' pulls in helpers. For example, I found 
that the core connector automatically creates an EDID property and tries 
to fill in some values, which in turn pulls all the EDID parsing 
helpers. It would be nice to move the parsing code into a module, but 
it's not possible ATM.

For a start we could try to split files into core and helper code and 
link them into different modules.

Best regards
Thomas

> 
> 
> BR,
> Jani.
> 
> 
> 
> 
>>
>> Thomas Zimmermann (3):
>>    drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set
>>    drm: Link several object files into drm_kms_helper.ko
>>    drm: Move GEM memory managers into modules
>>
>>   drivers/gpu/drm/Kconfig                |  4 ++--
>>   drivers/gpu/drm/Makefile               | 26 +++++++++++++++-----------
>>   drivers/gpu/drm/drm_gem_cma_helper.c   |  4 ++++
>>   drivers/gpu/drm/drm_gem_shmem_helper.c |  4 ++++
>>   drivers/gpu/drm/drm_irq.c              |  2 --
>>   5 files changed, 25 insertions(+), 15 deletions(-)
>>
>> --
>> 2.33.0
>>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH 0/3] drm: Move several files from DRM core into modules
  2021-10-21 12:38 ` Jani Nikula
  2021-10-21 13:34   ` Thomas Zimmermann
@ 2021-10-21 16:51   ` Daniel Vetter
  1 sibling, 0 replies; 9+ messages in thread
From: Daniel Vetter @ 2021-10-21 16:51 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Thomas Zimmermann, Maarten Lankhorst, Maxime Ripard, Dave Airlie,
	dri-devel

On Thu, Oct 21, 2021 at 2:38 PM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> On Wed, 20 Oct 2021, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> > Move a number of files into modules and behind config options.
> >
> > So far, early boot graphics was provided by fbdev. With simpledrm, and
> > possibly other generic DRM drivers, it's now possible to have general
> > early-boot output with DRM. This requires the DRM core to be linked into
> > the kernel binary image.
> >
> > The reduction in size here is only ~1%, but the patchset is part of a
> > larger effort to reduce the size of the DRM core module.
>
> I think the main problem is really that of organization. You have all of
> the files under drivers/gpu/drm/ and the only way to know which module
> the files belong to is to look at the Makefile and the Kconfig. It's not
> obvious based on the file names or directory, at all. And there are
> nearly a hundred drm_*.c files there!
>
> We also seem to have stuff depend on DRM alone, while functionally they
> should really depend on DRM_KMS_HELPER too.
>
> The subdirectories under drm/ also don't have any distinction between
> being part of drm core and helpers or drivers. We have lib, scheduler,
> selftests, and ttm next to the drivers.
>
> We should start adding drm_* subdirectories, and moving the modules
> separate from drm core there. We should rename the current non-driver
> directories drm_*. We need better structure.

Yeah it might be time for drm/core and drm/helpers or maybe even
split-up helpers, dunno. drm/core probably needs to contain also all
the legacy cruft since Kbuild doesn't support source files for the
same module spread across directories (I think at least, or was that
only meson?). Selftests might need to go with respective modules, not
sure.
-Daniel


>
>
> BR,
> Jani.
>
>
>
>
> >
> > Thomas Zimmermann (3):
> >   drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set
> >   drm: Link several object files into drm_kms_helper.ko
> >   drm: Move GEM memory managers into modules
> >
> >  drivers/gpu/drm/Kconfig                |  4 ++--
> >  drivers/gpu/drm/Makefile               | 26 +++++++++++++++-----------
> >  drivers/gpu/drm/drm_gem_cma_helper.c   |  4 ++++
> >  drivers/gpu/drm/drm_gem_shmem_helper.c |  4 ++++
> >  drivers/gpu/drm/drm_irq.c              |  2 --
> >  5 files changed, 25 insertions(+), 15 deletions(-)
> >
> > --
> > 2.33.0
> >
>
> --
> Jani Nikula, Intel Open Source Graphics Center



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

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

end of thread, other threads:[~2021-10-21 16:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 13:19 [PATCH 0/3] drm: Move several files from DRM core into modules Thomas Zimmermann
2021-10-20 13:19 ` [PATCH 1/3] drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set Thomas Zimmermann
2021-10-20 13:19 ` [PATCH 2/3] drm: Link several object files into drm_kms_helper.ko Thomas Zimmermann
2021-10-20 13:19 ` [PATCH 3/3] drm: Move GEM memory managers into modules Thomas Zimmermann
2021-10-21 11:52 ` [PATCH 0/3] drm: Move several files from DRM core " Daniel Vetter
2021-10-21 12:21   ` Thomas Zimmermann
2021-10-21 12:38 ` Jani Nikula
2021-10-21 13:34   ` Thomas Zimmermann
2021-10-21 16:51   ` Daniel Vetter

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.