[PATCH 06/17] ephyr: Remove some pointless indirection in the XV code.

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


Now that we have XCB on the server side, we don't need to split these
functions out.
---
 hw/kdrive/ephyr/ephyrhostvideo.c | 54 ----------------------------------------
 hw/kdrive/ephyr/ephyrhostvideo.h | 13 ----------
 hw/kdrive/ephyr/ephyrvideo.c     | 23 ++++++-----------
 3 files changed, 7 insertions(+), 83 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c
index ea5fc9b..9a5a3ba 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -43,12 +43,6 @@
 #define FALSE 0
 #endif /*FALSE*/
 
-
-void
-ephyrHostXVInit(void)
-{
-}
-
 Bool
 ephyrHostXVQueryAdaptors (xcb_xv_query_adaptors_reply_t **a_adaptors)
 {
@@ -78,19 +72,6 @@ out:
     return is_ok;
 }
 
-void
-ephyrHostXVAdaptorArrayDelete (xcb_xv_query_adaptors_reply_t *a_adaptors)
-{
-    free (a_adaptors);
-}
-
-int
-ephyrHostXVAdaptorArrayGetSize (const xcb_xv_query_adaptors_reply_t *a_this)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
-    return a_this->num_adaptors;
-}
-
 xcb_xv_adaptor_info_t *
 ephyrHostXVAdaptorArrayAt(const xcb_xv_query_adaptors_reply_t *a_this,
                           int a_index)
@@ -156,20 +137,6 @@ ephyrHostXVAdaptorGetVideoFormats (const xcb_xv_adaptor_info_t *a_this,
     return formats;
 }
 
-int
-ephyrHostXVAdaptorGetNbPorts(const xcb_xv_adaptor_info_t *a_this)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
-
-    return a_this->num_ports;
-}
-
-int
-ephyrHostXVAdaptorGetFirstPortID (const xcb_xv_adaptor_info_t *a_this)
-{
-    return a_this->base_id;
-}
-
 Bool
 ephyrHostXVAdaptorHasPutVideo (const xcb_xv_adaptor_info_t *a_this,
                                Bool *a_result)
@@ -538,12 +505,6 @@ ephyrHostGetAtomName(int a_atom)
     return ret;
 }
 
-void
-ephyrHostFree(void *a_pointer)
-{
-    free(a_pointer);
-}
-
 Bool
 ephyrHostXVPutImage(int a_screen_num,
                     int a_port_id,
@@ -732,18 +693,3 @@ ephyrHostXVGetStill(int a_screen_num, int a_port_id,
 
     return TRUE;
 }
-
-Bool
-ephyrHostXVStopVideo(int a_screen_num, int a_port_id)
-{
-    xcb_connection_t *conn = hostx_get_xcbconn();
-
-    EPHYR_RETURN_VAL_IF_FAIL(conn, FALSE);
-
-    EPHYR_LOG("enter\n");
-
-    xcb_xv_stop_video(conn, a_port_id, hostx_get_window (a_screen_num));
-
-    EPHYR_LOG("leave\n");
-    return TRUE;
-}
diff --git a/hw/kdrive/ephyr/ephyrhostvideo.h b/hw/kdrive/ephyr/ephyrhostvideo.h
index b946add..56a7359 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.h
+++ b/hw/kdrive/ephyr/ephyrhostvideo.h
@@ -82,16 +82,10 @@ typedef struct {
     unsigned short x1, y1, x2, y2;
 } EphyrHostBox;
 
-void ephyrHostXVInit(void);
-
-void ephyrHostFree(void *a_pointer);
-
 /*
  * host adaptor array
  */
 Bool ephyrHostXVQueryAdaptors(xcb_xv_query_adaptors_reply_t **a_adaptors);
-void ephyrHostXVAdaptorArrayDelete(xcb_xv_query_adaptors_reply_t *a_adaptors);
-int ephyrHostXVAdaptorArrayGetSize(const xcb_xv_query_adaptors_reply_t *a_this);
 xcb_xv_adaptor_info_t* ephyrHostXVAdaptorArrayAt(const xcb_xv_query_adaptors_reply_t *a_this,
                                                  int a_index);
 
@@ -103,8 +97,6 @@ char ephyrHostXVAdaptorGetType(const xcb_xv_adaptor_info_t *a_this);
 char* ephyrHostXVAdaptorGetName(const xcb_xv_adaptor_info_t *a_this);
 EphyrHostVideoFormat *ephyrHostXVAdaptorGetVideoFormats
     (const xcb_xv_adaptor_info_t *a_this, int *a_nb_formats);
-int ephyrHostXVAdaptorGetNbPorts(const xcb_xv_adaptor_info_t *a_this);
-int ephyrHostXVAdaptorGetFirstPortID(const xcb_xv_adaptor_info_t *a_this);
 
 Bool ephyrHostXVAdaptorHasPutVideo(const xcb_xv_adaptor_info_t *a_this,
                                    Bool *a_result);
@@ -216,9 +208,4 @@ Bool ephyrHostXVGetStill(int a_screen_num,
                          int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
                          int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h);
 
-/*
- * StopVideo
- */
-Bool ephyrHostXVStopVideo(int a_screen_num, int a_port_id);
-
 #endif /*__EPHYRHOSTVIDEO_H__*/
diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c
index 5813634..7d249d2 100644
--- a/hw/kdrive/ephyr/ephyrvideo.c
+++ b/hw/kdrive/ephyr/ephyrvideo.c
@@ -287,8 +287,6 @@ ephyrXVPrivNew(void)
         goto error;
     }
 
