1 // SPDX-License-Identifier: MIT 2 /* 3 * Copyright © 2022-2023 Intel Corporation 4 * 5 * High level display driver entry points. This is a layer between top level 6 * driver code and low level display functionality; no low level display code or 7 * details here. 8 */ 9 10 #include <linux/vga_switcheroo.h> 11 #include <acpi/video.h> 12 #include <drm/display/drm_dp_mst_helper.h> 13 #include <drm/drm_atomic_helper.h> 14 #include <drm/drm_mode_config.h> 15 #include <drm/drm_privacy_screen_consumer.h> 16 #include <drm/drm_probe_helper.h> 17 #include <drm/drm_vblank.h> 18 19 #include "i915_drv.h" 20 #include "i9xx_wm.h" 21 #include "intel_acpi.h" 22 #include "intel_atomic.h" 23 #include "intel_audio.h" 24 #include "intel_bios.h" 25 #include "intel_bw.h" 26 #include "intel_cdclk.h" 27 #include "intel_color.h" 28 #include "intel_crtc.h" 29 #include "intel_display_debugfs.h" 30 #include "intel_display_driver.h" 31 #include "intel_display_irq.h" 32 #include "intel_display_power.h" 33 #include "intel_display_types.h" 34 #include "intel_display_wa.h" 35 #include "intel_dkl_phy.h" 36 #include "intel_dmc.h" 37 #include "intel_dp.h" 38 #include "intel_dpll.h" 39 #include "intel_dpll_mgr.h" 40 #include "intel_fb.h" 41 #include "intel_fbc.h" 42 #include "intel_fbdev.h" 43 #include "intel_fdi.h" 44 #include "intel_gmbus.h" 45 #include "intel_hdcp.h" 46 #include "intel_hotplug.h" 47 #include "intel_hti.h" 48 #include "intel_modeset_lock.h" 49 #include "intel_modeset_setup.h" 50 #include "intel_opregion.h" 51 #include "intel_overlay.h" 52 #include "intel_plane_initial.h" 53 #include "intel_pmdemand.h" 54 #include "intel_pps.h" 55 #include "intel_quirks.h" 56 #include "intel_vga.h" 57 #include "intel_wm.h" 58 #include "skl_watermark.h" 59 60 bool intel_display_driver_probe_defer(struct pci_dev *pdev) 61 { 62 struct drm_privacy_screen *privacy_screen; 63 64 /* 65 * apple-gmux is needed on dual GPU MacBook Pro 66 * to probe the panel if we're the inactive GPU. 67 */ 68 if (vga_switcheroo_client_probe_defer(pdev)) 69 return true; 70 71 /* If the LCD panel has a privacy-screen, wait for it */ 72 privacy_screen = drm_privacy_screen_get(&pdev->dev, NULL); 73 if (IS_ERR(privacy_screen) && PTR_ERR(privacy_screen) == -EPROBE_DEFER) 74 return true; 75 76 drm_privacy_screen_put(privacy_screen); 77 78 return false; 79 } 80 81 void intel_display_driver_init_hw(struct drm_i915_private *i915) 82 { 83 struct intel_cdclk_state *cdclk_state; 84 85 if (!HAS_DISPLAY(i915)) 86 return; 87 88 cdclk_state = to_intel_cdclk_state(i915->display.cdclk.obj.state); 89 90 intel_update_cdclk(i915); 91 intel_cdclk_dump_config(i915, &i915->display.cdclk.hw, "Current CDCLK"); 92 cdclk_state->logical = cdclk_state->actual = i915->display.cdclk.hw; 93 94 intel_display_wa_apply(i915); 95 } 96 97 static const struct drm_mode_config_funcs intel_mode_funcs = { 98 .fb_create = intel_user_framebuffer_create, 99 .get_format_info = intel_fb_get_format_info, 100 .output_poll_changed = intel_fbdev_output_poll_changed, 101 .mode_valid = intel_mode_valid, 102 .atomic_check = intel_atomic_check, 103 .atomic_commit = intel_atomic_commit, 104 .atomic_state_alloc = intel_atomic_state_alloc, 105 .atomic_state_clear = intel_atomic_state_clear, 106 .atomic_state_free = intel_atomic_state_free, 107 }; 108 109 static const struct drm_mode_config_helper_funcs intel_mode_config_funcs = { 110 .atomic_commit_setup = drm_dp_mst_atomic_setup_commit, 111 }; 112 113 static void intel_mode_config_init(struct drm_i915_private *i915) 114 { 115 struct drm_mode_config *mode_config = &i915->drm.mode_config; 116 117 drm_mode_config_init(&i915->drm); 118 INIT_LIST_HEAD(&i915->display.global.obj_list); 119 120 mode_config->min_width = 0; 121 mode_config->min_height = 0; 122 123 mode_config->preferred_depth = 24; 124 mode_config->prefer_shadow = 1; 125 126 mode_config->funcs = &intel_mode_funcs; 127 mode_config->helper_private = &intel_mode_config_funcs; 128 129 mode_config->async_page_flip = HAS_ASYNC_FLIPS(i915); 130 131 /* 132 * Maximum framebuffer dimensions, chosen to match 133 * the maximum render engine surface size on gen4+. 134 */ 135 if (DISPLAY_VER(i915) >= 7) { 136 mode_config->max_width = 16384; 137 mode_config->max_height = 16384; 138 } else if (DISPLAY_VER(i915) >= 4) { 139 mode_config->max_width = 8192; 140 mode_config->max_height = 8192; 141 } else if (DISPLAY_VER(i915) == 3) { 142 mode_config->max_width = 4096; 143 mode_config->max_height = 4096; 144 } else { 145 mode_config->max_width = 2048; 146 mode_config->max_height = 2048; 147 } 148 149 if (IS_I845G(i915) || IS_I865G(i915)) { 150 mode_config->cursor_width = IS_I845G(i915) ? 64 : 512; 151 mode_config->cursor_height = 1023; 152 } else if (IS_I830(i915) || IS_I85X(i915) || 153 IS_I915G(i915) || IS_I915GM(i915)) { 154 mode_config->cursor_width = 64; 155 mode_config->cursor_height = 64; 156 } else { 157 mode_config->cursor_width = 256; 158 mode_config->cursor_height = 256; 159 } 160 } 161 162 static void intel_mode_config_cleanup(struct drm_i915_private *i915) 163 { 164 intel_atomic_global_obj_cleanup(i915); 165 drm_mode_config_cleanup(&i915->drm); 166 } 167 168 static void intel_plane_possible_crtcs_init(struct drm_i915_private *dev_priv) 169 { 170 struct intel_plane *plane; 171 172 for_each_intel_plane(&dev_priv->drm, plane) { 173 struct intel_crtc *crtc = intel_crtc_for_pipe(dev_priv, 174 plane->pipe); 175 176 plane->base.possible_crtcs = drm_crtc_mask(&crtc->base); 177 } 178 } 179 180 void intel_display_driver_early_probe(struct drm_i915_private *i915) 181 { 182 if (!HAS_DISPLAY(i915)) 183 return; 184 185 spin_lock_init(&i915->display.fb_tracking.lock); 186 mutex_init(&i915->display.backlight.lock); 187 mutex_init(&i915->display.audio.mutex); 188 mutex_init(&i915->display.wm.wm_mutex); 189 mutex_init(&i915->display.pps.mutex); 190 mutex_init(&i915->display.hdcp.hdcp_mutex); 191 192 intel_display_irq_init(i915); 193 intel_dkl_phy_init(i915); 194 intel_color_init_hooks(i915); 195 intel_init_cdclk_hooks(i915); 196 intel_audio_hooks_init(i915); 197 intel_dpll_init_clock_hook(i915); 198 intel_init_display_hooks(i915); 199 intel_fdi_init_hook(i915); 200 } 201 202 /* part #1: call before irq install */ 203 int intel_display_driver_probe_noirq(struct drm_i915_private *i915) 204 { 205 int ret; 206 207 if (i915_inject_probe_failure(i915)) 208 return -ENODEV; 209 210 if (HAS_DISPLAY(i915)) { 211 ret = drm_vblank_init(&i915->drm, 212 INTEL_NUM_PIPES(i915)); 213 if (ret) 214 return ret; 215 } 216 217 intel_bios_init(i915); 218 219 ret = intel_vga_register(i915); 220 if (ret) 221 goto cleanup_bios; 222 223 /* FIXME: completely on the wrong abstraction layer */ 224 ret = intel_power_domains_init(i915); 225 if (ret < 0) 226 goto cleanup_vga; 227 228 intel_pmdemand_init_early(i915); 229 230 intel_power_domains_init_hw(i915, false); 231 232 if (!HAS_DISPLAY(i915)) 233 return 0; 234 235 intel_dmc_init(i915); 236 237 i915->display.wq.modeset = alloc_ordered_workqueue("i915_modeset", 0); 238 i915->display.wq.flip = alloc_workqueue("i915_flip", WQ_HIGHPRI | 239 WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE); 240 241 intel_mode_config_init(i915); 242 243 ret = intel_cdclk_init(i915); 244 if (ret) 245 goto cleanup_vga_client_pw_domain_dmc; 246 247 ret = intel_color_init(i915); 248 if (ret) 249 goto cleanup_vga_client_pw_domain_dmc; 250 251 ret = intel_dbuf_init(i915); 252 if (ret) 253 goto cleanup_vga_client_pw_domain_dmc; 254 255 ret = intel_bw_init(i915); 256 if (ret) 257 goto cleanup_vga_client_pw_domain_dmc; 258 259 ret = intel_pmdemand_init(i915); 260 if (ret) 261 goto cleanup_vga_client_pw_domain_dmc; 262 263 intel_init_quirks(i915); 264 265 intel_fbc_init(i915); 266 267 return 0; 268 269 cleanup_vga_client_pw_domain_dmc: 270 intel_dmc_fini(i915); 271 intel_power_domains_driver_remove(i915); 272 cleanup_vga: 273 intel_vga_unregister(i915); 274 cleanup_bios: 275 intel_bios_driver_remove(i915); 276 277 return ret; 278 } 279 280 static void set_display_access(struct drm_i915_private *i915, 281 bool any_task_allowed, 282 struct task_struct *allowed_task) 283 { 284 struct drm_modeset_acquire_ctx ctx; 285 int err; 286 287 intel_modeset_lock_ctx_retry(&ctx, NULL, 0, err) { 288 err = drm_modeset_lock_all_ctx(&i915->drm, &ctx); 289 if (err) 290 continue; 291 292 i915->display.access.any_task_allowed = any_task_allowed; 293 i915->display.access.allowed_task = allowed_task; 294 } 295 296 drm_WARN_ON(&i915->drm, err); 297 } 298 299 /** 300 * intel_display_driver_enable_user_access - Enable display HW access for all threads 301 * @i915: i915 device instance 302 * 303 * Enable the display HW access for all threads. Examples for such accesses 304 * are modeset commits and connector probing. 305 * 306 * This function should be called during driver loading and system resume once 307 * all the HW initialization steps are done. 308 */ 309 void intel_display_driver_enable_user_access(struct drm_i915_private *i915) 310 { 311 set_display_access(i915, true, NULL); 312 313 intel_hpd_enable_detection_work(i915); 314 } 315 316 /** 317 * intel_display_driver_disable_user_access - Disable display HW access for user threads 318 * @i915: i915 device instance 319 * 320 * Disable the display HW access for user threads. Examples for such accesses 321 * are modeset commits and connector probing. For the current thread the 322 * access is still enabled, which should only perform HW init/deinit 323 * programming (as the initial modeset during driver loading or the disabling 324 * modeset during driver unloading and system suspend/shutdown). This function 325 * should be followed by calling either intel_display_driver_enable_user_access() 326 * after completing the HW init programming or 327 * intel_display_driver_suspend_access() after completing the HW deinit 328 * programming. 329 * 330 * This function should be called during driver loading/unloading and system 331 * suspend/shutdown before starting the HW init/deinit programming. 332 */ 333 void intel_display_driver_disable_user_access(struct drm_i915_private *i915) 334 { 335 intel_hpd_disable_detection_work(i915); 336 337 set_display_access(i915, false, current); 338 } 339 340 /** 341 * intel_display_driver_suspend_access - Suspend display HW access for all threads 342 * @i915: i915 device instance 343 * 344 * Disable the display HW access for all threads. Examples for such accesses 345 * are modeset commits and connector probing. This call should be either 346 * followed by calling intel_display_driver_resume_access(), or the driver 347 * should be unloaded/shutdown. 348 * 349 * This function should be called during driver unloading and system 350 * suspend/shutdown after completing the HW deinit programming. 351 */ 352 void intel_display_driver_suspend_access(struct drm_i915_private *i915) 353 { 354 set_display_access(i915, false, NULL); 355 } 356 357 /** 358 * intel_display_driver_resume_access - Resume display HW access for the resume thread 359 * @i915: i915 device instance 360 * 361 * Enable the display HW access for the current resume thread, keeping the 362 * access disabled for all other (user) threads. Examples for such accesses 363 * are modeset commits and connector probing. The resume thread should only 364 * perform HW init programming (as the restoring modeset). This function 365 * should be followed by calling intel_display_driver_enable_user_access(), 366 * after completing the HW init programming steps. 367 * 368 * This function should be called during system resume before starting the HW 369 * init steps. 370 */ 371 void intel_display_driver_resume_access(struct drm_i915_private *i915) 372 { 373 set_display_access(i915, false, current); 374 } 375 376 /** 377 * intel_display_driver_check_access - Check if the current thread has disaplay HW access 378 * @i915: i915 device instance 379 * 380 * Check whether the current thread has display HW access, print a debug 381 * message if it doesn't. Such accesses are modeset commits and connector 382 * probing. If the function returns %false any HW access should be prevented. 383 * 384 * Returns %true if the current thread has display HW access, %false 385 * otherwise. 386 */ 387 bool intel_display_driver_check_access(struct drm_i915_private *i915) 388 { 389 char comm[TASK_COMM_LEN]; 390 char current_task[TASK_COMM_LEN + 16]; 391 char allowed_task[TASK_COMM_LEN + 16] = "none"; 392 393 if (i915->display.access.any_task_allowed || 394 i915->display.access.allowed_task == current) 395 return true; 396 397 snprintf(current_task, sizeof(current_task), "%s[%d]", 398 get_task_comm(comm, current), 399 task_pid_vnr(current)); 400 401 if (i915->display.access.allowed_task) 402 snprintf(allowed_task, sizeof(allowed_task), "%s[%d]", 403 get_task_comm(comm, i915->display.access.allowed_task), 404 task_pid_vnr(i915->display.access.allowed_task)); 405 406 drm_dbg_kms(&i915->drm, 407 "Reject display access from task %s (allowed to %s)\n", 408 current_task, allowed_task); 409 410 return false; 411 } 412 413 /* part #2: call after irq install, but before gem init */ 414 int intel_display_driver_probe_nogem(struct drm_i915_private *i915) 415 { 416 struct drm_device *dev = &i915->drm; 417 enum pipe pipe; 418 int ret; 419 420 if (!HAS_DISPLAY(i915)) 421 return 0; 422 423 intel_wm_init(i915); 424 425 intel_panel_sanitize_ssc(i915); 426 427 intel_pps_setup(i915); 428 429 intel_gmbus_setup(i915); 430 431 drm_dbg_kms(&i915->drm, "%d display pipe%s available.\n", 432 INTEL_NUM_PIPES(i915), 433 INTEL_NUM_PIPES(i915) > 1 ? "s" : ""); 434 435 for_each_pipe(i915, pipe) { 436 ret = intel_crtc_init(i915, pipe); 437 if (ret) { 438 intel_mode_config_cleanup(i915); 439 return ret; 440 } 441 } 442 443 intel_plane_possible_crtcs_init(i915); 444 intel_shared_dpll_init(i915); 445 intel_fdi_pll_freq_update(i915); 446 447 intel_update_czclk(i915); 448 intel_display_driver_init_hw(i915); 449 intel_dpll_update_ref_clks(i915); 450 451 if (i915->display.cdclk.max_cdclk_freq == 0) 452 intel_update_max_cdclk(i915); 453 454 intel_hti_init(i915); 455 456 /* Just disable it once at startup */ 457 intel_vga_disable(i915); 458 intel_setup_outputs(i915); 459 460 intel_display_driver_disable_user_access(i915); 461 462 drm_modeset_lock_all(dev); 463 intel_modeset_setup_hw_state(i915, dev->mode_config.acquire_ctx); 464 intel_acpi_assign_connector_fwnodes(i915); 465 drm_modeset_unlock_all(dev); 466 467 intel_initial_plane_config(i915); 468 469 /* 470 * Make sure hardware watermarks really match the state we read out. 471 * Note that we need to do this after reconstructing the BIOS fb's 472 * since the watermark calculation done here will use pstate->fb. 473 */ 474 if (!HAS_GMCH(i915)) 475 ilk_wm_sanitize(i915); 476 477 return 0; 478 } 479 480 /* part #3: call after gem init */ 481 int intel_display_driver_probe(struct drm_i915_private *i915) 482 { 483 int ret; 484 485 if (!HAS_DISPLAY(i915)) 486 return 0; 487 488 /* 489 * This will bind stuff into ggtt, so it needs to be done after 490 * the BIOS fb takeover and whatever else magic ggtt reservations 491 * happen during gem/ggtt init. 492 */ 493 intel_hdcp_component_init(i915); 494 495 /* 496 * Force all active planes to recompute their states. So that on 497 * mode_setcrtc after probe, all the intel_plane_state variables 498 * are already calculated and there is no assert_plane warnings 499 * during bootup. 500 */ 501 ret = intel_initial_commit(&i915->drm); 502 if (ret) 503 drm_dbg_kms(&i915->drm, "Initial modeset failed, %d\n", ret); 504 505 intel_overlay_setup(i915); 506 507 ret = intel_fbdev_init(&i915->drm); 508 if (ret) 509 return ret; 510 511 /* Only enable hotplug handling once the fbdev is fully set up. */ 512 intel_hpd_init(i915); 513 514 skl_watermark_ipc_init(i915); 515 516 return 0; 517 } 518 519 void intel_display_driver_register(struct drm_i915_private *i915) 520 { 521 struct drm_printer p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, 522 "i915 display info:"); 523 524 if (!HAS_DISPLAY(i915)) 525 return; 526 527 /* Must be done after probing outputs */ 528 intel_opregion_register(i915); 529 intel_acpi_video_register(i915); 530 531 intel_audio_init(i915); 532 533 intel_display_driver_enable_user_access(i915); 534 535 intel_display_debugfs_register(i915); 536 537 /* 538 * Some ports require correctly set-up hpd registers for 539 * detection to work properly (leading to ghost connected 540 * connector status), e.g. VGA on gm45. Hence we can only set 541 * up the initial fbdev config after hpd irqs are fully 542 * enabled. We do it last so that the async config cannot run 543 * before the connectors are registered. 544 */ 545 intel_fbdev_initial_config_async(i915); 546 547 /* 548 * We need to coordinate the hotplugs with the asynchronous 549 * fbdev configuration, for which we use the 550 * fbdev->async_cookie. 551 */ 552 drm_kms_helper_poll_init(&i915->drm); 553 intel_hpd_poll_disable(i915); 554 555 intel_display_device_info_print(DISPLAY_INFO(i915), 556 DISPLAY_RUNTIME_INFO(i915), &p); 557 } 558 559 /* part #1: call before irq uninstall */ 560 void intel_display_driver_remove(struct drm_i915_private *i915) 561 { 562 if (!HAS_DISPLAY(i915)) 563 return; 564 565 flush_workqueue(i915->display.wq.flip); 566 flush_workqueue(i915->display.wq.modeset); 567 568 /* 569 * MST topology needs to be suspended so we don't have any calls to 570 * fbdev after it's finalized. MST will be destroyed later as part of 571 * drm_mode_config_cleanup() 572 */ 573 intel_dp_mst_suspend(i915); 574 } 575 576 /* part #2: call after irq uninstall */ 577 void intel_display_driver_remove_noirq(struct drm_i915_private *i915) 578 { 579 if (!HAS_DISPLAY(i915)) 580 return; 581 582 intel_display_driver_suspend_access(i915); 583 584 /* 585 * Due to the hpd irq storm handling the hotplug work can re-arm the 586 * poll handlers. Hence disable polling after hpd handling is shut down. 587 */ 588 intel_hpd_poll_fini(i915); 589 590 /* poll work can call into fbdev, hence clean that up afterwards */ 591 intel_fbdev_fini(i915); 592 593 intel_unregister_dsm_handler(); 594 595 /* flush any delayed tasks or pending work */ 596 flush_workqueue(i915->unordered_wq); 597 598 intel_hdcp_component_fini(i915); 599 600 intel_mode_config_cleanup(i915); 601 602 intel_overlay_cleanup(i915); 603 604 intel_gmbus_teardown(i915); 605 606 destroy_workqueue(i915->display.wq.flip); 607 destroy_workqueue(i915->display.wq.modeset); 608 609 intel_fbc_cleanup(i915); 610 } 611 612 /* part #3: call after gem init */ 613 void intel_display_driver_remove_nogem(struct drm_i915_private *i915) 614 { 615 intel_dmc_fini(i915); 616 617 intel_power_domains_driver_remove(i915); 618 619 intel_vga_unregister(i915); 620 621 intel_bios_driver_remove(i915); 622 } 623 624 void intel_display_driver_unregister(struct drm_i915_private *i915) 625 { 626 if (!HAS_DISPLAY(i915)) 627 return; 628 629 intel_fbdev_unregister(i915); 630 /* 631 * After flushing the fbdev (incl. a late async config which 632 * will have delayed queuing of a hotplug event), then flush 633 * the hotplug events. 634 */ 635 drm_kms_helper_poll_fini(&i915->drm); 636 637 intel_display_driver_disable_user_access(i915); 638 639 intel_audio_deinit(i915); 640 641 drm_atomic_helper_shutdown(&i915->drm); 642 643 acpi_video_unregister(); 644 intel_opregion_unregister(i915); 645 } 646 647 /* 648 * turn all crtc's off, but do not adjust state 649 * This has to be paired with a call to intel_modeset_setup_hw_state. 650 */ 651 int intel_display_driver_suspend(struct drm_i915_private *i915) 652 { 653 struct drm_atomic_state *state; 654 int ret; 655 656 if (!HAS_DISPLAY(i915)) 657 return 0; 658 659 state = drm_atomic_helper_suspend(&i915->drm); 660 ret = PTR_ERR_OR_ZERO(state); 661 if (ret) 662 drm_err(&i915->drm, "Suspending crtc's failed with %i\n", 663 ret); 664 else 665 i915->display.restore.modeset_state = state; 666 return ret; 667 } 668 669 int 670 __intel_display_driver_resume(struct drm_i915_private *i915, 671 struct drm_atomic_state *state, 672 struct drm_modeset_acquire_ctx *ctx) 673 { 674 struct drm_crtc_state *crtc_state; 675 struct drm_crtc *crtc; 676 int ret, i; 677 678 intel_modeset_setup_hw_state(i915, ctx); 679 intel_vga_redisable(i915); 680 681 if (!state) 682 return 0; 683 684 /* 685 * We've duplicated the state, pointers to the old state are invalid. 686 * 687 * Don't attempt to use the old state until we commit the duplicated state. 688 */ 689 for_each_new_crtc_in_state(state, crtc, crtc_state, i) { 690 /* 691 * Force recalculation even if we restore 692 * current state. With fast modeset this may not result 693 * in a modeset when the state is compatible. 694 */ 695 crtc_state->mode_changed = true; 696 } 697 698 /* ignore any reset values/BIOS leftovers in the WM registers */ 699 if (!HAS_GMCH(i915)) 700 to_intel_atomic_state(state)->skip_intermediate_wm = true; 701 702 ret = drm_atomic_helper_commit_duplicated_state(state, ctx); 703 704 drm_WARN_ON(&i915->drm, ret == -EDEADLK); 705 706 return ret; 707 } 708 709 void intel_display_driver_resume(struct drm_i915_private *i915) 710 { 711 struct drm_atomic_state *state = i915->display.restore.modeset_state; 712 struct drm_modeset_acquire_ctx ctx; 713 int ret; 714 715 if (!HAS_DISPLAY(i915)) 716 return; 717 718 i915->display.restore.modeset_state = NULL; 719 if (state) 720 state->acquire_ctx = &ctx; 721 722 drm_modeset_acquire_init(&ctx, 0); 723 724 while (1) { 725 ret = drm_modeset_lock_all_ctx(&i915->drm, &ctx); 726 if (ret != -EDEADLK) 727 break; 728 729 drm_modeset_backoff(&ctx); 730 } 731 732 if (!ret) 733 ret = __intel_display_driver_resume(i915, state, &ctx); 734 735 skl_watermark_ipc_update(i915); 736 drm_modeset_drop_locks(&ctx); 737 drm_modeset_acquire_fini(&ctx); 738 739 if (ret) 740 drm_err(&i915->drm, 741 "Restoring old state failed with %i\n", ret); 742 if (state) 743 drm_atomic_state_put(state); 744 } 745