Reduce intel_display.c
Subsystems (2)
cover Reduce intel_display.c
From: Paulo Zanoni <[email protected]>
Hi
We always talk about how intel_display.c is a giant file and how we would like to reduce it, so this is my attempt. Currently the file has 12090 lines, and after my patch series it has 8850 lines.
I don't know if right now is the appropriate time to merge patches like this. I don't remember seeing too many patches on the list touching cursor/fdi/eld/pll functions, but I know there is never an appropriate time for huge changes.
Also, this change will obviously make the lives of people who backport our patches more complicated. So if we don't want this series at all, feel free to NACK it.
I also didn't really know what kind of changes I needed to do to the file headers, so I just copied the header from intel_display.c, kept Eric's name and added a "2014" to Intel's copyright. I am not a lawyer and this may be not the best thing to do, so please tell me the correct approach here :)
There are also some things that we might want to migrate from intel_ddi.c to intel_pll.c, but I'll leave this to another patch.
Also, feel free to propose better ways to split intel_display.c.
Thanks,
Paulo
Paulo Zanoni (4):
drm/i915: extract intel_eld.c from intel_display.c drm/i915: extract intel_cursor.c from intel_display.c drm/i915: extract intel_fdi.c from intel_display.c drm/i915: extract intel_pll.c from intel_display.c
drivers/gpu/drm/i915/Makefile | 4 + drivers/gpu/drm/i915/intel_cursor.c | 357 ++++ drivers/gpu/drm/i915/intel_ddi.c | 142 +- drivers/gpu/drm/i915/intel_display.c | 3622 ++-------------------------------- drivers/gpu/drm/i915/intel_drv.h | 143 +- drivers/gpu/drm/i915/intel_eld.c | 355 ++++ drivers/gpu/drm/i915/intel_fdi.c | 959 +++++++++ drivers/gpu/drm/i915/intel_panel.c | 36 + drivers/gpu/drm/i915/intel_pll.c | 1779 +++++++++++++++++ 9 files changed, 3808 insertions(+), 3589 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_cursor.c create mode 100644 drivers/gpu/drm/i915/intel_eld.c create mode 100644 drivers/gpu/drm/i915/intel_fdi.c create mode 100644 drivers/gpu/drm/i915/intel_pll.c
Signature · 1 line
1.9.0
PATCH 1/4 drm/i915: extract intel_eld.c from intel_display.c
From: Paulo Zanoni <[email protected]>
Since intel_display.c is way too big for our little heads.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_display.c | 322 +------------------------------ drivers/gpu/drm/i915/intel_drv.h | 9 +- drivers/gpu/drm/i915/intel_eld.c | 355 +++++++++++++++++++++++++++++++++++ 4 files changed, 366 insertions(+), 321 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_eld.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -35,6 +35,7 @@ i915-y += i915_cmd_parser.o \ # modesetting core code i915-y += intel_bios.o \ intel_display.o \ + intel_eld.o \ intel_modes.o \ intel_overlay.o \ intel_sideband.o \
drivers/gpu/drm/i915/intel_display.c +3 -319
359 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +7 -2
@@ -728,8 +728,6 @@ void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,void assert_pipe (struct drm_i915_private *dev_priv,enum pipe pipe,bool state);#define assert_pipe_enabled (d, p) assert_pipe(d, p, true)#define assert_pipe_disabled (d, p) assert_pipe(d, p, false) -void intel_write_eld (struct drm_encoder *encoder, -struct drm_display_mode *mode); unsigned long intel_gen4_compute_page_offset(int *x, int *y, unsigned int tiling_mode, unsigned int bpp,
@@ -753,6 +751,7 @@ int valleyview_get_vco(struct drm_i915_private *dev_priv);void intel_mode_from_pipe_config (struct drm_display_mode *mode,struct intel_crtc_config *pipe_config);int intel_format_to_fourcc (int format); +bool intel_pipe_has_type (struct drm_crtc *crtc,int type);/* intel_dp.c */ void intel_dp_init (struct drm_device *dev,int output_reg,enum port port);
@@ -786,6 +785,12 @@ bool intel_dsi_init(struct drm_device *dev);void intel_dvo_init (struct drm_device *dev); +/* intel_eld.c */ +void intel_write_eld (struct drm_encoder *encoder, +struct drm_display_mode *mode); +void intel_eld_init (struct drm_i915_private *dev_priv); + +/* legacy fbdev emulation in intel_fbdev.c */ #ifdef CONFIG_DRM_I915_FBDEV extern int intel_fbdev_init (struct drm_device *dev);
drivers/gpu/drm/i915/intel_eld.c new file +355 -0
355 lines not on this page · raw message
Signature · 6 lines
1.9.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/4 drm/i915: extract intel_cursor.c from intel_display.c
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Since intel_display.c is way too big for our little heads.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_cursor.c | 357 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 340 +-------------------------------- drivers/gpu/drm/i915/intel_drv.h | 18 ++ 4 files changed, 377 insertions(+), 339 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_cursor.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -34,6 +34,7 @@ i915-y += i915_cmd_parser.o \ # modesetting core code i915-y += intel_bios.o \ + intel_cursor.o \ intel_display.o \ intel_eld.o \ intel_modes.o \
drivers/gpu/drm/i915/intel_cursor.c new file +357 -0
357 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +1 -339
370 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +18 -0
@@ -617,6 +617,10 @@ hdmi_to_dig_port(struct intel_hdmi *intel_hdmi) return container_of(intel_hdmi, struct intel_digital_port, hdmi); } +static inline const char *state_string (bool enabled) +{ +return enabled ?"on" :"off" ; +}/* i915_irq.c */ bool intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,
@@ -638,6 +642,19 @@ void intel_runtime_pm_restore_interrupts(struct drm_device *dev);void intel_crt_init (struct drm_device *dev); +/* intel_cursor.c */ +void assert_cursor (struct drm_i915_private *dev_priv,enum pipe pipe, +bool state); +#define assert_cursor_enabled (d, p) assert_cursor(d, p, true) +#define assert_cursor_disabled (d, p) assert_cursor(d, p, false) +void intel_crtc_update_cursor (struct drm_crtc *crtc,bool on); +int intel_crtc_cursor_set (struct drm_crtc *crtc, +struct drm_file *file, +uint32_t handle, +uint32_t width,uint32_t height); +int intel_crtc_cursor_move (struct drm_crtc *crtc,int x,int y); + +/* intel_ddi.c */ void intel_prepare_ddi (struct drm_device *dev);void hsw_fdi_link_train (struct drm_crtc *crtc);
@@ -752,6 +769,7 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode, struct intel_crtc_config *pipe_config);int intel_format_to_fourcc (int format);bool intel_pipe_has_type (struct drm_crtc *crtc,int type); +bool need_vtd_wa (struct drm_device *dev);/* intel_dp.c */ void intel_dp_init (struct drm_device *dev,int output_reg,enum port port);
Signature · 6 lines
1.9.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/4 drm/i915: extract intel_fdi.c from intel_display.c
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Since intel_display.c is way too big for our little heads.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_ddi.c | 142 +----- drivers/gpu/drm/i915/intel_display.c | 794 +---------------------------- drivers/gpu/drm/i915/intel_drv.h | 39 +- drivers/gpu/drm/i915/intel_fdi.c | 959 +++++++++++++++++++++++++++++++++++ 5 files changed, 1003 insertions(+), 932 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_fdi.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -37,6 +37,7 @@ i915-y += intel_bios.o \ intel_cursor.o \ intel_display.o \ intel_eld.o \ + intel_fdi.o \ intel_modes.o \ intel_overlay.o \ intel_sideband.o \
drivers/gpu/drm/i915/intel_ddi.c +1 -141
154 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +8 -786
857 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +34 -5
@@ -657,7 +657,6 @@ int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);/* intel_ddi.c */ void intel_prepare_ddi (struct drm_device *dev); -void hsw_fdi_link_train (struct drm_crtc *crtc);void intel_ddi_init (struct drm_device *dev,enum port port);enum port intel_ddi_get_encoder_port (struct intel_encoder *intel_encoder);bool intel_ddi_get_hw_state (struct intel_encoder *encoder,enum pipe *pipe);
@@ -678,6 +677,7 @@ bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);void intel_ddi_fdi_disable (struct drm_crtc *crtc);void intel_ddi_get_config (struct intel_encoder *encoder,struct intel_crtc_config *pipe_config); +void intel_wait_ddi_buf_idle (struct drm_i915_private *dev_priv,enum port port);/* intel_display.c */
@@ -738,13 +738,13 @@ void assert_pll(struct drm_i915_private *dev_priv, enum pipe pipe, bool state);#define assert_pll_enabled (d, p) assert_pll(d, p, true)#define assert_pll_disabled (d, p) assert_pll(d, p, false) -void assert_fdi_rx_pll (struct drm_i915_private *dev_priv, -enum pipe pipe,bool state); -#define assert_fdi_rx_pll_enabled (d, p) assert_fdi_rx_pll(d, p, true) -#define assert_fdi_rx_pll_disabled (d, p) assert_fdi_rx_pll(d, p, false)void assert_pipe (struct drm_i915_private *dev_priv,enum pipe pipe,bool state);#define assert_pipe_enabled (d, p) assert_pipe(d, p, true)#define assert_pipe_disabled (d, p) assert_pipe(d, p, false) +void assert_plane (struct drm_i915_private *dev_priv,enum plane plane, +bool state); +#define assert_plane_enabled (d, p) assert_plane(d, p, true) +#define assert_plane_disabled (d, p) assert_plane(d, p, false) unsigned long intel_gen4_compute_page_offset(int *x, int *y, unsigned int tiling_mode, unsigned int bpp,
@@ -840,6 +840,35 @@ static inline void intel_fbdev_restore_mode(struct drm_device *dev) }#endif + +/* intel_fdi.c */ +u32 intel_fdi_link_freq (struct drm_device *dev); +void assert_fdi_tx (struct drm_i915_private *dev_priv,enum pipe pipe, +bool state); +#define assert_fdi_tx_enabled (d, p) assert_fdi_tx(d, p, true) +#define assert_fdi_tx_disabled (d, p) assert_fdi_tx(d, p, false) +void assert_fdi_rx (struct drm_i915_private *dev_priv,enum pipe pipe, +bool state); +#define assert_fdi_rx_enabled (d, p) assert_fdi_rx(d, p, true) +#define assert_fdi_rx_disabled (d, p) assert_fdi_rx(d, p, false) +void assert_fdi_rx_pll (struct drm_i915_private *dev_priv, +enum pipe pipe,bool state); +#define assert_fdi_rx_pll_enabled (d, p) assert_fdi_rx_pll(d, p, true) +#define assert_fdi_rx_pll_disabled (d, p) assert_fdi_rx_pll(d, p, false) +void ivybridge_update_fdi_bc_bifurcation (struct intel_crtc *intel_crtc); +void intel_fdi_normal_train (struct drm_crtc *crtc); +void assert_fdi_tx_pll_enabled (struct drm_i915_private *dev_priv, +enum pipe pipe); +void ironlake_fdi_pll_enable (struct intel_crtc *intel_crtc); +void ironlake_fdi_pll_disable (struct intel_crtc *intel_crtc); +void ironlake_fdi_disable (struct drm_crtc *crtc); +void intel_fdi_init (struct drm_i915_private *dev_priv); +#define FDI_COMPUTE_CONFIG_RETRY 1 +int ironlake_fdi_compute_config (struct intel_crtc *intel_crtc, +struct intel_crtc_config *pipe_config); +void ivb_update_fdi_bc_resources (struct drm_i915_private *dev_priv); + +/* intel_hdmi.c */ void intel_hdmi_init (struct drm_device *dev,int hdmi_reg,enum port port); void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
drivers/gpu/drm/i915/intel_fdi.c new file +959 -0
959 lines not on this page · raw message
Signature · 6 lines
1.9.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/4 drm/i915: extract intel_pll.c from intel_display.c
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
Since intel_display.c is way too big for our little heads.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_display.c | 1902 +--------------------------------- drivers/gpu/drm/i915/intel_drv.h | 77 +- drivers/gpu/drm/i915/intel_panel.c | 36 + drivers/gpu/drm/i915/intel_pll.c | 1779 +++++++++++++++++++++++++++++++ 5 files changed, 1930 insertions(+), 1865 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_pll.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -40,6 +40,7 @@ i915-y += intel_bios.o \ intel_fdi.o \ intel_modes.o \ intel_overlay.o \ + intel_pll.o \ intel_sideband.o \ intel_sprite.o i915-$(CONFIG_ACPI) += intel_acpi.o intel_opregion.o
drivers/gpu/drm/i915/intel_display.c +47 -1855
2,031 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +67 -10
95 lines not on this page · raw message
drivers/gpu/drm/i915/intel_panel.c +36 -0
@@ -1189,6 +1189,42 @@ void intel_panel_init_backlight_funcs(struct drm_device *dev) } } +bool intel_panel_use_ssc (struct drm_i915_private *dev_priv) +{ +if (i915.panel_use_ssc >=0 ) +return i915.panel_use_ssc !=0 ; +return dev_priv->vbt.lvds_use_ssc + && !(dev_priv->quirks &QUIRK_LVDS_SSC_DISABLE ); +} + +void assert_panel_unlocked (struct drm_i915_private *dev_priv,enum pipe pipe) +{ +int pp_reg, lvds_reg; +u32 val; +enum pipe panel_pipe =PIPE_A ; +bool locked = true; + +if (HAS_PCH_SPLIT (dev_priv->dev)) { + pp_reg =PCH_PP_CONTROL ; + lvds_reg =PCH_LVDS ; + }else { + pp_reg =PP_CONTROL ; + lvds_reg =LVDS ; + } + + val =I915_READ (pp_reg); +if (!(val &PANEL_POWER_ON ) || + ((val &PANEL_UNLOCK_REGS ) ==PANEL_UNLOCK_REGS )) + locked = false; + +if (I915_READ (lvds_reg) &LVDS_PIPEB_SELECT ) + panel_pipe =PIPE_B ; + +WARN (panel_pipe == pipe && locked, +"panel assertion failure, pipe %c regs locked\n" , +pipe_name (pipe)); +} +int intel_panel_init (struct intel_panel *panel,struct drm_display_mode *fixed_mode,struct drm_display_mode *downclock_mode)
drivers/gpu/drm/i915/intel_pll.c new file +1779 -0
825 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.9.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Part of the diff is not shown here. View the raw message.
Quoted 21 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
Hi
We always talk about how
intel_display.cis a giant file and how we would like to reduce it, so this is my attempt. Currently the file has 12090 lines, and after my patch series it has 8850 lines.I don't know if right now is the appropriate time to merge patches like this. I don't remember seeing too many patches on the list touching cursor/fdi/eld/pll functions, but I know there is never an appropriate time for huge changes.
Also, this change will obviously make the lives of people who backport our patches more complicated. So if we don't want this series at all, feel free to NACK it.
I also didn't really know what kind of changes I needed to do to the file headers, so I just copied the header from
intel_display.c, kept Eric's name and added a "2014" to Intel's copyright. I am not a lawyer and this may be not the best thing to do, so please tell me the correct approach here :)
Quoted 4 lines
There are also some things that we might want to migrate from
intel_ddi.ctointel_pll.c, but I'll leave this to another patch.Also, feel free to propose better ways to split
intel_display.c.
FWIW, I think "Authors" lines in headers are silly, now that we're using git. I'd be happy to see mine dropped.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 8 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
Hi
We always talk about how
intel_display.cis a giant file and how we would like to reduce it, so this is my attempt. Currently the file has 12090 lines, and after my patch series it has 8850 lines.
Quoted 7 lines
I don't know if right now is the appropriate time to merge patches like this. I don't remember seeing too many patches on the list touching cursor/fdi/eld/pll functions, but I know there is never an appropriate time for huge changes.
Also, this change will obviously make the lives of people who backport our patches more complicated. So if we don't want this series at all, feel free to NACK it.
I am only responding because it seems nobody else really said much. I never touch this code, and I shouldn't be the authority. I really quickly glanced at the patches.
1. +LOC: It sucks that you ended up adding 220 lines. I assume half of it is the copyright header, but still, considering there are no actual refactors, cleanups, or functional changes - adding lines makes me unhappy.
2. necessary? I personally haven't heard from anyone that we need to shrink intel_display.c (again, I am the furthest from being an expert). I doubt anyone isn't using some form of tags, or grep to navigate anyway. My problem has never been the file size itself, but just the structure of the display code interacting with the core KMS was hard to follow.
3. conflicts: Like you said, it's likely nobody touches this code, but we should keep in mind we do have several people working on older branches, and this kind of thing makes any sort of backport hard.
On the other hand:
1. If more than one person finds the results more readable/consumable, I think it's worth it, and probably mostly justifies doing it. You've also shrunk the file by quite a bit, so it's somewhat useful churn.
2. intel_pll.c sounds like a good idea
Quoted 42 lines
I also didn't really know what kind of changes I needed to do to the file headers, so I just copied the header from
intel_display.c, kept Eric's name and added a "2014" to Intel's copyright. I am not a lawyer and this may be not the best thing to do, so please tell me the correct approach here :)There are also some things that we might want to migrate from
intel_ddi.ctointel_pll.c, but I'll leave this to another patch.Also, feel free to propose better ways to split
intel_display.c.Thanks,
PauloPaulo Zanoni (4):
drm/i915: extractintel_eld.cfromintel_display.cdrm/i915: extractintel_cursor.cfromintel_display.cdrm/i915: extractintel_fdi.cfromintel_display.cdrm/i915: extractintel_pll.cfromintel_display.cdrivers/gpu/drm/i915/Makefile | 4 + drivers/gpu/drm/i915/intel_cursor.c | 357 ++++ drivers/gpu/drm/i915/intel_ddi.c | 142 +- drivers/gpu/drm/i915/intel_display.c | 3622 ++-------------------------------- drivers/gpu/drm/i915/intel_drv.h | 143 +- drivers/gpu/drm/i915/intel_eld.c | 355 ++++ drivers/gpu/drm/i915/intel_fdi.c | 959 +++++++++ drivers/gpu/drm/i915/intel_panel.c | 36 + drivers/gpu/drm/i915/intel_pll.c | 1779 +++++++++++++++++ 9 files changed, 3808 insertions(+), 3589 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_cursor.c create mode 100644 drivers/gpu/drm/i915/intel_eld.c create mode 100644 drivers/gpu/drm/i915/intel_fdi.c create mode 100644 drivers/gpu/drm/i915/intel_pll.cSignature · 6 lines
1.9.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Jani Nikula
maintainerQuoted 35 lines · Ben Widawsky
Quoted 8 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
Hi
We always talk about how
intel_display.cis a giant file and how we would like to reduce it, so this is my attempt. Currently the file has 12090 lines, and after my patch series it has 8850 lines.Quoted 7 lines
I don't know if right now is the appropriate time to merge patches like this. I don't remember seeing too many patches on the list touching cursor/fdi/eld/pll functions, but I know there is never an appropriate time for huge changes.
Also, this change will obviously make the lives of people who backport our patches more complicated. So if we don't want this series at all, feel free to NACK it.
I am only responding because it seems nobody else really said much. I never touch this code, and I shouldn't be the authority. I really quickly glanced at the patches.
1. +LOC: It sucks that you ended up adding 220 lines. I assume half of it is the copyright header, but still, considering there are no actual refactors, cleanups, or functional changes - adding lines makes me unhappy.
2. necessary? I personally haven't heard from anyone that we need to shrink
intel_display.c(again, I am the furthest from being an expert). I doubt anyone isn't using some form of tags, or grep to navigate anyway. My problem has never been the file size itself, but just the structure of the display code interacting with the core KMS was hard to follow.3. conflicts: Like you said, it's likely nobody touches this code, but we should keep in mind we do have several people working on older branches, and this kind of thing makes any sort of backport hard.
Quoted 6 lines
On the other hand:
1. If more than one person finds the results more readable/consumable, I think it's worth it, and probably mostly justifies doing it. You've also shrunk the file by quite a bit, so it's somewhat useful churn.2.
intel_pll.csounds like a good idea
I'm in favour of reducing the size of intel_display.c. I did not look at the patches though, because I've sent a few patches to this effect in the past (limits/pll and quirks at least), but they were stalled because they were in the collision course with the Grand Plans Daniel has. So Daniel, I expect you to chime in on this one too. ;)
To reduce the conflict/backport pains, might be good to do this spread out over a few releases instead of everything at once. *shrug*.
BR,
Jani.
Quoted 51 lines
Quoted 44 lines
I also didn't really know what kind of changes I needed to do to the file headers, so I just copied the header from
intel_display.c, kept Eric's name and added a "2014" to Intel's copyright. I am not a lawyer and this may be not the best thing to do, so please tell me the correct approach here :)There are also some things that we might want to migrate from
intel_ddi.ctointel_pll.c, but I'll leave this to another patch.Also, feel free to propose better ways to split
intel_display.c.Thanks,
PauloPaulo Zanoni (4):
drm/i915: extractintel_eld.cfromintel_display.cdrm/i915: extractintel_cursor.cfromintel_display.cdrm/i915: extractintel_fdi.cfromintel_display.cdrm/i915: extractintel_pll.cfromintel_display.cdrivers/gpu/drm/i915/Makefile | 4 + drivers/gpu/drm/i915/intel_cursor.c | 357 ++++ drivers/gpu/drm/i915/intel_ddi.c | 142 +- drivers/gpu/drm/i915/intel_display.c | 3622 ++-------------------------------- drivers/gpu/drm/i915/intel_drv.h | 143 +- drivers/gpu/drm/i915/intel_eld.c | 355 ++++ drivers/gpu/drm/i915/intel_fdi.c | 959 +++++++++ drivers/gpu/drm/i915/intel_panel.c | 36 + drivers/gpu/drm/i915/intel_pll.c | 1779 +++++++++++++++++ 9 files changed, 3808 insertions(+), 3589 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_cursor.c create mode 100644 drivers/gpu/drm/i915/intel_eld.c create mode 100644 drivers/gpu/drm/i915/intel_fdi.c create mode 100644 drivers/gpu/drm/i915/intel_pll.cSignature · 6 lines
1.9.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 5 lines
Ben Widawsky, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Quoted 41 lines · Jani Nikula
Quoted 40 lines · Ben Widawsky
Quoted 8 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
Hi
We always talk about how
intel_display.cis a giant file and how we would like to reduce it, so this is my attempt. Currently the file has 12090 lines, and after my patch series it has 8850 lines.Quoted 7 lines
I don't know if right now is the appropriate time to merge patches like this. I don't remember seeing too many patches on the list touching cursor/fdi/eld/pll functions, but I know there is never an appropriate time for huge changes.
Also, this change will obviously make the lives of people who backport our patches more complicated. So if we don't want this series at all, feel free to NACK it.
I am only responding because it seems nobody else really said much. I never touch this code, and I shouldn't be the authority. I really quickly glanced at the patches.
1. +LOC: It sucks that you ended up adding 220 lines. I assume half of it is the copyright header, but still, considering there are no actual refactors, cleanups, or functional changes - adding lines makes me unhappy.
2. necessary? I personally haven't heard from anyone that we need to shrink
intel_display.c(again, I am the furthest from being an expert). I doubt anyone isn't using some form of tags, or grep to navigate anyway. My problem has never been the file size itself, but just the structure of the display code interacting with the core KMS was hard to follow.3. conflicts: Like you said, it's likely nobody touches this code, but we should keep in mind we do have several people working on older branches, and this kind of thing makes any sort of backport hard.
On the other hand:
1. If more than one person finds the results more readable/consumable, I think it's worth it, and probably mostly justifies doing it. You've also shrunk the file by quite a bit, so it's somewhat useful churn.
Quoted 7 lines
Quoted 1 line
2.
intel_pll.csounds like a good ideaI'm in favour of reducing the size of
intel_display.c. I did not look at the patches though, because I've sent a few patches to this effect in the past (limits/pll and quirks at least), but they were stalled because they were in the collision course with the Grand Plans Daniel has. So Daniel, I expect you to chime in on this one too. ;)
Chiming in now ;-)
I've seen a few "extract stuff" patches float by and occasionally also merged some, but thus far I' haven't been terribly convinced. I don't mind the conflicts these patches cause, but if we want to reorg the driver the goal shouldn't be to just make files smaller (cscope can cope) but actually improve the organization of all this.
Often these patches just grab a bag of functions with related names, throw them all into a new file and then add forward and header declaration until the damn thing compiles again. What we want instead are real code modules where interactions within one file are high and the number of exported functions fairly low.
Two examples:
- Extracting the pageflip helpers and related code would mean that we also should extract a new pageflip_init functions, so that all the platform functions don't need to be exported. We've done similar things when creating intel_unocore.c.
- I've just stumbled around in the haswell code and noticed that pretty much all the lpt and hsw fdi code could be moved into intel_crt.c with a new hsw specific crt encoder. In the pre_enable and post_disable hooks we could then do the ddi setup, fdi link training. And all the ltp handling code could mostly be moved away too. With this we could also remove a lot (if not all) of the has_pch_encoder checks and I think also many type == INTEL_OUTPUT_ANALOG checks in the haswell code.
I haven't actually checked whether it'll all nicely work out, but my gut feeling says it'll be fewer forward declarations than just shoveling all the fdi related functions (including the lpt stuff) into a new intel_fdi.c.
So from my pov to make extractions into new files really useful we need to put a bit of time into first polishing the interfaces a bit and maybe reorganizing the code structure to have real modules. In my experience trying to write abi docs for those interfaces helps a lot.
Quoted 2 lines
To reduce the conflict/backport pains, might be good to do this spread out over a few releases instead of everything at once. *shrug*.
tbh it'll always hurt, and due to our rolling -next model there's never really a time where it's convenient. I'm willing to merge such reorg patches pretty much always.
Taking all the above into account I propose the following approach:
1. Each patch series only does one extraction.
2. The series also does any necessary interface polish where the extraction requires tons of header declarations.
3. To make it really worth it the series also needs to add kerneldoc for all exported functions in the new file and a small DOC: section with an (potentially very short) overview section. All that should then be pulled into the drm DocBook template somewhere suitable in the i915 book.
Comments, thoughs?
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 78 lines · Daniel Vetter
Quoted 41 lines · Jani Nikula
Quoted 40 lines · Ben Widawsky
Quoted 8 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
Hi
We always talk about how
intel_display.cis a giant file and how we would like to reduce it, so this is my attempt. Currently the file has 12090 lines, and after my patch series it has 8850 lines.Quoted 7 lines
I don't know if right now is the appropriate time to merge patches like this. I don't remember seeing too many patches on the list touching cursor/fdi/eld/pll functions, but I know there is never an appropriate time for huge changes.
Also, this change will obviously make the lives of people who backport our patches more complicated. So if we don't want this series at all, feel free to NACK it.
I am only responding because it seems nobody else really said much. I never touch this code, and I shouldn't be the authority. I really quickly glanced at the patches.
1. +LOC: It sucks that you ended up adding 220 lines. I assume half of it is the copyright header, but still, considering there are no actual refactors, cleanups, or functional changes - adding lines makes me unhappy.
2. necessary? I personally haven't heard from anyone that we need to shrink
intel_display.c(again, I am the furthest from being an expert). I doubt anyone isn't using some form of tags, or grep to navigate anyway. My problem has never been the file size itself, but just the structure of the display code interacting with the core KMS was hard to follow.3. conflicts: Like you said, it's likely nobody touches this code, but we should keep in mind we do have several people working on older branches, and this kind of thing makes any sort of backport hard.
On the other hand:
1. If more than one person finds the results more readable/consumable, I think it's worth it, and probably mostly justifies doing it. You've also shrunk the file by quite a bit, so it's somewhat useful churn.Quoted 7 lines
Quoted 1 line
2.
intel_pll.csounds like a good ideaI'm in favour of reducing the size of
intel_display.c. I did not look at the patches though, because I've sent a few patches to this effect in the past (limits/pll and quirks at least), but they were stalled because they were in the collision course with the Grand Plans Daniel has. So Daniel, I expect you to chime in on this one too. ;)Chiming in now ;-)
I've seen a few "extract stuff" patches float by and occasionally also merged some, but thus far I' haven't been terribly convinced. I don't mind the conflicts these patches cause, but if we want to reorg the driver the goal shouldn't be to just make files smaller (cscope can cope) but actually improve the organization of all this.
Often these patches just grab a bag of functions with related names, throw them all into a new file and then add forward and header declaration until the damn thing compiles again. What we want instead are real code modules where interactions within one file are high and the number of exported functions fairly low.
Two examples:
- Extracting the pageflip helpers and related code would mean that we also should extract a newpageflip_initfunctions, so that all the platform functions don't need to be exported. We've done similar things when creatingintel_unocore.c.- I've just stumbled around in the haswell code and noticed that pretty much all the lpt and hsw fdi code could be moved into
intel_crt.cwith a new hsw specific crt encoder. In thepre_enableandpost_disablehooks we could then do the ddi setup, fdi link training. And all the ltp handling code could mostly be moved away too. With this we could also remove a lot (if not all) of thehas_pch_encoderchecks and I think also many type ==INTEL_OUTPUT_ANALOGchecks in the haswell code.
Quoted 4 lines
I haven't actually checked whether it'll all nicely work out, but my gut feeling says it'll be fewer forward declarations than just shoveling all the fdi related functions (including the lpt stuff) into a new
intel_fdi.c.
I'm not sure I'd like the code for one pch platform to have a totally different structure than the other platforms. I guess I can't really say w/o seeing the result. And this is hsw after all where the code likes be different just because, which usually makes it the last platform I think about. And my last hsw related patches got stuck in limbo anyway, so I now prefer to keep my distance.
Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 84 lines · Ville Syrjälä
Quoted 78 lines · Daniel Vetter
Quoted 41 lines · Jani Nikula
Quoted 40 lines · Ben Widawsky
Quoted 8 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
Hi
We always talk about how
intel_display.cis a giant file and how we would like to reduce it, so this is my attempt. Currently the file has 12090 lines, and after my patch series it has 8850 lines.Quoted 7 lines
I don't know if right now is the appropriate time to merge patches like this. I don't remember seeing too many patches on the list touching cursor/fdi/eld/pll functions, but I know there is never an appropriate time for huge changes.
Also, this change will obviously make the lives of people who backport our patches more complicated. So if we don't want this series at all, feel free to NACK it.
I am only responding because it seems nobody else really said much. I never touch this code, and I shouldn't be the authority. I really quickly glanced at the patches.
1. +LOC: It sucks that you ended up adding 220 lines. I assume half of it is the copyright header, but still, considering there are no actual refactors, cleanups, or functional changes - adding lines makes me unhappy.
2. necessary? I personally haven't heard from anyone that we need to shrink
intel_display.c(again, I am the furthest from being an expert). I doubt anyone isn't using some form of tags, or grep to navigate anyway. My problem has never been the file size itself, but just the structure of the display code interacting with the core KMS was hard to follow.3. conflicts: Like you said, it's likely nobody touches this code, but we should keep in mind we do have several people working on older branches, and this kind of thing makes any sort of backport hard.
On the other hand:
1. If more than one person finds the results more readable/consumable, I think it's worth it, and probably mostly justifies doing it. You've also shrunk the file by quite a bit, so it's somewhat useful churn.Quoted 7 lines
Quoted 1 line
2.
intel_pll.csounds like a good ideaI'm in favour of reducing the size of
intel_display.c. I did not look at the patches though, because I've sent a few patches to this effect in the past (limits/pll and quirks at least), but they were stalled because they were in the collision course with the Grand Plans Daniel has. So Daniel, I expect you to chime in on this one too. ;)Chiming in now ;-)
I've seen a few "extract stuff" patches float by and occasionally also merged some, but thus far I' haven't been terribly convinced. I don't mind the conflicts these patches cause, but if we want to reorg the driver the goal shouldn't be to just make files smaller (cscope can cope) but actually improve the organization of all this.
Often these patches just grab a bag of functions with related names, throw them all into a new file and then add forward and header declaration until the damn thing compiles again. What we want instead are real code modules where interactions within one file are high and the number of exported functions fairly low.
Two examples:
- Extracting the pageflip helpers and related code would mean that we also should extract a newpageflip_initfunctions, so that all the platform functions don't need to be exported. We've done similar things when creatingintel_unocore.c.- I've just stumbled around in the haswell code and noticed that pretty much all the lpt and hsw fdi code could be moved into
intel_crt.cwith a new hsw specific crt encoder. In thepre_enableandpost_disablehooks we could then do the ddi setup, fdi link training. And all the ltp handling code could mostly be moved away too. With this we could also remove a lot (if not all) of thehas_pch_encoderchecks and I think also many type ==INTEL_OUTPUT_ANALOGchecks in the haswell code.Quoted 4 lines
I haven't actually checked whether it'll all nicely work out, but my gut feeling says it'll be fewer forward declarations than just shoveling all the fdi related functions (including the lpt stuff) into a new
intel_fdi.c.
Quoted 6 lines
I'm not sure I'd like the code for one pch platform to have a totally different structure than the other platforms. I guess I can't really say w/o seeing the result. And this is hsw after all where the code likes be different just because, which usually makes it the last platform I think about. And my last hsw related patches got stuck in limbo anyway, so I now prefer to keep my distance.
I've implemented it just now since it avoids piling more hacks on top to handle the unshared SPLL. Imo looks fairly ok-ish:
http://cgit.freedesktop.org/~danvet/drm/log/?h=no-more-enc-mode_set
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch