drm/i915: extract intel_atomic.h from intel_drv.h
authorJani Nikula <jani.nikula@intel.com>
Mon, 29 Apr 2019 12:53:31 +0000 (15:53 +0300)
committerJani Nikula <jani.nikula@intel.com>
Tue, 30 Apr 2019 12:04:55 +0000 (15:04 +0300)
It used to be handy that we only had a couple of headers, but over time
intel_drv.h has become unwieldy. Extract declarations to a separate
header file corresponding to the implementation module, clarifying the
modularity of the driver.

Ensure the new header is self-contained, and do so with minimal further
includes, using forward declarations as needed. Include the new header
only where needed, and sort the modified include directives while at it
and as needed.

No functional changes.

v2: fix sparse warnings on undeclared global functions

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190429125331.32499-1-jani.nikula@intel.com
15 files changed:
drivers/gpu/drm/i915/Makefile.header-test
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/icl_dsi.c
drivers/gpu/drm/i915/intel_atomic.c
drivers/gpu/drm/i915/intel_atomic.h [new file with mode: 0644]
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_dp_mst.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_hdmi.c
drivers/gpu/drm/i915/intel_lvds.c
drivers/gpu/drm/i915/intel_pipe_crc.c
drivers/gpu/drm/i915/intel_pm.c
drivers/gpu/drm/i915/intel_sdvo.c
drivers/gpu/drm/i915/vlv_dsi.c

index fa7542a6b262b4eb217701d0ff90fccf5aec1b0e..bff153be3d043eb120f6c85843d64900ed9cbfcb 100644 (file)
@@ -13,6 +13,7 @@ header_test := \
        i915_reg.h \
        i915_scheduler_types.h \
        i915_timeline_types.h \
+       intel_atomic.h \
        intel_atomic_plane.h \
        intel_audio.h \
        intel_bios.h \
index e3263608d0d305c6f7afbefe53f151310b7a7c42..e1b858bd1d323ef08a897f244d5716bc38893360 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "i915_drv.h"
 #include "i915_gpu_error.h"
+#include "intel_atomic.h"
 #include "intel_overlay.h"
 
 static inline const struct intel_engine_cs *
index 9d962ea1e635e1ff5d8da5a3fe24450075201acf..c6ecc008760896e6bc2021c594efd10062904b03 100644 (file)
@@ -28,6 +28,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_mipi_dsi.h>
 
+#include "intel_atomic.h"
 #include "intel_connector.h"
 #include "intel_ddi.h"
 #include "intel_dsi.h"
index 8c8fae32ec50985e86c619dc1c5aa296f8f5e49e..58b8049649a0f929b9e5d90637d3b243bcd74a10 100644 (file)
@@ -34,6 +34,7 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_plane_helper.h>
 
+#include "intel_atomic.h"
 #include "intel_drv.h"
 #include "intel_hdcp.h"
 #include "intel_sprite.h"
@@ -411,3 +412,15 @@ void intel_atomic_state_clear(struct drm_atomic_state *s)
        drm_atomic_state_default_clear(&state->base);
        state->dpll_set = state->modeset = false;
 }
+
+struct intel_crtc_state *
+intel_atomic_get_crtc_state(struct drm_atomic_state *state,
+                           struct intel_crtc *crtc)
+{
+       struct drm_crtc_state *crtc_state;
+       crtc_state = drm_atomic_get_crtc_state(state, &crtc->base);
+       if (IS_ERR(crtc_state))
+               return ERR_CAST(crtc_state);
+
+       return to_intel_crtc_state(crtc_state);
+}
diff --git a/drivers/gpu/drm/i915/intel_atomic.h b/drivers/gpu/drm/i915/intel_atomic.h
new file mode 100644 (file)
index 0000000..1c8507d
--- /dev/null
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2019 Intel Corporation
+ */
+
+#ifndef __INTEL_ATOMIC_H__
+#define __INTEL_ATOMIC_H__
+
+#include <linux/types.h>
+
+struct drm_atomic_state;
+struct drm_connector;
+struct drm_connector_state;
+struct drm_crtc;
+struct drm_crtc_state;
+struct drm_device;
+struct drm_i915_private;
+struct drm_property;
+struct intel_crtc;
+struct intel_crtc_state;
+
+int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
+                                               const struct drm_connector_state *state,
+                                               struct drm_property *property,
+                                               u64 *val);
+int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
+                                               struct drm_connector_state *state,
+                                               struct drm_property *property,
+                                               u64 val);
+int intel_digital_connector_atomic_check(struct drm_connector *conn,
+                                        struct drm_connector_state *new_state);
+struct drm_connector_state *
+intel_digital_connector_duplicate_state(struct drm_connector *connector);
+
+struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
+void intel_crtc_destroy_state(struct drm_crtc *crtc,
+                              struct drm_crtc_state *state);
+struct drm_atomic_state *intel_atomic_state_alloc(struct drm_device *dev);
+void intel_atomic_state_clear(struct drm_atomic_state *state);
+
+struct intel_crtc_state *
+intel_atomic_get_crtc_state(struct drm_atomic_state *state,
+                           struct intel_crtc *crtc);
+
+int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,
+                              struct intel_crtc *intel_crtc,
+                              struct intel_crtc_state *crtc_state);
+
+#endif /* __INTEL_ATOMIC_H__ */
index 506786210357dd97af3ab494b068a46918abe6f0..29f6960e0f8b548f843b80ddee0e1f4b50272126 100644 (file)
@@ -47,6 +47,7 @@
 #include "i915_drv.h"
 #include "i915_gem_clflush.h"
 #include "i915_trace.h"
