Skip to contentSkip to conversation

drm/mgag200: Workaround HW bug with non-0 offset

PATCH Superseded Thomas Zimmermann 5 participants 14 messages Nov 26, 2019 – Dec 6, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

cover drm/mgag200: Workaround HW bug with non-0 offset

We found an MGA chip that does not interpret the scanout offset correctly. This patch works around the problem by placing all buffer objects at offset 0 on this system.

There's a new module parameter 'hw_bug_no_startadd' that enables and disables the offset-0 placement. Default is auto-detection.

Thomas Zimmermann (4):
drm/mgag200: Extract device type from flags
drm/mgag200: Store flags from PCI driver data in device structure drm/mgag200: Add workaround for HW that does not support 'startadd' drm/mgag200: Add module parameter to pin all buffers at offset 0

 drivers/gpu/drm/mgag200/mgag200_drv.c  | 44 +++++++++++++++++++++++++-
 drivers/gpu/drm/mgag200/mgag200_drv.h  | 18 +++++++++++
 drivers/gpu/drm/mgag200/mgag200_main.c |  3 +-
 3 files changed, 63 insertions(+), 2 deletions(-)

--
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#1 lore raw

PATCH 1/4 drm/mgag200: Extract device type from flags

Adds a conversion function that extracts the device type from the PCI id-table flags. Allows for storing additional information in the other flag bits.

---
 drivers/gpu/drm/mgag200/mgag200_drv.h  | 7 +++++++
 drivers/gpu/drm/mgag200/mgag200_main.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_drv.h +7 -0
index 0ea9a525e57d..976404634092 100644
@@ -150,6 +150,8 @@ enum mga_type {
 	G200_EW3,
 };
 
