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>
This commit is contained in:
Eric Anholt 2013-08-23 10:40:52 -07:00
parent 2f994dfe9d
commit 74dff87790
4 changed files with 31 additions and 200 deletions

View File

@ -25,9 +25,7 @@ HOSTX_SRCS = \
hostx.h
HOSTVIDEO_SRCS = \
ephyrvideo.c \
ephyrhostvideo.c \
ephyrhostvideo.h
ephyrvideo.c
HOSTDRI_SRCS = \
ephyrdriext.c \

View File

@ -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;
}

View File

@ -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__*/

View File

@ -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;
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_RETURN_IF_FAIL(port_priv);
EPHYR_LOG("enter: frame (%dx%d), drw (%dx%d)\n",
a_src_w, a_src_h, a_drw_w, a_drw_h);
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");
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");
}