+#include "intel_atomic.h"
 #include "intel_atomic_plane.h"
 #include "intel_color.h"
 #include "intel_cdclk.h"
index 58f6d0e953adaad6a70678fb1e602314d0db728c..4e7b8d29d73346daa41805c5f924423367700c5c 100644 (file)
@@ -43,6 +43,7 @@
 #include <drm/i915_drm.h>
 
 #include "i915_drv.h"
+#include "intel_atomic.h"
 #include "intel_audio.h"
 #include "intel_connector.h"
 #include "intel_ddi.h"
index 46e88311add4d666f01e2f539669421aa09a5070..725518e8bfaa4ac1fac8285af2e3405771e286e4 100644 (file)
@@ -28,6 +28,7 @@
 #include <drm/drm_probe_helper.h>
 
 #include "i915_drv.h"
+#include "intel_atomic.h"
 #include "intel_audio.h"
 #include "intel_connector.h"
 #include "intel_ddi.h"
index 71ae3beae92c4f8f991dd84a006efe80145815a4..aa5542d44d39760527c4940921de3c30985f2ba0 100644 (file)
@@ -1912,40 +1912,4 @@ void chv_phy_powergate_lanes(struct intel_encoder *encoder,
 bool chv_phy_powergate_ch(struct drm_i915_private *dev_priv, enum dpio_phy phy,
                          enum dpio_channel ch, bool override);
 
-/* intel_atomic.c */
-int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
-                                               const struct drm_connector_state *state,
-                                               struct drm_property *property,
-                                               u64 *val);
-int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
-                                               struct drm_connector_state *state,
-                                               struct drm_property *property,
-                                               u64 val);
-int intel_digital_connector_atomic_check(struct drm_connector *conn,
-                                        struct drm_connector_state *new_state);
-struct drm_connector_state *
-intel_digital_connector_duplicate_state(struct drm_connector *connector);
-
-struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
-void intel_crtc_destroy_state(struct drm_crtc *crtc,
-                              struct drm_crtc_state *state);
-struct drm_atomic_state *intel_atomic_state_alloc(struct drm_device *dev);
-void intel_atomic_state_clear(struct drm_atomic_state *);
-
-static inline struct intel_crtc_state *
-intel_atomic_get_crtc_state(struct drm_atomic_state *state,
-                           struct intel_crtc *crtc)
-{
-       struct drm_crtc_state *crtc_state;
-       crtc_state = drm_atomic_get_crtc_state(state, &crtc->base);
-       if (IS_ERR(crtc_state))
-               return ERR_CAST(crtc_state);
-
-       return to_intel_crtc_state(crtc_state);
-}
-
-int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,
-                              struct intel_crtc *intel_crtc,
-                              struct intel_crtc_state *crtc_state);
-
 #endif /* __INTEL_DRV_H__ */
index 4d3e2c96916e593b303cc815539b7934cfbc0abd..f8440c6c784dffed607ff651a4f055a7fc4ea73b 100644 (file)
@@ -40,6 +40,7 @@
 #include <drm/intel_lpe_audio.h>
 
 #include "i915_drv.h"
+#include "intel_atomic.h"
 #include "intel_audio.h"
 #include "intel_connector.h"
 #include "intel_ddi.h"
index 51d1d59c16193d67335c0912e88d786a251b4214..dcfca443f4797c758c9448f333eb0982e1ff1ead 100644 (file)
@@ -40,6 +40,7 @@
 #include <drm/i915_drm.h>
 
 #include "i915_drv.h"
+#include "intel_atomic.h"
 #include "intel_connector.h"
 #include "intel_drv.h"
 #include "intel_lvds.h"
index e94b5b1bc1b7f2015b0613787d0a29e8656bd875..337600f0f3593f95f46431a753a34f420c4884a4 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 
+#include "intel_atomic.h"
 #include "intel_drv.h"
 #include "intel_pipe_crc.h"
 
index 3ba31a71ff978b0166bab6d7c54b82ed2f47d48f..efae44d7f68b20e6371c7b3ab3b2fbc671c7b23d 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "i915_drv.h"
 #include "i915_irq.h"
+#include "intel_atomic.h"
 #include "intel_drv.h"
 #include "intel_fbc.h"
 #include "intel_pm.h"
index 66365b14703b1c39a4c97bda2974f3113d6f4749..743e7458475c3db470d18906df961dacaedec90d 100644 (file)
@@ -37,6 +37,7 @@
 #include <drm/i915_drm.h>
 
 #include "i915_drv.h"
+#include "intel_atomic.h"
 #include "intel_connector.h"
 #include "intel_drv.h"
 #include "intel_fifo_underrun.h"
index 5d343a09d5304d6099aed3eab4f3e8045b37ba58..bc5b782b053c131f3ead831ac99719295f5bdb54 100644 (file)
@@ -32,6 +32,7 @@
 #include <drm/drm_mipi_dsi.h>
 
 #include "i915_drv.h"
+#include "intel_atomic.h"
 #include "intel_connector.h"
 #include "intel_drv.h"
 #include "intel_dsi.h"