xf86-video-intel: 2 commits - src/intel_video.c uxa/uxa.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Jul 12 09:42:21 PDT 2010


 src/intel_video.c |   15 +++++++++------
 uxa/uxa.c         |   11 +++++++++--
 2 files changed, 18 insertions(+), 8 deletions(-)

New commits:
commit 56e5816252afbc7dd555c308ca678fce7ee584cc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jul 12 17:26:37 2010 +0100

    video: Copy DummyEncoding into each adapter.
    
    As we use the static DummyEncoding and may attempt to modify it for each
    adaptor (on each device), we should use copies instead.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_video.c b/src/intel_video.c
index 8be9dfb..11fd7fa 100644
--- a/src/intel_video.c
+++ b/src/intel_video.c
@@ -128,7 +128,7 @@ static Atom xvSyncToVblank;
 #endif
 
 /* client libraries expect an encoding */
-static XF86VideoEncodingRec DummyEncoding[1] = {
+static const XF86VideoEncodingRec DummyEncoding[1] = {
 	{
 	 0,
 	 "XV_IMAGE",
@@ -423,16 +423,18 @@ static XF86VideoAdaptorPtr I830SetupImageVideoOverlay(ScreenPtr screen)
 
 	OVERLAY_DEBUG("I830SetupImageVideoOverlay\n");
 
-	if (!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
-			      sizeof(intel_adaptor_private) + sizeof(DevUnion))))
+	if (!(adapt = calloc(1,
+			     sizeof(XF86VideoAdaptorRec) +
+			     sizeof(intel_adaptor_private) +
+			     sizeof(DevUnion))))
 		return NULL;
 
 	adapt->type = XvWindowMask | XvInputMask | XvImageMask;
 	adapt->flags = VIDEO_OVERLAID_IMAGES /*| VIDEO_CLIP_TO_VIEWPORT */ ;
 	adapt->name = "Intel(R) Video Overlay";
 	adapt->nEncodings = 1;
-	adapt->pEncodings = DummyEncoding;
-	/* update the DummyEncoding for these two chipsets */
+	adapt->pEncodings = xnfalloc(sizeof(DummyEncoding));
+	memcpy(adapt->pEncodings, DummyEncoding, sizeof(DummyEncoding));
 	if (IS_845G(intel) || IS_I830(intel)) {
 		adapt->pEncodings->width = IMAGE_MAX_WIDTH_LEGACY;
 		adapt->pEncodings->height = IMAGE_MAX_HEIGHT_LEGACY;
@@ -550,7 +552,8 @@ static XF86VideoAdaptorPtr I830SetupImageVideoTextured(ScreenPtr screen)
 	adapt->flags = 0;
 	adapt->name = "Intel(R) Textured Video";
 	adapt->nEncodings = 1;
-	adapt->pEncodings = DummyEncoding;
+	adapt->pEncodings = xnfalloc(sizeof(DummyEncoding));
+	memcpy(adapt->pEncodings, DummyEncoding, sizeof(DummyEncoding));
 	adapt->nFormats = NUM_FORMATS;
 	adapt->pFormats = Formats;
 	adapt->nPorts = nports;
commit e30f0338fbf894fa3fdab20f4f9a97495cd341da
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Jul 1 09:56:40 2010 -0400

    Destroy screen pixmap on screen close.
    
    This avoids a memory leak on server reset.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    [ickle: Added comments from Keith that explain the necessity of
    destroying the pixmap ourselves and why chaining up in this instance is
    not the correct approach.]
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/uxa/uxa.c b/uxa/uxa.c
index 2321a7f..4a5907e 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -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
@@ -385,6 +385,13 @@ static Bool uxa_close_screen(int i, ScreenPtr pScreen)
 
 	uxa_glyphs_fini(pScreen);
 
+	/* Destroy the pixmap created by miScreenInit() *before* chaining up as
+	 * we finalize ourselves here and so this is the last chance we have of
+	 * releasing our resources associated with the Pixmap. So do it first.
+	 */
+	(void) (*pScreen->DestroyPixmap) (pScreen->devPrivate);
+	pScreen->devPrivate = NULL;
+
 	pScreen->CreateGC = uxa_screen->SavedCreateGC;
 	pScreen->CloseScreen = uxa_screen->SavedCloseScreen;
 	pScreen->GetImage = uxa_screen->SavedGetImage;


More information about the xorg-commit mailing list