[PATCH 4/4] xfree86/glamor: use glamor hooks to init/cleanup ports

Keith Packard keithp at keithp.com
Wed Aug 6 22:12:39 PDT 2014


Uses glamor_xv_init_port instead of open-coding that function at
server init time.

Uses the new ddFreePort hook to ensure that glamor resources are
freed at server reset time.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 hw/xfree86/glamor_egl/glamor_xf86_xv.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/hw/xfree86/glamor_egl/glamor_xf86_xv.c b/hw/xfree86/glamor_egl/glamor_xf86_xv.c
index 8535fa0..d3a3aab 100644
--- a/hw/xfree86/glamor_egl/glamor_xf86_xv.c
+++ b/hw/xfree86/glamor_egl/glamor_xf86_xv.c
@@ -114,6 +114,13 @@ glamor_xf86_xv_put_image(ScrnInfoPtr pScrn,
                                id, buf, width, height, sync, clipBoxes);
 }
 
+static void
+glamor_xf86_xv_free_port(ScrnInfoPtr scrn,
+                         void *data)
+{
+    glamor_xv_fini_port(data);
+}
+
 static XF86VideoEncodingRec DummyEncodingGLAMOR[1] = {
     {
      0,
@@ -166,20 +173,14 @@ glamor_xv_init(ScreenPtr screen, int num_texture_ports)
     adapt->PutImage = glamor_xf86_xv_put_image;
     adapt->ReputImage = NULL;
     adapt->QueryImageAttributes = glamor_xf86_xv_query_image_attributes;
+    adapt->FreePort = glamor_xf86_xv_free_port;
 
     for (i = 0; i < num_texture_ports; i++) {
         glamor_port_private *pPriv = &port_priv[i];
 
-        pPriv->brightness = 0;
-        pPriv->contrast = 0;
-        pPriv->saturation = 0;
-        pPriv->hue = 0;
-        pPriv->gamma = 1000;
-        pPriv->transform_index = 0;
-
-        REGION_NULL(pScreen, &pPriv->clip);
+        glamor_xv_init_port(pPriv);
 
-        adapt->pPortPrivates[i].ptr = (void *) (pPriv);
+        adapt->pPortPrivates[i].ptr = pPriv;
     }
     return adapt;
 }
-- 
2.0.1



More information about the xorg-devel mailing list