+#define MGAG200_TYPE_MASK	(0x000000ff)
+
 #define IS_G200_SE(mdev) (mdev->type == G200_SE_A || mdev->type == G200_SE_B)
 
 struct mga_device {
@@ -181,6 +183,11 @@ struct mga_device {
 	u32 unique_rev_id;
 };
 
+static inline enum mga_type
+mgag200_type_from_driver_data(kernel_ulong_t driver_data)
+{
+	return (enum mga_type)(driver_data & MGAG200_TYPE_MASK);
+}
 				/* mgag200_mode.c */
 int mgag200_modeset_init(struct mga_device *mdev);
 void mgag200_modeset_fini(struct mga_device *mdev);
drivers/gpu/drm/mgag200/mgag200_main.c +1 -1
index 5f74aabcd3df..517c5693ad69 100644
@@ -94,7 +94,7 @@ static int mgag200_device_init(struct drm_device *dev,
 	struct mga_device *mdev = dev->dev_private;
 	int ret, option;
 
-	mdev->type = flags;
+	mdev->type = mgag200_type_from_driver_data(flags);
 
 	/* Hardcode the number of CRTCs to 1 */
 	mdev->num_crtc = 1;
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#2 lore raw

PATCH 2/4 drm/mgag200: Store flags from PCI driver data in device structure

In reply to Thomas Zimmermann

The flags field in struct mga_device has been unused so far. We now use it to store flag bits from the PCI driver.

---
 drivers/gpu/drm/mgag200/mgag200_drv.h  | 8 ++++++++
 drivers/gpu/drm/mgag200/mgag200_main.c | 1 +
 2 files changed, 9 insertions(+)
drivers/gpu/drm/mgag200/mgag200_drv.h +8 -0
index 976404634092..4b4f9ce74a84 100644
@@ -151,6 +151,7 @@ enum mga_type {
 };
 
 #define MGAG200_TYPE_MASK	(0x000000ff)
+#define MGAG200_FLAG_MASK	(0x00ffff00)
 
 #define IS_G200_SE(mdev) (mdev->type == G200_SE_A || mdev->type == G200_SE_B)
 
@@ -188,6 +189,13 @@ mgag200_type_from_driver_data(kernel_ulong_t driver_data)
 {
 	return (enum mga_type)(driver_data & MGAG200_TYPE_MASK);
 }
+
+static inline unsigned long
+mgag200_flags_from_driver_data(kernel_ulong_t driver_data)
+{
+	return driver_data & MGAG200_FLAG_MASK;
+}
+
 				/* mgag200_mode.c */
 int mgag200_modeset_init(struct mga_device *mdev);
 void mgag200_modeset_fini(struct mga_device *mdev);
drivers/gpu/drm/mgag200/mgag200_main.c +1 -0
index 517c5693ad69..e1bc5b0aa774 100644
@@ -94,6 +94,7 @@ static int mgag200_device_init(struct drm_device *dev,
 	struct mga_device *mdev = dev->dev_private;
 	int ret, option;
 
+	mdev->flags = mgag200_flags_from_driver_data(flags);
 	mdev->type = mgag200_type_from_driver_data(flags);
 
 	/* Hardcode the number of CRTCs to 1 */
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#3 lore raw

PATCH 3/4 drm/mgag200: Add workaround for HW that does not support 'startadd'

In reply to Thomas Zimmermann

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 | 36 ++++++++++++++++++++++++++-
 drivers/gpu/drm/mgag200/mgag200_drv.h |  3 +++
 2 files changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +35 -1
index 397f8b0a9af8..d43951caeea0 100644
@@ -30,6 +30,8 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
 static 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 },
@@ -60,6 +62,35 @@ static void mga_pci_remove(struct pci_dev *pdev)
 
 DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
 
+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,
@@ -71,7 +102,10 @@ static struct drm_driver driver = {
 	.major = DRIVER_MAJOR,
 	.minor = DRIVER_MINOR,
 	.patchlevel = DRIVER_PATCHLEVEL,
-	DRM_GEM_VRAM_DRIVER
+	.debugfs_init = drm_vram_mm_debugfs_init,
+	.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
index 4b4f9ce74a84..aa32aad222c2 100644
@@ -150,6 +150,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)
 
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Tested-by John Donnelly Reviewed-by on v1 3/4
#4 lore raw

Re: [PATCH 3/4] drm/mgag200: Add workaround for HW that does not support 'startadd'

Quoted 8 lines · Thomas Zimmermann

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.

(Not quite this patch, but pretty much the logic, so counts).

Fixes 81da87f63a1e ("drm: Replace drm_gem_vram_push_to_system() with kunmap + unpin")
Cc <[email protected]> # v5.3+

Also you need the stable line on both prep patches too. For next time around,

$ dim fixes 81da87f63a1e

will generate all the stuff you need, including a good set of suggested
Cc: you should have.

On the first 3 patches, with all that stuff added:

Please push these to drm-misc-next-fixes so they get backported as quickly as possible.
-Daniel

Quoted 83 lines
---
 drivers/gpu/drm/mgag200/mgag200_drv.c | 36 ++++++++++++++++++++++++++-
 drivers/gpu/drm/mgag200/mgag200_drv.h |  3 +++
 2 files changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +35 -1
index 397f8b0a9af8..d43951caeea0 100644
@@ -30,6 +30,8 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
 static 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 },
@@ -60,6 +62,35 @@ static void mga_pci_remove(struct pci_dev *pdev)
 
 DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
 
+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,
@@ -71,7 +102,10 @@ static struct drm_driver driver = {
 	.major = DRIVER_MAJOR,
 	.minor = DRIVER_MINOR,
 	.patchlevel = DRIVER_PATCHLEVEL,
-	DRM_GEM_VRAM_DRIVER
+	.debugfs_init = drm_vram_mm_debugfs_init,
+	.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
index 4b4f9ce74a84..aa32aad222c2 100644
@@ -150,6 +150,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)
 
Signature · 1 line
2.23.0
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#5 lore raw

Re: [PATCH 3/4] drm/mgag200: Add workaround for HW that does not support 'startadd'

Hi

Am 26.11.19 um 10:37 schrieb Daniel Vetter:

Quoted 20 lines · Thomas Zimmermann
Quoted 8 lines

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.

(Not quite this patch, but pretty much the logic, so counts).

Fixes 81da87f63a1e ("drm: Replace drm_gem_vram_push_to_system() with kunmap + unpin")
Cc <[email protected]> # v5.3+

Also you need the stable line on both prep patches too. For next time around,

Quoted 8 lines
$ dim fixes 81da87f63a1e

will generate all the stuff you need, including a good set of suggested
Cc: you should have.

On the first 3 patches, with all that stuff added:

Thanks for the review.

Sorry for leaving out some of the tags. I wanted to wait for feedback before adding tested-by, fixes, stable. I'll split off patch 4 from the series and get 1 to 3 merged ASAP.

Best regards
Thomas

Quoted 89 lines

Please push these to drm-misc-next-fixes so they get backported as quickly as possible.
-Daniel

Quoted 83 lines
---
 drivers/gpu/drm/mgag200/mgag200_drv.c | 36 ++++++++++++++++++++++++++-
 drivers/gpu/drm/mgag200/mgag200_drv.h |  3 +++
 2 files changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +35 -1
index 397f8b0a9af8..d43951caeea0 100644
@@ -30,6 +30,8 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
 static 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 },
