diff options
| author | Dave Airlie <airlied@redhat.com> | 2019-03-13 21:37:31 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2019-03-13 21:37:46 -0400 |
| commit | 74cd45fa90a234de92a3f3ce8bdabeb643b546a5 (patch) | |
| tree | 3a8c874c5ece28e93bc90f13e01fbecdd8eff29c | |
| parent | 3a7d2f4f4427f4b241f8240e370099e2ec1fd307 (diff) | |
| parent | c34674a23d1e8674ac532bf3397333f24a41e7b2 (diff) | |
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
| -rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 35 | ||||
| -rw-r--r-- | drivers/gpu/drm/qxl/qxl_drv.c | 5 | ||||
| -rw-r--r-- | drivers/gpu/vga/vgaarb.c | 49 | ||||
| -rw-r--r-- | include/drm/drm_fb_helper.h | 14 | ||||
| -rw-r--r-- | include/linux/vgaarb.h | 2 |
5 files changed, 67 insertions, 38 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 6630212f2faf..9df65d386d11 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
| @@ -757,39 +757,6 @@ static int i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) | |||
| 757 | return ret; | 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 | static void intel_init_dpio(struct drm_i915_private *dev_priv) | 760 | static void intel_init_dpio(struct drm_i915_private *dev_priv) |
| 794 | { | 761 | { |
| 795 | /* | 762 | /* |
| @@ -1420,7 +1387,7 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv) | |||
| 1420 | goto err_ggtt; | 1387 | goto err_ggtt; |
| 1421 | } | 1388 | } |
| 1422 | 1389 | ||
| 1423 | ret = i915_kick_out_vgacon(dev_priv); | 1390 | ret = vga_remove_vgacon(pdev); |
| 1424 | if (ret) { | 1391 | if (ret) { |
| 1425 | DRM_ERROR("failed to remove conflicting VGA console\n"); | 1392 | DRM_ERROR("failed to remove conflicting VGA console\n"); |
| 1426 | goto err_ggtt; | 1393 | goto err_ggtt; |
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c index bb81e310eb6d..578d867a81d5 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.c +++ b/drivers/gpu/drm/qxl/qxl_drv.c | |||
| @@ -79,6 +79,10 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 79 | if (ret) | 79 | if (ret) |
| 80 | goto free_dev; | 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 | ret = qxl_device_init(qdev, &qxl_driver, pdev); | 86 | ret = qxl_device_init(qdev, &qxl_driver, pdev); |
| 83 | if (ret) | 87 | if (ret) |
| 84 | goto disable_pci; | 88 | goto disable_pci; |
| @@ -94,7 +98,6 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 94 | if (ret) | 98 | if (ret) |
| 95 | goto modeset_cleanup; | 99 | goto modeset_cleanup; |
| 96 | 100 | ||
| 97 | drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "qxl"); | ||
| 98 | drm_fbdev_generic_setup(&qdev->ddev, 32); | 101 | drm_fbdev_generic_setup(&qdev->ddev, 32); |
| 99 | return 0; | 102 | return 0; |
| 100 | 103 | ||
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index dc8e039bfab5..f2f3ef8af271 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
| @@ -48,6 +48,8 @@ | |||
| 48 | #include <linux/miscdevice.h> | 48 | #include <linux/miscdevice.h> |
| 49 | #include <linux/slab.h> | 49 | #include <linux/slab.h> |
| 50 | #include <linux/screen_info.h> | 50 | #include <linux/screen_info.h> |
| 51 | #include <linux/vt.h> | ||
| 52 | #include <linux/console.h> | ||
| 51 | 53 | ||
| 52 | #include <linux/uaccess.h> | 54 | #include <linux/uaccess.h> |
| 53 | 55 | ||
| @@ -168,6 +170,53 @@ void vga_set_default_device(struct pci_dev *pdev) | |||
| 168 | vga_default = pci_dev_get(pdev); | 170 | vga_default = pci_dev_get(pdev); |
| 169 | } | 171 | } |
| 170 | 172 | ||
| 173 | /** | ||
| 174 | * vga_remove_vgacon - deactivete vga console | ||
| 175 | * | ||
| 176 | * Unbind and unregister vgacon in case pdev is the default vga | ||
| 177 | * device. Can be called by gpu drivers on initialization to make | ||
| 178 | * sure vga register access done by vgacon will not disturb the | ||
| 179 | * device. | ||
| 180 | * | ||
| 181 | * @pdev: pci device. | ||
| 182 | */ | ||
| 183 | #if !defined(CONFIG_VGA_CONSOLE) | ||
| 184 | int vga_remove_vgacon(struct pci_dev *pdev) | ||
| 185 | { | ||
| 186 | return 0; | ||
| 187 | } | ||
| 188 | #elif !defined(CONFIG_DUMMY_CONSOLE) | ||
| 189 | int vga_remove_vgacon(struct pci_dev *pdev) | ||
| 190 | { | ||
| 191 | return -ENODEV; | ||
| 192 | } | ||
| 193 | #else | ||
| 194 | int vga_remove_vgacon(struct pci_dev *pdev) | ||
| 195 | { | ||
| 196 | int ret = 0; | ||
| 197 | |||
| 198 | if (pdev != vga_default) | ||
| 199 | return 0; | ||
| 200 | vgaarb_info(&pdev->dev, "deactivate vga console\n"); | ||
| 201 | |||
| 202 | console_lock(); | ||
| 203 | if (con_is_bound(&vga_con)) | ||
| 204 | ret = do_take_over_console(&dummy_con, 0, | ||
| 205 | MAX_NR_CONSOLES - 1, 1); | ||
| 206 | if (ret == 0) { | ||
| 207 | ret = do_unregister_con_driver(&vga_con); | ||
| 208 | |||
| 209 | /* Ignore "already unregistered". */ | ||
| 210 | if (ret == -ENODEV) | ||
| 211 | ret = 0; | ||
| 212 | } | ||
| 213 | console_unlock(); | ||
| 214 | |||
| 215 | return ret; | ||
| 216 | } | ||
| 217 | #endif | ||
| 218 | EXPORT_SYMBOL(vga_remove_vgacon); | ||
| 219 | |||
| 171 | static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) | 220 | static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) |
| 172 | { | 221 | { |
| 173 | if (vgadev->irq_set_state) | 222 | if (vgadev->irq_set_state) |
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index bb9acea61369..286d58efed5d 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
| @@ -36,6 +36,7 @@ struct drm_fb_helper; | |||
| 36 | #include <drm/drm_crtc.h> | 36 | #include <drm/drm_crtc.h> |
| 37 | #include <drm/drm_device.h> | 37 | #include <drm/drm_device.h> |
| 38 | #include <linux/kgdb.h> | 38 | #include <linux/kgdb.h> |
| 39 | #include <linux/vgaarb.h> | ||
| 39 | 40 | ||
| 40 | enum mode_set_atomic { | 41 | enum mode_set_atomic { |
| 41 | LEAVE_ATOMIC_MODE_SET, | 42 | LEAVE_ATOMIC_MODE_SET, |
| @@ -642,11 +643,18 @@ drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev, | |||
| 642 | int resource_id, | 643 | int resource_id, |
| 643 | const char *name) | 644 | const char *name) |
| 644 | { | 645 | { |
| 646 | int ret = 0; | ||
| 647 | |||
| 648 | /* | ||
| 649 | * WARNING: Apparently we must kick fbdev drivers before vgacon, | ||
| 650 | * otherwise the vga fbdev driver falls over. | ||
| 651 | */ | ||
| 645 | #if IS_REACHABLE(CONFIG_FB) | 652 | #if IS_REACHABLE(CONFIG_FB) |
| 646 | return remove_conflicting_pci_framebuffers(pdev, resource_id, name); | 653 | ret = remove_conflicting_pci_framebuffers(pdev, resource_id, name); |
| 647 | #else | ||
| 648 | return 0; | ||
| 649 | #endif | 654 | #endif |
| 655 | if (ret == 0) | ||
| 656 | ret = vga_remove_vgacon(pdev); | ||
| 657 | return ret; | ||
| 650 | } | 658 | } |
| 651 | 659 | ||
| 652 | #endif | 660 | #endif |
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h index ee162e3e879b..553b34c8b5f7 100644 --- a/include/linux/vgaarb.h +++ b/include/linux/vgaarb.h | |||
| @@ -125,9 +125,11 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc); | |||
| 125 | #ifdef CONFIG_VGA_ARB | 125 | #ifdef CONFIG_VGA_ARB |
| 126 | extern struct pci_dev *vga_default_device(void); | 126 | extern struct pci_dev *vga_default_device(void); |
| 127 | extern void vga_set_default_device(struct pci_dev *pdev); | 127 | extern void vga_set_default_device(struct pci_dev *pdev); |
| 128 | extern int vga_remove_vgacon(struct pci_dev *pdev); | ||
| 128 | #else | 129 | #else |
| 129 | static inline struct pci_dev *vga_default_device(void) { return NULL; }; | 130 | static inline struct pci_dev *vga_default_device(void) { return NULL; }; |
| 130 | static inline void vga_set_default_device(struct pci_dev *pdev) { }; | 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 | #endif | 133 | #endif |
| 132 | 134 | ||
| 133 | /* | 135 | /* |
