Skip to contentSkip to conversation

drm: minimize drmP.h dependencies

PATCH Applied Sam Ravnborg 4 participants 16 messages Dec 26, 2018 – Dec 27, 2018

Subsystems (14)

v1 of 6 Applied Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover drm: minimize drmP.h dependencies

The goal with this small series is to remove the last bits that prevents us from removing drmP.h file by file.

- drmP.h is now stripped down to include files and forward declarations.
- All header files in include/drm/ no longer include drmP.h.

The series was made on top of 4.20.
Build tested using arm and x86 all{yes,mod}config

Most of the work was to remove the include and fix fallout.

The patches are trivial but touches a lot of files, so a lot of people on cc: for the individual patches.

I expect the full series to be applied to drm-misc.

There are still ~900 uses of drmP.h so a long way ahead of us to get rid of the header file.

Sam

Sam Ravnborg (7):
drm: move DRM_IF_VERSION to drm_internal.h
drm: move DRM_SWITCH_POWER defines to drm_device.h
drm: move drm_can_sleep() to drm_util.h
drm: remove include of drmP.h from bridge/dw_hdmi.h
drm: remove include of drmP.h from drm_encoder_slave.h
drm: remove include of drmP.h from drm_modeset_helper.h
drm: remove include of drmP.h from drm_gem_cma_helper.h

 drivers/gpu/drm/amd/amdgpu/atom.c                   |  2 ++
 drivers/gpu/drm/arc/arcpgu_crtc.c                   |  2 ++
 drivers/gpu/drm/arc/arcpgu_drv.c                    |  6 ++++++
 drivers/gpu/drm/arc/arcpgu_sim.c                    |  1 +
 drivers/gpu/drm/ast/ast_fb.c                        |  1 +
 drivers/gpu/drm/bridge/cdns-dsi.c                   |  2 ++
 drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c |  4 ++++
 drivers/gpu/drm/cirrus/cirrus_fbdev.c               |  1 +
 drivers/gpu/drm/drm_flip_work.c                     |  1 +
 drivers/gpu/drm/drm_internal.h                      |  2 ++
 drivers/gpu/drm/drm_modeset_helper.c                |  2 ++
 drivers/gpu/drm/mgag200/mgag200_fb.c                |  1 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c            |  1 +
 drivers/gpu/drm/omapdrm/omap_fbdev.c                |  1 +
 drivers/gpu/drm/qxl/qxl_cmd.c                       |  2 ++
 drivers/gpu/drm/radeon/atom.c                       |  2 ++
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c     |  1 +
 drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c              |  1 +
 drivers/gpu/drm/rcar-du/rcar_lvds.c                 |  1 +
 drivers/gpu/drm/stm/drv.c                           |  3 +++
 drivers/gpu/drm/stm/ltdc.c                          |  9 ++++++++-
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c         |  1 +
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c      |  2 ++
 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c         |  1 +
 drivers/gpu/drm/tinydrm/ili9225.c                   |  1 +
 drivers/gpu/drm/tinydrm/mipi-dbi.c                  |  3 +++
 drivers/gpu/drm/vc4/vc4_drv.h                       |  1 +
 include/drm/bridge/dw_hdmi.h                        |  5 ++++-
 include/drm/drmP.h                                  | 15 ---------------
 include/drm/drm_device.h                            |  9 +++++++++
 include/drm/drm_encoder_slave.h                     |  1 -
 include/drm/drm_file.h                              |  1 +
 include/drm/drm_gem_cma_helper.h                    |  5 ++++-
 include/drm/drm_modeset_helper.h                    |  2 --
 include/drm/drm_util.h                              | 13 +++++++++++++
 include/drm/tinydrm/tinydrm.h                       |  1 +
 36 files changed, 86 insertions(+), 21 deletions(-)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

PATCH 2/7 drm: move DRM_SWITCH_POWER defines to drm_device.h

Move DRM_SWITCH_POWER out of drmP.h to allow users to get rid of the drmP include.

DRM_SWITCH_POWER defines are used in combination with drm_device.switch_power_state.

Move the DRM_SWITCH_POWER defines to the file where drm_device.switch_power_state is defined.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 include/drm/drmP.h       | 5 -----
 include/drm/drm_device.h | 9 +++++++++
 2 files changed, 9 insertions(+), 5 deletions(-)
include/drm/drmP.h +0 -5
index b6b8436b5123..2ba786820052 100644
@@ -95,11 +95,6 @@ struct dma_buf_attachment;
 struct pci_dev;
 struct pci_controller;
 
-#define DRM_SWITCH_POWER_ON 0
-#define DRM_SWITCH_POWER_OFF 1
-#define DRM_SWITCH_POWER_CHANGING 2
-#define DRM_SWITCH_POWER_DYNAMIC_OFF 3
-
 /* returns true if currently okay to sleep */
 static inline bool drm_can_sleep(void)
 {
include/drm/drm_device.h +9 -0
index 42411b3ea0c8..c3da194d25f9 100644
@@ -24,6 +24,13 @@ struct inode;
 struct pci_dev;
 struct pci_controller;
 
+
+/* Used by drm_device.switch_power_state */
+#define DRM_SWITCH_POWER_ON 0
+#define DRM_SWITCH_POWER_OFF 1
+#define DRM_SWITCH_POWER_CHANGING 2
+#define DRM_SWITCH_POWER_DYNAMIC_OFF 3
+
 /**
  * DRM device structure. This structure represent a complete card that
  * may contain multiple heads.
@@ -222,6 +229,8 @@ struct drm_device {
 	struct idr object_name_idr;
 	struct drm_vma_offset_manager *vma_offset_manager;
 	/*@} */
+
+	/* See DRM_SWITCH_POWER defines */
 	int switch_power_state;
 
 	/**
Signature · 1 line
2.12.0
#1 lore raw

PATCH 1/7 drm: move DRM_IF_VERSION to drm_internal.h

In reply to Sam Ravnborg

Move DRM_IF_VERSION out of drmP.h to allow users to get rid of the drmP include.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_internal.h | 2 ++
 include/drm/drmP.h             | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_internal.h +2 -0
index 51e06defc8d8..e9374cd43610 100644
@@ -26,6 +26,8 @@
 #define DRM_IF_MAJOR 1
 #define DRM_IF_MINOR 4
 
+#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
+
 struct drm_prime_file_private;
 struct dma_buf;
 
include/drm/drmP.h +0 -2
index 05350424a4d3..b6b8436b5123 100644
@@ -95,8 +95,6 @@ struct dma_buf_attachment;
 struct pci_dev;
 struct pci_controller;
 
-#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
-
 #define DRM_SWITCH_POWER_ON 0
 #define DRM_SWITCH_POWER_OFF 1
 #define DRM_SWITCH_POWER_CHANGING 2
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

PATCH 3/7 drm: move drm_can_sleep() to drm_util.h

In reply to Sam Ravnborg

Move drm_can_sleep() out of drmP.h to allow users
to get rid of the drmP.h include.

There was no header file that was a good match for this helper function. So add this to drm_util with the relevant includes.

Add include of drm_util.h to all users.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Alex Deucher <[email protected]>
Cc "Christian König" <[email protected]>
Cc "David (ChunMing) Zhou" <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Rob Clark <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc Eric Anholt <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/atom.c               |  2 ++
 drivers/gpu/drm/ast/ast_fb.c                    |  1 +
 drivers/gpu/drm/cirrus/cirrus_fbdev.c           |  1 +
 drivers/gpu/drm/drm_flip_work.c                 |  1 +
 drivers/gpu/drm/mgag200/mgag200_fb.c            |  1 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c        |  1 +
 drivers/gpu/drm/omapdrm/omap_fbdev.c            |  1 +
 drivers/gpu/drm/qxl/qxl_cmd.c                   |  2 ++
 drivers/gpu/drm/radeon/atom.c                   |  2 ++
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |  1 +
 drivers/gpu/drm/vc4/vc4_drv.h                   |  1 +
 include/drm/drmP.h                              |  8 --------
 include/drm/drm_util.h                          | 13 +++++++++++++
 13 files changed, 27 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/atom.c +2 -0
index e9934de1b9cf..dd30f4e61a8c 100644
@@ -27,6 +27,8 @@
 #include <linux/slab.h>
 #include <asm/unaligned.h>
 
+#include <drm/drm_util.h>
+
 #define ATOM_DEBUG
 
 #include "atom.h"
drivers/gpu/drm/ast/ast_fb.c +1 -0
index de26df0c6044..fb56fe848e81 100644
@@ -38,6 +38,7 @@
 
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_util.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
 #include "ast_drv.h"
drivers/gpu/drm/cirrus/cirrus_fbdev.c +1 -0
index 68ab1821e15b..1544fa55d1ff 100644
@@ -10,6 +10,7 @@
  */
 #include <linux/module.h>
 #include <drm/drmP.h>
+#include <drm/drm_util.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
 
drivers/gpu/drm/drm_flip_work.c +1 -0
index 12dea16f22a8..3da3bf5af405 100644
@@ -22,6 +22,7 @@
  */
 
 #include <drm/drmP.h>
+#include <drm/drm_util.h>
 #include <drm/drm_flip_work.h>
 
 /**
drivers/gpu/drm/mgag200/mgag200_fb.c +1 -0
index 30726c9fe28c..6893934b26c0 100644
@@ -12,6 +12,7 @@
  */
 #include <linux/module.h>
 #include <drm/drmP.h>
+#include <drm/drm_util.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
 
drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c +1 -0
index 96c2b828dba4..fa2d1d8995ee 100644
@@ -16,6 +16,7 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <drm/drm_util.h>
 
 #include "mdp5_kms.h"
 #include "mdp5_smp.h"
drivers/gpu/drm/omapdrm/omap_fbdev.c +1 -0
index aee99194499f..851c59f07eb1 100644
@@ -16,6 +16,7 @@
  */
 
 #include <drm/drm_crtc.h>
+#include <drm/drm_util.h>
 #include <drm/drm_fb_helper.h>
 
 #include "omap_drv.h"
drivers/gpu/drm/qxl/qxl_cmd.c +2 -0
index 208af9f37914..d17676824377 100644
@@ -25,6 +25,8 @@
 
 /* QXL cmd/ring handling */
 
+#include <drm/drm_util.h>
+
 #include "qxl_drv.h"
 #include "qxl_object.h"
 
drivers/gpu/drm/radeon/atom.c +2 -0
index e55cbeee7a53..ac98ad561870 100644
@@ -27,6 +27,8 @@
 #include <linux/slab.h>
 #include <asm/unaligned.h>
 
+#include <drm/drm_util.h>
+
 #define ATOM_DEBUG
 
 #include "atom.h"
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +1 -0
index 222a1fa41d7c..7e3257e8fd56 100644
@@ -24,6 +24,7 @@
  *          Alex Deucher
  */
 #include <drm/drmP.h>
+#include <drm/drm_util.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/radeon_drm.h>
 #include "radeon.h"
drivers/gpu/drm/vc4/vc4_drv.h +1 -0
index bd6ef1f31822..79c6bcc4f509 100644
@@ -9,6 +9,7 @@
 #include <linux/mm_types.h>
 #include <linux/reservation.h>
 #include <drm/drmP.h>
+#include <drm/drm_util.h>
 #include <drm/drm_encoder.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_atomic.h>
include/drm/drmP.h +0 -8
index 2ba786820052..a77c9ee43b68 100644
@@ -95,12 +95,4 @@ struct dma_buf_attachment;
 struct pci_dev;
 struct pci_controller;
 
-/* returns true if currently okay to sleep */
-static inline bool drm_can_sleep(void)
-{
-	if (in_atomic() || in_dbg_master() || irqs_disabled())
-		return false;
-	return true;
-}
-
 #endif
include/drm/drm_util.h +13 -0
index 88abdca89baa..e3200980d3f3 100644
@@ -26,7 +26,20 @@
 #ifndef _DRM_UTIL_H_
 #define _DRM_UTIL_H_
 
+#include <linux/irqflags.h>
+#include <linux/preempt.h>
+#include <linux/kgdb.h>
+#include <linux/smp.h>
+
 /* helper for handling conditionals in various for_each macros */
 #define for_each_if(condition) if (!(condition)) {} else
 
+/* returns true if currently okay to sleep */
+static inline bool drm_can_sleep(void)
+{
+	if (in_atomic() || in_dbg_master() || irqs_disabled())
+		return false;
+	return true;
+}
+
 #endif
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

PATCH 4/7 drm: remove include of drmP.h from bridge/dw_hdmi.h

In reply to Sam Ravnborg

Add missing includes in dw_hdmi.h and
fix fallout in drivers.

Cc Archit Taneja <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Kieran Bingham <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Neil Armstrong <[email protected]>
Cc Maxime Ripard <[email protected]>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 4 ++++
 drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c              | 1 +
 include/drm/bridge/dw_hdmi.h                        | 5 ++++-
 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +4 -0
index 8f9c8a6b46de..c61ec4caaa84 100644
@@ -8,6 +8,10 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+
+#include <linux/dma-mapping.h>
+#include <linux/module.h>
+
 #include <drm/bridge/dw_hdmi.h>
 
 #include <sound/hdmi-codec.h>
drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c +1 -0
index 75490a3e0a2a..f5b07a2e3f59 100644
@@ -8,6 +8,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
 
 #include <drm/bridge/dw_hdmi.h>
include/drm/bridge/dw_hdmi.h +4 -1
index ccb5aa8468e0..b0218ee75a65 100644
@@ -10,7 +10,10 @@
 #ifndef __DW_HDMI__
 #define __DW_HDMI__
 
-#include <drm/drmP.h>
+#include <linux/platform_device.h>
+
+#include <drm/drm_connector.h>
+#include <drm/drm_modes.h>
 
 struct dw_hdmi;
 
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

PATCH 5/7 drm: remove include of drmP.h from drm_encoder_slave.h

In reply to Sam Ravnborg

No further changes required.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 include/drm/drm_encoder_slave.h | 1 -
 1 file changed, 1 deletion(-)
include/drm/drm_encoder_slave.h +0 -1
index 1107b4b1c599..a09864f6d684 100644
@@ -27,7 +27,6 @@
 #ifndef __DRM_ENCODER_SLAVE_H__
 #define __DRM_ENCODER_SLAVE_H__
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_encoder.h>
 
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw

PATCH 6/7 drm: remove include of drmP.h from drm_modeset_helper.h

In reply to Sam Ravnborg

Fix fallout in various files/drivers by adding missing include files.

Cc Alexey Brodkin <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Archit Taneja <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc Kieran Bingham <[email protected]>
---
 drivers/gpu/drm/arc/arcpgu_sim.c     | 1 +
 drivers/gpu/drm/bridge/cdns-dsi.c    | 2 ++
 drivers/gpu/drm/drm_modeset_helper.c | 2 ++
 drivers/gpu/drm/rcar-du/rcar_lvds.c  | 1 +
 include/drm/drm_modeset_helper.h     | 2 --
 5 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/arc/arcpgu_sim.c +1 -0
index 68629e614990..3b7556f62230 100644
@@ -14,6 +14,7 @@
  *
  */
 
+#include <drm/drm_device.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_atomic_helper.h>
 
drivers/gpu/drm/bridge/cdns-dsi.c +2 -0
index ce9496d13986..4b73d0969468 100644
@@ -8,11 +8,13 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
 #include <video/mipi_display.h>
 
 #include <linux/clk.h>
+#include <linux/interrupt.h>
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
drivers/gpu/drm/drm_modeset_helper.c +2 -0
index f1c24ab0ef09..680cb6a5978c 100644
@@ -23,8 +23,10 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_helper.h>
+#include <drm/drm_fourcc.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_plane_helper.h>
+#include <drm/drm_print.h>
 
 /**
  * DOC: aux kms helpers
drivers/gpu/drm/rcar-du/rcar_lvds.c +1 -0
index 173d7ad0b991..f1043458cbd8 100644
@@ -10,6 +10,7 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_graph.h>
include/drm/drm_modeset_helper.h +0 -2
index efa337f03129..82ead67dfa36 100644
@@ -23,8 +23,6 @@
 #ifndef __DRM_KMS_HELPER_H__
 #define __DRM_KMS_HELPER_H__
 
-#include <drm/drmP.h>
-
 void drm_helper_move_panel_connectors_to_head(struct drm_device *);
 
 void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw

PATCH 7/7 drm: remove include of drmP.h from drm_gem_cma_helper.h

In reply to Sam Ravnborg

Fix fallout in various files/drivers.

Cc Alexey Brodkin <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Yannick Fertre <[email protected]>
Cc Philippe Cornu <[email protected]>
Cc Benjamin Gaignard <[email protected]>
Cc Vincent Abriou <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Alexandre Torgue <[email protected]>
Cc "Noralf Trønnes" <[email protected]>
Cc David Lechner <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
---
 drivers/gpu/drm/arc/arcpgu_crtc.c              | 2 ++
 drivers/gpu/drm/arc/arcpgu_drv.c               | 6 ++++++
 drivers/gpu/drm/stm/drv.c                      | 3 +++
 drivers/gpu/drm/stm/ltdc.c                     | 9 ++++++++-
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c    | 1 +
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 2 ++
 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c    | 1 +
 drivers/gpu/drm/tinydrm/ili9225.c              | 1 +
 drivers/gpu/drm/tinydrm/mipi-dbi.c             | 3 +++
 include/drm/drm_file.h                         | 1 +
 include/drm/drm_gem_cma_helper.h               | 5 ++++-
 include/drm/tinydrm/tinydrm.h                  | 1 +
 12 files changed, 33 insertions(+), 2 deletions(-)
drivers/gpu/drm/arc/arcpgu_crtc.c +2 -0
index 965cda48dc13..41e8bbfe2806 100644
@@ -16,8 +16,10 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_device.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_vblank.h>
 #include <drm/drm_plane_helper.h>
 #include <linux/clk.h>
 #include <linux/platform_data/simplefb.h>
drivers/gpu/drm/arc/arcpgu_drv.c +6 -0
index f067de4e1e82..cca897341921 100644
@@ -16,11 +16,17 @@
 
 #include <linux/clk.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_device.h>
+#include <drm/drm_debugfs.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_atomic_helper.h>
+#include <linux/dma-mapping.h>
+#include <linux/module.h>
 #include <linux/of_reserved_mem.h>
+#include <linux/platform_device.h>
 
 #include "arcpgu.h"
 #include "arcpgu_regs.h"
drivers/gpu/drm/stm/drv.c +3 -0
index f2021b23554d..6d41b0fb165f 100644
@@ -9,12 +9,15 @@
  */
 
 #include <linux/component.h>
+#include <linux/dma-mapping.h>
+#include <linux/module.h>
 #include <linux/of_platform.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_helper.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
drivers/gpu/drm/stm/ltdc.c +8 -1
index 808d9fb627e9..8f6249368450 100644
@@ -10,17 +10,24 @@
 
 #include <linux/clk.h>
 #include <linux/component.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_graph.h>
+#include <linux/platform_device.h>
 #include <linux/reset.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_bridge.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_device.h>
 #include <drm/drm_fb_cma_helper.h>
+#include <drm/drm_fourcc.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_of.h>
-#include <drm/drm_bridge.h>
+#include <drm/drm_vblank.h>
 #include <drm/drm_plane_helper.h>
 
 #include <video/videomode.h>
drivers/gpu/drm/tinydrm/core/tinydrm-core.c +1 -0
index 255341ee4eb9..cc4f4c6a6cb4 100644
@@ -15,6 +15,7 @@
 #include <drm/tinydrm/tinydrm.h>
 #include <linux/device.h>
 #include <linux/dma-buf.h>
+#include <linux/module.h>
 
 /**
  * DOC: overview
drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c +2 -0
index dcd390163a4a..d4ec6bcc39b2 100644
@@ -9,10 +9,12 @@
 
 #include <linux/backlight.h>
 #include <linux/dma-buf.h>
+#include <linux/moduleparam.h>
 #include <linux/pm.h>
 #include <linux/spi/spi.h>
 #include <linux/swab.h>
 
+#include <drm/drm_fourcc.h>
 #include <drm/tinydrm/tinydrm.h>
 #include <drm/tinydrm/tinydrm-helpers.h>
 
drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c +1 -0
index 7e8e24d0b7a7..652b596070e6 100644
@@ -11,6 +11,7 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_vblank.h>
 #include <drm/tinydrm/tinydrm.h>
 
 struct tinydrm_connector {
drivers/gpu/drm/tinydrm/ili9225.c +1 -0
index 455fefe012f5..fbd94fe8b36f 100644
@@ -21,6 +21,7 @@
 #include <video/mipi_display.h>
 
 #include <drm/drm_fb_helper.h>
+#include <drm/drm_fourcc.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/tinydrm/mipi-dbi.h>
 #include <drm/tinydrm/tinydrm-helpers.h>
drivers/gpu/drm/tinydrm/mipi-dbi.c +3 -0
index cb3441e51d5f..c61f5539e58e 100644
@@ -9,10 +9,13 @@
  * (at your option) any later version.
  */
 
+#include <drm/drm_file.h>
+#include <drm/drm_fourcc.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/tinydrm/mipi-dbi.h>
 #include <drm/tinydrm/tinydrm-helpers.h>
 #include <linux/debugfs.h>
+#include <linux/delay.h>
 #include <linux/dma-buf.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
include/drm/drm_file.h +1 -0
index 26485acc51d7..931b072d0aa9 100644
@@ -30,6 +30,7 @@
 #ifndef _DRM_FILE_H_
 #define _DRM_FILE_H_
 
+#include <linux/idr.h>
 #include <linux/types.h>
 #include <linux/completion.h>
 
include/drm/drm_gem_cma_helper.h +4 -1
index 19777145cf8e..83907bd1cf53 100644
@@ -2,9 +2,12 @@
 #ifndef __DRM_GEM_CMA_HELPER_H__
 #define __DRM_GEM_CMA_HELPER_H__
 
-#include <drm/drmP.h>
+#include <drm/drm_file.h>
+#include <drm/drm_ioctl.h>
 #include <drm/drm_gem.h>
 
+struct drm_mode_create_dumb;
+
 /**
  * struct drm_gem_cma_object - GEM object backed by CMA memory allocations
  * @base: base GEM object
include/drm/tinydrm/tinydrm.h +1 -0
index fe9827d0ca8a..449fdc4de7d3 100644
@@ -10,6 +10,7 @@
 #ifndef __LINUX_TINYDRM_H
 #define __LINUX_TINYDRM_H
 
+#include <drm/drm_drv.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_simple_kms_helper.h>
Signature · 6 lines
2.12.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
reviewer Reviewed-by on v1 4/7
#9 lore raw

Re: [PATCH v1 4/7] drm: remove include of drmP.h from bridge/dw_hdmi.h

In reply to Sam Ravnborg

Hi Sam,

Thank you for the patch.

Quoted 41 lines · On Wednesday, 26 December 2018 23:03:50 EET Sam Ravnborg wrote:

Add missing includes in dw_hdmi.h and
fix fallout in drivers.

Cc Archit Taneja <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Kieran Bingham <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Neil Armstrong <[email protected]>
Cc Maxime Ripard <[email protected]>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 4 ++++
 drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c              | 1 +
 include/drm/bridge/dw_hdmi.h                        | 5 ++++-
 3 files changed, 9 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c index 8f9c8a6b46de..c61ec4caaa84 100644

drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +4 -0
@@ -8,6 +8,10 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+
+#include <linux/dma-mapping.h>
+#include <linux/module.h>
+
 #include <drm/bridge/dw_hdmi.h>
 
 #include <sound/hdmi-codec.h>
(quoted diff) +0 -0

b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c index 75490a3e0a2a..f5b07a2e3f59 100644

drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c line 11

Quoted 4 lines
drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c +1 -0
@@ -8,6 +8,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>

Nitpicking, _ comes before u.

include/drm/bridge/dw_hdmi.h line 13

Quoted 13 lines
drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c +0 -0
 #include <linux/platform_device.h>
 
 #include <drm/bridge/dw_hdmi.h>
include/drm/bridge/dw_hdmi.h +1 -1
index ccb5aa8468e0..b0218ee75a65 100644
@@ -10,7 +10,10 @@
 #ifndef __DW_HDMI__
 #define __DW_HDMI__
 
-#include <drm/drmP.h>
+#include <linux/platform_device.h>

I think you can replace this with a forward declaration of struct platform_device. You will likely need to handle more fallout.

include/drm/bridge/dw_hdmi.h line 16

Quoted 2 lines
include/drm/bridge/dw_hdmi.h +2 -0
+#include <drm/drm_connector.h>
+#include <drm/drm_modes.h>

Please add forward definitions for structures used in this file and not defined in the above headers. I'm thinking about struct regmap and struct drm_encoder. They may be defined in headers included from the above three, or from headers included from files including dw_hdmi.h, but we shouldn't rely on that as it may change.

With this fixed,

Quoted 1 line
include/drm/bridge/dw_hdmi.h +0 -0
 struct dw_hdmi;
Signature · 3 lines
Regards,

Laurent Pinchart
reviewer Reviewed-by on v1 6/7
#12 lore raw

Re: [PATCH v1 6/7] drm: remove include of drmP.h from drm_modeset_helper.h

In reply to Sam Ravnborg

Hi Sam,

Thank you for the patch.

Quoted 85 lines · On Wednesday, 26 December 2018 23:03:52 EET Sam Ravnborg wrote:

Fix fallout in various files/drivers by adding missing include files.

Cc Alexey Brodkin <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Archit Taneja <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc Kieran Bingham <[email protected]>
---
 drivers/gpu/drm/arc/arcpgu_sim.c     | 1 +
 drivers/gpu/drm/bridge/cdns-dsi.c    | 2 ++
 drivers/gpu/drm/drm_modeset_helper.c | 2 ++
 drivers/gpu/drm/rcar-du/rcar_lvds.c  | 1 +
 include/drm/drm_modeset_helper.h     | 2 --
 5 files changed, 6 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/arc/arcpgu_sim.c index 68629e614990..3b7556f62230 100644

drivers/gpu/drm/arc/arcpgu_sim.c +1 -0
@@ -14,6 +14,7 @@
  *
  */
 
+#include <drm/drm_device.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_atomic_helper.h>
 
(quoted diff) +0 -0

b/drivers/gpu/drm/bridge/cdns-dsi.c index ce9496d13986..4b73d0969468 100644

drivers/gpu/drm/bridge/cdns-dsi.c +2 -0
@@ -8,11 +8,13 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
 #include <video/mipi_display.h>
 
 #include <linux/clk.h>
+#include <linux/interrupt.h>
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_modeset_helper.c index f1c24ab0ef09..680cb6a5978c 100644

drivers/gpu/drm/drm_modeset_helper.c +2 -0
@@ -23,8 +23,10 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_helper.h>
+#include <drm/drm_fourcc.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_plane_helper.h>
+#include <drm/drm_print.h>
 
 /**
  * DOC: aux kms helpers
(quoted diff) +0 -0

b/drivers/gpu/drm/rcar-du/rcar_lvds.c index 173d7ad0b991..f1043458cbd8 100644

drivers/gpu/drm/rcar-du/rcar_lvds.c +1 -0
@@ -10,6 +10,7 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_graph.h>
(quoted diff) +0 -0

b/include/drm/drm_modeset_helper.h index efa337f03129..82ead67dfa36 100644

include/drm/drm_modeset_helper.h line 26

Quoted 4 lines
include/drm/drm_modeset_helper.h +0 -1
@@ -23,8 +23,6 @@
 #ifndef __DRM_KMS_HELPER_H__
 #define __DRM_KMS_HELPER_H__
 
-#include <drm/drmP.h>

Please add forward declarations for all structures used as pointers in this file. We shouldn't rely on the files including drm_modeset_helper.h to provide definitions or declarations for those structures.

With that fixed,

Quoted 3 lines
include/drm/drm_modeset_helper.h +0 -0
 void drm_helper_move_panel_connectors_to_head(struct drm_device *);
 
 void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw

Re: [PATCH v1 1/7] drm: move DRM_IF_VERSION to drm_internal.h

In reply to Sam Ravnborg
Quoted 9 lines · Sam Ravnborg

Move DRM_IF_VERSION out of drmP.h to allow users to get rid of the drmP include.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

Applied to drm-misc-next, thanks for your patch.
-Daniel

Quoted 34 lines
---
 drivers/gpu/drm/drm_internal.h | 2 ++
 include/drm/drmP.h             | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_internal.h +2 -0
index 51e06defc8d8..e9374cd43610 100644
@@ -26,6 +26,8 @@
 #define DRM_IF_MAJOR 1
 #define DRM_IF_MINOR 4
 
+#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
+
 struct drm_prime_file_private;
 struct dma_buf;
 
include/drm/drmP.h +0 -2
index 05350424a4d3..b6b8436b5123 100644
@@ -95,8 +95,6 @@ struct dma_buf_attachment;
 struct pci_dev;
 struct pci_controller;
 
-#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
-
 #define DRM_SWITCH_POWER_ON 0
 #define DRM_SWITCH_POWER_OFF 1
 #define DRM_SWITCH_POWER_CHANGING 2
Signature · 1 line
2.12.0
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Re: [PATCH v1 2/7] drm: move DRM_SWITCH_POWER defines to drm_device.h

In reply to Sam Ravnborg
Quoted 41 lines · Sam Ravnborg

Move DRM_SWITCH_POWER out of drmP.h to allow users to get rid of the drmP include.

DRM_SWITCH_POWER defines are used in combination with drm_device.switch_power_state.

Move the DRM_SWITCH_POWER defines to the file where drm_device.switch_power_state is defined.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 include/drm/drmP.h       | 5 -----
 include/drm/drm_device.h | 9 +++++++++
 2 files changed, 9 insertions(+), 5 deletions(-)
include/drm/drmP.h +0 -5
index b6b8436b5123..2ba786820052 100644
@@ -95,11 +95,6 @@ struct dma_buf_attachment;
 struct pci_dev;
 struct pci_controller;
 
-#define DRM_SWITCH_POWER_ON 0
-#define DRM_SWITCH_POWER_OFF 1
-#define DRM_SWITCH_POWER_CHANGING 2
-#define DRM_SWITCH_POWER_DYNAMIC_OFF 3
-
 /* returns true if currently okay to sleep */
 static inline bool drm_can_sleep(void)
 {
include/drm/drm_device.h +0 -0
index 42411b3ea0c8..c3da194d25f9 100644

include/drm/drm_device.h struct inode; · line 32

Quoted 9 lines
include/drm/drm_device.h +6 -0
@@ -24,6 +24,13 @@ struct inode;
 struct pci_dev;
 struct pci_controller;
 
+
+/* Used by drm_device.switch_power_state */
+#define DRM_SWITCH_POWER_ON 0
+#define DRM_SWITCH_POWER_OFF 1
+#define DRM_SWITCH_POWER_CHANGING 2
+#define DRM_SWITCH_POWER_DYNAMIC_OFF 3

Since this isn't uapi it'd be nice to change it to an enum, which we can then properly kernel-doc and make your references links in the resulting html. Otherwise lgtm.

Would need an include stanza for drm_device.h in drm-internals.rst, plus a bit of kernel-doc cleanup in here I think (which iirc is why I didn't yet do this).
-Daniel

Quoted 16 lines
include/drm/drm_device.h +3 -0
+
 /**
  * DRM device structure. This structure represent a complete card that
  * may contain multiple heads.
@@ -222,6 +229,8 @@ struct drm_device {
 	struct idr object_name_idr;
 	struct drm_vma_offset_manager *vma_offset_manager;
 	/*@} */
+
+	/* See DRM_SWITCH_POWER defines */
 	int switch_power_state;
 
 	/**
Signature · 1 line
2.12.0
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

Re: [PATCH v1 3/7] drm: move drm_can_sleep() to drm_util.h

In reply to Sam Ravnborg
Quoted 196 lines · Sam Ravnborg

Move drm_can_sleep() out of drmP.h to allow users
to get rid of the drmP.h include.

There was no header file that was a good match for this helper function. So add this to drm_util with the relevant includes.

Add include of drm_util.h to all users.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Alex Deucher <[email protected]>
Cc "Christian König" <[email protected]>
Cc "David (ChunMing) Zhou" <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Rob Clark <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc Eric Anholt <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/atom.c               |  2 ++
 drivers/gpu/drm/ast/ast_fb.c                    |  1 +
 drivers/gpu/drm/cirrus/cirrus_fbdev.c           |  1 +
 drivers/gpu/drm/drm_flip_work.c                 |  1 +
 drivers/gpu/drm/mgag200/mgag200_fb.c            |  1 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c        |  1 +
 drivers/gpu/drm/omapdrm/omap_fbdev.c            |  1 +
 drivers/gpu/drm/qxl/qxl_cmd.c                   |  2 ++
 drivers/gpu/drm/radeon/atom.c                   |  2 ++
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |  1 +
 drivers/gpu/drm/vc4/vc4_drv.h                   |  1 +
 include/drm/drmP.h                              |  8 --------
 include/drm/drm_util.h                          | 13 +++++++++++++
 13 files changed, 27 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/atom.c +2 -0
index e9934de1b9cf..dd30f4e61a8c 100644
@@ -27,6 +27,8 @@
 #include <linux/slab.h>
 #include <asm/unaligned.h>
 
+#include <drm/drm_util.h>
+
 #define ATOM_DEBUG
 
 #include "atom.h"
drivers/gpu/drm/ast/ast_fb.c +1 -0
index de26df0c6044..fb56fe848e81 100644
@@ -38,6 +38,7 @@
 
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_util.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
 #include "ast_drv.h"
drivers/gpu/drm/cirrus/cirrus_fbdev.c +1 -0
index 68ab1821e15b..1544fa55d1ff 100644
@@ -10,6 +10,7 @@
  */
 #include <linux/module.h>
 #include <drm/drmP.h>
+#include <drm/drm_util.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
 
drivers/gpu/drm/drm_flip_work.c +1 -0
index 12dea16f22a8..3da3bf5af405 100644
@@ -22,6 +22,7 @@
  */
 
 #include <drm/drmP.h>
+#include <drm/drm_util.h>
 #include <drm/drm_flip_work.h>
 
 /**
drivers/gpu/drm/mgag200/mgag200_fb.c +1 -0
index 30726c9fe28c..6893934b26c0 100644
@@ -12,6 +12,7 @@
  */
 #include <linux/module.h>
 #include <drm/drmP.h>
+#include <drm/drm_util.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
 
drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c +1 -0
index 96c2b828dba4..fa2d1d8995ee 100644
@@ -16,6 +16,7 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <drm/drm_util.h>
 
 #include "mdp5_kms.h"
 #include "mdp5_smp.h"
drivers/gpu/drm/omapdrm/omap_fbdev.c +1 -0
index aee99194499f..851c59f07eb1 100644
@@ -16,6 +16,7 @@
  */
 
 #include <drm/drm_crtc.h>
+#include <drm/drm_util.h>
 #include <drm/drm_fb_helper.h>
 
 #include "omap_drv.h"
drivers/gpu/drm/qxl/qxl_cmd.c +2 -0
index 208af9f37914..d17676824377 100644
@@ -25,6 +25,8 @@
 
 /* QXL cmd/ring handling */
 
+#include <drm/drm_util.h>
+
 #include "qxl_drv.h"
 #include "qxl_object.h"
 
drivers/gpu/drm/radeon/atom.c +2 -0
index e55cbeee7a53..ac98ad561870 100644
@@ -27,6 +27,8 @@
 #include <linux/slab.h>
 #include <asm/unaligned.h>
 
+#include <drm/drm_util.h>
+
 #define ATOM_DEBUG
 
 #include "atom.h"
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +1 -0
index 222a1fa41d7c..7e3257e8fd56 100644
@@ -24,6 +24,7 @@
  *          Alex Deucher
  */
 #include <drm/drmP.h>
+#include <drm/drm_util.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/radeon_drm.h>
 #include "radeon.h"
drivers/gpu/drm/vc4/vc4_drv.h +1 -0
index bd6ef1f31822..79c6bcc4f509 100644
@@ -9,6 +9,7 @@
 #include <linux/mm_types.h>
 #include <linux/reservation.h>
 #include <drm/drmP.h>
+#include <drm/drm_util.h>
 #include <drm/drm_encoder.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_atomic.h>
include/drm/drmP.h +0 -8
index 2ba786820052..a77c9ee43b68 100644
@@ -95,12 +95,4 @@ struct dma_buf_attachment;
 struct pci_dev;
 struct pci_controller;
 
-/* returns true if currently okay to sleep */
-static inline bool drm_can_sleep(void)
-{
-	if (in_atomic() || in_dbg_master() || irqs_disabled())
-		return false;
-	return true;
-}
-
 #endif
include/drm/drm_util.h +0 -0
index 88abdca89baa..e3200980d3f3 100644
@@ -26,7 +26,20 @@
 #ifndef _DRM_UTIL_H_
 #define _DRM_UTIL_H_

include/drm/drm_util.h line 37

Quoted 10 lines
include/drm/drm_util.h +6 -0
 
+#include <linux/irqflags.h>
+#include <linux/preempt.h>
+#include <linux/kgdb.h>
+#include <linux/smp.h>
+
 /* helper for handling conditionals in various for_each macros */
 #define for_each_if(condition) if (!(condition)) {} else
 
+/* returns true if currently okay to sleep */

Kerneldoc would be nice for this, specifically a huge warning that this shouldn't be used (it doesn't work everywhere) and a FIXME that all users should be removed. We might even want to include this as a todo item in gpu/todo.rst
-Daniel

Quoted 11 lines
include/drm/drm_util.h +7 -0
+static inline bool drm_can_sleep(void)
+{
+	if (in_atomic() || in_dbg_master() || irqs_disabled())
+		return false;
+	return true;
+}
+
 #endif
Signature · 1 line
2.12.0
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#14 lore raw

Re: [PATCH v1 7/7] drm: remove include of drmP.h from drm_gem_cma_helper.h

In reply to Sam Ravnborg
Quoted 2 lines · Sam Ravnborg

Fix fallout in various files/drivers.

What fallout is being fixed? It would be helpful if we received the full patch series for context. It would also be nice to have a more detailed description in this commit message.

#5 lore raw

Re: [PATCH v1 2/7] drm: move DRM_SWITCH_POWER defines to drm_device.h

In reply to Daniel Vetter

Hi Daniel.

Quoted 10 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+/* Used by drm_device.switch_power_state */
+#define DRM_SWITCH_POWER_ON 0
+#define DRM_SWITCH_POWER_OFF 1
+#define DRM_SWITCH_POWER_CHANGING 2
+#define DRM_SWITCH_POWER_DYNAMIC_OFF 3

Since this isn't uapi it'd be nice to change it to an enum, which we can then properly kernel-doc and make your references links in the resulting html. Otherwise lgtm.

Quoted 3 lines

Would need an include stanza for drm_device.h in drm-internals.rst, plus a bit of kernel-doc cleanup in here I think (which iirc is why I didn't yet do this).

Converting to enum was easy, the documentation part not so. I have tried to add some documentation based on what I could figure out. There are room for improvements.

The other task was to include drm_device in the documentation.

This work resulted in the following two patches that I will post as part of an updated series later.
Posted here to maybe get some initial feedback.

Sam

From 3bc5d6a11a1e04f20a465e2690583c87cee74ac0 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Thu, 27 Dec 2018 23:03:12 +0100
Subject: [PATCH 1/7] drm: add drm_device.h to kernel-doc

Updated comment style to kernel-doc format

---
 Documentation/gpu/drm-internals.rst |   4 +
 include/drm/drm_device.h            | 157 ++++++++++++++++++++++--------------
 2 files changed, 101 insertions(+), 60 deletions(-)
Documentation/gpu/drm-internals.rst +4 -0
index 5ee9674fb9e9..7a677b2b0ebc 100644
@@ -149,6 +149,10 @@ Device Instance and Driver Handling
 .. kernel-doc:: drivers/gpu/drm/drm_drv.c
    :export:
 
+DRM Device
+----------
+.. kernel-doc:: include/drm/drm_device.h
+
 Driver Load
 -----------
 
include/drm/drm_device.h +97 -60

223 lines not on this page · raw message

Signature · 26 lines
2.12.0

From a3c94604f8c32a2a48efc79d15fbc66e0e62fd33 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Wed, 26 Dec 2018 14:21:01 +0100
Subject: [PATCH 2/7] drm: move DRM_SWITCH_POWER defines to drm_device.h

Move DRM_SWITCH_POWER out of drmP.h to allow users
to get rid of the drmP include.

DRM_SWITCH_POWER defines are used in combination
with drm_device.switch_power_state.

Move the DRM_SWITCH_POWER defines to the file where
drm_device.switch_power_state is defined.

Signed-off-by: Sam Ravnborg <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Sean Paul <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Daniel Vetter <[email protected]>
---
 include/drm/drmP.h       |  5 -----
 include/drm/drm_device.h | 37 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 6 deletions(-)
include/drm/drmP.h +0 -5
index b6b8436b5123..2ba786820052 100644
@@ -95,11 +95,6 @@ struct dma_buf_attachment;
 struct pci_dev;
 struct pci_controller;
 
-#define DRM_SWITCH_POWER_ON 0
-#define DRM_SWITCH_POWER_OFF 1
-#define DRM_SWITCH_POWER_CHANGING 2
-#define DRM_SWITCH_POWER_DYNAMIC_OFF 3
-
 /* returns true if currently okay to sleep */
 static inline bool drm_can_sleep(void)
 {
include/drm/drm_device.h +36 -1
index cd385d3fc979..098bbc2b169e 100644
@@ -24,6 +24,33 @@ struct inode;
 struct pci_dev;
 struct pci_controller;
 
+
+/**
+ * enum drm_switch_power - power state of drm device
+ */
+
+enum switch_power_state {
+	/**
+	 * @DRM_SWITCH_POWER_ON: Power state is ON
+	 */
+	DRM_SWITCH_POWER_ON = 0,
+
+	/**
+	 * @DRM_SWITCH_POWER_OFF: Power state is OFF
+	 */
+	DRM_SWITCH_POWER_OFF = 1,
+
+	/**
+	 * @DRM_SWITCH_POWER_CHANGING: Power state is changing
+	 */
+	DRM_SWITCH_POWER_CHANGING = 2,
+
+	/**
+	 * @DRM_SWITCH_POWER_DYNAMIC_OFF: Suspended
+	 */
+	DRM_SWITCH_POWER_DYNAMIC_OFF = 3,
+};
+
 /**
  * struct drm_device - DRM device structure
  *
@@ -259,7 +286,15 @@ struct drm_device {
 	/** @vma_offset_manager: GEM information */
 	struct drm_vma_offset_manager *vma_offset_manager;
 
-	int switch_power_state;
+	/**
+	 * @switch_power_state:
+	 *
+	 * Power state of the client.
+	 * Used by drivers supporting the switcheroo driver.
+	 * The state is maintained in the
+	 * &vga_switcheroo_client_ops.set_gpu_state callback
+	 */
+	enum switch_power_state switch_power_state;
 
 	/**
 	 * @fb_helper:
Signature · 8 lines
2.12.0



_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#15 lore raw

Re: [PATCH v1 7/7] drm: remove include of drmP.h from drm_gem_cma_helper.h

In reply to David Lechner

Hi David.

Thanks for your comments.

Quoted 5 lines · David Lechner
Quoted 2 lines · Sam Ravnborg

Fix fallout in various files/drivers.

What fallout is being fixed?

The removal of drmP.h from drm_gem_cma_helper.h resulted in some build erros that is fixed by this patch.
drmP.h was removed from the header file to make it possible to remove drmP.h on a file-by-file (or driver-by-driver) basis for the rest of gpu/drm/*

Quoted 3 lines

It would be helpful if we received the full
patch series for context. It would also be nice to have a more detailed description in this commit message.

The cc: list was too long to include everyone in the cover letter. In v2 I will make the individual commit message self explaning.

For v2 I also need to re-vist the changes as I have added include files in some cases where a forward declaration would have been enough.

Sam