Patch "drm/mgag200: Add workaround for HW that does not support 'startadd'" has been added to the 5.4-stable tree
Subsystems (3)
[email protected]
AppliedThis is a note to let you know that I've just added the patch titled
drm/mgag200: Add workaround for HW that does not support 'startadd'
to the 5.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
drm-mgag200-add-workaround-for-hw-that-does-not-support-startadd.patch
and it can be found in the queue-5.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From 1591fadf857cdbaf2baa55e421af99a61354713c Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <[email protected]>
Date: Tue, 26 Nov 2019 11:15:29 +0100
Subject: drm/mgag200: Add workaround for HW that does not support 'startadd'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Thomas Zimmermann <[email protected]>
commit 1591fadf857cdbaf2baa55e421af99a61354713c upstream.
There's at least one system that does not interpret the value of the device's 'startadd' field correctly, which leads to incorrectly displayed scanout buffers. Always placing the active scanout buffer at offset 0 works around the problem.
--- drivers/gpu/drm/mgag200/mgag200_drv.c | 35 +++++++++++++++++++++++++++++++++- drivers/gpu/drm/mgag200/mgag200_drv.h | 3 ++ 2 files changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +34 -1
@@ -30,6 +30,8 @@ module_param_named(modeset, mgag200_modestatic struct drm_driver driver;static const struct pci_device_id pciidlist[] = { + {PCI_VENDOR_ID_MATROX ,0x522 ,PCI_VENDOR_ID_SUN ,0x4852 ,0 ,0 , +G200_SE_A |MGAG200_FLAG_HW_BUG_NO_STARTADD }, {PCI_VENDOR_ID_MATROX ,0x522 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,G200_SE_A }, {PCI_VENDOR_ID_MATROX ,0x524 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,G200_SE_B }, {PCI_VENDOR_ID_MATROX ,0x530 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,G200_EV },
@@ -63,6 +65,35 @@ static const struct file_operations mgagDRM_VRAM_MM_FILE_OPERATIONS }; +static bool mgag200_pin_bo_at_0 (const struct mga_device *mdev) +{ +return mdev->flags &MGAG200_FLAG_HW_BUG_NO_STARTADD ; +} + +int mgag200_driver_dumb_create (struct drm_file *file, +struct drm_device *dev, +struct drm_mode_create_dumb *args) +{ +struct mga_device *mdev = dev->dev_private; +unsigned long pg_align; + +if (WARN_ONCE (!dev->vram_mm,"VRAM MM not initialized" )) +return -EINVAL ; + + pg_align =0ul ; + +/* +* Aligning scanout buffers to the size of the video ram forces +* placement at offset 0. Works around a bug where HW does not +* respect 'startadd' field. +*/ +if (mgag200_pin_bo_at_0 (mdev)) + pg_align =PFN_UP (mdev->mc.vram_size); + +return drm_gem_vram_fill_create_dumb (file, dev, &dev->vram_mm->bdev, + pg_align, false, args); +} +static struct drm_driver driver = { .driver_features =DRIVER_GEM |DRIVER_MODESET , .load = mgag200_driver_load,
@@ -74,7 +105,9 @@ static struct drm_driver driver = { .major = DRIVER_MAJOR, .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, - DRM_GEM_VRAM_DRIVER + .dumb_create = mgag200_driver_dumb_create, + .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset, + .gem_prime_mmap = drm_gem_prime_mmap, };static struct pci_driver mgag200_pci_driver = {
drivers/gpu/drm/mgag200/mgag200_drv.h +3 -0
@@ -159,6 +159,9 @@ enum mga_type { G200_EW3, }; +/* HW does not handle 'startadd' field correct. */ +#define MGAG200_FLAG_HW_BUG_NO_STARTADD (1ul << 8) +#define MGAG200_TYPE_MASK (0x000000ff)#define MGAG200_FLAG_MASK (0x00ffff00)
Patches currently in stable-queue which might be from [email protected] are
queue-5.4/drm-mgag200-flag-all-g200-se-a-machines-as-broken-wrt-startadd.patch queue-5.4/drm-mgag200-store-flags-from-pci-driver-data-in-device-structure.patch queue-5.4/drm-mgag200-add-workaround-for-hw-that-does-not-support-startadd.patch queue-5.4/drm-mgag200-extract-device-type-from-flags.patch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel