summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-08-23 10:40:52 -0700
committerEric Anholt <eric@anholt.net>2013-09-03 14:35:14 -0700
commit74dff87790dbb3dcb23634f1e8cd54018e5ddc9d (patch)
treecc3ceef5ccfbb3f5262a8671cb4a9700e5f31ec3
parent2f994dfe9d1add9ea8cb9c88ddb0d15843854788 (diff)
ephyr: Remove the remaining bits of host/server XV split.
Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--hw/kdrive/ephyr/Makefile.am4
-rw-r--r--hw/kdrive/ephyr/ephyrhostvideo.c130
-rw-r--r--hw/kdrive/ephyr/ephyrhostvideo.h53
-rw-r--r--hw/kdrive/ephyr/ephyrvideo.c48
4 files changed, 33 insertions, 202 deletions
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index 7648e1446..805b3b7d6 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 a26c31c3f..000000000
--- 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 <mallum@openedhand.com>
- *
- * 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 <dodji@openedhand.com>
- */
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-#include <xcb/xv.h>
-#include <xcb/xcb_aux.h>
-#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 9c2cd5ac4..000000000
--- 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 <mallum@openedhand.com>
- *
- * 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 <dodji@openedhand.com>
- */
-#ifndef __EPHYRHOSTVIDEO_H__
-#define __EPHYRHOSTVIDEO_H__
-
-#include <xcb/xv.h>
-#include <X11/Xdefs.h>
-
-/*
- *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 dde58b471..f4fcf728c 100644
--- a/hw/kdrive/ephyr/ephyrvideo.c
+++ b/hw/kdrive/ephyr/ephyrvideo.c
@@ -33,12 +33,12 @@
#include <X11/extensions/Xv.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
+#include <xcb/xv.h>
#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");
}