[PATCH 16/17] ephyr: Garbage collect some dead XV clipping code.

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


---
 hw/kdrive/ephyr/ephyrvideo.c | 117 ++-----------------------------------------
 1 file changed, 4 insertions(+), 113 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c
index fe69043..e78f18d 100644
--- a/hw/kdrive/ephyr/ephyrvideo.c
+++ b/hw/kdrive/ephyr/ephyrvideo.c
@@ -60,8 +60,6 @@ struct _EphyrPortPriv {
 };
 typedef struct _EphyrPortPriv EphyrPortPriv;
 
-static Bool DoSimpleClip(BoxPtr a_dst_drw, BoxPtr a_clipper, BoxPtr a_result);
-
 static Bool ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom);
 
 static EphyrXVPriv *ephyrXVPrivNew(void);
@@ -178,49 +176,6 @@ adaptor_has_flags(const xcb_xv_adaptor_info_t *adaptor, uint32_t flags)
 }
 
 static Bool
-DoSimpleClip(BoxPtr a_dst_box, BoxPtr a_clipper, BoxPtr a_result)
-{
-    BoxRec dstClippedBox;
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_dst_box && a_clipper && a_result, FALSE);
-
-    /*
-     * setup the clipbox inside the destination.
-     */
-    dstClippedBox.x1 = a_dst_box->x1;
-    dstClippedBox.x2 = a_dst_box->x2;
-    dstClippedBox.y1 = a_dst_box->y1;
-    dstClippedBox.y2 = a_dst_box->y2;
-
-    /*
-     * if the cliper leftmost edge is inside
-     * the destination area then the leftmost edge of the resulting
-     * clipped box is the leftmost edge of the cliper.
-     */
-    if (a_clipper->x1 > dstClippedBox.x1)
-        dstClippedBox.x1 = a_clipper->x1;
-
-    /*
-     * if the cliper top edge is inside the destination area
-     * then the bottom horizontal edge of the resulting clipped box
-     * is the bottom edge of the cliper
-     */
-    if (a_clipper->y1 > dstClippedBox.y1)
-        dstClippedBox.y1 = a_clipper->y1;
-
-    /*ditto for right edge */
-    if (a_clipper->x2 < dstClippedBox.x2)
-        dstClippedBox.x2 = a_clipper->x2;
-
-    /*ditto for bottom edge */
-    if (a_clipper->y2 < dstClippedBox.y2)
-        dstClippedBox.y2 = a_clipper->y2;
-
-    memcpy(a_result, &dstClippedBox, sizeof(dstClippedBox));
-    return TRUE;
-}
-
-static Bool
 ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom)
 {
     xcb_connection_t *conn = hostx_get_xcbconn();
@@ -1154,25 +1109,12 @@ ephyrPutVideo(KdScreenInfo * a_info,
     xcb_connection_t *conn = hostx_get_xcbconn();
     xcb_gcontext_t gc;
     EphyrPortPriv *port_priv = a_port_priv;
-    BoxRec clipped_area, dst_box;
-    int result = BadImplementation;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_info->pScreen, BadValue);
     EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
 
     EPHYR_LOG("enter\n");
 
-    dst_box.x1 = a_drw_x;
-    dst_box.x2 = a_drw_x + a_drw_w;
-    dst_box.y1 = a_drw_y;
-    dst_box.y2 = a_drw_y + a_drw_h;
-
-    if (!DoSimpleClip(&dst_box,
-                      RegionExtents(a_clipping_region), &clipped_area)) {
-        EPHYR_LOG_ERROR("failed to simple clip\n");
-        goto out;
-    }
-
     gc = xcb_generate_id(conn);
     xcb_create_gc(conn, gc, scrpriv->win, 0, NULL);
     xcb_xv_put_video(conn, port_priv->port_number,
@@ -1181,11 +1123,8 @@ ephyrPutVideo(KdScreenInfo * a_info,
                      a_drw_x, a_drw_y, a_drw_w, a_drw_h);
     xcb_free_gc(conn, gc);
 
-    result = Success;
-
- out:
     EPHYR_LOG("leave\n");
-    return result;
+    return Success;
 }
 
 static int
@@ -1201,25 +1140,12 @@ ephyrGetVideo(KdScreenInfo * a_info,
     xcb_connection_t *conn = hostx_get_xcbconn();
     xcb_gcontext_t gc;
     EphyrPortPriv *port_priv = a_port_priv;
-    BoxRec clipped_area, dst_box;
-    int result = BadImplementation;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue);
     EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
 
     EPHYR_LOG("enter\n");
 
-    dst_box.x1 = a_drw_x;
-    dst_box.x2 = a_drw_x + a_drw_w;
-    dst_box.y1 = a_drw_y;
-    dst_box.y2 = a_drw_y + a_drw_h;
-
-    if (!DoSimpleClip(&dst_box,
-                      RegionExtents(a_clipping_region), &clipped_area)) {
-        EPHYR_LOG_ERROR("failed to simple clip\n");
-        goto out;
-    }
-
     gc = xcb_generate_id(conn);
     xcb_create_gc(conn, gc, scrpriv->win, 0, NULL);
     xcb_xv_get_video(conn, port_priv->port_number,
@@ -1229,11 +1155,8 @@ ephyrGetVideo(KdScreenInfo * a_info,
 
     xcb_free_gc(conn, gc);
 
-    result = Success;
-
- out:
     EPHYR_LOG("leave\n");
-    return result;
+    return Success;
 }
 
 static int
@@ -1249,25 +1172,12 @@ ephyrPutStill(KdScreenInfo * a_info,
     xcb_connection_t *conn = hostx_get_xcbconn();
     xcb_gcontext_t gc;
     EphyrPortPriv *port_priv = a_port_priv;
-    BoxRec clipped_area, dst_box;
-    int result = BadImplementation;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue);
     EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
 
     EPHYR_LOG("enter\n");
 
-    dst_box.x1 = a_drw_x;
-    dst_box.x2 = a_drw_x + a_drw_w;
-    dst_box.y1 = a_drw_y;
-    dst_box.y2 = a_drw_y + a_drw_h;
-
-    if (!DoSimpleClip(&dst_box,
-                      RegionExtents(a_clipping_region), &clipped_area)) {
-        EPHYR_LOG_ERROR("failed to simple clip\n");
-        goto out;
-    }
-
     gc = xcb_generate_id(conn);
     xcb_create_gc(conn, gc, scrpriv->win, 0, NULL);
     xcb_xv_put_still(conn, port_priv->port_number,
@@ -1276,11 +1186,8 @@ ephyrPutStill(KdScreenInfo * a_info,
                      a_drw_x, a_drw_y, a_drw_w, a_drw_h);
     xcb_free_gc(conn, gc);
 
-    result = Success;
-
- out:
     EPHYR_LOG("leave\n");
-    return result;
+    return Success;
 }
 
 static int
@@ -1296,25 +1203,12 @@ ephyrGetStill(KdScreenInfo * a_info,
     xcb_connection_t *conn = hostx_get_xcbconn();
     xcb_gcontext_t gc;
     EphyrPortPriv *port_priv = a_port_priv;
-    BoxRec clipped_area, dst_box;
-    int result = BadImplementation;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue);
     EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
 
     EPHYR_LOG("enter\n");
 
-    dst_box.x1 = a_drw_x;
-    dst_box.x2 = a_drw_x + a_drw_w;
-    dst_box.y1 = a_drw_y;
-    dst_box.y2 = a_drw_y + a_drw_h;
-
-    if (!DoSimpleClip(&dst_box,
-                      RegionExtents(a_clipping_region), &clipped_area)) {
-        EPHYR_LOG_ERROR("failed to simple clip\n");
-        goto out;
-    }
-
     gc = xcb_generate_id(conn);
     xcb_create_gc(conn, gc, scrpriv->win, 0, NULL);
     xcb_xv_get_still(conn, port_priv->port_number,
@@ -1323,11 +1217,8 @@ ephyrGetStill(KdScreenInfo * a_info,
                      a_drw_x, a_drw_y, a_drw_w, a_drw_h);
     xcb_free_gc(conn, gc);
 
-    result = Success;
-
- out:
     EPHYR_LOG("leave\n");
-    return result;
+    return Success;
 }
 
 static int
-- 
1.8.4.rc3



More information about the xorg-devel mailing list