mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
drm/i915/reset: Reorganize display reset code
Stop returning the "is there a display?" status from intel_display_reset_prepare(). I plan to move the pending_fb_pin into the i915 code, so I need to make that determination already before intel_display_reset_prepare() is called. Add a new intel_display_reset_supported() function for that. v2: Also check display!=NULL for mock tests Cc: Jouni Högander <jouni.hogander@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260415210411.24750-4-ville.syrjala@linux.intel.com
This commit is contained in:
parent
cc07f2925b
commit
2c5b432097
|
|
@ -16,22 +16,24 @@
|
|||
#include "intel_hotplug.h"
|
||||
#include "intel_pps.h"
|
||||
|
||||
bool intel_display_reset_test(struct intel_display *display)
|
||||
bool intel_display_reset_supported(struct intel_display *display)
|
||||
{
|
||||
return display->params.force_reset_modeset_test;
|
||||
return display && HAS_DISPLAY(display);
|
||||
}
|
||||
|
||||
/* returns true if intel_display_reset_finish() needs to be called */
|
||||
bool intel_display_reset_prepare(struct intel_display *display,
|
||||
bool intel_display_reset_test(struct intel_display *display)
|
||||
{
|
||||
return display && HAS_DISPLAY(display) &&
|
||||
display->params.force_reset_modeset_test;
|
||||
}
|
||||
|
||||
void intel_display_reset_prepare(struct intel_display *display,
|
||||
modeset_stuck_fn modeset_stuck, void *context)
|
||||
{
|
||||
struct drm_modeset_acquire_ctx *ctx = &display->restore.reset_ctx;
|
||||
struct drm_atomic_state *state;
|
||||
int ret;
|
||||
|
||||
if (!HAS_DISPLAY(display))
|
||||
return false;
|
||||
|
||||
if (atomic_read(&display->restore.pending_fb_pin)) {
|
||||
drm_dbg_kms(display->drm,
|
||||
"Modeset potentially stuck, unbreaking through wedging\n");
|
||||
|
|
@ -60,7 +62,7 @@ bool intel_display_reset_prepare(struct intel_display *display,
|
|||
ret = PTR_ERR(state);
|
||||
drm_err(display->drm, "Duplicating state failed with %i\n",
|
||||
ret);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
ret = drm_atomic_helper_disable_all(display->drm, ctx);
|
||||
|
|
@ -68,13 +70,11 @@ bool intel_display_reset_prepare(struct intel_display *display,
|
|||
drm_err(display->drm, "Suspending crtc's failed with %i\n",
|
||||
ret);
|
||||
drm_atomic_state_put(state);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
display->restore.modeset_state = state;
|
||||
state->acquire_ctx = ctx;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void intel_display_reset_finish(struct intel_display *display, bool test_only)
|
||||
|
|
@ -83,9 +83,6 @@ void intel_display_reset_finish(struct intel_display *display, bool test_only)
|
|||
struct drm_atomic_state *state;
|
||||
int ret;
|
||||
|
||||
if (!HAS_DISPLAY(display))
|
||||
return;
|
||||
|
||||
state = fetch_and_zero(&display->restore.modeset_state);
|
||||
if (!state)
|
||||
goto unlock;
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@ struct intel_display;
|
|||
|
||||
typedef void modeset_stuck_fn(void *context);
|
||||
|
||||
bool intel_display_reset_supported(struct intel_display *display);
|
||||
bool intel_display_reset_test(struct intel_display *display);
|
||||
bool intel_display_reset_prepare(struct intel_display *display,
|
||||
void intel_display_reset_prepare(struct intel_display *display,
|
||||
modeset_stuck_fn modeset_stuck, void *context);
|
||||
void intel_display_reset_finish(struct intel_display *display, bool test_only);
|
||||
|
||||
|
|
|
|||
|
|
@ -1425,16 +1425,19 @@ static void intel_gt_reset_global(struct intel_gt *gt,
|
|||
bool need_display_reset;
|
||||
bool reset_display;
|
||||
|
||||
need_display_reset = intel_gt_gpu_reset_clobbers_display(gt) &&
|
||||
need_display_reset =
|
||||
intel_display_reset_supported(display) &&
|
||||
intel_gt_gpu_reset_clobbers_display(gt) &&
|
||||
intel_has_gpu_reset(gt);
|
||||
|
||||
reset_display = intel_display_reset_test(display) ||
|
||||
reset_display =
|
||||
intel_display_reset_test(display) ||
|
||||
need_display_reset;
|
||||
|
||||
if (reset_display)
|
||||
reset_display = intel_display_reset_prepare(display,
|
||||
display_reset_modeset_stuck,
|
||||
gt);
|
||||
intel_display_reset_prepare(display,
|
||||
display_reset_modeset_stuck,
|
||||
gt);
|
||||
|
||||
intel_gt_reset(gt, engine_mask, reason);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user