Commit 3b10f851 authored by Jani Nikula's avatar Jani Nikula

drm/i915: add display sub-struct to drm_i915_private

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.

v2:
- Fix multi-line comment style (Arun)
- Use display as the member name
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarArun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/d44cae096b664f7015f8c797d6dfd4964226d4f8.1661346845.git.jani.nikula@intel.com
parent 6215a7c8
...@@ -4145,7 +4145,7 @@ bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state) ...@@ -4145,7 +4145,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 intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *i915 = to_i915(crtc->base.dev); struct drm_i915_private *i915 = to_i915(crtc->base.dev);
if (!i915->display->get_pipe_config(crtc, crtc_state)) if (!i915->display.funcs.display->get_pipe_config(crtc, crtc_state))
return false; return false;
crtc_state->hw.active = true; crtc_state->hw.active = true;
...@@ -7120,7 +7120,7 @@ static void intel_enable_crtc(struct intel_atomic_state *state, ...@@ -7120,7 +7120,7 @@ static void intel_enable_crtc(struct intel_atomic_state *state,
intel_crtc_update_active_timings(new_crtc_state); intel_crtc_update_active_timings(new_crtc_state);
dev_priv->display->crtc_enable(state, crtc); dev_priv->display.funcs.display->crtc_enable(state, crtc);
if (intel_crtc_is_bigjoiner_slave(new_crtc_state)) if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
return; return;
...@@ -7199,7 +7199,7 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state, ...@@ -7199,7 +7199,7 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state,
*/ */
intel_crtc_disable_pipe_crc(crtc); intel_crtc_disable_pipe_crc(crtc);
dev_priv->display->crtc_disable(state, crtc); dev_priv->display.funcs.display->crtc_disable(state, crtc);
crtc->active = false; crtc->active = false;
intel_fbc_disable(crtc); intel_fbc_disable(crtc);
intel_disable_shared_dpll(old_crtc_state); intel_disable_shared_dpll(old_crtc_state);
...@@ -7587,7 +7587,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state) ...@@ -7587,7 +7587,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
} }
/* Now enable the clocks, plane, pipe, and connectors that we set up. */ /* Now enable the clocks, plane, pipe, and connectors that we set up. */
dev_priv->display->commit_modeset_enables(state); dev_priv->display.funcs.display->commit_modeset_enables(state);
intel_encoders_update_complete(state); intel_encoders_update_complete(state);
...@@ -8318,7 +8318,7 @@ static const struct drm_mode_config_funcs intel_mode_funcs = { ...@@ -8318,7 +8318,7 @@ static const struct drm_mode_config_funcs intel_mode_funcs = {
.atomic_state_free = intel_atomic_state_free, .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, .get_pipe_config = hsw_get_pipe_config,
.crtc_enable = hsw_crtc_enable, .crtc_enable = hsw_crtc_enable,
.crtc_disable = hsw_crtc_disable, .crtc_disable = hsw_crtc_disable,
...@@ -8326,7 +8326,7 @@ static const struct drm_i915_display_funcs skl_display_funcs = { ...@@ -8326,7 +8326,7 @@ static const struct drm_i915_display_funcs skl_display_funcs = {
.get_initial_plane_config = skl_get_initial_plane_config, .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, .get_pipe_config = hsw_get_pipe_config,
.crtc_enable = hsw_crtc_enable, .crtc_enable = hsw_crtc_enable,
.crtc_disable = hsw_crtc_disable, .crtc_disable = hsw_crtc_disable,
...@@ -8334,7 +8334,7 @@ static const struct drm_i915_display_funcs ddi_display_funcs = { ...@@ -8334,7 +8334,7 @@ static const struct drm_i915_display_funcs ddi_display_funcs = {
.get_initial_plane_config = i9xx_get_initial_plane_config, .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, .get_pipe_config = ilk_get_pipe_config,
.crtc_enable = ilk_crtc_enable, .crtc_enable = ilk_crtc_enable,
.crtc_disable = ilk_crtc_disable, .crtc_disable = ilk_crtc_disable,
...@@ -8342,7 +8342,7 @@ static const struct drm_i915_display_funcs pch_split_display_funcs = { ...@@ -8342,7 +8342,7 @@ static const struct drm_i915_display_funcs pch_split_display_funcs = {
.get_initial_plane_config = i9xx_get_initial_plane_config, .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, .get_pipe_config = i9xx_get_pipe_config,
.crtc_enable = valleyview_crtc_enable, .crtc_enable = valleyview_crtc_enable,
.crtc_disable = i9xx_crtc_disable, .crtc_disable = i9xx_crtc_disable,
...@@ -8350,7 +8350,7 @@ static const struct drm_i915_display_funcs vlv_display_funcs = { ...@@ -8350,7 +8350,7 @@ static const struct drm_i915_display_funcs vlv_display_funcs = {
.get_initial_plane_config = i9xx_get_initial_plane_config, .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, .get_pipe_config = i9xx_get_pipe_config,
.crtc_enable = i9xx_crtc_enable, .crtc_enable = i9xx_crtc_enable,
.crtc_disable = i9xx_crtc_disable, .crtc_disable = i9xx_crtc_disable,
...@@ -8373,16 +8373,16 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv) ...@@ -8373,16 +8373,16 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv)
intel_dpll_init_clock_hook(dev_priv); intel_dpll_init_clock_hook(dev_priv);
if (DISPLAY_VER(dev_priv) >= 9) { if (DISPLAY_VER(dev_priv) >= 9) {
dev_priv->display = &skl_display_funcs; dev_priv->display.funcs.display = &skl_display_funcs;
} else if (HAS_DDI(dev_priv)) { } else if (HAS_DDI(dev_priv)) {
dev_priv->display = &ddi_display_funcs; dev_priv->display.funcs.display = &ddi_display_funcs;
} else if (HAS_PCH_SPLIT(dev_priv)) { } else if (HAS_PCH_SPLIT(dev_priv)) {
dev_priv->display = &pch_split_display_funcs; dev_priv->display.funcs.display = &pch_split_display_funcs;
} else if (IS_CHERRYVIEW(dev_priv) || } else if (IS_CHERRYVIEW(dev_priv) ||
IS_VALLEYVIEW(dev_priv)) { IS_VALLEYVIEW(dev_priv)) {
dev_priv->display = &vlv_display_funcs; dev_priv->display.funcs.display = &vlv_display_funcs;
} else { } else {
dev_priv->display = &i9xx_display_funcs; dev_priv->display.funcs.display = &i9xx_display_funcs;
} }
intel_fdi_init_hook(dev_priv); intel_fdi_init_hook(dev_priv);
......
/* 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 {
/*
* Returns the active state of the crtc, and if the crtc is active,
* fills out the pipe-config with the hw state.
*/
bool (*get_pipe_config)(struct intel_crtc *,
struct intel_crtc_state *);
void (*get_initial_plane_config)(struct intel_crtc *,
struct intel_initial_plane_config *);
void (*crtc_enable)(struct intel_atomic_state *state,
struct intel_crtc *crtc);
void (*crtc_disable)(struct intel_atomic_state *state,
struct intel_crtc *crtc);
void (*commit_modeset_enables)(struct intel_atomic_state *state);
};
struct intel_display {
/* Display functions */
struct {
/* Top level crtc-ish functions */
const struct intel_display_funcs *display;
} funcs;
};
#endif /* __INTEL_DISPLAY_CORE_H__ */
...@@ -70,7 +70,7 @@ static void intel_crtc_disable_noatomic(struct intel_crtc *crtc, ...@@ -70,7 +70,7 @@ static void intel_crtc_disable_noatomic(struct intel_crtc *crtc,
drm_WARN_ON(&i915->drm, IS_ERR(temp_crtc_state) || ret); drm_WARN_ON(&i915->drm, IS_ERR(temp_crtc_state) || ret);
i915->display->crtc_disable(to_intel_atomic_state(state), crtc); i915->display.funcs.display->crtc_disable(to_intel_atomic_state(state), crtc);
drm_atomic_state_put(state); drm_atomic_state_put(state);
......
...@@ -311,7 +311,7 @@ void intel_crtc_initial_plane_config(struct intel_crtc *crtc) ...@@ -311,7 +311,7 @@ void intel_crtc_initial_plane_config(struct intel_crtc *crtc)
* can even allow for smooth boot transitions if the BIOS * can even allow for smooth boot transitions if the BIOS
* fb is large enough for the active pipe configuration. * fb is large enough for the active pipe configuration.
*/ */
dev_priv->display->get_initial_plane_config(crtc, &plane_config); dev_priv->display.funcs.display->get_initial_plane_config(crtc, &plane_config);
/* /*
* If the fb is shared between multiple heads, we'll * If the fb is shared between multiple heads, we'll
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "display/intel_cdclk.h" #include "display/intel_cdclk.h"
#include "display/intel_display.h" #include "display/intel_display.h"
#include "display/intel_display_core.h"
#include "display/intel_display_power.h" #include "display/intel_display_power.h"
#include "display/intel_dmc.h" #include "display/intel_dmc.h"
#include "display/intel_dpll_mgr.h" #include "display/intel_dpll_mgr.h"
...@@ -96,7 +97,6 @@ struct intel_fbdev; ...@@ -96,7 +97,6 @@ struct intel_fbdev;
struct intel_fdi_funcs; struct intel_fdi_funcs;
struct intel_gmbus; struct intel_gmbus;
struct intel_hotplug_funcs; struct intel_hotplug_funcs;
struct intel_initial_plane_config;
struct intel_limit; struct intel_limit;
struct intel_overlay; struct intel_overlay;
struct intel_overlay_error_state; struct intel_overlay_error_state;
...@@ -177,20 +177,6 @@ struct drm_i915_wm_disp_funcs { ...@@ -177,20 +177,6 @@ struct drm_i915_wm_disp_funcs {
int (*compute_global_watermarks)(struct intel_atomic_state *state); int (*compute_global_watermarks)(struct intel_atomic_state *state);
}; };
struct drm_i915_display_funcs {
/* Returns the active state of the crtc, and if the crtc is active,
* fills out the pipe-config with the hw state. */
bool (*get_pipe_config)(struct intel_crtc *,
struct intel_crtc_state *);
void (*get_initial_plane_config)(struct intel_crtc *,
struct intel_initial_plane_config *);
void (*crtc_enable)(struct intel_atomic_state *state,
struct intel_crtc *crtc);
void (*crtc_disable)(struct intel_atomic_state *state,
struct intel_crtc *crtc);
void (*commit_modeset_enables)(struct intel_atomic_state *state);
};
#define I915_COLOR_UNEVICTABLE (-1) /* a non-vma sharing the address space */ #define I915_COLOR_UNEVICTABLE (-1) /* a non-vma sharing the address space */
#define QUIRK_LVDS_SSC_DISABLE (1<<1) #define QUIRK_LVDS_SSC_DISABLE (1<<1)
...@@ -374,6 +360,8 @@ struct intel_audio_private { ...@@ -374,6 +360,8 @@ struct intel_audio_private {
struct drm_i915_private { struct drm_i915_private {
struct drm_device drm; struct drm_device drm;
struct intel_display display;
/* FIXME: Device release actions should all be moved to drmm_ */ /* FIXME: Device release actions should all be moved to drmm_ */
bool do_release; bool do_release;
...@@ -532,9 +520,6 @@ struct drm_i915_private { ...@@ -532,9 +520,6 @@ struct drm_i915_private {
/* display pll funcs */ /* display pll funcs */
const struct intel_dpll_funcs *dpll_funcs; const struct intel_dpll_funcs *dpll_funcs;
/* Display functions */
const struct drm_i915_display_funcs *display;
/* Display internal color functions */ /* Display internal color functions */
const struct intel_color_funcs *color_funcs; const struct intel_color_funcs *color_funcs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment