Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'drm-fixes-2021-04-18' of git://anongit.freedesktop.org/drm/drm

Pull vmwgfx fixes from Dave Airlie:
"This contains two regression fixes for vmwgfx, one due to a refactor
which meant locks were being used before initialisation, and the other
in fixing up some warnings from the core when destroying pinned
buffers.

vmwgfx:

- fixed unpinning before destruction

- lockdep init reordering"

* tag 'drm-fixes-2021-04-18' of git://anongit.freedesktop.org/drm/drm:
drm/vmwgfx: Make sure bo's are unpinned before putting them back
drm/vmwgfx: Fix the lockdep breakage
drm/vmwgfx: Make sure we unpin no longer needed buffers

+28 -14
+4
drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
··· 481 481 vmw_bo_unreference(&old_buf); 482 482 res->id = vcotbl->type; 483 483 484 + /* Release the pin acquired in vmw_bo_init */ 485 + ttm_bo_unpin(bo); 486 + 484 487 return 0; 485 488 486 489 out_map_new: 487 490 ttm_bo_kunmap(&old_map); 488 491 out_wait: 492 + ttm_bo_unpin(bo); 489 493 ttm_bo_unreserve(bo); 490 494 vmw_bo_unreference(&buf); 491 495
+9 -10
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
··· 712 712 dev_priv->last_read_seqno = (uint32_t) -100; 713 713 dev_priv->drm.dev_private = dev_priv; 714 714 715 + mutex_init(&dev_priv->cmdbuf_mutex); 716 + mutex_init(&dev_priv->binding_mutex); 717 + ttm_lock_init(&dev_priv->reservation_sem); 718 + spin_lock_init(&dev_priv->resource_lock); 719 + spin_lock_init(&dev_priv->hw_lock); 720 + spin_lock_init(&dev_priv->waiter_lock); 721 + spin_lock_init(&dev_priv->cap_lock); 722 + spin_lock_init(&dev_priv->cursor_lock); 723 + 715 724 ret = vmw_setup_pci_resources(dev_priv, pci_id); 716 725 if (ret) 717 726 return ret; ··· 728 719 if (ret) 729 720 goto out_no_pci_or_version; 730 721 731 - mutex_init(&dev_priv->cmdbuf_mutex); 732 - mutex_init(&dev_priv->release_mutex); 733 - mutex_init(&dev_priv->binding_mutex); 734 - mutex_init(&dev_priv->global_kms_state_mutex); 735 - ttm_lock_init(&dev_priv->reservation_sem); 736 - spin_lock_init(&dev_priv->resource_lock); 737 - spin_lock_init(&dev_priv->hw_lock); 738 - spin_lock_init(&dev_priv->waiter_lock); 739 - spin_lock_init(&dev_priv->cap_lock); 740 - spin_lock_init(&dev_priv->cursor_lock); 741 722 742 723 for (i = vmw_res_context; i < vmw_res_max; ++i) { 743 724 idr_init(&dev_priv->res_idr[i]);
+1 -4
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
··· 529 529 struct vmw_overlay *overlay_priv; 530 530 struct drm_property *hotplug_mode_update_property; 531 531 struct drm_property *implicit_placement_property; 532 - struct mutex global_kms_state_mutex; 533 532 spinlock_t cursor_lock; 534 533 struct drm_atomic_state *suspend_state; 535 534 ··· 591 592 bool refuse_hibernation; 592 593 bool suspend_locked; 593 594 594 - struct mutex release_mutex; 595 595 atomic_t num_fifo_resources; 596 596 597 597 /* ··· 1522 1524 struct vmw_buffer_object *tmp_buf = *buf; 1523 1525 1524 1526 *buf = NULL; 1525 - if (tmp_buf != NULL) { 1527 + if (tmp_buf != NULL) 1526 1528 ttm_bo_put(&tmp_buf->base); 1527 - } 1528 1529 } 1529 1530 1530 1531 static inline struct vmw_buffer_object *
+14
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
··· 94 94 struct vmw_piter data_iter, 95 95 unsigned long num_data_pages); 96 96 97 + 98 + static inline void vmw_bo_unpin_unlocked(struct ttm_buffer_object *bo) 99 + { 100 + int ret = ttm_bo_reserve(bo, false, true, NULL); 101 + BUG_ON(ret != 0); 102 + ttm_bo_unpin(bo); 103 + ttm_bo_unreserve(bo); 104 + } 105 + 106 + 97 107 /* 98 108 * vmw_setup_otable_base - Issue an object table base setup command to 99 109 * the device ··· 287 277 &batch->otables[i]); 288 278 } 289 279 280 + vmw_bo_unpin_unlocked(batch->otable_bo); 290 281 ttm_bo_put(batch->otable_bo); 291 282 batch->otable_bo = NULL; 292 283 return ret; ··· 351 340 BUG_ON(ret != 0); 352 341 353 342 vmw_bo_fence_single(bo, NULL); 343 + ttm_bo_unpin(bo); 354 344 ttm_bo_unreserve(bo); 355 345 356 346 ttm_bo_put(batch->otable_bo); ··· 540 528 void vmw_mob_destroy(struct vmw_mob *mob) 541 529 { 542 530 if (mob->pt_bo) { 531 + vmw_bo_unpin_unlocked(mob->pt_bo); 543 532 ttm_bo_put(mob->pt_bo); 544 533 mob->pt_bo = NULL; 545 534 } ··· 656 643 out_no_cmd_space: 657 644 vmw_fifo_resource_dec(dev_priv); 658 645 if (pt_set_up) { 646 + vmw_bo_unpin_unlocked(mob->pt_bo); 659 647 ttm_bo_put(mob->pt_bo); 660 648 mob->pt_bo = NULL; 661 649 }