-    ephyrHostXVInit();
-
     if (!ephyrXVPrivQueryHostAdaptors(xv_priv)) {
         EPHYR_LOG_ERROR("failed to query the host x for xv properties\n");
         goto error;
@@ -317,7 +315,7 @@ ephyrXVPrivDelete(EphyrXVPriv * a_this)
     if (!a_this)
         return;
     if (a_this->host_adaptors) {
-        ephyrHostXVAdaptorArrayDelete(a_this->host_adaptors);
+        free(a_this->host_adaptors);
         a_this->host_adaptors = NULL;
     }
     free(a_this->adaptors);
@@ -396,8 +394,7 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
         goto out;
     }
     if (a_this->host_adaptors)
-        a_this->num_adaptors =
-            ephyrHostXVAdaptorArrayGetSize(a_this->host_adaptors);
+        a_this->num_adaptors = a_this->host_adaptors->num_adaptors;
     if (a_this->num_adaptors < 0) {
         EPHYR_LOG_ERROR("failed to get number of host adaptors\n");
         goto out;
@@ -420,8 +417,7 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
         cur_host_adaptor = ephyrHostXVAdaptorArrayAt(a_this->host_adaptors, i);
         if (!cur_host_adaptor)
             continue;
-        a_this->adaptors[i].nPorts =
-            ephyrHostXVAdaptorGetNbPorts(cur_host_adaptor);
+        a_this->adaptors[i].nPorts = cur_host_adaptor->num_ports;
         if (a_this->adaptors[i].nPorts <= 0) {
             EPHYR_LOG_ERROR("Could not find any port of adaptor %d\n", i);
             continue;
@@ -433,7 +429,7 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
         a_this->adaptors[i].name = ephyrHostXVAdaptorGetName(cur_host_adaptor);
         if (!a_this->adaptors[i].name)
             a_this->adaptors[i].name = strdup("Xephyr Video Overlay");
-        base_port_id = ephyrHostXVAdaptorGetFirstPortID(cur_host_adaptor);
+        base_port_id = cur_host_adaptor->base_id;
         if (base_port_id < 0) {
             EPHYR_LOG_ERROR("failed to get port id for adaptor %d\n", i);
             continue;
@@ -455,10 +451,6 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
                                               &num_video_formats);
         a_this->adaptors[i].pFormats = (KdVideoFormatPtr) video_formats;
         a_this->adaptors[i].nFormats = num_video_formats;
-        /* got a_this->adaptors[i].nPorts already
-           a_this->adaptors[i].nPorts =
-           ephyrHostXVAdaptorGetNbPorts (cur_host_adaptor) ;
-         */
         a_this->adaptors[i].pPortPrivates =
             calloc(a_this->adaptors[i].nPorts,
                    sizeof(DevUnion) + sizeof(EphyrPortPriv));
@@ -710,15 +702,14 @@ ephyrXVPrivSaveImageToPortPriv(EphyrPortPriv * a_port_priv,
 static void
 ephyrStopVideo(KdScreenInfo * a_info, pointer a_port_priv, Bool a_exit)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
     EphyrPortPriv *port_priv = a_port_priv;
+    EphyrScrPriv *scrpriv = a_info->driver;
 
-    EPHYR_RETURN_IF_FAIL(a_info && a_info->pScreen);
     EPHYR_RETURN_IF_FAIL(port_priv);
 
     EPHYR_LOG("enter\n");
-    if (!ephyrHostXVStopVideo(a_info->pScreen->myNum, port_priv->port_number)) {
-        EPHYR_LOG_ERROR("XvStopVideo() failed\n");
-    }
+    xcb_xv_stop_video(conn, port_priv->port_number, scrpriv->win);
     EPHYR_LOG("leave\n");
 }
 
-- 
1.8.4.rc3



More information about the xorg-devel mailing list