@@ -60,6 +62,35 @@ static void mga_pci_remove(struct pci_dev *pdev)
 
 DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
 
+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,
@@ -71,7 +102,10 @@ static struct drm_driver driver = {
 	.major = DRIVER_MAJOR,
 	.minor = DRIVER_MINOR,
 	.patchlevel = DRIVER_PATCHLEVEL,
-	DRM_GEM_VRAM_DRIVER
+	.debugfs_init = drm_vram_mm_debugfs_init,
+	.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
index 4b4f9ce74a84..aa32aad222c2 100644
@@ -150,6 +150,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)
 
Signature · 1 line
2.23.0
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

Re: [PATCH 3/4] drm/mgag200: Add workaround for HW that does not support 'startadd'

Hi ,

See below ,

Quoted 60 lines · Thomas Zimmermann

Hi

Am 26.11.19 um 10:37 schrieb Daniel Vetter:

Quoted 20 lines · Thomas Zimmermann
Quoted 8 lines

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.

(Not quite this patch, but pretty much the logic, so counts).

Fixes 81da87f63a1e ("drm: Replace drm_gem_vram_push_to_system() with kunmap + unpin")
Cc <[email protected]> # v5.3+

Also you need the stable line on both prep patches too. For next time around,

Quoted 8 lines
$ dim fixes 81da87f63a1e

will generate all the stuff you need, including a good set of suggested
Cc: you should have.

On the first 3 patches, with all that stuff added:

Thanks for the review.

Sorry for leaving out some of the tags. I wanted to wait for feedback before adding tested-by, fixes, stable. I'll split off patch 4 from the series and get 1 to 3 merged ASAP.

Best regards
Thomas

Quoted 17 lines

Please push these to drm-misc-next-fixes so they get backported as quickly as possible.
-Daniel

Quoted 12 lines

---
drivers/gpu/drm/mgag200/mgag200_drv.c | 36 ++++++++++++++++++++++++++- drivers/gpu/drm/mgag200/mgag200_drv.h | 3 +++

2 files changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +0 -0
index 397f8b0a9af8..d43951caeea0 100644
@@ -30,6 +30,8 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
 static struct drm_driver driver;
 
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/mgag200/mgag200_drv.c module_param_named(modeset, mgag200_modeset, int, 0400); · line 34

Quoted 3 lines
drivers/gpu/drm/mgag200/mgag200_drv.c +2 -0
 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},

I will have an additional list of vendor IDs (0x4852) I will provide in a follow up patch shortly . This fixes only 1 flavor of server.

Thank you .

Quoted 65 lines
Quoted 65 lines
Quoted 65 lines
drivers/gpu/drm/mgag200/mgag200_drv.c +33 -1
 	{ 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 },
@@ -60,6 +62,35 @@ static void mga_pci_remove(struct pci_dev *pdev)
 
 DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
 
+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,
@@ -71,7 +102,10 @@ static struct drm_driver driver = {
 	.major = DRIVER_MAJOR,
 	.minor = DRIVER_MINOR,
 	.patchlevel = DRIVER_PATCHLEVEL,
-	DRM_GEM_VRAM_DRIVER
+	.debugfs_init = drm_vram_mm_debugfs_init,
+	.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
index 4b4f9ce74a84..aa32aad222c2 100644
@@ -150,6 +150,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)
 
Quoted 13 lines
Quoted 4 lines
Quoted 3 lines
Signature · 1 line
2.23.0
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#7 lore raw

Re: [PATCH 3/4] drm/mgag200: Add workaround for HW that does not support 'startadd'

Hi John

Am 03.12.19 um 18:55 schrieb John Donnelly:

Quoted 65 lines

Hi ,

See below ,

Quoted 60 lines · Thomas Zimmermann

Hi

Am 26.11.19 um 10:37 schrieb Daniel Vetter:

Quoted 20 lines · Thomas Zimmermann
Quoted 8 lines

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.

(Not quite this patch, but pretty much the logic, so counts).

Fixes 81da87f63a1e ("drm: Replace drm_gem_vram_push_to_system() with kunmap + unpin")
Cc <[email protected]> # v5.3+

Also you need the stable line on both prep patches too. For next time around,

Quoted 8 lines
$ dim fixes 81da87f63a1e

will generate all the stuff you need, including a good set of suggested
Cc: you should have.

On the first 3 patches, with all that stuff added:

Thanks for the review.

Sorry for leaving out some of the tags. I wanted to wait for feedback before adding tested-by, fixes, stable. I'll split off patch 4 from the series and get 1 to 3 merged ASAP.

Best regards
Thomas

Quoted 17 lines

Please push these to drm-misc-next-fixes so they get backported as quickly as possible.
-Daniel

Quoted 12 lines

---
drivers/gpu/drm/mgag200/mgag200_drv.c | 36 ++++++++++++++++++++++++++- drivers/gpu/drm/mgag200/mgag200_drv.h | 3 +++

2 files changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +0 -0
index 397f8b0a9af8..d43951caeea0 100644
@@ -30,6 +30,8 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
 static struct drm_driver driver;
 
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/mgag200/mgag200_drv.c module_param_named(modeset, mgag200_modeset, int, 0400); · line 34

Quoted 3 lines
drivers/gpu/drm/mgag200/mgag200_drv.c +2 -0
 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},

I will have an additional list of vendor IDs (0x4852) I will provide in a follow up patch shortly . This fixes only 1 flavor of server.

Thank you for all the testing you do. We can add these ids as necessary.

Before, I posted a patch at [1] that prints an internal unique id. The id of your original test machine was 0x2 IIRC.

My guess is that the problem might be related to the chip's revision. If you have the option of booting your own kernels on all these machines, could you apply the patch and look for a pattern in these ids? Maybe only revision 0x2 is affected.

Best regards
Thomas

[1]
https://gitlab.freedesktop.org/drm/misc/uploads/1d5d9a75571c2bac71f80e0d2411e840/0001-drm-mgag200-Print-unique-revision-id-for-G200SE.patch

Quoted 88 lines

Thank you .

Quoted 78 lines
Quoted 69 lines
Quoted 68 lines
drivers/gpu/drm/mgag200/mgag200_drv.c +33 -1
 	{ 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 },
@@ -60,6 +62,35 @@ static void mga_pci_remove(struct pci_dev *pdev)
 
 DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
 
