[PATCH 16/16] xv: Remove the pScreen from the XV encodings.

Eric Anholt eric at anholt.net
Fri Jul 18 10:32:33 PDT 2014


It was never used, and it meant a bunch of pointless frobbing of
structure members between the DDX and DIX.

Signed-off-by: Eric Anholt <eric at anholt.net>
---
 Xext/xvdix.h                      |  1 -
 hw/kdrive/ephyr/ephyr_glamor_xv.c |  2 +-
 hw/kdrive/ephyr/ephyrvideo.c      |  2 +-
 hw/kdrive/src/kxv.c               | 20 ++++++--------------
 hw/kdrive/src/kxv.h               |  9 +--------
 hw/xfree86/common/xf86xv.c        | 20 ++++++--------------
 hw/xfree86/common/xf86xv.h        |  7 +------
 7 files changed, 16 insertions(+), 45 deletions(-)

diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index e67a3c7..527ceb9 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -100,7 +100,6 @@ typedef struct _XvPortNotifyRec {
 
 typedef struct {
     int id;
-    ScreenPtr pScreen;
     char *name;
     unsigned short width, height;
     XvRationalRec rate;
diff --git a/hw/kdrive/ephyr/ephyr_glamor_xv.c b/hw/kdrive/ephyr/ephyr_glamor_xv.c
index b9c3464..96946b0 100644
--- a/hw/kdrive/ephyr/ephyr_glamor_xv.c
+++ b/hw/kdrive/ephyr/ephyr_glamor_xv.c
@@ -110,7 +110,7 @@ ephyr_glamor_xv_init(ScreenPtr screen)
 {
     KdVideoAdaptorRec *adaptor;
     glamor_port_private *port_privates;
-    KdVideoEncodingRec encoding = {
+    XvEncodingRec encoding = {
         0,
         "XV_IMAGE",
         /* These sizes should probably be GL_MAX_TEXTURE_SIZE instead
diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c
index ab18c7a..03f0793 100644
--- a/hw/kdrive/ephyr/ephyrvideo.c
+++ b/hw/kdrive/ephyr/ephyrvideo.c
@@ -320,7 +320,7 @@ translate_video_encodings(KdVideoAdaptorPtr adaptor,
     encoding_it = xcb_xv_query_encodings_info_iterator(reply);
     for (i = 0; i < adaptor->nEncodings; i++) {
         xcb_xv_encoding_info_t *encoding_info = encoding_it.data;
-        KdVideoEncodingPtr encoding = &adaptor->pEncodings[i];
+        XvEncodingPtr encoding = &adaptor->pEncodings[i];
 
         encoding->id = encoding_info->encoding;
         encoding->name = strndup(xcb_xv_encoding_info_name(encoding_info),
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index f979e1f..7e006ac 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -211,8 +211,6 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr infoPtr, int number)
     KdVideoFormatPtr formatPtr;
     XvFormatPtr pFormat, pf;
     int numFormat, totFormat;
-    KdVideoEncodingPtr encodingPtr;
-    XvEncodingPtr pEncode, pe;
     int numVisuals;
     VisualPtr pVisual;
     int i;
@@ -271,20 +269,14 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr infoPtr, int number)
         pa->name = strdup(adaptorPtr->name);
 
         if (adaptorPtr->nEncodings &&
-            (pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
-
-            for (pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
-                 i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) {
-                pe->id = encodingPtr->id;
-                pe->pScreen = pScreen;
-                pe->name = strdup(encodingPtr->name);
-                pe->width = encodingPtr->width;
-                pe->height = encodingPtr->height;
-                pe->rate.numerator = encodingPtr->rate.numerator;
-                pe->rate.denominator = encodingPtr->rate.denominator;
+            (pa->pEncodings = calloc(adaptorPtr->nEncodings,
+                                     sizeof(XvEncodingRec)))) {
+            memcpy(pa->pEncodings, adaptorPtr->pEncodings,
+                   sizeof(XvEncodingRec) * adaptorPtr->nEncodings);
+            for (i = 0; i < adaptorPtr->nEncodings; i++) {
+                pa->pEncodings[i].name = strdup(adaptorPtr->pEncodings[i].name);
             }
             pa->nEncodings = adaptorPtr->nEncodings;
-            pa->pEncodings = pEncode;
         }
 
         if (adaptorPtr->nImages &&
diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
index b997299..10aeb50 100644
--- a/hw/kdrive/src/kxv.h
+++ b/hw/kdrive/src/kxv.h
@@ -107,13 +107,6 @@ typedef enum {
 /*** this is what the driver needs to fill out ***/
 
 typedef struct {
-    int id;
-    const char *name;
-    unsigned short width, height;
-    XvRationalRec rate;
-} KdVideoEncodingRec, *KdVideoEncodingPtr;
-
-typedef struct {
     char depth;
     short class;
 } KdVideoFormatRec, *KdVideoFormatPtr;
@@ -123,7 +116,7 @@ typedef struct {
     int flags;
     const char *name;
     int nEncodings;
-    KdVideoEncodingPtr pEncodings;
+    XvEncodingPtr pEncodings;
     int nFormats;
     KdVideoFormatPtr pFormats;
     int nPorts;
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index d342bde..dd03923 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -320,8 +320,6 @@ xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
     XF86VideoFormatPtr formatPtr;
     XvFormatPtr pFormat, pf;
     int numFormat, totFormat;
-    XF86VideoEncodingPtr encodingPtr;
-    XvEncodingPtr pEncode, pe;
     int numVisuals;
     VisualPtr pVisual;
     int i;
@@ -380,20 +378,14 @@ xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
         pa->name = strdup(adaptorPtr->name);
 
         if (adaptorPtr->nEncodings &&
-            (pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
-
-            for (pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
-                 i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) {
-                pe->id = encodingPtr->id;
-                pe->pScreen = pScreen;
-                pe->name = strdup(encodingPtr->name);
-                pe->width = encodingPtr->width;
-                pe->height = encodingPtr->height;
-                pe->rate.numerator = encodingPtr->rate.numerator;
-                pe->rate.denominator = encodingPtr->rate.denominator;
+            (pa->pEncodings = calloc(adaptorPtr->nEncodings,
+                                     sizeof(XvEncodingRec)))) {
+            memcpy(pa->pEncodings, adaptorPtr->pEncodings,
+                   sizeof(XvEncodingRec) * adaptorPtr->nEncodings);
+            for (i = 0; i < adaptorPtr->nEncodings; i++) {
+                pa->pEncodings[i].name = strdup(adaptorPtr->pEncodings[i].name);
             }
             pa->nEncodings = adaptorPtr->nEncodings;
-            pa->pEncodings = pEncode;
         }
 
         if (adaptorPtr->nImages &&
diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index c6455d7..61b2818 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -106,12 +106,7 @@ typedef enum {
 
 /*** this is what the driver needs to fill out ***/
 
-typedef struct {
-    int id;
-    const char *name;
-    unsigned short width, height;
-    XvRationalRec rate;
-} XF86VideoEncodingRec, *XF86VideoEncodingPtr;
+typedef XvEncodingRec XF86VideoEncodingRec,  *XF86VideoEncodingPtr;
 
 typedef struct {
     char depth;
-- 
2.0.1



More information about the xorg-devel mailing list