Re: [PATCH 01/39] drm/i915: add display sub-struct to drm_i915_private

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 16 Aug 2022, Lucas De Marchi <lucas.demarchi@xxxxxxxxx> wrote:
> On Thu, Aug 11, 2022 at 06:07:12PM +0300, Jani Nikula wrote:
>>In another long-overdue cleanup, add a display sub-struct to
>>drm_i915_private, and start moving display related members there. Start
>>with display funcs that need a rename anyway to not collide with the new
>>display member.
>>
>>Add a new header under display/ for defining struct intel_display.
>>
>>Rename struct drm_i915_display_funcs to intel_display_funcs while at it.
>>
>>Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
>>---
>> drivers/gpu/drm/i915/display/intel_display.c  | 28 +++++++-------
>> .../gpu/drm/i915/display/intel_display_core.h | 38 +++++++++++++++++++
>> .../drm/i915/display/intel_modeset_setup.c    |  2 +-
>> .../drm/i915/display/intel_plane_initial.c    |  2 +-
>> drivers/gpu/drm/i915/i915_drv.h               | 21 ++--------
>> 5 files changed, 57 insertions(+), 34 deletions(-)
>> create mode 100644 drivers/gpu/drm/i915/display/intel_display_core.h
>>
>>diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>>index f143adefdf38..24ab1501beea 100644
>>--- a/drivers/gpu/drm/i915/display/intel_display.c
>>+++ b/drivers/gpu/drm/i915/display/intel_display.c
>>@@ -4144,7 +4144,7 @@ bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)
>> 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>> 	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
>>
>>-	if (!i915->display->get_pipe_config(crtc, crtc_state))
>>+	if (!i915->display.funcs.crtc->get_pipe_config(crtc, crtc_state))
>> 		return false;
>>
>> 	crtc_state->hw.active = true;
>>@@ -7119,7 +7119,7 @@ static void intel_enable_crtc(struct intel_atomic_state *state,
>>
>> 	intel_crtc_update_active_timings(new_crtc_state);
>>
>>-	dev_priv->display->crtc_enable(state, crtc);
>>+	dev_priv->display.funcs.crtc->crtc_enable(state, crtc);
>>
>> 	if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
>> 		return;
>>@@ -7198,7 +7198,7 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state,
>> 	 */
>> 	intel_crtc_disable_pipe_crc(crtc);
>>
>>-	dev_priv->display->crtc_disable(state, crtc);
>>+	dev_priv->display.funcs.crtc->crtc_disable(state, crtc);
>
> lgtm. Regarding names: it's a little weird to have "crtc doubled in the funcs.crtc->crtc_
> and it not being consistent accross all functions
>
>
>> 	crtc->active = false;
>> 	intel_fbc_disable(crtc);
>> 	intel_disable_shared_dpll(old_crtc_state);
>>@@ -7586,7 +7586,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
>> 	}
>>
>> 	/* Now enable the clocks, plane, pipe, and connectors that we set up. */
>>-	dev_priv->display->commit_modeset_enables(state);
>>+	dev_priv->display.funcs.crtc->commit_modeset_enables(state);
>>
>> 	intel_encoders_update_complete(state);
>>
>>@@ -8317,7 +8317,7 @@ static const struct drm_mode_config_funcs intel_mode_funcs = {
>> 	.atomic_state_free = intel_atomic_state_free,
>> };
>>
>>-static const struct drm_i915_display_funcs skl_display_funcs = {
>>+static const struct intel_display_funcs skl_display_funcs = {
>> 	.get_pipe_config = hsw_get_pipe_config,
>> 	.crtc_enable = hsw_crtc_enable,
>> 	.crtc_disable = hsw_crtc_disable,
>>@@ -8325,7 +8325,7 @@ static const struct drm_i915_display_funcs skl_display_funcs = {
>> 	.get_initial_plane_config = skl_get_initial_plane_config,
>> };
>>
>>-static const struct drm_i915_display_funcs ddi_display_funcs = {
>>+static const struct intel_display_funcs ddi_display_funcs = {
>> 	.get_pipe_config = hsw_get_pipe_config,
>> 	.crtc_enable = hsw_crtc_enable,
>> 	.crtc_disable = hsw_crtc_disable,
>>@@ -8333,7 +8333,7 @@ static const struct drm_i915_display_funcs ddi_display_funcs = {
>> 	.get_initial_plane_config = i9xx_get_initial_plane_config,
>> };
>>
>>-static const struct drm_i915_display_funcs pch_split_display_funcs = {
>>+static const struct intel_display_funcs pch_split_display_funcs = {
>> 	.get_pipe_config = ilk_get_pipe_config,
>> 	.crtc_enable = ilk_crtc_enable,
>> 	.crtc_disable = ilk_crtc_disable,
>>@@ -8341,7 +8341,7 @@ static const struct drm_i915_display_funcs pch_split_display_funcs = {
>> 	.get_initial_plane_config = i9xx_get_initial_plane_config,
>> };
>>
>>-static const struct drm_i915_display_funcs vlv_display_funcs = {
>>+static const struct intel_display_funcs vlv_display_funcs = {
>> 	.get_pipe_config = i9xx_get_pipe_config,
>> 	.crtc_enable = valleyview_crtc_enable,
>> 	.crtc_disable = i9xx_crtc_disable,
>>@@ -8349,7 +8349,7 @@ static const struct drm_i915_display_funcs vlv_display_funcs = {
>> 	.get_initial_plane_config = i9xx_get_initial_plane_config,
>> };
>>
>>-static const struct drm_i915_display_funcs i9xx_display_funcs = {
>>+static const struct intel_display_funcs i9xx_display_funcs = {
>> 	.get_pipe_config = i9xx_get_pipe_config,
>> 	.crtc_enable = i9xx_crtc_enable,
>> 	.crtc_disable = i9xx_crtc_disable,
>>@@ -8372,16 +8372,16 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv)
>> 	intel_dpll_init_clock_hook(dev_priv);
>>
>> 	if (DISPLAY_VER(dev_priv) >= 9) {
>>-		dev_priv->display = &skl_display_funcs;
>>+		dev_priv->display.funcs.crtc = &skl_display_funcs;
>> 	} else if (HAS_DDI(dev_priv)) {
>>-		dev_priv->display = &ddi_display_funcs;
>>+		dev_priv->display.funcs.crtc = &ddi_display_funcs;
>> 	} else if (HAS_PCH_SPLIT(dev_priv)) {
>>-		dev_priv->display = &pch_split_display_funcs;
>>+		dev_priv->display.funcs.crtc = &pch_split_display_funcs;
>> 	} else if (IS_CHERRYVIEW(dev_priv) ||
>> 		   IS_VALLEYVIEW(dev_priv)) {
>>-		dev_priv->display = &vlv_display_funcs;
>>+		dev_priv->display.funcs.crtc = &vlv_display_funcs;
>> 	} else {
>>-		dev_priv->display = &i9xx_display_funcs;
>>+		dev_priv->display.funcs.crtc = &i9xx_display_funcs;
>> 	}
>>
>> 	intel_fdi_init_hook(dev_priv);
>>diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h
>>new file mode 100644
>>index 000000000000..aafe548875cc
>>--- /dev/null
>>+++ b/drivers/gpu/drm/i915/display/intel_display_core.h
>>@@ -0,0 +1,38 @@
>>+/* SPDX-License-Identifier: MIT */
>>+/*
>>+ * Copyright © 2022 Intel Corporation
>>+ */
>>+
>>+#ifndef __INTEL_DISPLAY_CORE_H__
>>+#define __INTEL_DISPLAY_CORE_H__
>>+
>>+#include <linux/types.h>
>>+
>>+struct intel_atomic_state;
>>+struct intel_crtc;
>>+struct intel_crtc_state;
>>+struct intel_initial_plane_config;
>>+
>>+struct intel_display_funcs {
>
> in the same line as comment above. Maybe we could give this struct a
> better name? Because it's already inside a intel_display.funcs.crtc
>
> display->funcs.crtc->get_pipe_config()
> display->funcs.crtc->get_initial_plane_nfig()
> display->funcs.crtc->enable()
> display->funcs.crtc->disable()
> display->funcs.crtc->commit_modeset_enables()
>
> and then call this `struct intel_crtc_funcs`.
>
> This can be done later as this commit itself is basically moving things
> with the same name inside a substruct.

I guess my question is, are the functions inside "crtc enough" to be
called intel_crtc_funcs? Though intel_display_funcs is really too
generic too.

Maybe I'll just go with crtc.

> Reviewed-by: Lucas De Marchi <lucas.demarchi@xxxxxxxxx>

Thanks!

-- 
Jani Nikula, Intel Open Source Graphics Center




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux