[PATCH 10/17] ephyr: Remove the host/server split for XV formats.

Eric Anholt eric at anholt.net
Mon Aug 26 13:26:16 PDT 2013


---
 hw/kdrive/ephyr/ephyrhostvideo.c | 25 -------------------------
 hw/kdrive/ephyr/ephyrhostvideo.h | 11 -----------
 hw/kdrive/ephyr/ephyrvideo.c     | 22 +++++++++++++++-------
 3 files changed, 15 insertions(+), 43 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c
index c1b7a97..82a40a0 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -43,31 +43,6 @@
 #define FALSE 0
 #endif /*FALSE*/
 
-EphyrHostVideoFormat*
-ephyrHostXVAdaptorGetVideoFormats (const xcb_xv_adaptor_info_t *a_this,
-                                   int *a_nb_formats)
-{
-    EphyrHostVideoFormat *formats = NULL;
-    int nb_formats = 0, i = 0;
-    xcb_xv_format_t *format = xcb_xv_adaptor_info_formats(a_this);
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_this, NULL);
-
-    nb_formats = a_this->num_formats;
-    formats = calloc(nb_formats, sizeof(EphyrHostVideoFormat));
-    for (i = 0; i < nb_formats; i++) {
-        xcb_visualtype_t *visual =
-            xcb_aux_find_visual_by_id(
-                    xcb_aux_get_screen(hostx_get_xcbconn(), hostx_get_screen()),
-                    format[i].visual);
-        formats[i].depth = format[i].depth;
-        formats[i].visual_class = visual->_class;
-    }
-    if (a_nb_formats)
-        *a_nb_formats = nb_formats;
-    return formats;
-}
-
 Bool
 ephyrHostXVQueryEncodings(int a_port_id,
                           EphyrHostEncoding ** a_encodings,
diff --git a/hw/kdrive/ephyr/ephyrhostvideo.h b/hw/kdrive/ephyr/ephyrhostvideo.h
index 6fa8f7a..d37af00 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.h
+++ b/hw/kdrive/ephyr/ephyrhostvideo.h
@@ -31,11 +31,6 @@
 #include <xcb/xv.h>
 #include <X11/Xdefs.h>
 
-typedef struct _EphyrHostVideoFormat {
-    char depth;
-    short visual_class;
-} EphyrHostVideoFormat;
-
 typedef struct _EphyrHostRational {
     int numerator;
     int denominator;
@@ -82,12 +77,6 @@ typedef struct {
 } EphyrHostBox;
 
 /*
- * host adaptor
- */
-EphyrHostVideoFormat *ephyrHostXVAdaptorGetVideoFormats
-    (const xcb_xv_adaptor_info_t *a_this, int *a_nb_formats);
-
-/*
  * encoding
  */
 Bool ephyrHostXVQueryEncodings(int a_port_id,
diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c
index 62f697c..9765ef9 100644
--- a/hw/kdrive/ephyr/ephyrvideo.c
+++ b/hw/kdrive/ephyr/ephyrvideo.c
@@ -401,10 +401,9 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
 {
     xcb_connection_t *conn = hostx_get_xcbconn();
     xcb_screen_t *xscreen = xcb_aux_get_screen(conn, hostx_get_screen());
-    EphyrHostVideoFormat *video_formats = NULL;
     EphyrHostEncoding *encodings = NULL;
     EphyrHostImageFormat *image_formats = NULL;
-    int num_video_formats = 0, base_port_id = 0,
+    int base_port_id = 0,
         num_formats = 0, i = 0, port_priv_offset = 0;
     unsigned num_encodings = 0;
     Bool is_ok = FALSE;
@@ -425,6 +424,7 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
             goto out;
         }
     }
+
     if (a_this->host_adaptors)
         a_this->num_adaptors = a_this->host_adaptors->num_adaptors;
     if (a_this->num_adaptors < 0) {
@@ -447,6 +447,7 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
     it = xcb_xv_query_adaptors_info_iterator(a_this->host_adaptors);
     for (i = 0; i < a_this->num_adaptors; i++) {
         xcb_xv_adaptor_info_t *cur_host_adaptor = it.data;
+        xcb_xv_format_t *format = xcb_xv_adaptor_info_formats(cur_host_adaptor);
         int j = 0;
 
         a_this->adaptors[i].nPorts = cur_host_adaptor->num_ports;
@@ -480,11 +481,18 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
         a_this->adaptors[i].nEncodings = num_encodings;
         a_this->adaptors[i].pEncodings =
             videoEncodingDup(encodings, num_encodings);
-        video_formats = (EphyrHostVideoFormat *)
-            ephyrHostXVAdaptorGetVideoFormats(cur_host_adaptor,
-                                              &num_video_formats);
-        a_this->adaptors[i].pFormats = (KdVideoFormatPtr) video_formats;
-        a_this->adaptors[i].nFormats = num_video_formats;
+
+        a_this->adaptors[i].nFormats = cur_host_adaptor->num_formats;
+        a_this->adaptors[i].pFormats =
+            calloc(cur_host_adaptor->num_formats,
+                   sizeof(*a_this->adaptors[i].pFormats));
+        for (j = 0; j < cur_host_adaptor->num_formats; j++) {
+            xcb_visualtype_t *visual =
+                xcb_aux_find_visual_by_id(xscreen, format[j].visual);
+            a_this->adaptors[i].pFormats[j].depth = format[j].depth;
+            a_this->adaptors[i].pFormats[j].class = visual->_class;
+        }
+
         a_this->adaptors[i].pPortPrivates =
             calloc(a_this->adaptors[i].nPorts,
                    sizeof(DevUnion) + sizeof(EphyrPortPriv));
-- 
1.8.4.rc3



More information about the xorg-devel mailing list