Skip to contentSkip to conversation

Fixes for mgag200 cursors

PATCH In review Thomas Zimmermann 2 participants 6 messages Jul 23, 2019 – Jul 24, 2019

Subsystems (3)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

cover Fixes for mgag200 cursors

This patch set fixes a number of bugs that where introduced by the recent changes to mgag200's handling of cursor BOs.

Thomas Zimmermann (3):
drm/mgag200: Pin displayed cursor BO to video memory drm/mgag200: Set cursor scanout address to correct BO drm/mgag200: Don't unpin the current cursor image's buffer.

 drivers/gpu/drm/mgag200/mgag200_cursor.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--
2.22.0

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

author maintainer
#1 lore raw

PATCH 1/3 drm/mgag200: Pin displayed cursor BO to video memory

The cursor BO has to be pinned to video ram while it's being displayed. With the current code, the BO might be pinned to system memory instead. The patch fixes this problem.

Fixes 94dc57b10399 ("drm/mgag200: Rewrite cursor handling")
Cc Gerd Hoffmann <[email protected]>
Cc Dave Airlie <[email protected]>
---
 drivers/gpu/drm/mgag200/mgag200_cursor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_cursor.c +1 -1
index 13f32df7e357..a19975931c6d 100644
@@ -99,7 +99,7 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
 	}
 
 	/* Pin and map up-coming buffer to write colour indices */
-	ret = drm_gem_vram_pin(pixels_next, 0);
+	ret = drm_gem_vram_pin(pixels_next, DRM_GEM_VRAM_PL_FLAG_VRAM);
 	if (ret) {
 		dev_err(&dev->pdev->dev,
 			"failed to pin cursor buffer: %d\n", ret);
Signature · 6 lines
2.22.0

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

PATCH 2/3 drm/mgag200: Set cursor scanout address to correct BO

In reply to Thomas Zimmermann

The hardware requires the correct memory address of the buffer. Currently the same BO's address is programmed unconditionally, so only every second cursor update actually becomes visible.

Fixes 94dc57b10399 ("drm/mgag200: Rewrite cursor handling")
Cc Gerd Hoffmann <[email protected]>
Cc Dave Airlie <[email protected]>
---
 drivers/gpu/drm/mgag200/mgag200_cursor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_cursor.c +1 -1
index a19975931c6d..f11b862cbed9 100644
@@ -112,7 +112,7 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
 			"failed to kmap cursor updates: %d\n", ret);
 		goto err_drm_gem_vram_unpin_dst;
 	}
-	gpu_addr = drm_gem_vram_offset(pixels_2);
+	gpu_addr = drm_gem_vram_offset(pixels_next);
 	if (gpu_addr < 0) {
 		ret = (int)gpu_addr;
 		dev_err(&dev->pdev->dev,
Signature · 6 lines
2.22.0

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

PATCH 3/3 drm/mgag200: Don't unpin the current cursor image's buffer.

In reply to Thomas Zimmermann

Currently the displayed cursor buffer might be evicted from video memory. Not unpinning the BO fixes this problem. At this point, pixels_current also references the BO and it will be unpinned during the next cursor update.

Fixes 94dc57b10399 ("drm/mgag200: Rewrite cursor handling")
Cc Gerd Hoffmann <[email protected]>
Cc Dave Airlie <[email protected]>
---
 drivers/gpu/drm/mgag200/mgag200_cursor.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_cursor.c +0 -1
index f11b862cbed9..289ce3e29032 100644
@@ -213,7 +213,6 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
 	mdev->cursor.pixels_current = pixels_next;
 
 	drm_gem_vram_kunmap(pixels_next);
-	drm_gem_vram_unpin(pixels_next);
 	drm_gem_vram_kunmap(gbo);
 	drm_gem_vram_unpin(gbo);
 	drm_gem_object_put_unlocked(obj);
Signature · 6 lines
2.22.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on the v1 series
#4 lore raw
In reply to Thomas Zimmermann

Hi Thomas.

Quoted 7 lines · Thomas Zimmermann

This patch set fixes a number of bugs that where introduced by the recent changes to mgag200's handling of cursor BOs.

Thomas Zimmermann (3):
drm/mgag200: Pin displayed cursor BO to video memory drm/mgag200: Set cursor scanout address to correct BO drm/mgag200: Don't unpin the current cursor image's buffer.

Browsed the fixes - looks good to me.

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

author maintainer
#5 lore raw

Am 23.07.19 um 10:40 schrieb Sam Ravnborg:

Quoted 6 lines

Hi Thomas.

Quoted 3 lines · Thomas Zimmermann

This patch set fixes a number of bugs that where introduced by the recent changes to mgag200's handling of cursor BOs.

Quoted 9 lines
Quoted 4 lines

Thomas Zimmermann (3):
drm/mgag200: Pin displayed cursor BO to video memory drm/mgag200: Set cursor scanout address to correct BO drm/mgag200: Don't unpin the current cursor image's buffer.

Browsed the fixes - looks good to me.

Thanks!

Signature · 5 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)

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