Skip to contentSkip to conversation

Destroy screen pixmap on screen close.

PATCH In review Keith Packard 2 participants 9 messages Jul 1, 2010 – Jul 3, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Destroy screen pixmap on screen close.

This avoids a memory leak on server reset.

---
 uxa/uxa.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
uxa/uxa.c +4 -2
index a9a705c..dcfaaa9 100644
@@ -1,7 +1,7 @@
 /*
- * Copyright � 2001 Keith Packard
+ * Copyright © 2001 Keith Packard
  *
- * Partly based on code that is Copyright � The XFree86 Project Inc.
+ * Partly based on code that is Copyright © The XFree86 Project Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -381,6 +381,8 @@ static Bool uxa_close_screen(int i, ScreenPtr pScreen)
 
 	uxa_glyphs_fini(pScreen);
 
+	(void) (*pScreen->DestroyPixmap) (pScreen->devPrivate);
+	pScreen->devPrivate = NULL;
 	pScreen->CreateGC = uxa_screen->SavedCreateGC;
 	pScreen->CloseScreen = uxa_screen->SavedCloseScreen;
 	pScreen->GetImage = uxa_screen->SavedGetImage;
Signature · 1 line
1.7.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#1 lore raw
Quoted 22 lines · Keith Packard

This avoids a memory leak on server reset.

---
 uxa/uxa.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
uxa/uxa.c +2 -2
index a9a705c..dcfaaa9 100644
@@ -1,7 +1,7 @@
 /*
- * Copyright � 2001 Keith Packard
+ * Copyright © 2001 Keith Packard
  *
- * Partly based on code that is Copyright � The XFree86 Project Inc.
+ * Partly based on code that is Copyright © The XFree86 Project Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that

uxa/uxa.c static Bool uxa_close_screen(int i, ScreenPtr pScreen) · line 385

Quoted 5 lines
uxa/uxa.c +2 -0
@@ -381,6 +381,8 @@ static Bool uxa_close_screen(int i, ScreenPtr pScreen)
 
 	uxa_glyphs_fini(pScreen);
 
+	(void) (*pScreen->DestroyPixmap) (pScreen->devPrivate);
+	pScreen->devPrivate = NULL;

This looks like the responsibility of miCloseScreen(). Are we failing to chain up properly?

Currently we have

uxa_close_screen -> PictureCloseScreen -> fbCloseScreen

and fbCloseScreen supersedes miCloseScreen. So should it not be fbCloseScreen that calls miCloseScreen, since fb has taken over the management of the mi interface?

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

#2 lore raw
In reply to Keith Packard
Quoted 22 lines · Keith Packard

This avoids a memory leak on server reset.

---
 uxa/uxa.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
uxa/uxa.c +2 -2
index a9a705c..dcfaaa9 100644
@@ -1,7 +1,7 @@
 /*
- * Copyright � 2001 Keith Packard
+ * Copyright © 2001 Keith Packard
  *
- * Partly based on code that is Copyright � The XFree86 Project Inc.
+ * Partly based on code that is Copyright © The XFree86 Project Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that

uxa/uxa.c static Bool uxa_close_screen(int i, ScreenPtr pScreen) · line 385

Quoted 5 lines
uxa/uxa.c +2 -0
@@ -381,6 +381,8 @@ static Bool uxa_close_screen(int i, ScreenPtr pScreen)
 
 	uxa_glyphs_fini(pScreen);
 
+	(void) (*pScreen->DestroyPixmap) (pScreen->devPrivate);
+	pScreen->devPrivate = NULL;

This looks like the responsibility of miCloseScreen(). Are we failing to chain up properly?

Currently we have

uxa_close_screen -> PictureCloseScreen -> fbCloseScreen

and fbCloseScreen supersedes miCloseScreen. So should it not be fbCloseScreen that calls miCloseScreen, since fb has taken over the management of the mi interface?

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 2 lines · Chris Wilson

This looks like the responsibility of miCloseScreen(). Are we failing to chain up properly?

I don't think miCloseScreen (or fbCloseScreen) can do this -- before we're called, rendering may not have been finished, after we're called, the acceleration code is shut down and pixmaps cannot be freed.

Signature · 1 line
[email protected]

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

#4 lore raw
In reply to Chris Wilson
Quoted 2 lines · Chris Wilson

This looks like the responsibility of miCloseScreen(). Are we failing to chain up properly?

I don't think miCloseScreen (or fbCloseScreen) can do this -- before we're called, rendering may not have been finished, after we're called, the acceleration code is shut down and pixmaps cannot be freed.

Signature · 1 line
[email protected]

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 8 lines · Keith Packard
Quoted 2 lines · Chris Wilson

This looks like the responsibility of miCloseScreen(). Are we failing to chain up properly?

I don't think miCloseScreen (or fbCloseScreen) can do this -- before we're called, rendering may not have been finished, after we're called, the acceleration code is shut down and pixmaps cannot be freed.

That sounds true, and deserves a comment in the code. It doesn't explain why fbCloseScreen() calls free(screen->devPrivate) instead of miCloseScreen() and causing the leak in the first place... :)

Signature · 7 lines
Chris Wilson, Intel Open Source Technology Centre

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
--
#6 lore raw
In reply to Keith Packard
Quoted 8 lines · Keith Packard
Quoted 2 lines · Chris Wilson

This looks like the responsibility of miCloseScreen(). Are we failing to chain up properly?

I don't think miCloseScreen (or fbCloseScreen) can do this -- before we're called, rendering may not have been finished, after we're called, the acceleration code is shut down and pixmaps cannot be freed.

That sounds true, and deserves a comment in the code. It doesn't explain why fbCloseScreen() calls free(screen->devPrivate) instead of miCloseScreen() and causing the leak in the first place... :)

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#7 lore raw
Quoted 6 lines · Chris Wilson
Quoted 5 lines · Keith Packard
Quoted 2 lines · Chris Wilson

This looks like the responsibility of miCloseScreen(). Are we failing to chain up properly?

Quoted 7 lines
Quoted 3 lines

I don't think miCloseScreen (or fbCloseScreen) can do this -- before we're called, rendering may not have been finished, after we're called, the acceleration code is shut down and pixmaps cannot be freed.

That sounds true, and deserves a comment in the code. It doesn't explain why fbCloseScreen() calls free(screen->devPrivate) instead of miCloseScreen() and causing the leak in the first place... :)

yeah, miCloseScreen frees the pixmap, but that's too late...

Signature · 1 line
[email protected]

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

#8 lore raw
In reply to Chris Wilson
Quoted 6 lines · Chris Wilson
Quoted 5 lines · Keith Packard
Quoted 2 lines · Chris Wilson

This looks like the responsibility of miCloseScreen(). Are we failing to chain up properly?

Quoted 7 lines
Quoted 3 lines

I don't think miCloseScreen (or fbCloseScreen) can do this -- before we're called, rendering may not have been finished, after we're called, the acceleration code is shut down and pixmaps cannot be freed.

That sounds true, and deserves a comment in the code. It doesn't explain why fbCloseScreen() calls free(screen->devPrivate) instead of miCloseScreen() and causing the leak in the first place... :)

yeah, miCloseScreen frees the pixmap, but that's too late...

Signature · 1 line
[email protected]

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx