From 74dff87790dbb3dcb23634f1e8cd54018e5ddc9d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 23 Aug 2013 10:40:52 -0700 Subject: [PATCH] ephyr: Remove the remaining bits of host/server XV split. Signed-off-by: Eric Anholt Reviewed-by: Julien Cristau --- hw/kdrive/ephyr/Makefile.am | 4 +- hw/kdrive/ephyr/ephyrhostvideo.c | 130 --------------------------------------- hw/kdrive/ephyr/ephyrhostvideo.h | 53 ---------------- hw/kdrive/ephyr/ephyrvideo.c | 48 ++++++++++----- 4 files changed, 33 insertions(+), 202 deletions(-) delete mode 100644 hw/kdrive/ephyr/ephyrhostvideo.c delete mode 100644 hw/kdrive/ephyr/ephyrhostvideo.h diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am index 7648e14..805b3b7 100644 --- a/hw/kdrive/ephyr/Makefile.am +++ b/hw/kdrive/ephyr/Makefile.am @@ -25,9 +25,7 @@ HOSTX_SRCS = \ hostx.h HOSTVIDEO_SRCS = \ - ephyrvideo.c \ - ephyrhostvideo.c \ - ephyrhostvideo.h + ephyrvideo.c HOSTDRI_SRCS = \ ephyrdriext.c \ diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c deleted file mode 100644 index a26c31c..0000000 --- a/hw/kdrive/ephyr/ephyrhostvideo.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Xephyr - A kdrive X server thats runs in a host X window. - * Authored by Matthew Allum - * - * Copyright © 2007 OpenedHand Ltd - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of OpenedHand Ltd not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. OpenedHand Ltd makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: - * Dodji Seketeli - */ -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#define _HAVE_XALLOC_DECLS - -#include "hostx.h" -#include "ephyrhostvideo.h" -#include "ephyrlog.h" - -#ifndef TRUE -#define TRUE 1 -#endif /*TRUE*/ -#ifndef FALSE -#define FALSE 0 -#endif /*FALSE*/ - -Bool -ephyrHostXVQueryBestSize(int a_port_id, - Bool a_motion, - unsigned int a_frame_w, - unsigned int a_frame_h, - unsigned int a_drw_w, - unsigned int a_drw_h, - unsigned int *a_actual_w, unsigned int *a_actual_h) -{ - Bool is_ok = FALSE; - xcb_xv_query_best_size_cookie_t cookie; - xcb_xv_query_best_size_reply_t *reply; - - EPHYR_RETURN_VAL_IF_FAIL(a_actual_w && a_actual_h, FALSE); - - EPHYR_LOG("enter: frame (%dx%d), drw (%dx%d)\n", - a_frame_w, a_frame_h, a_drw_w, a_drw_h); - - cookie = xcb_xv_query_best_size(hostx_get_xcbconn(), - a_port_id, - a_frame_w, a_frame_h, - a_drw_w, a_drw_h, - a_motion); - reply = xcb_xv_query_best_size_reply(hostx_get_xcbconn(), cookie, NULL); - if (!reply) { - EPHYR_LOG_ERROR ("XvQueryBestSize() failed\n"); - goto out; - } - *a_actual_w = reply->actual_width; - *a_actual_h = reply->actual_height; - free(reply); - - EPHYR_LOG("actual (%dx%d)\n", *a_actual_w, *a_actual_h); - is_ok = TRUE; - -out: - free(reply); - EPHYR_LOG("leave\n"); - return is_ok; -} - -Bool -ephyrHostGetAtom(const char *a_name, Bool a_create_if_not_exists, int *a_atom) -{ - xcb_connection_t *conn = hostx_get_xcbconn(); - xcb_intern_atom_cookie_t cookie; - xcb_intern_atom_reply_t *reply; - - EPHYR_RETURN_VAL_IF_FAIL(a_atom, FALSE); - - cookie = xcb_intern_atom(conn, - a_create_if_not_exists, - strlen(a_name), - a_name); - reply = xcb_intern_atom_reply(conn, cookie, NULL); - if (!reply || reply->atom == None) { - free(reply); - return FALSE; - } - *a_atom = reply->atom; - free(reply); - return TRUE; -} - -char * -ephyrHostGetAtomName(int a_atom) -{ - xcb_connection_t *conn = hostx_get_xcbconn(); - xcb_get_atom_name_cookie_t cookie; - xcb_get_atom_name_reply_t *reply; - char *ret; - - cookie = xcb_get_atom_name(conn, a_atom); - reply = xcb_get_atom_name_reply(conn, cookie, NULL); - if (!reply) - return NULL; - ret = malloc(xcb_get_atom_name_name_length(reply) + 1); - if (ret) { - memcpy(ret, xcb_get_atom_name_name(reply), - xcb_get_atom_name_name_length(reply)); - ret[xcb_get_atom_name_name_length(reply)] = '\0'; - } - free(reply); - return ret; -} diff --git a/hw/kdrive/ephyr/ephyrhostvideo.h b/hw/kdrive/ephyr/ephyrhostvideo.h deleted file mode 100644 index 9c2cd5a..0000000 --- a/hw/kdrive/ephyr/ephyrhostvideo.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Xephyr - A kdrive X server thats runs in a host X window. - * Authored by Matthew Allum - * - * Copyright © 2007 OpenedHand Ltd - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of OpenedHand Ltd not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. OpenedHand Ltd makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: - * Dodji Seketeli - */ -#ifndef __EPHYRHOSTVIDEO_H__ -#define __EPHYRHOSTVIDEO_H__ - -#include -#include - -/* - *size query - */ -Bool ephyrHostXVQueryBestSize(int a_port_id, - Bool a_motion, - unsigned int a_frame_w, - unsigned int a_frame_h, - unsigned int a_drw_w, - unsigned int a_drw_h, - unsigned int *a_actual_w, - unsigned int *a_actual_h); - -/* - * atom - */ -Bool ephyrHostGetAtom(const char *a_name, - Bool a_create_if_not_exists, int *a_atom); -char *ephyrHostGetAtomName(int a_atom); - -#endif /*__EPHYRHOSTVIDEO_H__*/ diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c index dde58b4..f4fcf72 100644 --- a/hw/kdrive/ephyr/ephyrvideo.c +++ b/hw/kdrive/ephyr/ephyrvideo.c @@ -33,12 +33,12 @@ #include #include #include +#include #include "ephyrlog.h" #include "kdrive.h" #include "kxv.h" #include "ephyr.h" #include "hostx.h" -#include "ephyrhostvideo.h" struct _EphyrXVPriv { xcb_xv_query_adaptors_reply_t *host_adaptors; @@ -223,8 +223,10 @@ DoSimpleClip(BoxPtr a_dst_box, BoxPtr a_clipper, BoxPtr a_result) static Bool ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom) { + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_intern_atom_cookie_t cookie; + xcb_intern_atom_reply_t *reply; const char *atom_name = NULL; - int host_atom = None; EPHYR_RETURN_VAL_IF_FAIL(a_host_atom, FALSE); @@ -236,11 +238,16 @@ ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom) if (!atom_name) return FALSE; - if (!ephyrHostGetAtom(atom_name, FALSE, &host_atom) || host_atom == None) { + cookie = xcb_intern_atom(conn, FALSE, strlen(atom_name), atom_name); + reply = xcb_intern_atom_reply(conn, cookie, NULL); + if (!reply || reply->atom == None) { EPHYR_LOG_ERROR("no atom for string %s defined in host X\n", atom_name); return FALSE; } - *a_host_atom = host_atom; + + *a_host_atom = reply->atom; + free(reply); + return TRUE; } @@ -902,20 +909,29 @@ ephyrQueryBestSize(KdScreenInfo * a_info, unsigned int *a_prefered_w, unsigned int *a_prefered_h, pointer a_port_priv) { - int res = 0; + xcb_connection_t *conn = hostx_get_xcbconn(); EphyrPortPriv *port_priv = a_port_priv; - - EPHYR_RETURN_IF_FAIL(port_priv); - - EPHYR_LOG("enter\n"); - res = ephyrHostXVQueryBestSize(port_priv->port_number, - a_motion, - a_src_w, a_src_h, - a_drw_w, a_drw_h, - a_prefered_w, a_prefered_h); - if (!res) { - EPHYR_LOG_ERROR("Failed to query best size\n"); + xcb_xv_query_best_size_cookie_t cookie = + xcb_xv_query_best_size(conn, + port_priv->port_number, + a_src_w, a_src_h, + a_drw_w, a_drw_h, + a_motion); + xcb_xv_query_best_size_reply_t *reply = + xcb_xv_query_best_size_reply(conn, cookie, NULL); + + EPHYR_LOG("enter: frame (%dx%d), drw (%dx%d)\n", + a_src_w, a_src_h, a_drw_w, a_drw_h); + + if (!reply) { + EPHYR_LOG_ERROR ("XvQueryBestSize() failed\n"); + return; } + *a_prefered_w = reply->actual_width; + *a_prefered_h = reply->actual_height; + EPHYR_LOG("actual (%dx%d)\n", *a_prefered_w, *a_prefered_h); + free(reply); + EPHYR_LOG("leave\n"); } -- 2.7.4