/* * apple-gmux is needed on dual GPU MacBook Pro * to probe the panel if we're the inactive GPU.
*/ if (vga_switcheroo_client_probe_defer(pdev)) returntrue;
/* If the LCD panel has a privacy-screen, wait for it */
privacy_screen = drm_privacy_screen_get(&pdev->dev, NULL); if (IS_ERR(privacy_screen) && PTR_ERR(privacy_screen) == -EPROBE_DEFER) returntrue;
drm_privacy_screen_put(privacy_screen);
returnfalse;
}
void intel_display_driver_init_hw(struct intel_display *display)
{ if (!HAS_DISPLAY(display)) return;
void intel_display_driver_early_probe(struct intel_display *display)
{ /* This must be called before any calls to HAS_PCH_* */
intel_pch_detect(display);
/* part #1: call before irq install */ int intel_display_driver_probe_noirq(struct intel_display *display)
{ struct drm_i915_private *i915 = to_i915(display->drm); int ret;
if (i915_inject_probe_failure(i915)) return -ENODEV;
if (HAS_DISPLAY(display)) {
ret = drm_vblank_init(display->drm,
INTEL_NUM_PIPES(display)); if (ret) return ret;
}
intel_bios_init(display);
ret = intel_vga_register(display); if (ret) goto cleanup_bios;
intel_psr_dc5_dc6_wa_init(display);
/* FIXME: completely on the wrong abstraction layer */
ret = intel_power_domains_init(display); if (ret < 0) goto cleanup_vga;
intel_pmdemand_init_early(display);
intel_power_domains_init_hw(display, false);
if (!HAS_DISPLAY(display)) return 0;
display->hotplug.dp_wq = alloc_ordered_workqueue("intel-dp", 0); if (!display->hotplug.dp_wq) {
ret = -ENOMEM; goto cleanup_vga_client_pw_domain_dmc;
}
display->wq.modeset = alloc_ordered_workqueue("i915_modeset", 0); if (!display->wq.modeset) {
ret = -ENOMEM; goto cleanup_wq_dp;
}
display->wq.flip = alloc_workqueue("i915_flip", WQ_HIGHPRI |
WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE); if (!display->wq.flip) {
ret = -ENOMEM; goto cleanup_wq_modeset;
}
display->wq.cleanup = alloc_workqueue("i915_cleanup", WQ_HIGHPRI, 0); if (!display->wq.cleanup) {
ret = -ENOMEM; goto cleanup_wq_flip;
}
display->wq.unordered = alloc_workqueue("display_unordered", 0, 0); if (!display->wq.unordered) {
ret = -ENOMEM; goto cleanup_wq_cleanup;
}
intel_dmc_init(display);
intel_mode_config_init(display);
ret = intel_cdclk_init(display); if (ret) goto cleanup_wq_unordered;
ret = intel_color_init(display); if (ret) goto cleanup_wq_unordered;
ret = intel_dbuf_init(display); if (ret) goto cleanup_wq_unordered;
ret = intel_bw_init(display); if (ret) goto cleanup_wq_unordered;
ret = intel_pmdemand_init(display); if (ret) goto cleanup_wq_unordered;
/** * intel_display_driver_enable_user_access - Enable display HW access for all threads * @display: display device instance * * Enable the display HW access for all threads. Examples for such accesses * are modeset commits and connector probing. * * This function should be called during driver loading and system resume once * all the HW initialization steps are done.
*/ void intel_display_driver_enable_user_access(struct intel_display *display)
{
set_display_access(display, true, NULL);
intel_hpd_enable_detection_work(display);
}
/** * intel_display_driver_disable_user_access - Disable display HW access for user threads * @display: display device instance * * Disable the display HW access for user threads. Examples for such accesses * are modeset commits and connector probing. For the current thread the * access is still enabled, which should only perform HW init/deinit * programming (as the initial modeset during driver loading or the disabling * modeset during driver unloading and system suspend/shutdown). This function * should be followed by calling either intel_display_driver_enable_user_access() * after completing the HW init programming or * intel_display_driver_suspend_access() after completing the HW deinit * programming. * * This function should be called during driver loading/unloading and system * suspend/shutdown before starting the HW init/deinit programming.
*/ void intel_display_driver_disable_user_access(struct intel_display *display)
{
intel_hpd_disable_detection_work(display);
set_display_access(display, false, current);
}
/** * intel_display_driver_suspend_access - Suspend display HW access for all threads * @display: display device instance * * Disable the display HW access for all threads. Examples for such accesses * are modeset commits and connector probing. This call should be either * followed by calling intel_display_driver_resume_access(), or the driver * should be unloaded/shutdown. * * This function should be called during driver unloading and system * suspend/shutdown after completing the HW deinit programming.
*/ void intel_display_driver_suspend_access(struct intel_display *display)
{
set_display_access(display, false, NULL);
}
/** * intel_display_driver_resume_access - Resume display HW access for the resume thread * @display: display device instance * * Enable the display HW access for the current resume thread, keeping the * access disabled for all other (user) threads. Examples for such accesses * are modeset commits and connector probing. The resume thread should only * perform HW init programming (as the restoring modeset). This function * should be followed by calling intel_display_driver_enable_user_access(), * after completing the HW init programming steps. * * This function should be called during system resume before starting the HW * init steps.
*/ void intel_display_driver_resume_access(struct intel_display *display)
{
set_display_access(display, false, current);
}
/** * intel_display_driver_check_access - Check if the current thread has disaplay HW access * @display: display device instance * * Check whether the current thread has display HW access, print a debug * message if it doesn't. Such accesses are modeset commits and connector * probing. If the function returns %false any HW access should be prevented. * * Returns %true if the current thread has display HW access, %false * otherwise.
*/ bool intel_display_driver_check_access(struct intel_display *display)
{ char current_task[TASK_COMM_LEN + 16]; char allowed_task[TASK_COMM_LEN + 16] = "none";
if (display->access.any_task_allowed ||
display->access.allowed_task == current) returntrue;
if (display->access.allowed_task)
snprintf(allowed_task, sizeof(allowed_task), "%s[%d]",
display->access.allowed_task->comm,
task_pid_vnr(display->access.allowed_task));
drm_dbg_kms(display->drm, "Reject display access from task %s (allowed to %s)\n",
current_task, allowed_task);
returnfalse;
}
/* part #2: call after irq install, but before gem init */ int intel_display_driver_probe_nogem(struct intel_display *display)
{ enum pipe pipe; int ret;
/* * Make sure hardware watermarks really match the state we read out. * Note that we need to do this after reconstructing the BIOS fb's * since the watermark calculation done here will use pstate->fb.
*/ if (!HAS_GMCH(display))
ilk_wm_sanitize(display);
/* part #3: call after gem init */ int intel_display_driver_probe(struct intel_display *display)
{ int ret;
if (!HAS_DISPLAY(display)) return 0;
/* * This will bind stuff into ggtt, so it needs to be done after * the BIOS fb takeover and whatever else magic ggtt reservations * happen during gem/ggtt init.
*/
intel_hdcp_component_init(display);
intel_flipq_init(display);
/* * Force all active planes to recompute their states. So that on * mode_setcrtc after probe, all the intel_plane_state variables * are already calculated and there is no assert_plane warnings * during bootup.
*/
ret = intel_initial_commit(display); if (ret)
drm_dbg_kms(display->drm, "Initial modeset failed, %d\n", ret);
intel_overlay_setup(display);
/* Only enable hotplug handling once the fbdev is fully set up. */
intel_hpd_init(display);
/* Must be done after probing outputs */
intel_opregion_register(display);
intel_acpi_video_register(display);
intel_audio_init(display);
intel_display_driver_enable_user_access(display);
intel_audio_register(display);
intel_display_debugfs_register(display);
/* * We need to coordinate the hotplugs with the asynchronous * fbdev configuration, for which we use the * fbdev->async_cookie.
*/
drm_kms_helper_poll_init(display->drm);
intel_hpd_poll_disable(display);
/* * MST topology needs to be suspended so we don't have any calls to * fbdev after it's finalized. MST will be destroyed later as part of * drm_mode_config_cleanup()
*/
intel_dp_mst_suspend(display);
}
/* part #2: call after irq uninstall */ void intel_display_driver_remove_noirq(struct intel_display *display)
{ if (!HAS_DISPLAY(display)) return;
intel_display_driver_suspend_access(display);
/* * Due to the hpd irq storm handling the hotplug work can re-arm the * poll handlers. Hence disable polling after hpd handling is shut down.
*/
intel_hpd_poll_fini(display);
intel_unregister_dsm_handler();
/* flush any delayed tasks or pending work */
flush_workqueue(display->wq.unordered);
/* part #3: call after gem init */ void intel_display_driver_remove_nogem(struct intel_display *display)
{
intel_dmc_fini(display);
intel_power_domains_driver_remove(display);
intel_vga_unregister(display);
intel_bios_driver_remove(display);
}
void intel_display_driver_unregister(struct intel_display *display)
{ if (!HAS_DISPLAY(display)) return;
intel_unregister_dsm_handler();
drm_client_dev_unregister(display->drm);
/* * After flushing the fbdev (incl. a late async config which * will have delayed queuing of a hotplug event), then flush * the hotplug events.
*/
drm_kms_helper_poll_fini(display->drm);
/* * turn all crtc's off, but do not adjust state * This has to be paired with a call to intel_modeset_setup_hw_state.
*/ int intel_display_driver_suspend(struct intel_display *display)
{ struct drm_atomic_state *state; int ret;
if (!HAS_DISPLAY(display)) return 0;
state = drm_atomic_helper_suspend(display->drm);
ret = PTR_ERR_OR_ZERO(state); if (ret)
drm_err(display->drm, "Suspending crtc's failed with %i\n",
ret); else
display->restore.modeset_state = state;
/* ensure all DPT VMAs have been unpinned for intel_dpt_suspend() */
flush_workqueue(display->wq.cleanup);
intel_dp_mst_suspend(display);
return ret;
}
int
__intel_display_driver_resume(struct intel_display *display, struct drm_atomic_state *state, struct drm_modeset_acquire_ctx *ctx)
{ struct drm_crtc_state *crtc_state; struct drm_crtc *crtc; int ret, i;
intel_modeset_setup_hw_state(display, ctx);
if (!state) return 0;
/* * We've duplicated the state, pointers to the old state are invalid. * * Don't attempt to use the old state until we commit the duplicated state.
*/
for_each_new_crtc_in_state(state, crtc, crtc_state, i) { /* * Force recalculation even if we restore * current state. With fast modeset this may not result * in a modeset when the state is compatible.
*/
crtc_state->mode_changed = true;
}
/* ignore any reset values/BIOS leftovers in the WM registers */ if (!HAS_GMCH(display))
to_intel_atomic_state(state)->skip_intermediate_wm = true;
ret = drm_atomic_helper_commit_duplicated_state(state, ctx);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.