Commit 1b9e8095 authored by Jani Nikula's avatar Jani Nikula

drm/i915/display: convert intel_load_detect.c to struct intel_display

Going forward, struct intel_display shall replace struct
drm_i915_private as the main display device data pointer type. Convert
intel_load_detect.[ch] to struct intel_display.
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240813164123.2674462-3-jani.nikula@intel.comSigned-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 9aec90f9
...@@ -48,23 +48,22 @@ struct drm_atomic_state * ...@@ -48,23 +48,22 @@ struct drm_atomic_state *
intel_load_detect_get_pipe(struct drm_connector *connector, intel_load_detect_get_pipe(struct drm_connector *connector,
struct drm_modeset_acquire_ctx *ctx) struct drm_modeset_acquire_ctx *ctx)
{ {
struct intel_display *display = to_intel_display(connector->dev);
struct intel_encoder *encoder = struct intel_encoder *encoder =
intel_attached_encoder(to_intel_connector(connector)); intel_attached_encoder(to_intel_connector(connector));
struct intel_crtc *possible_crtc; struct intel_crtc *possible_crtc;
struct intel_crtc *crtc = NULL; struct intel_crtc *crtc = NULL;
struct drm_device *dev = encoder->base.dev; struct drm_mode_config *config = &display->drm->mode_config;
struct drm_i915_private *dev_priv = to_i915(dev);
struct drm_mode_config *config = &dev->mode_config;
struct drm_atomic_state *state = NULL, *restore_state = NULL; struct drm_atomic_state *state = NULL, *restore_state = NULL;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
struct intel_crtc_state *crtc_state; struct intel_crtc_state *crtc_state;
int ret; int ret;
drm_dbg_kms(&dev_priv->drm, "[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n", drm_dbg_kms(display->drm, "[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",
connector->base.id, connector->name, connector->base.id, connector->name,
encoder->base.base.id, encoder->base.name); encoder->base.base.id, encoder->base.name);
drm_WARN_ON(dev, !drm_modeset_is_locked(&config->connection_mutex)); drm_WARN_ON(display->drm, !drm_modeset_is_locked(&config->connection_mutex));
/* /*
* Algorithm gets a little messy: * Algorithm gets a little messy:
...@@ -89,7 +88,7 @@ intel_load_detect_get_pipe(struct drm_connector *connector, ...@@ -89,7 +88,7 @@ intel_load_detect_get_pipe(struct drm_connector *connector,
} }
/* Find an unused one (if possible) */ /* Find an unused one (if possible) */
for_each_intel_crtc(dev, possible_crtc) { for_each_intel_crtc(display->drm, possible_crtc) {
if (!(encoder->base.possible_crtcs & if (!(encoder->base.possible_crtcs &
drm_crtc_mask(&possible_crtc->base))) drm_crtc_mask(&possible_crtc->base)))
continue; continue;
...@@ -111,15 +110,15 @@ intel_load_detect_get_pipe(struct drm_connector *connector, ...@@ -111,15 +110,15 @@ intel_load_detect_get_pipe(struct drm_connector *connector,
* If we didn't find an unused CRTC, don't use any. * If we didn't find an unused CRTC, don't use any.
*/ */
if (!crtc) { if (!crtc) {
drm_dbg_kms(&dev_priv->drm, drm_dbg_kms(display->drm,
"no pipe available for load-detect\n"); "no pipe available for load-detect\n");
ret = -ENODEV; ret = -ENODEV;
goto fail; goto fail;
} }
found: found:
state = drm_atomic_state_alloc(dev); state = drm_atomic_state_alloc(display->drm);
restore_state = drm_atomic_state_alloc(dev); restore_state = drm_atomic_state_alloc(display->drm);
if (!state || !restore_state) { if (!state || !restore_state) {
ret = -ENOMEM; ret = -ENOMEM;
goto fail; goto fail;
...@@ -164,7 +163,7 @@ intel_load_detect_get_pipe(struct drm_connector *connector, ...@@ -164,7 +163,7 @@ intel_load_detect_get_pipe(struct drm_connector *connector,
if (!ret) if (!ret)
ret = drm_atomic_add_affected_planes(restore_state, &crtc->base); ret = drm_atomic_add_affected_planes(restore_state, &crtc->base);
if (ret) { if (ret) {
drm_dbg_kms(&dev_priv->drm, drm_dbg_kms(display->drm,
"Failed to create a copy of old state to restore: %i\n", "Failed to create a copy of old state to restore: %i\n",
ret); ret);
goto fail; goto fail;
...@@ -172,7 +171,7 @@ intel_load_detect_get_pipe(struct drm_connector *connector, ...@@ -172,7 +171,7 @@ intel_load_detect_get_pipe(struct drm_connector *connector,
ret = drm_atomic_commit(state); ret = drm_atomic_commit(state);
if (ret) { if (ret) {
drm_dbg_kms(&dev_priv->drm, drm_dbg_kms(display->drm,
"failed to set mode on load-detect pipe\n"); "failed to set mode on load-detect pipe\n");
goto fail; goto fail;
} }
...@@ -204,13 +203,13 @@ void intel_load_detect_release_pipe(struct drm_connector *connector, ...@@ -204,13 +203,13 @@ void intel_load_detect_release_pipe(struct drm_connector *connector,
struct drm_atomic_state *state, struct drm_atomic_state *state,
struct drm_modeset_acquire_ctx *ctx) struct drm_modeset_acquire_ctx *ctx)
{ {
struct intel_display *display = to_intel_display(connector->dev);
struct intel_encoder *intel_encoder = struct intel_encoder *intel_encoder =
intel_attached_encoder(to_intel_connector(connector)); intel_attached_encoder(to_intel_connector(connector));
struct drm_i915_private *i915 = to_i915(intel_encoder->base.dev);
struct drm_encoder *encoder = &intel_encoder->base; struct drm_encoder *encoder = &intel_encoder->base;
int ret; int ret;
drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n", drm_dbg_kms(display->drm, "[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",
connector->base.id, connector->name, connector->base.id, connector->name,
encoder->base.id, encoder->name); encoder->base.id, encoder->name);
...@@ -219,7 +218,7 @@ void intel_load_detect_release_pipe(struct drm_connector *connector, ...@@ -219,7 +218,7 @@ void intel_load_detect_release_pipe(struct drm_connector *connector,
ret = drm_atomic_helper_commit_duplicated_state(state, ctx); ret = drm_atomic_helper_commit_duplicated_state(state, ctx);
if (ret) if (ret)
drm_dbg_kms(&i915->drm, drm_dbg_kms(display->drm,
"Couldn't release load detect pipe: %i\n", ret); "Couldn't release load detect pipe: %i\n", ret);
drm_atomic_state_put(state); drm_atomic_state_put(state);
} }
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