+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,
@@ -71,7 +102,10 @@ static struct drm_driver driver = {
 	.major = DRIVER_MAJOR,
 	.minor = DRIVER_MINOR,
 	.patchlevel = DRIVER_PATCHLEVEL,
-	DRM_GEM_VRAM_DRIVER
+	.debugfs_init = drm_vram_mm_debugfs_init,
+	.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
index 4b4f9ce74a84..aa32aad222c2 100644
@@ -150,6 +150,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)
 
Signature · 1 line
2.23.0
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#8 lore raw

Re: [PATCH 3/4] drm/mgag200: Add workaround for HW that does not support 'startadd'

Quoted 79 lines · Thomas Zimmermann

Hi John

Am 03.12.19 um 18:55 schrieb John Donnelly:

Quoted 65 lines

Hi ,

See below ,

Quoted 60 lines · Thomas Zimmermann

Hi

Am 26.11.19 um 10:37 schrieb Daniel Vetter:

Quoted 20 lines · Thomas Zimmermann
Quoted 8 lines

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.

(Not quite this patch, but pretty much the logic, so counts).

Fixes 81da87f63a1e ("drm: Replace drm_gem_vram_push_to_system() with kunmap + unpin")
Cc <[email protected]> # v5.3+

Also you need the stable line on both prep patches too. For next time around,

Quoted 8 lines
$ dim fixes 81da87f63a1e

will generate all the stuff you need, including a good set of suggested
Cc: you should have.

On the first 3 patches, with all that stuff added:

Thanks for the review.

Sorry for leaving out some of the tags. I wanted to wait for feedback before adding tested-by, fixes, stable. I'll split off patch 4 from the series and get 1 to 3 merged ASAP.

Best regards
Thomas

Quoted 17 lines

Please push these to drm-misc-next-fixes so they get backported as quickly as possible.
-Daniel

Quoted 12 lines

---
drivers/gpu/drm/mgag200/mgag200_drv.c | 36 ++++++++++++++++++++++++++- drivers/gpu/drm/mgag200/mgag200_drv.h | 3 +++

2 files changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +0 -0
index 397f8b0a9af8..d43951caeea0 100644
@@ -30,6 +30,8 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
 static struct drm_driver driver;
 
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/mgag200/mgag200_drv.c module_param_named(modeset, mgag200_modeset, int, 0400); · line 34

Quoted 3 lines
drivers/gpu/drm/mgag200/mgag200_drv.c +2 -0
 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},

I will have an additional list of vendor IDs (0x4852) I will provide in a follow up patch shortly . This fixes only 1 flavor of server.

Thank you for all the testing you do. We can add these ids as necessary.

Quoted 8 lines

Before, I posted a patch at [1] that prints an internal unique id. The id of your original test machine was 0x2 IIRC.

My guess is that the problem might be related to the chip's revision. If you have the option of booting your own kernels on all these machines, could you apply the patch and look for a pattern in these ids? Maybe only revision 0x2 is affected.

I've got an old bug I never got around to that has a comment from Matrox

"The issue is reproducible with G200e chip. The device ID is 0x0522."

so it might be a broader problem than we think.

Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#9 lore raw

Re: [PATCH 3/4] drm/mgag200: Add workaround for HW that does not support 'startadd'

Hi

Am 04.12.19 um 10:36 schrieb Dave Airlie:

Quoted 89 lines · Thomas Zimmermann
Quoted 79 lines

Hi John

Am 03.12.19 um 18:55 schrieb John Donnelly:

Quoted 65 lines

Hi ,

See below ,

Quoted 60 lines · Thomas Zimmermann

Hi

Am 26.11.19 um 10:37 schrieb Daniel Vetter:

Quoted 20 lines · Thomas Zimmermann
Quoted 8 lines

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.

(Not quite this patch, but pretty much the logic, so counts).

Fixes 81da87f63a1e ("drm: Replace drm_gem_vram_push_to_system() with kunmap + unpin")
Cc <[email protected]> # v5.3+

Also you need the stable line on both prep patches too. For next time around,

Quoted 8 lines
$ dim fixes 81da87f63a1e

will generate all the stuff you need, including a good set of suggested
Cc: you should have.

