drm: Make it compilable without CONFIG_HDMI and CONFIG_I2C
Subsystems (2)
cover drm: Make it compilable without CONFIG_HDMI and CONFIG_I2C
By enabling the DRM code for virtio-gpu on S390, you currently also get all the code that is enabled by CONFIG_HDMI and CONFIG_I2C automatically. This is quite ugly, since on S390, there is no HDMI and no I2C. Thus it would be great if the DRM code could also be compiled without CONFIG_HDMI and CONFIG_I2C. These two patches now refactor the DRM code a little bit so that we can compile it also without CONFIG_HDMI and CONFIG_I2C.
Thomas Huth (2):
drivers/gpu/drm: Move CONFIG_HDMI-dependent code to a separate file drivers/gpu/drm: Make the DRM code compilable without CONFIG_I2C
drivers/gpu/drm/Kconfig | 6 +- drivers/gpu/drm/Makefile | 17 ++-- drivers/gpu/drm/drm_crtc_internal.h | 2 + drivers/gpu/drm/drm_edid.c | 173 ++-------------------------------- drivers/gpu/drm/drm_hdmi.c | 182 ++++++++++++++++++++++++++++++++++++ 5 files changed, 206 insertions(+), 174 deletions(-) create mode 100644 drivers/gpu/drm/drm_hdmi.c
Signature · 1 line
1.8.3.1
PATCH 1/2 drm: Move CONFIG_HDMI-dependent code to a separate file
Selecting CONFIG_HDMI for S390 is inappropriate - there is no real graphic hardware on this architecture. The drm subsystem is only enabled here for using the virtual graphics card "virtio-gpu". So it should be possible to compile the drm subsystem also without CONFIG_DRM. Let's move the related code to a separate file for this.
--- drivers/gpu/drm/Kconfig | 2 +- drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_crtc_internal.h | 2 + drivers/gpu/drm/drm_edid.c | 163 +------------------------------- drivers/gpu/drm/drm_hdmi.c | 182 ++++++++++++++++++++++++++++++++++++ 5 files changed, 188 insertions(+), 162 deletions(-) create mode 100644 drivers/gpu/drm/drm_hdmi.c
drivers/gpu/drm/Kconfig +1 -1
@@ -8,7 +8,7 @@ menuconfig DRM tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA select DRM_PANEL_ORIENTATION_QUIRKS - select HDMI + select HDMI if !S390 select FB_CMDLINE select I2C select I2C_ALGOBIT
drivers/gpu/drm/Makefile +1 -0
@@ -20,6 +20,7 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \ drm_dumb_buffers.o drm_mode_config.o drm_vblank.o \ drm_syncobj.o drm_lease.o +drm-$(CONFIG_HDMI) += drm_hdmi.o drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o drm-$(CONFIG_DRM_VM) += drm_vm.o drm-$(CONFIG_COMPAT) += drm_ioc32.o
drivers/gpu/drm/drm_crtc_internal.h +2 -0
@@ -220,3 +220,5 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,/* drm_edid.c */ void drm_mode_fixup_1366x768 (struct drm_display_mode *mode); +u8 drm_match_hdmi_mode (const struct drm_display_mode *to_match); +bool drm_valid_hdmi_vic (u8 vic);
drivers/gpu/drm/drm_edid.c +2 -161
193 lines not on this page · raw message
drivers/gpu/drm/drm_hdmi.c new file +182 -0
182 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 2/2 drm: Make the DRM code compilable without CONFIG_I2C
In reply to Thomas HuthSelecting CONFIG_HDMI for S390 is inappropriate - there is no real graphic hardware on this architecture. The drm subsystem is only enabled here for using the virtual graphics card "virtio-gpu". So it should be possible to compile the drm subsystem also without CONFIG_I2C. Tweak the Makefile to only compile the affected files with CONFIG_I2C=y and disable some I2C-related code in drm_edid.c.
--- drivers/gpu/drm/Kconfig | 4 ++-- drivers/gpu/drm/Makefile | 16 +++++++++------- drivers/gpu/drm/drm_edid.c | 10 +++++++--- 3 files changed, 18 insertions(+), 12 deletions(-)
drivers/gpu/drm/Kconfig +2 -2
@@ -10,8 +10,8 @@ menuconfig DRM select DRM_PANEL_ORIENTATION_QUIRKS select HDMI if !S390 select FB_CMDLINE - select I2C - select I2C_ALGOBIT + select I2C if !S390 + select I2C_ALGOBIT if !S390 select DMA_SHARED_BUFFER select SYNC_FILE help
drivers/gpu/drm/Makefile +9 -7
@@ -7,10 +7,9 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \ drm_context.o drm_dma.o \ drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \ drm_lock.o drm_memory.o drm_drv.o \ - drm_scatter.o drm_pci.o \ + drm_scatter.o drm_pci.o drm_info.o \ drm_sysfs.o drm_hashtab.o drm_mm.o \ drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o \ - drm_info.o drm_encoder_slave.o \ drm_trace_points.o drm_global.o drm_prime.o \ drm_rect.o drm_vma_manager.o drm_flip_work.o \ drm_modeset_lock.o drm_atomic.o drm_bridge.o \
@@ -20,6 +19,7 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \ drm_dumb_buffers.o drm_mode_config.o drm_vblank.o \ drm_syncobj.o drm_lease.o +drm-$(CONFIG_I2C) += drm_encoder_slave.o drm-$(CONFIG_HDMI) += drm_hdmi.o drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o drm-$(CONFIG_DRM_VM) += drm_vm.o
@@ -32,11 +32,13 @@ drm-$(CONFIG_AGP) += drm_agpsupport.o drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o drm-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o -drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.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_framebuffer_helper.o +drm_kms_helper-y := drm_crtc_helper.o drm_probe_helper.o \ + drm_plane_helper.o drm_atomic_helper.o \ + drm_gem_framebuffer_helper.o drm_kms_helper_common.o \ + drm_simple_kms_helper.o drm_modeset_helper.o + +drm_kms_helper-$(CONFIG_I2C) += drm_dp_helper.o drm_dp_mst_topology.o \ + drm_dp_dual_mode_helper.o drm_scdc_helper.o drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
drivers/gpu/drm/drm_edid.c +7 -3
@@ -1467,11 +1467,14 @@ bool drm_edid_is_valid(struct edid *edid)static int drm_do_probe_ddc_edid (void *data,u8 *buf,unsigned int block,size_t len) { -struct i2c_adapter *adapter = data; -unsigned char start = block *EDID_LENGTH ;unsigned char segment = block >>1 ;unsigned char xfers = segment ?3 :2 ; -int ret, retries =5 ; +int ret =-1 ; + +#if IS_ENABLED (CONFIG_I2C ) +struct i2c_adapter *adapter = data; +unsigned char start = block *EDID_LENGTH ; +int retries =5 ;/* * The core I2C driver will automatically retry the transfer if the
@@ -1512,6 +1515,7 @@ bool drm_edid_is_valid(struct edid *edid) break; } }while (ret != xfers && --retries); +#endif /* CONFIG_I2C */ return ret == xfers ?0 :-1 ; }
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm: Make the DRM code compilable without CONFIG_I2C
Quoted 78 lines · Thomas Huth
Selecting
CONFIG_HDMIfor S390 is inappropriate - there is no real graphic hardware on this architecture. The drm subsystem is only enabled here for using the virtual graphics card "virtio-gpu". So it should be possible to compile the drm subsystem also withoutCONFIG_I2C. Tweak theMakefileto only compile the affected files withCONFIG_I2C=yand disable some I2C-related code indrm_edid.c.Signed-off-by Thomas Huth <[email protected]>--- drivers/gpu/drm/Kconfig | 4 ++-- drivers/gpu/drm/Makefile | 16 +++++++++------- drivers/gpu/drm/drm_edid.c | 10 +++++++--- 3 files changed, 18 insertions(+), 12 deletions(-)drivers/gpu/drm/Kconfig +2
-2@@ -10,8 +10,8 @@ menuconfig DRM select DRM_PANEL_ORIENTATION_QUIRKS select HDMI if !S390 select FB_CMDLINE - select I2C - select I2C_ALGOBIT + select I2C if !S390 + select I2C_ALGOBIT if !S390 select DMA_SHARED_BUFFER select SYNC_FILE helpdrivers/gpu/drm/Makefile +9
-7@@ -7,10 +7,9 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \ drm_context.o drm_dma.o \ drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \ drm_lock.o drm_memory.o drm_drv.o \ - drm_scatter.o drm_pci.o \ + drm_scatter.o drm_pci.o drm_info.o \ drm_sysfs.o drm_hashtab.o drm_mm.o \ drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o \ - drm_info.o drm_encoder_slave.o \ drm_trace_points.o drm_global.o drm_prime.o \ drm_rect.o drm_vma_manager.o drm_flip_work.o \ drm_modeset_lock.o drm_atomic.o drm_bridge.o \@@ -20,6 +19,7 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \ drm_dumb_buffers.o drm_mode_config.o drm_vblank.o \ drm_syncobj.o drm_lease.o +drm-$(CONFIG_I2C) += drm_encoder_slave.o drm-$(CONFIG_HDMI) += drm_hdmi.o drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o drm-$(CONFIG_DRM_VM) += drm_vm.o@@ -32,11 +32,13 @@ drm-$(CONFIG_AGP) += drm_agpsupport.o drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o drm-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o -drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.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_framebuffer_helper.o +drm_kms_helper-y := drm_crtc_helper.o drm_probe_helper.o \ + drm_plane_helper.o drm_atomic_helper.o \ + drm_gem_framebuffer_helper.o drm_kms_helper_common.o \ + drm_simple_kms_helper.o drm_modeset_helper.o + +drm_kms_helper-$(CONFIG_I2C) += drm_dp_helper.o drm_dp_mst_topology.o \ + drm_dp_dual_mode_helper.o drm_scdc_helper.o drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.odrivers/gpu/drm/drm_edid.c +0
-0@@ -1467,11 +1467,14 @@ bool drm_edid_is_valid(struct edid *edid) static int
drivers/gpu/drm/drm_edid.c bool drm_edid_is_valid(struct edid *edid) · line 1474
Quoted 10 lines
drivers/gpu/drm/drm_edid.c +3
-3drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len) { -struct i2c_adapter *adapter = data; -unsigned char start = block *EDID_LENGTH ;unsigned char segment = block >>1 ;unsigned char xfers = segment ?3 :2 ; -int ret, retries =5 ; +int ret =-1 ; + +#if IS_ENABLED (CONFIG_I2C )
So I don't know if the patches are worth it, I'll let others decide, but no matter what the conditional build needs to be *outside* of function bodies. The #else branch would then contain just:
#else
static inline intdrm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
{
return -1;
}#endif /* CONFIG_I2C */
BR,
Jani.
Quoted 14 lines
drivers/gpu/drm/drm_edid.c +4
-0+struct i2c_adapter *adapter = data; +unsigned char start = block *EDID_LENGTH ; +int retries =5 ;/* * The core I2C driver will automatically retry the transfer if the @@ -1512,6 +1515,7 @@ bool drm_edid_is_valid(struct edid *edid) break; } }while (ret != xfers && --retries); +#endif /* CONFIG_I2C */ return ret == xfers ?0 :-1 ; }
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Quoted 10 lines · Thomas Huth
By enabling the DRM code for virtio-gpu on S390, you currently also get all the code that is enabled by
CONFIG_HDMIandCONFIG_I2Cautomatically. This is quite ugly, since on S390, there is no HDMI and no I2C. Thus it would be great if the DRM code could also be compiled withoutCONFIG_HDMIandCONFIG_I2C. These two patches now refactor the DRM code a little bit so that we can compile it also withoutCONFIG_HDMIandCONFIG_I2C.Thomas Huth (2):
drivers/gpu/drm: Move CONFIG_HDMI-dependent code to a separate filedrivers/gpu/drm: Make the DRM code compilable withoutCONFIG_I2C
What's the benefit? Why does I2C/HDMI hurt you?
Note that you still can't compile out DP code, and the DRM legacy code, and that's much bigger ...
-Daniel
Quoted 16 lines
drivers/gpu/drm/Kconfig | 6 +- drivers/gpu/drm/Makefile | 17 ++-- drivers/gpu/drm/drm_crtc_internal.h | 2 + drivers/gpu/drm/drm_edid.c | 173 ++-------------------------------- drivers/gpu/drm/drm_hdmi.c | 182 ++++++++++++++++++++++++++++++++++++ 5 files changed, 206 insertions(+), 174 deletions(-) create mode 100644 drivers/gpu/drm/drm_hdmi.c--
1.8.3.1_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 8 lines · Daniel Vetter
Quoted 7 lines · Thomas Huth
By enabling the DRM code for virtio-gpu on S390, you currently also get all the code that is enabled by
CONFIG_HDMIandCONFIG_I2Cautomatically. This is quite ugly, since on S390, there is no HDMI and no I2C. Thus it would be great if the DRM code could also be compiled withoutCONFIG_HDMIandCONFIG_I2C. These two patches now refactor the DRM code a little bit so that we can compile it also withoutCONFIG_HDMIandCONFIG_I2C.
Quoted 5 lines
Quoted 3 lines
Thomas Huth (2):
drivers/gpu/drm: Move CONFIG_HDMI-dependent code to a separate filedrivers/gpu/drm: Make the DRM code compilable withoutCONFIG_I2CWhat's the benefit? Why does I2C/HDMI hurt you?
Why should I be forced to compile-in subsystems that do not make any sense on this architecture? It's just completely weird to see CONFIG_I2C enabled on s390x.
Thomas
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 13 lines · Thomas Huth
Quoted 12 lines · Daniel Vetter
Quoted 10 lines · Thomas Huth
By enabling the DRM code for virtio-gpu on S390, you currently also get all the code that is enabled by
CONFIG_HDMIandCONFIG_I2Cautomatically. This is quite ugly, since on S390, there is no HDMI and no I2C. Thus it would be great if the DRM code could also be compiled withoutCONFIG_HDMIandCONFIG_I2C. These two patches now refactor the DRM code a little bit so that we can compile it also withoutCONFIG_HDMIandCONFIG_I2C.Thomas Huth (2):
drivers/gpu/drm: Move CONFIG_HDMI-dependent code to a separate filedrivers/gpu/drm: Make the DRM code compilable withoutCONFIG_I2C
Quoted 5 lines
Quoted 1 line
What's the benefit? Why does I2C/HDMI hurt you?
Why should I be forced to compile-in subsystems that do not make any sense on this architecture? It's just completely weird to see
CONFIG_I2Cenabled on s390x.
"Looks wierd" is not really a good engineering criteria, especially in graphics :-)
For context: In DRM almost nothing is optional, and it greatly simplifies life and coding. We don't have epic amounts of #ifdef battles to make trivial code changes compile, except in all the places where external stuff is optional (like backlight).
So making something optional will have a pretty clear cost on the drm subsystem, and it doesn't make sense to pay that cost to "look less wierd". To get this merged we need some clear benefits, which will balance out the inevitable cost of having to maintain this forever (and most likely getting yelled at by Linus for making some rando compile config no longer work).
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel