2018-12-26 22:27:40

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH v1 0/7] 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(-)


2018-12-26 21:08:21

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH v1 1/7] drm: move DRM_IF_VERSION to drm_internal.h

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

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]>
---
drivers/gpu/drm/drm_internal.h | 2 ++
include/drm/drmP.h | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index 51e06defc8d8..e9374cd43610 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -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;

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 05350424a4d3..b6b8436b5123 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -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
--
2.12.0


2018-12-26 21:10:15

by Sam Ravnborg

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

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.

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]>
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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index e9934de1b9cf..dd30f4e61a8c 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -27,6 +27,8 @@
#include <linux/slab.h>
#include <asm/unaligned.h>

+#include <drm/drm_util.h>
+
#define ATOM_DEBUG

#include "atom.h"
diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index de26df0c6044..fb56fe848e81 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -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"
diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index 68ab1821e15b..1544fa55d1ff 100644
--- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
+++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
@@ -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>

diff --git a/drivers/gpu/drm/drm_flip_work.c b/drivers/gpu/drm/drm_flip_work.c
index 12dea16f22a8..3da3bf5af405 100644
--- a/drivers/gpu/drm/drm_flip_work.c
+++ b/drivers/gpu/drm/drm_flip_work.c
@@ -22,6 +22,7 @@
*/

#include <drm/drmP.h>
+#include <drm/drm_util.h>
#include <drm/drm_flip_work.h>

/**
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 30726c9fe28c..6893934b26c0 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -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>

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
index 96c2b828dba4..fa2d1d8995ee 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
@@ -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"
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index aee99194499f..851c59f07eb1 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -16,6 +16,7 @@
*/

#include <drm/drm_crtc.h>
+#include <drm/drm_util.h>
#include <drm/drm_fb_helper.h>

#include "omap_drv.h"
diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
index 208af9f37914..d17676824377 100644
--- a/drivers/gpu/drm/qxl/qxl_cmd.c
+++ b/drivers/gpu/drm/qxl/qxl_cmd.c
@@ -25,6 +25,8 @@

/* QXL cmd/ring handling */

+#include <drm/drm_util.h>
+
#include "qxl_drv.h"
#include "qxl_object.h"

diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index e55cbeee7a53..ac98ad561870 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -27,6 +27,8 @@
#include <linux/slab.h>
#include <asm/unaligned.h>

+#include <drm/drm_util.h>
+
#define ATOM_DEBUG

#include "atom.h"
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 222a1fa41d7c..7e3257e8fd56 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -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"
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index bd6ef1f31822..79c6bcc4f509 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -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>
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2ba786820052..a77c9ee43b68 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -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
diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
index 88abdca89baa..e3200980d3f3 100644
--- a/include/drm/drm_util.h
+++ b/include/drm/drm_util.h
@@ -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
--
2.12.0


