linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/12] drm: minimize drmP.h dependencies
@ 2019-01-08 19:29 Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 01/12] drm: drm_device.h: update comments to kernel-doc style Sam Ravnborg
                   ` (11 more replies)
  0 siblings, 12 replies; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg

- 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 drm-misc-next
Build tested using arm and x86 all{yes,mod}config

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-next

There are still ~700 uses of drmP.h so a long way ahead of
us to get rid of it.

The kernel-doc parts that I authored in the following
may require some extra info as I know too little about
DRM to be able to write something really useful.
Or at least review by someone with knowledge of DRM,
but that goes for everything.

v3:
- Added Acks/Reviewed annotations (thanks!)
- Add forward of drm_gem_object to drm_framebuffer.h (Noralf)
- Drop "drm: move DRM_IF_VERSION to drm_internal.h" as it is applied to drm-misc
- Drop "drm: make drm_file.h self contained" as Jan made a similar patch that was appleid to drm-misc
- Rebased on top of drm-misc-next

v2:
- DRM_SWITCH_POWER as enum (Daniel Vetter)
- Prefer forward decalration over includes (Laurent Pinchart)
- Updated drm_device to use kerneldoc style (Daniel Vetter)
- Improved commit messages (David Lechner)
- Split up patch when removing drmP.h from drm_gem_cma_helper.h
- rebased on top of drm-misc-next
- dropped patch already applied
- added reviewed-by from Laurent Pinchart (Laurent Pinchart)
- add drm_framebuffer.h patch
- add kernel-doc comments to drm_util.h
- moved EXPORT_SYMBOL_FOR_TESTS_ONLY to drm_util.h
- added note to drmP.h not to add new stuff and not to use in new files

	Sam

Sam Ravnborg (12):
      drm: drm_device.h: update comments to kernel-doc style
      drm: move DRM_SWITCH_POWER defines to drm_device.h
      drm: make drm_framebuffer.h self contained
      drm: move drm_can_sleep() to drm_util.h
      drm: move EXPORT_SYMBOL_FOR_TESTS_ONLY 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/arc: do not reply on drmP.h from drm_gem_cma_helper.h
      drm/stm: do not reply on drmP.h from drm_gem_cma_helper.h
      drm/tinydrm: do not reply on drmP.h from drm_gem_cma_helper.h
      drm: remove 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                       |   2 +
 drivers/gpu/drm/bridge/cdns-dsi.c                  |   2 +
 .../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_framebuffer.c                  |   1 +
 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                          |   6 +-
 drivers/gpu/drm/stm/ltdc.c                         |   9 +-
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c        |   3 +
 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c        |   3 +
 drivers/gpu/drm/tinydrm/hx8357d.c                  |   1 +
 drivers/gpu/drm/tinydrm/ili9225.c                  |   2 +
 drivers/gpu/drm/tinydrm/ili9341.c                  |   1 +
 drivers/gpu/drm/tinydrm/mi0283qt.c                 |   1 +
 drivers/gpu/drm/tinydrm/mipi-dbi.c                 |   3 +
 drivers/gpu/drm/tinydrm/repaper.c                  |   1 +
 drivers/gpu/drm/tinydrm/st7586.c                   |   1 +
 drivers/gpu/drm/tinydrm/st7735r.c                  |   1 +
 drivers/gpu/drm/vc4/vc4_drv.h                      |   1 +
 include/drm/bridge/dw_hdmi.h                       |   6 +-
 include/drm/drmP.h                                 |  24 +--
 include/drm/drm_device.h                           | 228 +++++++++++++++------
 include/drm/drm_encoder_slave.h                    |   1 -
 include/drm/drm_framebuffer.h                      |  10 +-
 include/drm/drm_gem_cma_helper.h                   |   5 +-
 include/drm/drm_modeset_helper.h                   |   6 +-
 include/drm/drm_util.h                             |  52 ++++-
 40 files changed, 304 insertions(+), 95 deletions(-)



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

* [PATCH v3 01/12] drm: drm_device.h: update comments to kernel-doc style
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 02/12] drm: move DRM_SWITCH_POWER defines to drm_device.h Sam Ravnborg
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg, Jonathan Corbet

Updated comment style to kernel-doc format in drm_device.h

In struct drm_device there are 12 struct members without doc:
- registered
- filelist_mutex
- filelist
- irq
- vbl_lock
- event_lock
- hose
- sigdata
- sigdata.context
- sigdata.lock
- agp_buffer_map
- agp_buffer_token

They all need proper documentation, a task left for someone
that knows their usage.

drm_device is not plugged into Documentation/gpu/drm-internals.rst
as this would create a new load of warnings.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jonathan Corbet <corbet@lwn.net>
---
 include/drm/drm_device.h | 199 +++++++++++++++++++++++++++++++----------------
 1 file changed, 134 insertions(+), 65 deletions(-)

diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index 42411b3ea0c8..2b154ead9efc 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -25,24 +25,48 @@ 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 +87,42 @@ 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;
+
+	/** @buf_lock: Lock for &buf_use and a few other things. */
+	spinlock_t buf_lock;
 
-	/** \name Locks */
-	/*@{ */
-	struct mutex struct_mutex;	/**< For others */
-	struct mutex master_mutex;      /**< For drm_minor::master and drm_file::is_master */
-	/*@} */
+	/** @buf_use: Usage counter for buffers in use -- cannot alloc */
+	int buf_use;
 
-	/** \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_alloc: Buffer allocation in progress */
+	atomic_t buf_alloc;
 
 	struct mutex filelist_mutex;
 	struct list_head filelist;
@@ -87,51 +130,64 @@ struct drm_device {
 	/**
 	 * @filelist_internal:
 	 *
-	 * List of open DRM files for in-kernel clients. Protected by @filelist_mutex.
+	 * List of open DRM files for in-kernel clients.
+	 * Protected by &filelist_mutex.
 	 */
 	struct list_head filelist_internal;
 
 	/**
 	 * @clientlist_mutex:
 	 *
-	 * Protects @clientlist access.
+	 * Protects &clientlist access.
 	 */
 	struct mutex clientlist_mutex;
 
 	/**
 	 * @clientlist:
 	 *
-	 * List of in-kernel clients. Protected by @clientlist_mutex.
+	 * List of in-kernel clients. Protected by &clientlist_mutex.
 	 */
 	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;
 
-	struct list_head vmalist;	/**< List of vmas (for debugging) */
+	/**
+	 * @ctxlist_mutex:
+	 *
+	 * Context handle management - mutex for &ctxlist
+	 */
+	struct mutex ctxlist_mutex;
 
-	/*@} */
+	/**
+	 * @ctx_idr:
+	 * Context handle management
+	 */
+	struct idr ctx_idr;
 
-	/** \name DMA support */
-	/*@{ */
-	struct drm_device_dma *dma;		/**< Optional pointer for DMA support */
-	/*@} */
+	/**
+	 * @vmalist:
+	 * Context handle management - list of vmas (for debugging)
+	 */
+	struct list_head vmalist;
+
+	/** @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 +224,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 +247,29 @@ struct drm_device {
 	 *
 	 * If non-zeor, &drm_crtc_funcs.get_vblank_counter must be set.
 	 */
-	u32 max_vblank_count;           /**< size of vblank counter register */
 
-	/**
-	 * List of events
-	 */
+	/** @max_vblank_count: Size of vblank counter register */
+	u32 max_vblank_count;
+
+	/** @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 +279,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


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

* [PATCH v3 02/12] drm: move DRM_SWITCH_POWER defines to drm_device.h
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 01/12] drm: drm_device.h: update comments to kernel-doc style Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 03/12] drm: make drm_framebuffer.h self contained Sam Ravnborg
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg

Move DRM_SWITCH_POWER out of drmP.h to allow users
to get rid of the drmP include.
Moved to drm_device.h because drm_device.switch_power_state
is the only user.

Converted to enum and added sparse kerneldoc comments.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 include/drm/drmP.h       |  5 -----
 include/drm/drm_device.h | 29 ++++++++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index db94ef00940e..9e47c8dc6b87 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -94,11 +94,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 2b154ead9efc..d7cedbac66a3 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -24,6 +24,25 @@ 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
  *
@@ -291,7 +310,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


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

* [PATCH v3 03/12] drm: make drm_framebuffer.h self contained
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 01/12] drm: drm_device.h: update comments to kernel-doc style Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 02/12] drm: move DRM_SWITCH_POWER defines to drm_device.h Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 04/12] drm: move drm_can_sleep() to drm_util.h Sam Ravnborg
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg

Add forward declaration and pull in include
file to make drm_framebuffer.h self contained.

While add it order include files alphabetically.

The use of TASK_COMM_LEN is the reason for including sched.h.
I could not see any good way to avoid this dependency,
and users of drm_framebuffer.comm already use
TASK_COMM_LEN to check for length etc.

v2:
- Added forward declaration of drm_gem_object (Noralf)
- Added ack from Noralf

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 include/drm/drm_framebuffer.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h
index c94acedfb08e..f0b34c977ec5 100644
--- a/include/drm/drm_framebuffer.h
+++ b/include/drm/drm_framebuffer.h
@@ -23,13 +23,17 @@
 #ifndef __DRM_FRAMEBUFFER_H__
 #define __DRM_FRAMEBUFFER_H__
 
-#include <linux/list.h>
 #include <linux/ctype.h>
+#include <linux/list.h>
+#include <linux/sched.h>
+
 #include <drm/drm_mode_object.h>
 
-struct drm_framebuffer;
-struct drm_file;
+struct drm_clip_rect;
 struct drm_device;
+struct drm_file;
+struct drm_framebuffer;
+struct drm_gem_object;
 
 /**
  * struct drm_framebuffer_funcs - framebuffer hooks
-- 
2.12.0


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

* [PATCH v3 04/12] drm: move drm_can_sleep() to drm_util.h
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
                   ` (2 preceding siblings ...)
  2019-01-08 19:29 ` [PATCH v3 03/12] drm: make drm_framebuffer.h self contained Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-09 21:20   ` Daniel Vetter
  2019-01-08 19:29 ` [PATCH v3 05/12] drm: move EXPORT_SYMBOL_FOR_TESTS_ONLY " Sam Ravnborg
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg, Alex Deucher, Christian König,
	David (ChunMing) Zhou, Gerd Hoffmann, Rob Clark, Tomi Valkeinen,
	Eric Anholt

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.

Update comments to use kernel-doc style.
Add FIXME to drm_can_sleep and add note
that this function should not be used in new code

Add include of drm_util.h to all users.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/amd/amdgpu/atom.c               |  2 ++
 drivers/gpu/drm/ast/ast_fb.c                    |  2 ++
 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                          | 42 ++++++++++++++++++++++++-
 13 files changed, 56 insertions(+), 9 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 a80bca1a857f..eb66bf7d3e63 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -39,7 +39,9 @@
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_fb_helper.h>
+#include <drm/drm_util.h>
 #include <drm/drm_crtc_helper.h>
+
 #include "ast_drv.h"
 
 static void ast_dirty_update(struct ast_fbdev *afbdev,
diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index 4dd499c7d1ba..79fea1b8bc14 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 dffc5093ff16..2e100f644236 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 c24b078f0593..2c635f001c71 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 9e47c8dc6b87..bc4cb3732407 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -94,14 +94,6 @@ 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;
-}
-
 #if defined(CONFIG_DRM_DEBUG_SELFTEST_MODULE)
 #define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x)
 #else
diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
index 88abdca89baa..8fda5777471c 100644
--- a/include/drm/drm_util.h
+++ b/include/drm/drm_util.h
@@ -26,7 +26,47 @@
 #ifndef _DRM_UTIL_H_
 #define _DRM_UTIL_H_
 
-/* helper for handling conditionals in various for_each macros */
+/**
+ * DOC: drm utils
+ *
+ * Macros and inline functions that does not naturally belong in other places
+ */
+
+#include <linux/irqflags.h>
+#include <linux/preempt.h>
+#include <linux/kgdb.h>
+#include <linux/smp.h>
+
+/**
+ * for_each_if - helper for handling conditionals in various for_each macros
+ * @condition The condition to check
+ *
+ * Typical use:
+ * #define for_each_foo_bar(x, y) \
+ *	list_for_each_entry(x, y->list, head) \
+ *		for_each_if(x->something == SOMETHING)
+ *
+ * The for_each_if() macro makes the use of for_each_foo_bar() less error
+ * prone.
+ */
 #define for_each_if(condition) if (!(condition)) {} else
 
+/**
+ * drm_can_sleep - returns true if currently okay to sleep
+ *
+ * This function shall not be used in new code.
+ * The check for running in atomic context may not work - see linux/preempt.h.
+ *
+ * FIXME: All users of drm_can_sleep should be removed (see todo.rst)
+ *
+ * Returns:
+ * True if kgdb is active or we are in an atomic context or irqs are disabled
+ */
+static inline bool drm_can_sleep(void)
+{
+	if (in_atomic() || in_dbg_master() || irqs_disabled())
+		return false;
+	return true;
+}
+
 #endif
-- 
2.12.0


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

* [PATCH v3 05/12] drm: move EXPORT_SYMBOL_FOR_TESTS_ONLY to drm_util.h
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
                   ` (3 preceding siblings ...)
  2019-01-08 19:29 ` [PATCH v3 04/12] drm: move drm_can_sleep() to drm_util.h Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-09 21:54   ` Daniel Vetter
  2019-01-08 19:29 ` [PATCH v3 06/12] drm: remove include of drmP.h from bridge/dw_hdmi.h Sam Ravnborg
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg

In the quest to get rid of drmP.h move the newly
added EXPORT_SYMBOL_FOR_TESTS_ONLY to drm_util.h.
Fix the single user.

Add a note to drmP.h to avoid further use of it.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/drm_framebuffer.c |  1 +
 include/drm/drmP.h                | 11 ++++++-----
 include/drm/drm_util.h            | 10 ++++++++++
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index fcaea8f50513..7abcb265a108 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -27,6 +27,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_uapi.h>
 #include <drm/drm_print.h>
+#include <drm/drm_util.h>
 
 #include "drm_internal.h"
 #include "drm_crtc_internal.h"
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index bc4cb3732407..3f5c577c9dbd 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -94,10 +94,11 @@ struct dma_buf_attachment;
 struct pci_dev;
 struct pci_controller;
 
-#if defined(CONFIG_DRM_DEBUG_SELFTEST_MODULE)
-#define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x)
-#else
-#define EXPORT_SYMBOL_FOR_TESTS_ONLY(x)
-#endif
+/*
+ * NOTE: drmP.h is obsolete - do NOT add anything to this file
+ *
+ * Do not include drmP.h in new files.
+ * Work is ongoing to remove drmP.h includes from existing files
+ */
 
 #endif
diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
index 8fda5777471c..cd1e4be1dfb3 100644
--- a/include/drm/drm_util.h
+++ b/include/drm/drm_util.h
@@ -37,6 +37,16 @@
 #include <linux/kgdb.h>
 #include <linux/smp.h>
 
+/*
+ * Use EXPORT_SYMBOL_FOR_TESTS_ONLY() for functions that shall
+ * only be visible for drmselftests.
+ */
+#if defined(CONFIG_DRM_DEBUG_SELFTEST_MODULE)
+#define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x)
+#else
+#define EXPORT_SYMBOL_FOR_TESTS_ONLY(x)
+#endif
+
 /**
  * for_each_if - helper for handling conditionals in various for_each macros
  * @condition The condition to check
-- 
2.12.0


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

* [PATCH v3 06/12] drm: remove include of drmP.h from bridge/dw_hdmi.h
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
                   ` (4 preceding siblings ...)
  2019-01-08 19:29 ` [PATCH v3 05/12] drm: move EXPORT_SYMBOL_FOR_TESTS_ONLY " Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 07/12] drm: remove include of drmP.h from drm_encoder_slave.h Sam Ravnborg
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg, Archit Taneja, Andrzej Hajda, Kieran Bingham,
	Fabio Estevam, Neil Armstrong

drmP.h is an relic from the days when there was a single header file.
To enable the removal of drmP.h from all users drop include
of drmP.h from bridge/dw_hdmi.h.

A few files relied on the file included in drmP.h - add explicit
include statements or forward declarations to these files.
Build tested with arm and x86.

v2:
- prefer forward declarations when possible (Laurent Pinchart)
- sort include files (Laurent Pinchart)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Archit Taneja <architt@codeaurora.org>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
---
 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                        | 6 ++++--
 3 files changed, 9 insertions(+), 2 deletions(-)

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 2228689d9a5e..5cbb71a866d5 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
@@ -5,6 +5,10 @@
  * Copyright (c) 2017 Renesas Solutions Corp.
  * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  */
+
+#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..790d499daa10 100644
--- a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
+++ b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
@@ -7,6 +7,7 @@
  * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  */
 
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index 9c56412bb2cf..9f93895dde88 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -10,9 +10,11 @@
 #ifndef __DW_HDMI__
 #define __DW_HDMI__
 
-#include <drm/drmP.h>
-
+struct drm_connector;
+struct drm_display_mode;
+struct drm_encoder;
 struct dw_hdmi;
+struct platform_device;
 
 /**
  * DOC: Supported input formats and encodings
-- 
2.12.0


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

* [PATCH v3 07/12] drm: remove include of drmP.h from drm_encoder_slave.h
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
                   ` (5 preceding siblings ...)
  2019-01-08 19:29 ` [PATCH v3 06/12] drm: remove include of drmP.h from bridge/dw_hdmi.h Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 08/12] drm: remove include of drmP.h from drm_modeset_helper.h Sam Ravnborg
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg

No further changes required.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 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


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

* [PATCH v3 08/12] drm: remove include of drmP.h from drm_modeset_helper.h
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
                   ` (6 preceding siblings ...)
  2019-01-08 19:29 ` [PATCH v3 07/12] drm: remove include of drmP.h from drm_encoder_slave.h Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-09 21:53   ` Daniel Vetter
  2019-01-08 19:29 ` [PATCH v3 09/12] drm/arc: do not reply on drmP.h from drm_gem_cma_helper.h Sam Ravnborg
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg, Alexey Brodkin, Archit Taneja, Andrzej Hajda,
	Kieran Bingham

drmP.h is an relic from the days when there was a single header file.
To enable the removal of drmP.h from all users drop include
of drmP.h from drm_modeset_helper.h.

A few files relied on the file included in drmP.h - add explicit
include statements to these files.
Build tested with arm and x86.

v2:
- Add forward declarations to drm_modeset_helper.h (Laurent Pinchart)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Archit Taneja <architt@codeaurora.org>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
---
 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     | 6 +++++-
 5 files changed, 11 insertions(+), 1 deletion(-)

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 9150fa385bba..9bc1ef788c77 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 534a128a869d..8010ed702509 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..995fd981cab0 100644
--- a/include/drm/drm_modeset_helper.h
+++ b/include/drm/drm_modeset_helper.h
@@ -23,7 +23,11 @@
 #ifndef __DRM_KMS_HELPER_H__
 #define __DRM_KMS_HELPER_H__
 
-#include <drm/drmP.h>
+struct drm_crtc;
+struct drm_crtc_funcs;
+struct drm_device;
+struct drm_framebuffer;
+struct drm_mode_fb_cmd2;
 
 void drm_helper_move_panel_connectors_to_head(struct drm_device *);
 
-- 
2.12.0


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

* [PATCH v3 09/12] drm/arc: do not reply on drmP.h from drm_gem_cma_helper.h
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
                   ` (7 preceding siblings ...)
  2019-01-08 19:29 ` [PATCH v3 08/12] drm: remove include of drmP.h from drm_modeset_helper.h Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 10/12] drm/stm: " Sam Ravnborg
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg, Alexey Brodkin

drmP.h was the only header file in the past and a lot
of files rely on that drmP.h defines everything.
The goal is to one day to delete drmP.h and
as a step towards this it will no longer be included in the
headers files in include/drm/

To prepare arc/ for this add dependencies that
othwewise was pulled in by drmP.h from drm_gem_cma_helper.h

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
---
 drivers/gpu/drm/arc/arcpgu_crtc.c | 2 ++
 drivers/gpu/drm/arc/arcpgu_drv.c  | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 62f51f70606d..155ab177ce0b 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 206a76abf771..39a79f5718c4 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -16,12 +16,18 @@
 
 #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_fb_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"
-- 
2.12.0


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

* [PATCH v3 10/12] drm/stm: do not reply on drmP.h from drm_gem_cma_helper.h
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
                   ` (8 preceding siblings ...)
  2019-01-08 19:29 ` [PATCH v3 09/12] drm/arc: do not reply on drmP.h from drm_gem_cma_helper.h Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-09  8:21   ` Benjamin Gaignard
  2019-01-08 19:29 ` [PATCH v3 11/12] drm/tinydrm: " Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 12/12] drm: remove " Sam Ravnborg
  11 siblings, 1 reply; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg, Yannick Fertre, Philippe Cornu, Vincent Abriou

drmP.h was the only header file in the past and a lot
of files rely on that drmP.h defines everything.
The goal is to one day to delete drmP.h and
as a step towards this it will no longer be included in the
headers files in include/drm/

To prepare stm/ for this add dependencies that
othwewise was pulled in by drmP.h from drm_gem_cma_helper.h

Sort the include list when we anyway modify it.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Yannick Fertre <yannick.fertre@st.com>
Cc: Philippe Cornu <philippe.cornu@st.com>
Cc: Vincent Abriou <vincent.abriou@st.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/stm/drv.c  | 6 +++++-
 drivers/gpu/drm/stm/ltdc.c | 9 ++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 8dec001b9d37..9cd6228a18ad 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -9,15 +9,19 @@
  */
 
 #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_fb_cma_helper.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_fb_cma_helper.h>
+#include <drm/drm_vblank.h>
 
 #include "ltdc.h"
 
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 61dd661aa0ac..5cce6c7f35d4 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>
-- 
2.12.0


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

* [PATCH v3 11/12] drm/tinydrm: do not reply on drmP.h from drm_gem_cma_helper.h
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
                   ` (9 preceding siblings ...)
  2019-01-08 19:29 ` [PATCH v3 10/12] drm/stm: " Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-08 19:29 ` [PATCH v3 12/12] drm: remove " Sam Ravnborg
  11 siblings, 0 replies; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg, Eric Anholt, Daniel Vetter

drmP.h was the only header file in the past and a lot
of files rely on that drmP.h defines everything.
The goal is to one day to delete drmP.h and
as a step towards this it will no longer be included in the
headers files in include/drm/

To prepare tinydrm/ for this add dependencies that
othwewise was pulled in by drmP.h from drm_gem_cma_helper.h

To avoid that tinydrm.h became "include everything",
push include files to the individual drivers.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: David Lechner <david@lechnology.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Eric Anholt <eric@anholt.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 3 +++
 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c | 3 +++
 drivers/gpu/drm/tinydrm/hx8357d.c           | 1 +
 drivers/gpu/drm/tinydrm/ili9225.c           | 2 ++
 drivers/gpu/drm/tinydrm/ili9341.c           | 1 +
 drivers/gpu/drm/tinydrm/mi0283qt.c          | 1 +
 drivers/gpu/drm/tinydrm/mipi-dbi.c          | 3 +++
 drivers/gpu/drm/tinydrm/repaper.c           | 1 +
 drivers/gpu/drm/tinydrm/st7586.c            | 1 +
 drivers/gpu/drm/tinydrm/st7735r.c           | 1 +
 10 files changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
index 01a6f2d42440..aeb93eadb047 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
@@ -10,11 +10,14 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_print.h>
 #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-pipe.c b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
index eacfc0ec8ff1..d4576d6e8ce4 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
@@ -9,8 +9,11 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_print.h>
+#include <drm/drm_vblank.h>
 #include <drm/tinydrm/tinydrm.h>
 
 struct tinydrm_connector {
diff --git a/drivers/gpu/drm/tinydrm/hx8357d.c b/drivers/gpu/drm/tinydrm/hx8357d.c
index 81a2bbeb25d4..3ae11aa4b73b 100644
--- a/drivers/gpu/drm/tinydrm/hx8357d.c
+++ b/drivers/gpu/drm/tinydrm/hx8357d.c
@@ -16,6 +16,7 @@
 #include <linux/property.h>
 #include <linux/spi/spi.h>
 
+#include <drm/drm_drv.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_modeset_helper.h>
diff --git a/drivers/gpu/drm/tinydrm/ili9225.c b/drivers/gpu/drm/tinydrm/ili9225.c
index 78f7c2d1b449..b0ad58b97227 100644
--- a/drivers/gpu/drm/tinydrm/ili9225.c
+++ b/drivers/gpu/drm/tinydrm/ili9225.c
@@ -20,7 +20,9 @@
 #include <linux/spi/spi.h>
 #include <video/mipi_display.h>
 
+#include <drm/drm_drv.h>
 #include <drm/drm_fb_cma_helper.h>
+#include <drm/drm_fourcc.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/tinydrm/mipi-dbi.h>
diff --git a/drivers/gpu/drm/tinydrm/ili9341.c b/drivers/gpu/drm/tinydrm/ili9341.c
index 51395bdc6ca2..bcdf10906ade 100644
--- a/drivers/gpu/drm/tinydrm/ili9341.c
+++ b/drivers/gpu/drm/tinydrm/ili9341.c
@@ -15,6 +15,7 @@
 #include <linux/property.h>
 #include <linux/spi/spi.h>
 
+#include <drm/drm_drv.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_modeset_helper.h>
diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 3fa62e77c30b..97805ca37a04 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -17,6 +17,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
 
+#include <drm/drm_drv.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_modeset_helper.h>
diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c
index 3a05e56f9b0d..10294e1283dd 100644
--- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
+++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
@@ -10,14 +10,17 @@
  */
 
 #include <linux/debugfs.h>
+#include <linux/delay.h>
 #include <linux/dma-buf.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
 
+#include <drm/drm_drv.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_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/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c
index 54d6fe0f37ce..b2a8f894946a 100644
--- a/drivers/gpu/drm/tinydrm/repaper.c
+++ b/drivers/gpu/drm/tinydrm/repaper.c
@@ -26,6 +26,7 @@
 #include <linux/spi/spi.h>
 #include <linux/thermal.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/tinydrm/st7586.c b/drivers/gpu/drm/tinydrm/st7586.c
index a6a8a1081b73..bf518167760a 100644
--- a/drivers/gpu/drm/tinydrm/st7586.c
+++ b/drivers/gpu/drm/tinydrm/st7586.c
@@ -17,6 +17,7 @@
 #include <linux/spi/spi.h>
 #include <video/mipi_display.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/tinydrm/st7735r.c b/drivers/gpu/drm/tinydrm/st7735r.c
index b39779e0dcd8..9bc93d5a0401 100644
--- a/drivers/gpu/drm/tinydrm/st7735r.c
+++ b/drivers/gpu/drm/tinydrm/st7735r.c
@@ -14,6 +14,7 @@
 #include <linux/spi/spi.h>
 #include <video/mipi_display.h>
 
+#include <drm/drm_drv.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/tinydrm/mipi-dbi.h>
-- 
2.12.0


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

* [PATCH v3 12/12] drm: remove drmP.h from drm_gem_cma_helper.h
  2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
                   ` (10 preceding siblings ...)
  2019-01-08 19:29 ` [PATCH v3 11/12] drm/tinydrm: " Sam Ravnborg
@ 2019-01-08 19:29 ` Sam Ravnborg
  2019-01-09 22:24   ` Daniel Vetter
  11 siblings, 1 reply; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-08 19:29 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel
  Cc: Sam Ravnborg

With all dependencies fixed we can now remove
drmP.h from drm_gem_cma_helper.h.
It is replaced by the include files required,
or forward declarations as appropritate.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 include/drm/drm_gem_cma_helper.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index 07c504940ba1..947ac95eb24a 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
-- 
2.12.0


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

* Re: [PATCH v3 10/12] drm/stm: do not reply on drmP.h from drm_gem_cma_helper.h
  2019-01-08 19:29 ` [PATCH v3 10/12] drm/stm: " Sam Ravnborg
@ 2019-01-09  8:21   ` Benjamin Gaignard
  2019-01-09  9:42     ` Sam Ravnborg
  0 siblings, 1 reply; 21+ messages in thread
From: Benjamin Gaignard @ 2019-01-09  8:21 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	Linux Kernel Mailing List, ML dri-devel, Yannick Fertre,
	Vincent Abriou, Philippe Cornu

Le mar. 8 janv. 2019 à 20:30, Sam Ravnborg <sam@ravnborg.org> a écrit :
I just notice the a typo in the title of the commit message reply ->rely ?

>
> drmP.h was the only header file in the past and a lot
> of files rely on that drmP.h defines everything.
> The goal is to one day to delete drmP.h and
> as a step towards this it will no longer be included in the
> headers files in include/drm/
>
> To prepare stm/ for this add dependencies that
> othwewise was pulled in by drmP.h from drm_gem_cma_helper.h
>
> Sort the include list when we anyway modify it.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Acked-by: Noralf Trønnes <noralf@tronnes.org>
> Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Yannick Fertre <yannick.fertre@st.com>
> Cc: Philippe Cornu <philippe.cornu@st.com>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  drivers/gpu/drm/stm/drv.c  | 6 +++++-
>  drivers/gpu/drm/stm/ltdc.c | 9 ++++++++-
>  2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> index 8dec001b9d37..9cd6228a18ad 100644
> --- a/drivers/gpu/drm/stm/drv.c
> +++ b/drivers/gpu/drm/stm/drv.c
> @@ -9,15 +9,19 @@
>   */
>
>  #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_fb_cma_helper.h>
> +#include <drm/drm_drv.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> +#include <drm/drm_fb_cma_helper.h>
> +#include <drm/drm_vblank.h>
>
>  #include "ltdc.h"
>
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 61dd661aa0ac..5cce6c7f35d4 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>
> --
> 2.12.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 10/12] drm/stm: do not reply on drmP.h from drm_gem_cma_helper.h
  2019-01-09  8:21   ` Benjamin Gaignard
@ 2019-01-09  9:42     ` Sam Ravnborg
  0 siblings, 0 replies; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-09  9:42 UTC (permalink / raw)
  To: Benjamin Gaignard
  Cc: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	Linux Kernel Mailing List, ML dri-devel, Yannick Fertre,
	Vincent Abriou, Philippe Cornu

Hi Benjamin.

On Wed, Jan 09, 2019 at 09:21:39AM +0100, Benjamin Gaignard wrote:
> Le mar. 8 janv. 2019 à 20:30, Sam Ravnborg <sam@ravnborg.org> a écrit :
> I just notice the a typo in the title of the commit message reply ->rely ?
Randy already told me this, but I missed that in the update.

Will fix in v4 if this set do not get applied.

	Sam

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

* Re: [PATCH v3 04/12] drm: move drm_can_sleep() to drm_util.h
  2019-01-08 19:29 ` [PATCH v3 04/12] drm: move drm_can_sleep() to drm_util.h Sam Ravnborg
@ 2019-01-09 21:20   ` Daniel Vetter
  0 siblings, 0 replies; 21+ messages in thread
From: Daniel Vetter @ 2019-01-09 21:20 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel, Alex Deucher, Christian König,
	David (ChunMing) Zhou, Gerd Hoffmann, Rob Clark, Tomi Valkeinen,
	Eric Anholt

On Tue, Jan 08, 2019 at 08:29:31PM +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.
> 
> Update comments to use kernel-doc style.
> Add FIXME to drm_can_sleep and add note
> that this function should not be used in new code
> 
> Add include of drm_util.h to all users.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/amd/amdgpu/atom.c               |  2 ++
>  drivers/gpu/drm/ast/ast_fb.c                    |  2 ++
>  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                          | 42 ++++++++++++++++++++++++-
>  13 files changed, 56 insertions(+), 9 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 a80bca1a857f..eb66bf7d3e63 100644
> --- a/drivers/gpu/drm/ast/ast_fb.c
> +++ b/drivers/gpu/drm/ast/ast_fb.c
> @@ -39,7 +39,9 @@
>  #include <drm/drmP.h>
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_fb_helper.h>
> +#include <drm/drm_util.h>
>  #include <drm/drm_crtc_helper.h>
> +
>  #include "ast_drv.h"
>  
>  static void ast_dirty_update(struct ast_fbdev *afbdev,
> diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> index 4dd499c7d1ba..79fea1b8bc14 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 dffc5093ff16..2e100f644236 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 c24b078f0593..2c635f001c71 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 9e47c8dc6b87..bc4cb3732407 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -94,14 +94,6 @@ 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;
> -}
> -
>  #if defined(CONFIG_DRM_DEBUG_SELFTEST_MODULE)
>  #define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x)
>  #else
> diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
> index 88abdca89baa..8fda5777471c 100644
> --- a/include/drm/drm_util.h
> +++ b/include/drm/drm_util.h
> @@ -26,7 +26,47 @@
>  #ifndef _DRM_UTIL_H_
>  #define _DRM_UTIL_H_
>  
> -/* helper for handling conditionals in various for_each macros */
> +/**
> + * DOC: drm utils
> + *
> + * Macros and inline functions that does not naturally belong in other places
> + */

The nice new docs here aren't included anywhere. We already have a "Misc
Utilities" in drm-internals.rst, including this there under a "Utilities"
subheading makes sense I think - yes I know, not the most creative name :-)
> +
> +#include <linux/irqflags.h>
> +#include <linux/preempt.h>
> +#include <linux/kgdb.h>
> +#include <linux/smp.h>
> +
> +/**
> + * for_each_if - helper for handling conditionals in various for_each macros
> + * @condition The condition to check
> + *
> + * Typical use:
> + * #define for_each_foo_bar(x, y) \
> + *	list_for_each_entry(x, y->list, head) \
> + *		for_each_if(x->something == SOMETHING)

I think the formatting of this in the html output will look off:
Double-colon plus indenting should fix that.

Merged the first 3 patches of this series thus far.

Thanks, Daniel

> + *
> + * The for_each_if() macro makes the use of for_each_foo_bar() less error
> + * prone.
> + */
>  #define for_each_if(condition) if (!(condition)) {} else
>  
> +/**
> + * drm_can_sleep - returns true if currently okay to sleep
> + *
> + * This function shall not be used in new code.
> + * The check for running in atomic context may not work - see linux/preempt.h.
> + *
> + * FIXME: All users of drm_can_sleep should be removed (see todo.rst)
> + *
> + * Returns:
> + * True if kgdb is active or we are in an atomic context or irqs are disabled
> + */
> +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

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

* Re: [PATCH v3 08/12] drm: remove include of drmP.h from drm_modeset_helper.h
  2019-01-08 19:29 ` [PATCH v3 08/12] drm: remove include of drmP.h from drm_modeset_helper.h Sam Ravnborg
@ 2019-01-09 21:53   ` Daniel Vetter
  2019-01-11 15:56     ` Daniel Vetter
  0 siblings, 1 reply; 21+ messages in thread
From: Daniel Vetter @ 2019-01-09 21:53 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel, Alexey Brodkin, Archit Taneja,
	Andrzej Hajda, Kieran Bingham

On Tue, Jan 08, 2019 at 08:29:35PM +0100, Sam Ravnborg wrote:
> drmP.h is an relic from the days when there was a single header file.
> To enable the removal of drmP.h from all users drop include
> of drmP.h from drm_modeset_helper.h.
> 
> A few files relied on the file included in drmP.h - add explicit
> include statements to these files.
> Build tested with arm and x86.
> 
> v2:
> - Add forward declarations to drm_modeset_helper.h (Laurent Pinchart)
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Reviewed-by: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Archit Taneja <architt@codeaurora.org>
> Cc: Andrzej Hajda <a.hajda@samsung.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

This one here breaks tinydrm without the tinydrm patch first. I reorderd
while applying. It also breaks kirin (and maybe more, I didn't check), so
I've left this one out for now.
-Daniel

> ---
>  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     | 6 +++++-
>  5 files changed, 11 insertions(+), 1 deletion(-)
> 
> 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 9150fa385bba..9bc1ef788c77 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 534a128a869d..8010ed702509 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..995fd981cab0 100644
> --- a/include/drm/drm_modeset_helper.h
> +++ b/include/drm/drm_modeset_helper.h
> @@ -23,7 +23,11 @@
>  #ifndef __DRM_KMS_HELPER_H__
>  #define __DRM_KMS_HELPER_H__
>  
> -#include <drm/drmP.h>
> +struct drm_crtc;
> +struct drm_crtc_funcs;
> +struct drm_device;
> +struct drm_framebuffer;
> +struct drm_mode_fb_cmd2;
>  
>  void drm_helper_move_panel_connectors_to_head(struct drm_device *);
>  
> -- 
> 2.12.0
> 

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

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

* Re: [PATCH v3 05/12] drm: move EXPORT_SYMBOL_FOR_TESTS_ONLY to drm_util.h
  2019-01-08 19:29 ` [PATCH v3 05/12] drm: move EXPORT_SYMBOL_FOR_TESTS_ONLY " Sam Ravnborg
@ 2019-01-09 21:54   ` Daniel Vetter
  0 siblings, 0 replies; 21+ messages in thread
From: Daniel Vetter @ 2019-01-09 21:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel

On Tue, Jan 08, 2019 at 08:29:32PM +0100, Sam Ravnborg wrote:
> In the quest to get rid of drmP.h move the newly
> added EXPORT_SYMBOL_FOR_TESTS_ONLY to drm_util.h.
> Fix the single user.
> 
> Add a note to drmP.h to avoid further use of it.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>

Skipping this one for now, since it doesn't apply cleanly without patch 4.
Seems like none of the later patches requires it.
-Daniel

> ---
>  drivers/gpu/drm/drm_framebuffer.c |  1 +
>  include/drm/drmP.h                | 11 ++++++-----
>  include/drm/drm_util.h            | 10 ++++++++++
>  3 files changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index fcaea8f50513..7abcb265a108 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -27,6 +27,7 @@
>  #include <drm/drm_atomic.h>
>  #include <drm/drm_atomic_uapi.h>
>  #include <drm/drm_print.h>
> +#include <drm/drm_util.h>
>  
>  #include "drm_internal.h"
>  #include "drm_crtc_internal.h"
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index bc4cb3732407..3f5c577c9dbd 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -94,10 +94,11 @@ struct dma_buf_attachment;
>  struct pci_dev;
>  struct pci_controller;
>  
> -#if defined(CONFIG_DRM_DEBUG_SELFTEST_MODULE)
> -#define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x)
> -#else
> -#define EXPORT_SYMBOL_FOR_TESTS_ONLY(x)
> -#endif
> +/*
> + * NOTE: drmP.h is obsolete - do NOT add anything to this file
> + *
> + * Do not include drmP.h in new files.
> + * Work is ongoing to remove drmP.h includes from existing files
> + */
>  
>  #endif
> diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
> index 8fda5777471c..cd1e4be1dfb3 100644
> --- a/include/drm/drm_util.h
> +++ b/include/drm/drm_util.h
> @@ -37,6 +37,16 @@
>  #include <linux/kgdb.h>
>  #include <linux/smp.h>
>  
> +/*
> + * Use EXPORT_SYMBOL_FOR_TESTS_ONLY() for functions that shall
> + * only be visible for drmselftests.
> + */
> +#if defined(CONFIG_DRM_DEBUG_SELFTEST_MODULE)
> +#define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x)
> +#else
> +#define EXPORT_SYMBOL_FOR_TESTS_ONLY(x)
> +#endif
> +
>  /**
>   * for_each_if - helper for handling conditionals in various for_each macros
>   * @condition The condition to check
> -- 
> 2.12.0
> 

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

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

* Re: [PATCH v3 12/12] drm: remove drmP.h from drm_gem_cma_helper.h
  2019-01-08 19:29 ` [PATCH v3 12/12] drm: remove " Sam Ravnborg
@ 2019-01-09 22:24   ` Daniel Vetter
  2019-01-09 23:06     ` Sam Ravnborg
  0 siblings, 1 reply; 21+ messages in thread
From: Daniel Vetter @ 2019-01-09 22:24 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel

On Tue, Jan 08, 2019 at 08:29:39PM +0100, Sam Ravnborg wrote:
> With all dependencies fixed we can now remove
> drmP.h from drm_gem_cma_helper.h.
> It is replaced by the include files required,
> or forward declarations as appropritate.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Acked-by: Noralf Trønnes <noralf@tronnes.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>

Except for the ones I commented on, all patches applied. I also fixed the
one typo in the summary.

Thanks, Daniel
> ---
>  include/drm/drm_gem_cma_helper.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
> index 07c504940ba1..947ac95eb24a 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
> -- 
> 2.12.0
> 

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

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

* Re: [PATCH v3 12/12] drm: remove drmP.h from drm_gem_cma_helper.h
  2019-01-09 22:24   ` Daniel Vetter
@ 2019-01-09 23:06     ` Sam Ravnborg
  0 siblings, 0 replies; 21+ messages in thread
From: Sam Ravnborg @ 2019-01-09 23:06 UTC (permalink / raw)
  To: David Airlie, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel

On Wed, Jan 09, 2019 at 11:24:05PM +0100, Daniel Vetter wrote:
> On Tue, Jan 08, 2019 at 08:29:39PM +0100, Sam Ravnborg wrote:
> > With all dependencies fixed we can now remove
> > drmP.h from drm_gem_cma_helper.h.
> > It is replaced by the include files required,
> > or forward declarations as appropritate.
> > 
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Acked-by: Noralf Trønnes <noralf@tronnes.org>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> > Cc: Sean Paul <sean@poorly.run>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> 
> Except for the ones I commented on, all patches applied. I also fixed the
> one typo in the summary.

Thanks, I will rebase, address comments, do a new set of build tests etc. and repost.

	Sam

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

* Re: [PATCH v3 08/12] drm: remove include of drmP.h from drm_modeset_helper.h
  2019-01-09 21:53   ` Daniel Vetter
@ 2019-01-11 15:56     ` Daniel Vetter
  0 siblings, 0 replies; 21+ messages in thread
From: Daniel Vetter @ 2019-01-11 15:56 UTC (permalink / raw)
  To: Sam Ravnborg, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, David Lechner, Laurent Pinchart, Noralf Trønnes,
	linux-kernel, dri-devel, Alexey Brodkin, Archit Taneja,
	Andrzej Hajda, Kieran Bingham

On Wed, Jan 09, 2019 at 10:53:54PM +0100, Daniel Vetter wrote:
> On Tue, Jan 08, 2019 at 08:29:35PM +0100, Sam Ravnborg wrote:
> > drmP.h is an relic from the days when there was a single header file.
> > To enable the removal of drmP.h from all users drop include
> > of drmP.h from drm_modeset_helper.h.
> > 
> > A few files relied on the file included in drmP.h - add explicit
> > include statements to these files.
> > Build tested with arm and x86.
> > 
> > v2:
> > - Add forward declarations to drm_modeset_helper.h (Laurent Pinchart)
> > 
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Reviewed-by: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> > Cc: Alexey Brodkin <abrodkin@synopsys.com>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Archit Taneja <architt@codeaurora.org>
> > Cc: Andrzej Hajda <a.hajda@samsung.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> > Cc: Sean Paul <sean@poorly.run>
> > Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> 
> This one here breaks tinydrm without the tinydrm patch first. I reorderd
> while applying. It also breaks kirin (and maybe more, I didn't check), so
> I've left this one out for now.

Note that I've just fixed up a large pile of these in i915 because I've
been rebasing a patch that removes lots of drm_modeset_helper.h includes.

Getting this all merged will be fun :-/
-Daniel

> -Daniel
> 
> > ---
> >  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     | 6 +++++-
> >  5 files changed, 11 insertions(+), 1 deletion(-)
> > 
> > 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 9150fa385bba..9bc1ef788c77 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 534a128a869d..8010ed702509 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..995fd981cab0 100644
> > --- a/include/drm/drm_modeset_helper.h
> > +++ b/include/drm/drm_modeset_helper.h
> > @@ -23,7 +23,11 @@
> >  #ifndef __DRM_KMS_HELPER_H__
> >  #define __DRM_KMS_HELPER_H__
> >  
> > -#include <drm/drmP.h>
> > +struct drm_crtc;
> > +struct drm_crtc_funcs;
> > +struct drm_device;
> > +struct drm_framebuffer;
> > +struct drm_mode_fb_cmd2;
> >  
> >  void drm_helper_move_panel_connectors_to_head(struct drm_device *);
> >  
> > -- 
> > 2.12.0
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

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

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

end of thread, other threads:[~2019-01-11 15:56 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08 19:29 [PATCH v3 0/12] drm: minimize drmP.h dependencies Sam Ravnborg
2019-01-08 19:29 ` [PATCH v3 01/12] drm: drm_device.h: update comments to kernel-doc style Sam Ravnborg
2019-01-08 19:29 ` [PATCH v3 02/12] drm: move DRM_SWITCH_POWER defines to drm_device.h Sam Ravnborg
2019-01-08 19:29 ` [PATCH v3 03/12] drm: make drm_framebuffer.h self contained Sam Ravnborg
2019-01-08 19:29 ` [PATCH v3 04/12] drm: move drm_can_sleep() to drm_util.h Sam Ravnborg
2019-01-09 21:20   ` Daniel Vetter
2019-01-08 19:29 ` [PATCH v3 05/12] drm: move EXPORT_SYMBOL_FOR_TESTS_ONLY " Sam Ravnborg
2019-01-09 21:54   ` Daniel Vetter
2019-01-08 19:29 ` [PATCH v3 06/12] drm: remove include of drmP.h from bridge/dw_hdmi.h Sam Ravnborg
2019-01-08 19:29 ` [PATCH v3 07/12] drm: remove include of drmP.h from drm_encoder_slave.h Sam Ravnborg
2019-01-08 19:29 ` [PATCH v3 08/12] drm: remove include of drmP.h from drm_modeset_helper.h Sam Ravnborg
2019-01-09 21:53   ` Daniel Vetter
2019-01-11 15:56     ` Daniel Vetter
2019-01-08 19:29 ` [PATCH v3 09/12] drm/arc: do not reply on drmP.h from drm_gem_cma_helper.h Sam Ravnborg
2019-01-08 19:29 ` [PATCH v3 10/12] drm/stm: " Sam Ravnborg
2019-01-09  8:21   ` Benjamin Gaignard
2019-01-09  9:42     ` Sam Ravnborg
2019-01-08 19:29 ` [PATCH v3 11/12] drm/tinydrm: " Sam Ravnborg
2019-01-08 19:29 ` [PATCH v3 12/12] drm: remove " Sam Ravnborg
2019-01-09 22:24   ` Daniel Vetter
2019-01-09 23:06     ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).