Skip to contentSkip to conversation

uxa: Restore old bo on failure

PATCH In review Lyude 2 participants 2 messages Mar 23, 2016

lore
Share & tools
lore

Lyude

author
#0 lore raw

PATCH 1/1 uxa: Restore old bo on failure

When we fail to do a modeset, we need to make sure that we restore the previous bo in the event that it's changed. Otherwise we'll crash the X server the next time we do a pageflip.

This fixes an issue with panning crashing the X server if a user tries to set a large panning resolution such as 5200x3200, and the GPU doesn't have enough memory to handle the bo due to being in UXA mode.

---
 src/uxa/intel_uxa.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
src/uxa/intel_uxa.c +5 -1
index 590ff5d..830f094 100644
@@ -1068,7 +1068,7 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen)
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 	PixmapPtr pixmap;
 	intel_screen_private *intel = intel_get_screen_private(scrn);
-	dri_bo *bo = intel->front_buffer;
+	dri_bo *bo = intel->front_buffer, *old_bo;
 	int old_width, old_height, old_pitch;
 
 	if (!uxa_resources_init(screen))
@@ -1081,6 +1081,7 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen)
 	old_width = pixmap->drawable.width;
 	old_height = pixmap->drawable.height;
 	old_pitch = pixmap->devKind;
+	old_bo = intel_uxa_get_pixmap_bo(pixmap);
 
 	if (!screen->ModifyPixmapHeader(pixmap,
 					scrn->virtualX,
@@ -1102,6 +1103,9 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen)
 err:
 	screen->ModifyPixmapHeader(pixmap,
 				   old_width, old_height, -1, -1, old_pitch, NULL);
+	if (old_bo)
+		intel_uxa_set_pixmap_bo(pixmap, old_bo);
+
 	return FALSE;
 }
 
Signature · 6 lines
2.5.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Lyude

When we fail to do a modeset, we need to make sure that we restore the previous bo in the event that it's changed. Otherwise we'll crash the X server the next time we do a pageflip.

This fixes an issue with panning crashing the X server if a user tries to set a large panning resolution such as 5200x3200, and the GPU doesn't have enough memory to handle the bo due to being in UXA mode.

Ok, the reference handling there is a little dodgy, but since this only occurs along one very specific callpath where we know that a ref is held for both new/old bo here, it all just works and so avoids having to dive into the mess that is set_pixmap_bo.

I'll valgrind the flip-vs-xrandr tests tomorrow to be sure. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx