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

Merge tag 'drm-misc-next-fixes-2019-03-13' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

- qxl: Remove the conflicting framebuffers earlier
- Split out some i915 code into the fb_helper to allow the above

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190313192158.k3qssf733khsqodn@flea

+67 -38
+1 -34
drivers/gpu/drm/i915/i915_drv.c
··· 757 757 return ret; 758 758 } 759 759 760 - #if !defined(CONFIG_VGA_CONSOLE) 761 - static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) 762 - { 763 - return 0; 764 - } 765 - #elif !defined(CONFIG_DUMMY_CONSOLE) 766 - static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) 767 - { 768 - return -ENODEV; 769 - } 770 - #else 771 - static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) 772 - { 773 - int ret = 0; 774 - 775 - DRM_INFO("Replacing VGA console driver\n"); 776 - 777 - console_lock(); 778 - if (con_is_bound(&vga_con)) 779 - ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1); 780 - if (ret == 0) { 781 - ret = do_unregister_con_driver(&vga_con); 782 - 783 - /* Ignore "already unregistered". */ 784 - if (ret == -ENODEV) 785 - ret = 0; 786 - } 787 - console_unlock(); 788 - 789 - return ret; 790 - } 791 - #endif 792 - 793 760 static void intel_init_dpio(struct drm_i915_private *dev_priv) 794 761 { 795 762 /* ··· 1387 1420 goto err_ggtt; 1388 1421 } 1389 1422 1390 - ret = i915_kick_out_vgacon(dev_priv); 1423 + ret = vga_remove_vgacon(pdev); 1391 1424 if (ret) { 1392 1425 DRM_ERROR("failed to remove conflicting VGA console\n"); 1393 1426 goto err_ggtt;
+4 -1
drivers/gpu/drm/qxl/qxl_drv.c
··· 79 79 if (ret) 80 80 goto free_dev; 81 81 82 + ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "qxl"); 83 + if (ret) 84 + goto disable_pci; 85 + 82 86 ret = qxl_device_init(qdev, &qxl_driver, pdev); 83 87 if (ret) 84 88 goto disable_pci; ··· 98 94 if (ret) 99 95 goto modeset_cleanup; 100 96 101 - drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "qxl"); 102 97 drm_fbdev_generic_setup(&qdev->ddev, 32); 103 98 return 0; 104 99
+49
drivers/gpu/vga/vgaarb.c
··· 48 48 #include <linux/miscdevice.h> 49 49 #include <linux/slab.h> 50 50 #include <linux/screen_info.h> 51 + #include <linux/vt.h> 52 + #include <linux/console.h> 51 53 52 54 #include <linux/uaccess.h> 53 55 ··· 169 167 pci_dev_put(vga_default); 170 168 vga_default = pci_dev_get(pdev); 171 169 } 170 + 171 + /** 172 + * vga_remove_vgacon - deactivete vga console 173 + * 174 + * Unbind and unregister vgacon in case pdev is the default vga 175 + * device. Can be called by gpu drivers on initialization to make 176 + * sure vga register access done by vgacon will not disturb the 177 + * device. 178 + * 179 + * @pdev: pci device. 180 + */ 181 + #if !defined(CONFIG_VGA_CONSOLE) 182 + int vga_remove_vgacon(struct pci_dev *pdev) 183 + { 184 + return 0; 185 + } 186 + #elif !defined(CONFIG_DUMMY_CONSOLE) 187 + int vga_remove_vgacon(struct pci_dev *pdev) 188 + { 189 + return -ENODEV; 190 + } 191 + #else 192 + int vga_remove_vgacon(struct pci_dev *pdev) 193 + { 194 + int ret = 0; 195 + 196 + if (pdev != vga_default) 197 + return 0; 198 + vgaarb_info(&pdev->dev, "deactivate vga console\n"); 199 + 200 + console_lock(); 201 + if (con_is_bound(&vga_con)) 202 + ret = do_take_over_console(&dummy_con, 0, 203 + MAX_NR_CONSOLES - 1, 1); 204 + if (ret == 0) { 205 + ret = do_unregister_con_driver(&vga_con); 206 + 207 + /* Ignore "already unregistered". */ 208 + if (ret == -ENODEV) 209 + ret = 0; 210 + } 211 + console_unlock(); 212 + 213 + return ret; 214 + } 215 + #endif 216 + EXPORT_SYMBOL(vga_remove_vgacon); 172 217 173 218 static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) 174 219 {
+11 -3
include/drm/drm_fb_helper.h
··· 36 36 #include <drm/drm_crtc.h> 37 37 #include <drm/drm_device.h> 38 38 #include <linux/kgdb.h> 39 + #include <linux/vgaarb.h> 39 40 40 41 enum mode_set_atomic { 41 42 LEAVE_ATOMIC_MODE_SET, ··· 643 642 int resource_id, 644 643 const char *name) 645 644 { 645 + int ret = 0; 646 + 647 + /* 648 + * WARNING: Apparently we must kick fbdev drivers before vgacon, 649 + * otherwise the vga fbdev driver falls over. 650 + */ 646 651 #if IS_REACHABLE(CONFIG_FB) 647 - return remove_conflicting_pci_framebuffers(pdev, resource_id, name); 648 - #else 649 - return 0; 652 + ret = remove_conflicting_pci_framebuffers(pdev, resource_id, name); 650 653 #endif 654 + if (ret == 0) 655 + ret = vga_remove_vgacon(pdev); 656 + return ret; 651 657 } 652 658 653 659 #endif
+2
include/linux/vgaarb.h
··· 125 125 #ifdef CONFIG_VGA_ARB 126 126 extern struct pci_dev *vga_default_device(void); 127 127 extern void vga_set_default_device(struct pci_dev *pdev); 128 + extern int vga_remove_vgacon(struct pci_dev *pdev); 128 129 #else 129 130 static inline struct pci_dev *vga_default_device(void) { return NULL; }; 130 131 static inline void vga_set_default_device(struct pci_dev *pdev) { }; 132 + static inline int vga_remove_vgacon(struct pci_dev *pdev) { return 0; }; 131 133 #endif 132 134 133 135 /*