Skip to content

Commit 6bb517d

Browse files
committed
Merge tag 'drm-misc-fixes-2023-01-19' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
A fix for vc4 to address a memory leak when allocating a buffer, a Kconfig fix for panfrost and two fixes for i915 and fb-helper to address some bugs with vga-switcheroo. Signed-off-by: Dave Airlie <[email protected]> From: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20230119082059.h32bs7zqoxmjbcvn@houat
2 parents d6cf886 + 2293a73 commit 6bb517d

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

drivers/gpu/drm/drm_fb_helper.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
3131

3232
#include <linux/console.h>
33+
#include <linux/pci.h>
3334
#include <linux/sysrq.h>
35+
#include <linux/vga_switcheroo.h>
3436

3537
#include <drm/drm_atomic.h>
3638
#include <drm/drm_drv.h>
@@ -1909,6 +1911,11 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
19091911
return ret;
19101912

19111913
strcpy(fb_helper->fb->comm, "[fbcon]");
1914+
1915+
/* Set the fb info for vgaswitcheroo clients. Does nothing otherwise. */
1916+
if (dev_is_pci(dev->dev))
1917+
vga_switcheroo_client_fb_set(to_pci_dev(dev->dev), fb_helper->info);
1918+
19121919
return 0;
19131920
}
19141921

drivers/gpu/drm/i915/i915_driver.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,12 +1069,9 @@ static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
10691069
*/
10701070
static void i915_driver_lastclose(struct drm_device *dev)
10711071
{
1072-
struct drm_i915_private *i915 = to_i915(dev);
1073-
10741072
intel_fbdev_restore_mode(dev);
10751073

1076-
if (HAS_DISPLAY(i915))
1077-
vga_switcheroo_process_delayed_switch();
1074+
vga_switcheroo_process_delayed_switch();
10781075
}
10791076

10801077
static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)

drivers/gpu/drm/i915/i915_switcheroo.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ static void i915_switcheroo_set_state(struct pci_dev *pdev,
1919
dev_err(&pdev->dev, "DRM not initialized, aborting switch.\n");
2020
return;
2121
}
22+
if (!HAS_DISPLAY(i915)) {
23+
dev_err(&pdev->dev, "Device state not initialized, aborting switch.\n");
24+
return;
25+
}
2226

2327
if (state == VGA_SWITCHEROO_ON) {
2428
drm_info(&i915->drm, "switched on\n");
@@ -44,7 +48,7 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
4448
* locking inversion with the driver load path. And the access here is
4549
* completely racy anyway. So don't bother with locking for now.
4650
*/
47-
return i915 && atomic_read(&i915->drm.open_count) == 0;
51+
return i915 && HAS_DISPLAY(i915) && atomic_read(&i915->drm.open_count) == 0;
4852
}
4953

5054
static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {

drivers/gpu/drm/panfrost/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
config DRM_PANFROST
44
tristate "Panfrost (DRM support for ARM Mali Midgard/Bifrost GPUs)"
55
depends on DRM
6-
depends on ARM || ARM64 || (COMPILE_TEST && !GENERIC_ATOMIC64)
6+
depends on ARM || ARM64 || COMPILE_TEST
7+
depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE
78
depends on MMU
89
select DRM_SCHED
910
select IOMMU_SUPPORT

drivers/gpu/drm/vc4/vc4_bo.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ static void vc4_bo_destroy(struct vc4_bo *bo)
179179
bo->validated_shader = NULL;
180180
}
181181

182+
mutex_destroy(&bo->madv_lock);
182183
drm_gem_dma_free(&bo->base);
183184
}
184185

@@ -394,7 +395,6 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size)
394395
{
395396
struct vc4_dev *vc4 = to_vc4_dev(dev);
396397
struct vc4_bo *bo;
397-
int ret;
398398

399399
if (WARN_ON_ONCE(vc4->is_vc5))
400400
return ERR_PTR(-ENODEV);
@@ -406,9 +406,7 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size)
406406
bo->madv = VC4_MADV_WILLNEED;
407407
refcount_set(&bo->usecnt, 0);
408408

409-
ret = drmm_mutex_init(dev, &bo->madv_lock);
410-
if (ret)
411-
return ERR_PTR(ret);
409+
mutex_init(&bo->madv_lock);
412410

413411
mutex_lock(&vc4->bo_lock);
414412
bo->label = VC4_BO_TYPE_KERNEL;

0 commit comments

Comments
 (0)