On the first 3 patches, with all that stuff added:

Thanks for the review.

Sorry for leaving out some of the tags. I wanted to wait for feedback before adding tested-by, fixes, stable. I'll split off patch 4 from the series and get 1 to 3 merged ASAP.

Best regards
Thomas

Quoted 17 lines

Please push these to drm-misc-next-fixes so they get backported as quickly as possible.
-Daniel

Quoted 12 lines

---
drivers/gpu/drm/mgag200/mgag200_drv.c | 36 ++++++++++++++++++++++++++- drivers/gpu/drm/mgag200/mgag200_drv.h | 3 +++

2 files changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +0 -0
index 397f8b0a9af8..d43951caeea0 100644
@@ -30,6 +30,8 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
 static struct drm_driver driver;
 
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/mgag200/mgag200_drv.c module_param_named(modeset, mgag200_modeset, int, 0400); · line 34

Quoted 3 lines
drivers/gpu/drm/mgag200/mgag200_drv.c +2 -0
 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},

I will have an additional list of vendor IDs (0x4852) I will provide in a follow up patch shortly . This fixes only 1 flavor of server.

Thank you for all the testing you do. We can add these ids as necessary.

Quoted 8 lines

Before, I posted a patch at [1] that prints an internal unique id. The id of your original test machine was 0x2 IIRC.

My guess is that the problem might be related to the chip's revision. If you have the option of booting your own kernels on all these machines, could you apply the patch and look for a pattern in these ids? Maybe only revision 0x2 is affected.

Quoted 5 lines

I've got an old bug I never got around to that has a comment from Matrox

"The issue is reproducible with G200e chip. The device ID is 0x0522."

so it might be a broader problem than we think.

Did they tell you a subvendor id? John reported that the internal revision id differs among affected machines. I'm thinking about flagging either Sun devices or all 0x0522 devices as broken.

Best regards
Thomas

Quoted 7 lines

Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#10 lore raw

Re: [PATCH 3/4] drm/mgag200: Add workaround for HW that does not support 'startadd'

Quoted 95 lines · Thomas Zimmermann

Hi

Am 04.12.19 um 10:36 schrieb Dave Airlie:

Quoted 91 lines · Thomas Zimmermann
Quoted 79 lines

Hi John

Am 03.12.19 um 18:55 schrieb John Donnelly:

Quoted 65 lines

Hi ,

See below ,

Quoted 60 lines · Thomas Zimmermann

Hi

Am 26.11.19 um 10:37 schrieb Daniel Vetter:

Quoted 20 lines · Thomas Zimmermann
Quoted 8 lines

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.

(Not quite this patch, but pretty much the logic, so counts).

Fixes 81da87f63a1e ("drm: Replace drm_gem_vram_push_to_system() with kunmap + unpin")
Cc <[email protected]> # v5.3+

Also you need the stable line on both prep patches too. For next time around,

Quoted 8 lines
$ dim fixes 81da87f63a1e

will generate all the stuff you need, including a good set of suggested
Cc: you should have.

On the first 3 patches, with all that stuff added:

Thanks for the review.

Sorry for leaving out some of the tags. I wanted to wait for feedback before adding tested-by, fixes, stable. I'll split off patch 4 from the series and get 1 to 3 merged ASAP.

Best regards
Thomas

Quoted 17 lines

Please push these to drm-misc-next-fixes so they get backported as quickly as possible.
-Daniel

Quoted 12 lines

---
drivers/gpu/drm/mgag200/mgag200_drv.c | 36 ++++++++++++++++++++++++++- drivers/gpu/drm/mgag200/mgag200_drv.h | 3 +++

2 files changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +0 -0
index 397f8b0a9af8..d43951caeea0 100644
@@ -30,6 +30,8 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
 static struct drm_driver driver;
 
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/mgag200/mgag200_drv.c module_param_named(modeset, mgag200_modeset, int, 0400); · line 34