2018-12-26 21:10:43

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH v1 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 | 9 +++++++++
2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index b6b8436b5123..2ba786820052 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -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)
{
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index 42411b3ea0c8..c3da194d25f9 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -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;

/**
--
2.12.0


2018-12-26 22:37:20

by Sam Ravnborg

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

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

Signed-off-by: Sam Ravnborg <[email protected]>
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(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c
index 68629e614990..3b7556f62230 100644
--- a/drivers/gpu/drm/arc/arcpgu_sim.c
+++ b/drivers/gpu/drm/arc/arcpgu_sim.c
@@ -14,6 +14,7 @@
*
*/

+#include <drm/drm_device.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_atomic_helper.h>

diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cdns-dsi.c
index ce9496d13986..4b73d0969468 100644
--- a/drivers/gpu/drm/bridge/cdns-dsi.c
+++ b/drivers/gpu/drm/bridge/cdns-dsi.c
@@ -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>
diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
index f1c24ab0ef09..680cb6a5978c 100644
--- a/drivers/gpu/drm/drm_modeset_helper.c
+++ b/drivers/gpu/drm/drm_modeset_helper.c
@@ -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
diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c
index 173d7ad0b991..f1043458cbd8 100644
--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
+++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
@@ -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>
diff --git a/include/drm/drm_modeset_helper.h b/include/drm/drm_modeset_helper.h
index efa337f03129..82ead67dfa36 100644
--- a/include/drm/drm_modeset_helper.h
+++ b/include/drm/drm_modeset_helper.h
@@ -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,
--
2.12.0


2018-12-26 22:37:20

by Sam Ravnborg

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

Fix fallout in various files/drivers.

Signed-off-by: Sam Ravnborg <[email protected]>
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(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 965cda48dc13..41e8bbfe2806 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -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>
diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index f067de4e1e82..cca897341921 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -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"
diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index f2021b23554d..6d41b0fb165f 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -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>
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 808d9fb627e9..8f6249368450 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -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>
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
index 255341ee4eb9..cc4f4c6a6cb4 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
@@ -15,6 +15,7 @@
#include <drm/tinydrm/tinydrm.h>
#include <linux/device.h>
#include <linux/dma-buf.h>
+#include <linux/module.h>

/**
* DOC: overview
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
index dcd390163a4a..d4ec6bcc39b2 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -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>

diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
index 7e8e24d0b7a7..652b596070e6 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
@@ -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 {
diff --git a/drivers/gpu/drm/tinydrm/ili9225.c b/drivers/gpu/drm/tinydrm/ili9225.c
index 455fefe012f5..fbd94fe8b36f 100644
--- a/drivers/gpu/drm/tinydrm/ili9225.c
+++ b/drivers/gpu/drm/tinydrm/ili9225.c
@@ -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>
diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c
index cb3441e51d5f..c61f5539e58e 100644
--- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
+++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
@@ -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>
diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
index 26485acc51d7..931b072d0aa9 100644
--- a/include/drm/drm_file.h
+++ b/include/drm/drm_file.h
@@ -30,6 +30,7 @@
#ifndef _DRM_FILE_H_
#define _DRM_FILE_H_

+#include <linux/idr.h>
#include <linux/types.h>
#include <linux/completion.h>

diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index 19777145cf8e..83907bd1cf53 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -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
diff --git a/include/drm/tinydrm/tinydrm.h b/include/drm/tinydrm/tinydrm.h
index fe9827d0ca8a..449fdc4de7d3 100644
--- a/include/drm/tinydrm/tinydrm.h
+++ b/include/drm/tinydrm/tinydrm.h
@@ -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>
--
2.12.0


2018-12-26 22:37:32

by Sam Ravnborg

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

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

Signed-off-by: Sam Ravnborg <[email protected]>
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(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
index 8f9c8a6b46de..c61ec4caaa84 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
@@ -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>
diff --git a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
index 75490a3e0a2a..f5b07a2e3f59 100644
--- a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
+++ b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
@@ -8,6 +8,7 @@
*/

#include <linux/module.h>
+#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>

#include <drm/bridge/dw_hdmi.h>
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index ccb5aa8468e0..b0218ee75a65 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -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;

--
2.12.0


2018-12-26 23:23:29

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH v1 5/7] drm: remove include of drmP.h from drm_encoder_slave.h

No further changes required.

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/drm_encoder_slave.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/include/drm/drm_encoder_slave.h b/include/drm/drm_encoder_slave.h
index 1107b4b1c599..a09864f6d684 100644
--- a/include/drm/drm_encoder_slave.h
+++ b/include/drm/drm_encoder_slave.h
@@ -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>

--
2.12.0


2018-12-27 18:23:49

by Laurent Pinchart

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

Hi Sam,

Thank you for the patch.

On Wednesday, 26 December 2018 23:03:50 EET Sam Ravnborg wrote:
> Add missing includes in dw_hdmi.h and
> fix fallout in drivers.
>
> Signed-off-by: Sam Ravnborg <[email protected]>
> 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(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c index
> 8f9c8a6b46de..c61ec4caaa84 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> @@ -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>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
> b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c index 75490a3e0a2a..f5b07a2e3f59
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
> @@ -8,6 +8,7 @@
> */
>
> #include <linux/module.h>
> +#include <linux/mod_devicetable.h>

Nitpicking, _ comes before u.

> #include <linux/platform_device.h>
>
> #include <drm/bridge/dw_hdmi.h>
> diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> index ccb5aa8468e0..b0218ee75a65 100644
> --- a/include/drm/bridge/dw_hdmi.h
> +++ b/include/drm/bridge/dw_hdmi.h
> @@ -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/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,

Reviewed-by: Laurent Pinchart <[email protected]>

> struct dw_hdmi;

--
Regards,

Laurent Pinchart




2018-12-27 18:24:15

by Laurent Pinchart

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

Hi Sam,

Thank you for the patch.

On Wednesday, 26 December 2018 23:03:52 EET Sam Ravnborg wrote:
> Fix fallout in various files/drivers by adding missing include files.
>
> Signed-off-by: Sam Ravnborg <[email protected]>
> 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(-)
>
> diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c
> b/drivers/gpu/drm/arc/arcpgu_sim.c index 68629e614990..3b7556f62230 100644
> --- a/drivers/gpu/drm/arc/arcpgu_sim.c
> +++ b/drivers/gpu/drm/arc/arcpgu_sim.c
> @@ -14,6 +14,7 @@
> *
> */
>
> +#include <drm/drm_device.h>
> #include <drm/drm_crtc_helper.h>
> #include <drm/drm_atomic_helper.h>
>
> diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c
> b/drivers/gpu/drm/bridge/cdns-dsi.c index ce9496d13986..4b73d0969468 100644
> --- a/drivers/gpu/drm/bridge/cdns-dsi.c
> +++ b/drivers/gpu/drm/bridge/cdns-dsi.c
> @@ -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>
> diff --git a/drivers/gpu/drm/drm_modeset_helper.c
> b/drivers/gpu/drm/drm_modeset_helper.c index f1c24ab0ef09..680cb6a5978c
> 100644
> --- a/drivers/gpu/drm/drm_modeset_helper.c
> +++ b/drivers/gpu/drm/drm_modeset_helper.c
> @@ -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
> diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c
> b/drivers/gpu/drm/rcar-du/rcar_lvds.c index 173d7ad0b991..f1043458cbd8
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> @@ -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>
> diff --git a/include/drm/drm_modeset_helper.h
> b/include/drm/drm_modeset_helper.h index efa337f03129..82ead67dfa36 100644
> --- a/include/drm/drm_modeset_helper.h
> +++ b/include/drm/drm_modeset_helper.h
> @@ -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,

Reviewed-by: Laurent Pinchart <[email protected]>

> void drm_helper_move_panel_connectors_to_head(struct drm_device *);
>
> void drm_helper_mode_fill_fb_struct(struct drm_device *dev,

--
Regards,

Laurent Pinchart




2018-12-27 22:05:09

by Daniel Vetter

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

On Wed, Dec 26, 2018 at 10:03:49PM +0100, Sam Ravnborg wrote:
> 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.
>
> 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]>
> 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(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
> index e9934de1b9cf..dd30f4e61a8c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atom.c
> +++ b/drivers/gpu/drm/amd/amdgpu/atom.c
> @@ -27,6 +27,8 @@
> #include <linux/slab.h>
> #include <asm/unaligned.h>
>
> +#include <drm/drm_util.h>
> +
> #define ATOM_DEBUG
>
> #include "atom.h"
> diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
> index de26df0c6044..fb56fe848e81 100644
> --- a/drivers/gpu/drm/ast/ast_fb.c
> +++ b/drivers/gpu/drm/ast/ast_fb.c
> @@ -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"
> diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> index 68ab1821e15b..1544fa55d1ff 100644
> --- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> +++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> @@ -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>
>
> diff --git a/drivers/gpu/drm/drm_flip_work.c b/drivers/gpu/drm/drm_flip_work.c
> index 12dea16f22a8..3da3bf5af405 100644
> --- a/drivers/gpu/drm/drm_flip_work.c
> +++ b/drivers/gpu/drm/drm_flip_work.c
> @@ -22,6 +22,7 @@
> */
>
> #include <drm/drmP.h>
> +#include <drm/drm_util.h>
> #include <drm/drm_flip_work.h>
>
> /**
> diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
> index 30726c9fe28c..6893934b26c0 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_fb.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
> @@ -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>
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> index 96c2b828dba4..fa2d1d8995ee 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> @@ -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"
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> index aee99194499f..851c59f07eb1 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -16,6 +16,7 @@
> */
>
> #include <drm/drm_crtc.h>
> +#include <drm/drm_util.h>
> #include <drm/drm_fb_helper.h>
>
> #include "omap_drv.h"
> diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
> index 208af9f37914..d17676824377 100644
> --- a/drivers/gpu/drm/qxl/qxl_cmd.c
> +++ b/drivers/gpu/drm/qxl/qxl_cmd.c
> @@ -25,6 +25,8 @@
>
> /* QXL cmd/ring handling */
>
> +#include <drm/drm_util.h>
> +
> #include "qxl_drv.h"
> #include "qxl_object.h"
>
> diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
> index e55cbeee7a53..ac98ad561870 100644
> --- a/drivers/gpu/drm/radeon/atom.c
> +++ b/drivers/gpu/drm/radeon/atom.c
> @@ -27,6 +27,8 @@
> #include <linux/slab.h>
> #include <asm/unaligned.h>
>
> +#include <drm/drm_util.h>
> +
> #define ATOM_DEBUG
>
> #include "atom.h"
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> index 222a1fa41d7c..7e3257e8fd56 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> @@ -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"
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
> index bd6ef1f31822..79c6bcc4f509 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.h
> +++ b/drivers/gpu/drm/vc4/vc4_drv.h
> @@ -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>
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 2ba786820052..a77c9ee43b68 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -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
> diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
> index 88abdca89baa..e3200980d3f3 100644
> --- a/include/drm/drm_util.h
> +++ b/include/drm/drm_util.h
> @@ -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 */

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

> +static inline bool drm_can_sleep(void)
> +{
> + if (in_atomic() || in_dbg_master() || irqs_disabled())
> + return false;
> + return true;
> +}
> +
> #endif
> --
> 2.12.0
>

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

2018-12-27 23:44:59

by Daniel Vetter

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

On Wed, Dec 26, 2018 at 10:03:47PM +0100, Sam Ravnborg wrote:
> Move DRM_IF_VERSION out of drmP.h to allow users
> to get rid of the drmP include.
>
> 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]>

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

> ---
> drivers/gpu/drm/drm_internal.h | 2 ++
> include/drm/drmP.h | 2 --
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
> index 51e06defc8d8..e9374cd43610 100644
> --- a/drivers/gpu/drm/drm_internal.h
> +++ b/drivers/gpu/drm/drm_internal.h
> @@ -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;
>
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 05350424a4d3..b6b8436b5123 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -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
> --
> 2.12.0
>

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

2018-12-28 00:18:01

by Daniel Vetter

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

On Wed, Dec 26, 2018 at 10:03:48PM +0100, Sam Ravnborg wrote:
> 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 | 9 +++++++++
> 2 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index b6b8436b5123..2ba786820052 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -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)
> {
> diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
> index 42411b3ea0c8..c3da194d25f9 100644
> --- a/include/drm/drm_device.h
> +++ b/include/drm/drm_device.h
> @@ -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

> +
> /**
> * 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;
>
> /**
> --
> 2.12.0
>

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

2018-12-28 02:41:29

by David Lechner

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

On 12/26/18 3:03 PM, Sam Ravnborg wrote:
> 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.


2018-12-28 08:23:01

by Sam Ravnborg

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

Hi Daniel.

> > +/* 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).

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

Signed-off-by: Sam Ravnborg <[email protected]>
---
Documentation/gpu/drm-internals.rst | 4 +
include/drm/drm_device.h | 157 ++++++++++++++++++++++--------------
2 files changed, 101 insertions(+), 60 deletions(-)

diff --git a/Documentation/gpu/drm-internals.rst b/Documentation/gpu/drm-internals.rst
index 5ee9674fb9e9..7a677b2b0ebc 100644
--- a/Documentation/gpu/drm-internals.rst
+++ b/Documentation/gpu/drm-internals.rst
@@ -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
-----------

diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index 42411b3ea0c8..cd385d3fc979 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -25,24 +25,39 @@ struct pci_dev;
struct pci_controller;

/**
- * DRM device structure. This structure represent a complete card that
+ * struct drm_device - DRM device structure
+ *
+ * This structure represent a complete card that
* may contain multiple heads.
*/
struct drm_device {
- struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */
- int if_version; /**< Highest interface version set */
-
- /** \name Lifetime Management */
- /*@{ */
- struct kref ref; /**< Object ref-count */
- struct device *dev; /**< Device structure of bus-device */
- struct drm_driver *driver; /**< DRM driver managing the device */
- void *dev_private; /**< DRM driver private data */
- struct drm_minor *primary; /**< Primary node */
- struct drm_minor *render; /**< Render node */
+ /** @legacy_dev_list: List of devices per driver for stealth attach cleanup */
+ struct list_head legacy_dev_list;
+
+ /** @if_version: Highest interface version set */
+ int if_version;
+
+ /** @ref: Object ref-count */
+ struct kref ref;
+
+ /** @dev: Device structure of bus-device */
+ struct device *dev;
+
+ /** @driver: DRM driver managing the device */
+ struct drm_driver *driver;
+
+ /** @dev_private: DRM driver private data */
+ void *dev_private;
+
+ /** @primary: Primary node */
+ struct drm_minor *primary;
+
+ /** @render: Render node */
+ struct drm_minor *render;
+
bool registered;

- /* currently active master for this device. Protected by master_mutex */
+ /** @master: Currently active master for this device. Protected by master_mutex */
struct drm_master *master;

/**
@@ -63,23 +78,29 @@ struct drm_device {
*/
bool unplugged;

- struct inode *anon_inode; /**< inode for private address-space */
- char *unique; /**< unique name of the device */
- /*@} */
+ /** @anon_inode: inode for private address-space */
+ struct inode *anon_inode;
+
+ /** @unique: Unique name of the device */
+ char *unique;
+
+ /** @struct_mutex: Lock for others (not drm_minor::master and drm_file::is_master) */
+ struct mutex struct_mutex;
+
+ /** @master_mutex: Lock for drm_minor::master and drm_file::is_master */
+ struct mutex master_mutex;
+
+ /** @open_count: Usage counter for outstanding files open, protected by drm_global_mutex. */
+ int open_count;

- /** \name Locks */
- /*@{ */
- struct mutex struct_mutex; /**< For others */
- struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */
- /*@} */
+ /** @buf_lock: Lock for drm_device::buf_use and a few other things. */
+ spinlock_t buf_lock;

- /** \name Usage Counters */
- /*@{ */
- int open_count; /**< Outstanding files open, protected by drm_global_mutex. */
- spinlock_t buf_lock; /**< For drm_device::buf_use and a few other things. */
- int buf_use; /**< Buffers in use -- cannot alloc */
- atomic_t buf_alloc; /**< Buffer allocation in progress */
- /*@} */
+ /** @buf_use: Usage counter for buffers in use -- cannot alloc */
+ int buf_use;
+
+ /** @buf_alloc: Buffer allocation in progress */
+ atomic_t buf_alloc;

struct mutex filelist_mutex;
struct list_head filelist;
@@ -105,33 +126,32 @@ struct drm_device {
*/
struct list_head clientlist;

- /** \name Memory management */
- /*@{ */
- struct list_head maplist; /**< Linked list of regions */
- struct drm_open_hash map_hash; /**< User token hash table for maps */
+ /** @maplist: Memory management - linked list of regions */
+ struct list_head maplist;

- /** \name Context handle management */
- /*@{ */
- struct list_head ctxlist; /**< Linked list of context handles */
- struct mutex ctxlist_mutex; /**< For ctxlist */
+ /** @map_hash: Memory management - user token hash table for maps */
+ struct drm_open_hash map_hash;

- struct idr ctx_idr;
+ /** @ctxlist: Context handle management - linked list of context handles */
+ struct list_head ctxlist;
+
+ /** @ctxlist_mutex: Context handle management - mutex for ctxlist */
+ struct mutex ctxlist_mutex;

- struct list_head vmalist; /**< List of vmas (for debugging) */
+ /** @ctx_idr: Context handle management */
+ struct idr ctx_idr;

- /*@} */
+ /** @vmalist: Context handle management - list of vmas (for debugging) */
+ struct list_head vmalist;

- /** \name DMA support */
- /*@{ */
- struct drm_device_dma *dma; /**< Optional pointer for DMA support */
- /*@} */
+ /** @dma: Optional pointer for DMA support */
+ struct drm_device_dma *dma;

- /** \name Context support */
- /*@{ */
+ /** @context_flag: Context swapping flag */
+ __volatile__ long context_flag;

- __volatile__ long context_flag; /**< Context swapping flag */
- int last_context; /**< Last current context */
- /*@} */
+ /** @last_context: Last current context */
+ int last_context;

/**
* @irq_enabled:
@@ -168,7 +188,12 @@ struct drm_device {
*/
struct drm_vblank_crtc *vblank;

- spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */
+ /**
+ * @vblank_time_lock:
+ *
+ * Protects vblank count and time updates during vblank enable/disable
+ */
+ spinlock_t vblank_time_lock;
spinlock_t vbl_lock;

/**
@@ -186,25 +211,33 @@ struct drm_device {
*
* If non-zeor, &drm_crtc_funcs.get_vblank_counter must be set.
*/
- u32 max_vblank_count; /**< size of vblank counter register */
+
+ /** @max_vblank_count: Size of vblank counter register */
+ u32 max_vblank_count;

/**
- * List of events
+ * @vblank_event_list:
+ *
+ * List of vblank events
*/
struct list_head vblank_event_list;
spinlock_t event_lock;

- /*@} */
+ /** @agp: AGP data */
+ struct drm_agp_head *agp;

- struct drm_agp_head *agp; /**< AGP data */
+ /** @pdev: PCI device structure */
+ struct pci_dev *pdev;

- struct pci_dev *pdev; /**< PCI device structure */
#ifdef __alpha__
struct pci_controller *hose;
#endif

- struct drm_sg_mem *sg; /**< Scatter gather memory */
- unsigned int num_crtcs; /**< Number of CRTCs on this device */
+ /** @sg: Scatter gather memory */
+ struct drm_sg_mem *sg;
+
+ /** @num_crtcs: Number of CRTCs on this device */
+ unsigned int num_crtcs;

struct {
int context;
@@ -214,14 +247,18 @@ struct drm_device {
struct drm_local_map *agp_buffer_map;
unsigned int agp_buffer_token;

- struct drm_mode_config mode_config; /**< Current mode config */
+ /** @mode_config: Current mode config */
+ struct drm_mode_config mode_config;

- /** \name GEM information */
- /*@{ */
+ /** @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;
- /*@} */
+
int switch_power_state;

/**
--
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(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index b6b8436b5123..2ba786820052 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -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)
{
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index cd385d3fc979..098bbc2b169e 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -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:
--
2.12.0




2018-12-28 08:24:54

by Sam Ravnborg

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

Hi David.

Thanks for your comments.

On Thu, Dec 27, 2018 at 10:28:07AM -0600, David Lechner wrote:
> On 12/26/18 3:03 PM, Sam Ravnborg wrote:
> >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/*


> 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