Quoted 3 lines
drivers/gpu/drm/mgag200/mgag200_drv.c +2 -0
 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},

I will have an additional list of vendor IDs (0x4852) I will provide in a follow up patch shortly . This fixes only 1 flavor of server.

Thank you for all the testing you do. We can add these ids as necessary.

Quoted 8 lines

Before, I posted a patch at [1] that prints an internal unique id. The id of your original test machine was 0x2 IIRC.

My guess is that the problem might be related to the chip's revision. If you have the option of booting your own kernels on all these machines, could you apply the patch and look for a pattern in these ids? Maybe only revision 0x2 is affected.

I've got an old bug I never got around to that has a comment from Matrox

Quoted 7 lines
Quoted 3 lines

"The issue is reproducible with G200e chip. The device ID is 0x0522."

so it might be a broader problem than we think.

Did they tell you a subvendor id? John reported that the internal revision id differs among affected machines. I'm thinking about flagging either Sun devices or all 0x0522 devices as broken.

Well it was from Matrox themselves, so they are the vendor ID, it didn't sounds like subvendor mattered, though I expect the problem is the BMC firmware anyways, not sure if we can even know what ths is.

Dave.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#11 lore raw

Re: [PATCH 3/4] drm/mgag200: Add workaround for HW that does not support 'startadd'

Hi

Am 06.12.19 um 07:50 schrieb David Airlie:

Quoted 100 lines · Thomas Zimmermann
Quoted 99 lines

Hi

Am 04.12.19 um 10:36 schrieb Dave Airlie:

Quoted 94 lines · Thomas Zimmermann
Quoted 79 lines

Hi John

Am 03.12.19 um 18:55 schrieb John Donnelly:

Quoted 65 lines

Hi ,

See below ,

Quoted 60 lines · Thomas Zimmermann

Hi

Am 26.11.19 um 10:37 schrieb Daniel Vetter:

Quoted 20 lines · Thomas Zimmermann
Quoted 8 lines

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.

(Not quite this patch, but pretty much the logic, so counts).

Fixes 81da87f63a1e ("drm: Replace drm_gem_vram_push_to_system() with kunmap + unpin")
Cc <[email protected]> # v5.3+

Also you need the stable line on both prep patches too. For next time around,

Quoted 8 lines
$ dim fixes 81da87f63a1e

will generate all the stuff you need, including a good set of suggested
Cc: you should have.

On the first 3 patches, with all that stuff added:

Thanks for the review.

Sorry for leaving out some of the tags. I wanted to wait for feedback before adding tested-by, fixes, stable. I'll split off patch 4 from the series and get 1 to 3 merged ASAP.

Best regards
Thomas

Quoted 17 lines

Please push these to drm-misc-next-fixes so they get backported as quickly as possible.
-Daniel

Quoted 12 lines

---
drivers/gpu/drm/mgag200/mgag200_drv.c | 36 ++++++++++++++++++++++++++- drivers/gpu/drm/mgag200/mgag200_drv.h | 3 +++

2 files changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +0 -0
index 397f8b0a9af8..d43951caeea0 100644
@@ -30,6 +30,8 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
 static struct drm_driver driver;
 
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/mgag200/mgag200_drv.c module_param_named(modeset, mgag200_modeset, int, 0400); · line 34

Quoted 3 lines
drivers/gpu/drm/mgag200/mgag200_drv.c +2 -0
 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},

I will have an additional list of vendor IDs (0x4852) I will provide in a follow up patch shortly . This fixes only 1 flavor of server.

Thank you for all the testing you do. We can add these ids as necessary.

Quoted 8 lines

Before, I posted a patch at [1] that prints an internal unique id. The id of your original test machine was 0x2 IIRC.

My guess is that the problem might be related to the chip's revision. If you have the option of booting your own kernels on all these machines, could you apply the patch and look for a pattern in these ids? Maybe only revision 0x2 is affected.

I've got an old bug I never got around to that has a comment from Matrox

"The issue is reproducible with G200e chip. The device ID is 0x0522."

so it might be a broader problem than we think.

Quoted 7 lines
Quoted 3 lines

Did they tell you a subvendor id? John reported that the internal revision id differs among affected machines. I'm thinking about flagging either Sun devices or all 0x0522 devices as broken.

Well it was from Matrox themselves, so they are the vendor ID, it didn't sounds like subvendor mattered, though I expect the problem is the BMC firmware anyways, not sure if we can even know what ths is.

OK, thanks. I'll prepare a patch to flag all 0x0522 machines.

Best regards
Thomas

Quoted 8 lines

Dave.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#12 lore raw

PATCH 4/4 drm/mgag200: Add module parameter to pin all buffers at offset 0

In reply to Thomas Zimmermann

For hardware that does not interpret the startadd field correctly, add the module parameter 'hw_bug_no_startadd', which enables the workaround.

---
 drivers/gpu/drm/mgag200/mgag200_drv.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/mgag200/mgag200_drv.c +8 -0
index d43951caeea0..79836b09a54a 100644
@@ -27,6 +27,10 @@ int mgag200_modeset = -1;
 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
 module_param_named(modeset, mgag200_modeset, int, 0400);
 
+int mgag200_hw_bug_no_startadd = -1;
+MODULE_PARM_DESC(modeset, "HW does not interpret scanout-buffer start address correctly");
+module_param_named(hw_bug_no_startadd, mgag200_hw_bug_no_startadd, int, 0400);
+
 static struct drm_driver driver;
 
 static const struct pci_device_id pciidlist[] = {
@@ -64,6 +68,10 @@ DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
 
 static bool mgag200_pin_bo_at_0(const struct mga_device *mdev)
 {
+	if (!mgag200_hw_bug_no_startadd)
+		return false;
+	else if (mgag200_hw_bug_no_startadd > 0)
+		return true;
 	return mdev->flags & MGAG200_FLAG_HW_BUG_NO_STARTADD;
 }
 
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 4/4
#13 lore raw

Re: [PATCH 4/4] drm/mgag200: Add module parameter to pin all buffers at offset 0

Quoted 25 lines · Thomas Zimmermann

For hardware that does not interpret the startadd field correctly, add the module parameter 'hw_bug_no_startadd', which enables the workaround.

---
 drivers/gpu/drm/mgag200/mgag200_drv.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/mgag200/mgag200_drv.c +4 -0
index d43951caeea0..79836b09a54a 100644
@@ -27,6 +27,10 @@ int mgag200_modeset = -1;
 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
 module_param_named(modeset, mgag200_modeset, int, 0400);
 
+int mgag200_hw_bug_no_startadd = -1;
+MODULE_PARM_DESC(modeset, "HW does not interpret scanout-buffer start address correctly");
+module_param_named(hw_bug_no_startadd, mgag200_hw_bug_no_startadd, int, 0400);
+
 static struct drm_driver driver;
 
 static const struct pci_device_id pciidlist[] = {

drivers/gpu/drm/mgag200/mgag200_drv.c DEFINE_DRM_GEM_FOPS(mgag200_driver_fops); · line 70

Quoted 3 lines
drivers/gpu/drm/mgag200/mgag200_drv.c +0 -0
@@ -64,6 +68,10 @@ DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
 
 static bool mgag200_pin_bo_at_0(const struct mga_device *mdev)
 {

I'd add a infor printing if the module option is non-zero that people should submit a bug report if this fixes their issue. We don't want people fixing bugs with module options, stuff should work by default.

With that addressed:

Quoted 10 lines
drivers/gpu/drm/mgag200/mgag200_drv.c +4 -0
+	if (!mgag200_hw_bug_no_startadd)
+		return false;
+	else if (mgag200_hw_bug_no_startadd > 0)
+		return true;
 	return mdev->flags & MGAG200_FLAG_HW_BUG_NO_STARTADD;
 }
 
Signature · 1 line
2.23.0
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel