2007-08-14 22:48:41 +02:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* This file is heavily copied from hw/xfree86/dri/xf86dri.c
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Dodji Seketeli <dodji@openedhand.com>
|
|
|
|
*/
|
2007-08-15 19:40:10 +02:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <kdrive-config.h>
|
2007-08-14 22:48:41 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
|
|
|
#define _XF86DRI_SERVER_
|
|
|
|
#include <X11/dri/xf86dri.h>
|
2009-09-15 04:51:23 +02:00
|
|
|
#include <X11/dri/xf86driproto.h>
|
2013-08-18 14:12:45 +02:00
|
|
|
#include <xcb/xcb.h>
|
|
|
|
#include <xcb/shape.h>
|
|
|
|
#include <xcb/xf86dri.h>
|
2007-08-14 22:48:41 +02:00
|
|
|
#include "misc.h"
|
2007-12-14 01:51:40 +01:00
|
|
|
#include "privates.h"
|
2007-08-14 22:48:41 +02:00
|
|
|
#include "dixstruct.h"
|
|
|
|
#include "extnsionst.h"
|
|
|
|
#include "colormapst.h"
|
|
|
|
#include "cursorstr.h"
|
|
|
|
#include "scrnintstr.h"
|
2007-09-08 00:33:59 +02:00
|
|
|
#include "windowstr.h"
|
2007-08-14 22:48:41 +02:00
|
|
|
#include "servermd.h"
|
|
|
|
#include "swaprep.h"
|
|
|
|
#include "ephyrdri.h"
|
2007-09-08 00:33:59 +02:00
|
|
|
#include "ephyrdriext.h"
|
|
|
|
#include "hostx.h"
|
2007-08-14 22:48:41 +02:00
|
|
|
#define _HAVE_XALLOC_DECLS
|
|
|
|
#include "ephyrlog.h"
|
2009-09-18 08:27:54 +02:00
|
|
|
#include "protocol-versions.h"
|
2007-09-08 00:33:59 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int foo;
|
|
|
|
} EphyrDRIWindowPrivRec;
|
2012-03-21 20:55:09 +01:00
|
|
|
typedef EphyrDRIWindowPrivRec *EphyrDRIWindowPrivPtr;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
|
|
|
typedef struct {
|
2012-03-21 20:55:09 +01:00
|
|
|
CreateWindowProcPtr CreateWindow;
|
|
|
|
DestroyWindowProcPtr DestroyWindow;
|
|
|
|
MoveWindowProcPtr MoveWindow;
|
|
|
|
PositionWindowProcPtr PositionWindow;
|
|
|
|
ClipNotifyProcPtr ClipNotify;
|
2007-09-08 00:33:59 +02:00
|
|
|
} EphyrDRIScreenPrivRec;
|
2012-03-21 20:55:09 +01:00
|
|
|
typedef EphyrDRIScreenPrivRec *EphyrDRIScreenPrivPtr;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
static int DRIErrorBase;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static Bool ephyrDRIScreenInit(ScreenPtr a_screen);
|
|
|
|
static Bool ephyrDRICreateWindow(WindowPtr a_win);
|
|
|
|
static Bool ephyrDRIDestroyWindow(WindowPtr a_win);
|
|
|
|
static void ephyrDRIMoveWindow(WindowPtr a_win,
|
|
|
|
int a_x, int a_y,
|
|
|
|
WindowPtr a_siblings, VTKind a_kind);
|
|
|
|
static Bool ephyrDRIPositionWindow(WindowPtr a_win, int x, int y);
|
|
|
|
static void ephyrDRIClipNotify(WindowPtr a_win, int a_x, int a_y);
|
2010-07-16 19:19:50 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static Bool EphyrMirrorHostVisuals(ScreenPtr a_screen);
|
|
|
|
static Bool destroyHostPeerWindow(const WindowPtr a_win);
|
|
|
|
static Bool findWindowPairFromLocal(WindowPtr a_local,
|
|
|
|
EphyrWindowPair ** a_pair);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
static unsigned char DRIReqCode = 0;
|
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
static DevPrivateKeyRec ephyrDRIWindowKeyRec;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
#define ephyrDRIWindowKey (&ephyrDRIWindowKeyRec)
|
|
|
|
static DevPrivateKeyRec ephyrDRIScreenKeyRec;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
#define ephyrDRIScreenKey (&ephyrDRIScreenKeyRec)
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2007-12-14 01:51:40 +01:00
|
|
|
#define GET_EPHYR_DRI_WINDOW_PRIV(win) ((EphyrDRIWindowPrivPtr) \
|
|
|
|
dixLookupPrivate(&(win)->devPrivates, ephyrDRIWindowKey))
|
|
|
|
#define GET_EPHYR_DRI_SCREEN_PRIV(screen) ((EphyrDRIScreenPrivPtr) \
|
|
|
|
dixLookupPrivate(&(screen)->devPrivates, ephyrDRIScreenKey))
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2007-09-08 00:33:59 +02:00
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
ephyrDRIScreenInit(ScreenPtr a_screen)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool is_ok = FALSE;
|
|
|
|
EphyrDRIScreenPrivPtr screen_priv = NULL;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(a_screen, FALSE);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(a_screen);
|
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(screen_priv, FALSE);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
screen_priv->CreateWindow = a_screen->CreateWindow;
|
|
|
|
screen_priv->DestroyWindow = a_screen->DestroyWindow;
|
|
|
|
screen_priv->MoveWindow = a_screen->MoveWindow;
|
|
|
|
screen_priv->PositionWindow = a_screen->PositionWindow;
|
|
|
|
screen_priv->ClipNotify = a_screen->ClipNotify;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
a_screen->CreateWindow = ephyrDRICreateWindow;
|
|
|
|
a_screen->DestroyWindow = ephyrDRIDestroyWindow;
|
|
|
|
a_screen->MoveWindow = ephyrDRIMoveWindow;
|
|
|
|
a_screen->PositionWindow = ephyrDRIPositionWindow;
|
|
|
|
a_screen->ClipNotify = ephyrDRIClipNotify;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
is_ok = TRUE;
|
2008-01-15 06:27:16 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
return is_ok;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
ephyrDRICreateWindow(WindowPtr a_win)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool is_ok = FALSE;
|
|
|
|
ScreenPtr screen = NULL;
|
|
|
|
EphyrDRIScreenPrivPtr screen_priv = NULL;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(a_win, FALSE);
|
|
|
|
screen = a_win->drawable.pScreen;
|
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(screen, FALSE);
|
|
|
|
screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(screen);
|
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(screen_priv && screen_priv->CreateWindow, FALSE);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter. win:%p\n", a_win);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
screen->CreateWindow = screen_priv->CreateWindow;
|
|
|
|
is_ok = (*screen->CreateWindow) (a_win);
|
|
|
|
screen->CreateWindow = ephyrDRICreateWindow;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
|
|
|
if (is_ok) {
|
2012-03-21 20:55:09 +01:00
|
|
|
dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
return is_ok;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
ephyrDRIDestroyWindow(WindowPtr a_win)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool is_ok = FALSE;
|
|
|
|
ScreenPtr screen = NULL;
|
|
|
|
EphyrDRIScreenPrivPtr screen_priv = NULL;
|
|
|
|
|
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(a_win, FALSE);
|
|
|
|
screen = a_win->drawable.pScreen;
|
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(screen, FALSE);
|
|
|
|
screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(screen);
|
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(screen_priv && screen_priv->DestroyWindow, FALSE);
|
|
|
|
|
|
|
|
screen->DestroyWindow = screen_priv->DestroyWindow;
|
2007-09-17 18:15:03 +02:00
|
|
|
if (screen->DestroyWindow) {
|
2012-03-21 20:55:09 +01:00
|
|
|
is_ok = (*screen->DestroyWindow) (a_win);
|
2007-09-17 18:15:03 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
screen->DestroyWindow = ephyrDRIDestroyWindow;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
|
|
|
if (is_ok) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EphyrDRIWindowPrivPtr win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
|
|
|
|
|
2007-09-08 00:33:59 +02:00
|
|
|
if (win_priv) {
|
2012-03-21 20:55:09 +01:00
|
|
|
destroyHostPeerWindow(a_win);
|
|
|
|
free(win_priv);
|
|
|
|
dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
|
|
|
|
EPHYR_LOG("destroyed the remote peer window\n");
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
return is_ok;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-21 20:55:09 +01:00
|
|
|
ephyrDRIMoveWindow(WindowPtr a_win,
|
|
|
|
int a_x, int a_y, WindowPtr a_siblings, VTKind a_kind)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
ScreenPtr screen = NULL;
|
|
|
|
EphyrDRIScreenPrivPtr screen_priv = NULL;
|
|
|
|
EphyrDRIWindowPrivPtr win_priv = NULL;
|
|
|
|
EphyrWindowPair *pair = NULL;
|
2007-09-08 00:33:59 +02:00
|
|
|
EphyrBox geo;
|
2012-03-21 20:55:09 +01:00
|
|
|
int x = 0, y = 0; /*coords relative to parent window */
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_RETURN_IF_FAIL(a_win);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
|
|
|
screen = a_win->drawable.pScreen;
|
|
|
|
EPHYR_RETURN_IF_FAIL(screen);
|
|
|
|
screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(screen);
|
|
|
|
EPHYR_RETURN_IF_FAIL(screen_priv && screen_priv->MoveWindow);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
screen->MoveWindow = screen_priv->MoveWindow;
|
2007-09-17 18:15:03 +02:00
|
|
|
if (screen->MoveWindow) {
|
2012-03-21 20:55:09 +01:00
|
|
|
(*screen->MoveWindow) (a_win, a_x, a_y, a_siblings, a_kind);
|
2007-09-17 18:15:03 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
screen->MoveWindow = ephyrDRIMoveWindow;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("window: %p\n", a_win);
|
2007-09-08 00:33:59 +02:00
|
|
|
if (!a_win->parent) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("cannot move root window\n");
|
2013-08-17 14:38:08 +02:00
|
|
|
return;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
|
2007-09-08 00:33:59 +02:00
|
|
|
if (!win_priv) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("not a DRI peered window\n");
|
2013-08-17 14:38:08 +02:00
|
|
|
return;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
|
|
|
|
EPHYR_LOG_ERROR("failed to get window pair\n");
|
2013-08-17 14:38:08 +02:00
|
|
|
return;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
/*compute position relative to parent window */
|
|
|
|
x = a_win->drawable.x - a_win->parent->drawable.x;
|
|
|
|
y = a_win->drawable.y - a_win->parent->drawable.y;
|
|
|
|
/*set the geometry to pass to hostx_set_window_geometry */
|
|
|
|
memset(&geo, 0, sizeof(geo));
|
|
|
|
geo.x = x;
|
|
|
|
geo.y = y;
|
|
|
|
geo.width = a_win->drawable.width;
|
|
|
|
geo.height = a_win->drawable.height;
|
|
|
|
hostx_set_window_geometry(pair->remote, &geo);
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
ephyrDRIPositionWindow(WindowPtr a_win, int a_x, int a_y)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool is_ok = FALSE;
|
|
|
|
ScreenPtr screen = NULL;
|
|
|
|
EphyrDRIScreenPrivPtr screen_priv = NULL;
|
|
|
|
EphyrDRIWindowPrivPtr win_priv = NULL;
|
|
|
|
EphyrWindowPair *pair = NULL;
|
2007-09-08 00:33:59 +02:00
|
|
|
EphyrBox geo;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(a_win, FALSE);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
|
|
|
screen = a_win->drawable.pScreen;
|
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(screen, FALSE);
|
|
|
|
screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(screen);
|
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(screen_priv && screen_priv->PositionWindow, FALSE);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
screen->PositionWindow = screen_priv->PositionWindow;
|
2007-09-17 18:15:03 +02:00
|
|
|
if (screen->PositionWindow) {
|
2012-03-21 20:55:09 +01:00
|
|
|
(*screen->PositionWindow) (a_win, a_x, a_y);
|
2007-09-17 18:15:03 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
screen->PositionWindow = ephyrDRIPositionWindow;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("window: %p\n", a_win);
|
|
|
|
win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
|
2007-09-08 00:33:59 +02:00
|
|
|
if (!win_priv) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("not a DRI peered window\n");
|
|
|
|
is_ok = TRUE;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
|
|
|
|
EPHYR_LOG_ERROR("failed to get window pair\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
/*set the geometry to pass to hostx_set_window_geometry */
|
|
|
|
memset(&geo, 0, sizeof(geo));
|
|
|
|
geo.x = a_x;
|
|
|
|
geo.y = a_y;
|
|
|
|
geo.width = a_win->drawable.width;
|
|
|
|
geo.height = a_win->drawable.height;
|
|
|
|
hostx_set_window_geometry(pair->remote, &geo);
|
|
|
|
is_ok = TRUE;
|
|
|
|
|
|
|
|
out:
|
|
|
|
EPHYR_LOG("leave. is_ok:%d\n", is_ok);
|
|
|
|
/*do cleanup here */
|
|
|
|
return is_ok;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
|
2007-09-17 18:15:03 +02:00
|
|
|
static void
|
2012-03-21 20:55:09 +01:00
|
|
|
ephyrDRIClipNotify(WindowPtr a_win, int a_x, int a_y)
|
2007-09-17 18:15:03 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
ScreenPtr screen = NULL;
|
|
|
|
EphyrDRIScreenPrivPtr screen_priv = NULL;
|
|
|
|
EphyrDRIWindowPrivPtr win_priv = NULL;
|
|
|
|
EphyrWindowPair *pair = NULL;
|
|
|
|
EphyrRect *rects = NULL;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
EPHYR_RETURN_IF_FAIL(a_win);
|
|
|
|
|
|
|
|
EPHYR_LOG("enter\n");
|
|
|
|
screen = a_win->drawable.pScreen;
|
|
|
|
EPHYR_RETURN_IF_FAIL(screen);
|
|
|
|
screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(screen);
|
|
|
|
EPHYR_RETURN_IF_FAIL(screen_priv && screen_priv->ClipNotify);
|
|
|
|
|
|
|
|
screen->ClipNotify = screen_priv->ClipNotify;
|
2007-09-17 18:15:03 +02:00
|
|
|
if (screen->ClipNotify) {
|
2012-03-21 20:55:09 +01:00
|
|
|
(*screen->ClipNotify) (a_win, a_x, a_y);
|
2007-09-17 18:15:03 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
screen->ClipNotify = ephyrDRIClipNotify;
|
2007-09-17 18:15:03 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("window: %p\n", a_win);
|
|
|
|
win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
|
2007-09-17 18:15:03 +02:00
|
|
|
if (!win_priv) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("not a DRI peered window\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
|
|
|
|
EPHYR_LOG_ERROR("failed to get window pair\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
rects = calloc(RegionNumRects(&a_win->clipList), sizeof(EphyrRect));
|
|
|
|
for (i = 0; i < RegionNumRects(&a_win->clipList); i++) {
|
|
|
|
memmove(&rects[i],
|
|
|
|
&RegionRects(&a_win->clipList)[i], sizeof(EphyrRect));
|
2007-09-17 18:15:03 +02:00
|
|
|
rects[i].x1 -= a_win->drawable.x;
|
|
|
|
rects[i].x2 -= a_win->drawable.x;
|
|
|
|
rects[i].y1 -= a_win->drawable.y;
|
|
|
|
rects[i].y2 -= a_win->drawable.y;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* push the clipping region of this window
|
|
|
|
* to the peer window in the host
|
|
|
|
*/
|
2013-08-17 14:38:08 +02:00
|
|
|
hostx_set_window_bounding_rectangles
|
2012-03-21 20:55:09 +01:00
|
|
|
(pair->remote, rects, RegionNumRects(&a_win->clipList));
|
2007-09-17 18:15:03 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
out:
|
|
|
|
free(rects);
|
|
|
|
rects = NULL;
|
2010-01-02 00:43:26 +01:00
|
|
|
|
2013-09-15 20:56:34 +02:00
|
|
|
EPHYR_LOG("leave.\n");
|
2012-03-21 20:55:09 +01:00
|
|
|
/*do cleanup here */
|
2007-09-17 18:15:03 +02:00
|
|
|
}
|
|
|
|
|
2007-09-08 00:33:59 +02:00
|
|
|
/**
|
|
|
|
* Duplicates a visual of a_screen
|
|
|
|
* In screen a_screen, for depth a_depth, find a visual which
|
|
|
|
* bitsPerRGBValue and colormap size equal
|
|
|
|
* a_bits_per_rgb_values and a_colormap_entries.
|
|
|
|
* The ID of that duplicated visual is set to a_new_id.
|
|
|
|
* That duplicated visual is then added to the list of visuals
|
|
|
|
* of the screen.
|
|
|
|
*/
|
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
EphyrDuplicateVisual(unsigned int a_screen,
|
|
|
|
short a_depth,
|
|
|
|
short a_class,
|
|
|
|
short a_bits_per_rgb_values,
|
|
|
|
short a_colormap_entries,
|
|
|
|
unsigned int a_red_mask,
|
|
|
|
unsigned int a_green_mask,
|
|
|
|
unsigned int a_blue_mask, unsigned int a_new_id)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool is_ok = FALSE, found_visual = FALSE, found_depth = FALSE;
|
|
|
|
ScreenPtr screen = NULL;
|
|
|
|
VisualRec new_visual, *new_visuals = NULL;
|
|
|
|
int i = 0;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2010-12-01 14:12:55 +01:00
|
|
|
if (a_screen >= screenInfo.numScreens) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("bad screen number\n");
|
2007-09-08 00:33:59 +02:00
|
|
|
goto out;
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
memset(&new_visual, 0, sizeof(VisualRec));
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*get the screen pointed to by a_screen */
|
|
|
|
screen = screenInfo.screens[a_screen];
|
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(screen, FALSE);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* In that screen, first look for an existing visual that has the
|
|
|
|
* same characteristics as those passed in parameter
|
|
|
|
* to this function and copy it.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < screen->numVisuals; i++) {
|
2007-09-08 00:33:59 +02:00
|
|
|
if (screen->visuals[i].bitsPerRGBValue == a_bits_per_rgb_values &&
|
2012-03-21 20:55:09 +01:00
|
|
|
screen->visuals[i].ColormapEntries == a_colormap_entries) {
|
|
|
|
/*copy the visual found */
|
|
|
|
memcpy(&new_visual, &screen->visuals[i], sizeof(new_visual));
|
|
|
|
new_visual.vid = a_new_id;
|
|
|
|
new_visual.class = a_class;
|
|
|
|
new_visual.redMask = a_red_mask;
|
|
|
|
new_visual.greenMask = a_green_mask;
|
|
|
|
new_visual.blueMask = a_blue_mask;
|
|
|
|
found_visual = TRUE;
|
|
|
|
EPHYR_LOG("found a visual that matches visual id: %d\n", a_new_id);
|
2007-09-08 00:33:59 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found_visual) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("did not find any visual matching %d\n", a_new_id);
|
|
|
|
goto out;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* be prepare to extend screen->visuals to add new_visual to it
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
new_visuals = calloc(screen->numVisuals + 1, sizeof(VisualRec));
|
|
|
|
memmove(new_visuals,
|
|
|
|
screen->visuals, screen->numVisuals * sizeof(VisualRec));
|
|
|
|
memmove(&new_visuals[screen->numVisuals], &new_visual, sizeof(VisualRec));
|
2007-09-08 00:33:59 +02:00
|
|
|
/*
|
|
|
|
* Now, in that same screen, update the screen->allowedDepths member.
|
|
|
|
* In that array, each element represents the visuals applicable to
|
|
|
|
* a given depth. So we need to add an entry matching the new visual
|
|
|
|
* that we are going to add to screen->visuals
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < screen->numDepths; i++) {
|
|
|
|
VisualID *vids = NULL;
|
|
|
|
DepthPtr cur_depth = NULL;
|
|
|
|
|
|
|
|
/*find the entry matching a_depth */
|
2007-09-08 00:33:59 +02:00
|
|
|
if (screen->allowedDepths[i].depth != a_depth)
|
2012-03-21 20:55:09 +01:00
|
|
|
continue;
|
2007-09-08 00:33:59 +02:00
|
|
|
cur_depth = &screen->allowedDepths[i];
|
|
|
|
/*
|
|
|
|
* extend the list of visual IDs in that entry,
|
|
|
|
* so to add a_new_id in there.
|
|
|
|
*/
|
2010-05-05 20:44:06 +02:00
|
|
|
vids = realloc(cur_depth->vids,
|
2012-03-21 20:55:09 +01:00
|
|
|
(cur_depth->numVids + 1) * sizeof(VisualID));
|
2007-09-08 00:33:59 +02:00
|
|
|
if (!vids) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("failed to realloc numids\n");
|
|
|
|
goto out;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
vids[cur_depth->numVids] = a_new_id;
|
2007-09-08 00:33:59 +02:00
|
|
|
/*
|
|
|
|
* Okay now commit our change.
|
|
|
|
* Do really update screen->allowedDepths[i]
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
cur_depth->numVids++;
|
|
|
|
cur_depth->vids = vids;
|
|
|
|
found_depth = TRUE;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
if (!found_depth) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("failed to update screen[%d]->allowedDepth\n",
|
|
|
|
a_screen);
|
|
|
|
goto out;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Commit our change to screen->visuals
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
free(screen->visuals);
|
|
|
|
screen->visuals = new_visuals;
|
|
|
|
screen->numVisuals++;
|
|
|
|
new_visuals = NULL;
|
|
|
|
|
|
|
|
is_ok = TRUE;
|
|
|
|
out:
|
|
|
|
free(new_visuals);
|
|
|
|
new_visuals = NULL;
|
|
|
|
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return is_ok;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Duplicates the visuals of the host X server.
|
|
|
|
* This is necessary to have visuals that have the same
|
|
|
|
* ID as those of the host X. It is important to have that for
|
|
|
|
* GLX.
|
|
|
|
*/
|
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
EphyrMirrorHostVisuals(ScreenPtr a_screen)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool is_ok = FALSE;
|
|
|
|
EphyrHostVisualInfo *visuals = NULL;
|
|
|
|
int nb_visuals = 0, i = 0;
|
|
|
|
|
|
|
|
EPHYR_LOG("enter\n");
|
|
|
|
if (!hostx_get_visuals_info(&visuals, &nb_visuals)) {
|
|
|
|
EPHYR_LOG_ERROR("failed to get host visuals\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
for (i = 0; i < nb_visuals; i++) {
|
|
|
|
if (!EphyrDuplicateVisual(a_screen->myNum,
|
|
|
|
visuals[i].depth,
|
|
|
|
visuals[i].class,
|
|
|
|
visuals[i].bits_per_rgb,
|
|
|
|
visuals[i].colormap_size,
|
|
|
|
visuals[i].red_mask,
|
|
|
|
visuals[i].green_mask,
|
|
|
|
visuals[i].blue_mask, visuals[i].visualid)) {
|
|
|
|
EPHYR_LOG_ERROR("failed to duplicate host visual %d\n",
|
|
|
|
(int) visuals[i].visualid);
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
is_ok = TRUE;
|
|
|
|
out:
|
|
|
|
EPHYR_LOG("leave\n");
|
2007-09-08 00:33:59 +02:00
|
|
|
return is_ok;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRIQueryVersion(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
2012-07-10 04:12:43 +02:00
|
|
|
xXF86DRIQueryVersionReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.majorVersion = SERVER_XF86DRI_MAJOR_VERSION,
|
|
|
|
.minorVersion = SERVER_XF86DRI_MINOR_VERSION,
|
|
|
|
.patchVersion = SERVER_XF86DRI_PATCH_VERSION
|
|
|
|
};
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2009-04-25 08:51:48 +02:00
|
|
|
REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-23 11:53:02 +02:00
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
if (client->swapped) {
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swaps(&rep.majorVersion);
|
|
|
|
swaps(&rep.minorVersion);
|
|
|
|
swapl(&rep.patchVersion);
|
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), &rep);
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("leave\n");
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
xXF86DRIQueryDirectRenderingCapableReply rep;
|
2007-08-14 22:48:41 +02:00
|
|
|
Bool isCapable;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
|
2009-04-25 08:51:48 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
if (stuff->screen >= screenInfo.numScreens) {
|
2012-03-21 20:55:09 +01:00
|
|
|
client->errorValue = stuff->screen;
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!ephyrDRIQueryDirectRenderingCapable(stuff->screen, &isCapable)) {
|
2007-08-14 22:48:41 +02:00
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
|
2012-09-20 19:16:59 +02:00
|
|
|
if (!client->local || client->swapped)
|
2012-07-10 04:12:43 +02:00
|
|
|
isCapable = 0;
|
|
|
|
|
|
|
|
rep = (xXF86DRIQueryDirectRenderingCapableReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.isCapable = isCapable
|
|
|
|
};
|
2007-08-14 22:48:41 +02:00
|
|
|
|
|
|
|
if (client->swapped) {
|
2012-03-21 20:55:09 +01:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
WriteToClient(client, sizeof(xXF86DRIQueryDirectRenderingCapableReply),
|
2012-05-13 09:03:35 +02:00
|
|
|
&rep);
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("leave\n");
|
2007-08-23 11:53:02 +02:00
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRIOpenConnection(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
|
|
|
xXF86DRIOpenConnectionReply rep;
|
2012-03-21 20:55:09 +01:00
|
|
|
drm_handle_t hSAREA;
|
|
|
|
char *busIdString = NULL;
|
2012-07-10 04:12:42 +02:00
|
|
|
CARD32 busIdStringLength = 0;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
REQUEST(xXF86DRIOpenConnectionReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
|
2009-04-25 08:51:48 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
if (stuff->screen >= screenInfo.numScreens) {
|
2012-03-21 20:55:09 +01:00
|
|
|
client->errorValue = stuff->screen;
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!ephyrDRIOpenConnection(stuff->screen, &hSAREA, &busIdString)) {
|
2007-08-14 22:48:41 +02:00
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
|
2012-07-10 04:12:42 +02:00
|
|
|
if (busIdString)
|
|
|
|
busIdStringLength = strlen(busIdString);
|
|
|
|
|
2012-07-10 04:12:43 +02:00
|
|
|
rep = (xXF86DRIOpenConnectionReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
|
|
|
|
SIZEOF(xGenericReply) +
|
|
|
|
pad_to_int32(busIdStringLength)),
|
|
|
|
.hSAREALow = (CARD32) (hSAREA & 0xffffffff),
|
2007-08-14 22:48:41 +02:00
|
|
|
#if defined(LONG64) && !defined(__linux__)
|
2012-07-10 04:12:43 +02:00
|
|
|
.hSAREAHigh = (CARD32) (hSAREA >> 32),
|
2007-08-14 22:48:41 +02:00
|
|
|
#else
|
2012-07-10 04:12:43 +02:00
|
|
|
.hSAREAHigh = 0,
|
2007-08-14 22:48:41 +02:00
|
|
|
#endif
|
2012-07-10 04:12:43 +02:00
|
|
|
.busIdStringLength = busIdStringLength
|
|
|
|
};
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
|
2012-07-10 04:12:42 +02:00
|
|
|
if (busIdStringLength)
|
|
|
|
WriteToClient(client, busIdStringLength, busIdString);
|
2010-06-24 19:45:10 +02:00
|
|
|
free(busIdString);
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("leave\n");
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRIAuthConnection(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
|
|
|
xXF86DRIAuthConnectionReply rep;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
REQUEST(xXF86DRIAuthConnectionReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
|
2009-04-25 08:51:48 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
if (stuff->screen >= screenInfo.numScreens) {
|
2012-03-21 20:55:09 +01:00
|
|
|
client->errorValue = stuff->screen;
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-07-10 04:12:43 +02:00
|
|
|
rep = (xXF86DRIAuthConnectionReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.authenticated = 1
|
|
|
|
};
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!ephyrDRIAuthConnection(stuff->screen, stuff->magic)) {
|
|
|
|
ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
|
2007-08-14 22:48:41 +02:00
|
|
|
rep.authenticated = 0;
|
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), &rep);
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("leave\n");
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRICloseConnection(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXF86DRICloseConnectionReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86DRICloseConnectionReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
if (stuff->screen >= screenInfo.numScreens) {
|
2007-08-23 11:53:02 +02:00
|
|
|
client->errorValue = stuff->screen;
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-03-21 20:55:09 +01:00
|
|
|
DRICloseConnection( screenInfo.screens[stuff->screen]);
|
|
|
|
*/
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("leave\n");
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRIGetClientDriverName(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
2012-07-10 04:12:43 +02:00
|
|
|
xXF86DRIGetClientDriverNameReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.clientDriverNameLength = 0
|
|
|
|
};
|
2012-03-21 20:55:09 +01:00
|
|
|
char *clientDriverName;
|
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
REQUEST(xXF86DRIGetClientDriverNameReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86DRIGetClientDriverNameReq);
|
2009-04-25 08:51:48 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
if (stuff->screen >= screenInfo.numScreens) {
|
2012-03-21 20:55:09 +01:00
|
|
|
client->errorValue = stuff->screen;
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
ephyrDRIGetClientDriverName(stuff->screen,
|
|
|
|
(int *) &rep.ddxDriverMajorVersion,
|
|
|
|
(int *) &rep.ddxDriverMinorVersion,
|
|
|
|
(int *) &rep.ddxDriverPatchVersion,
|
|
|
|
&clientDriverName);
|
2007-08-14 22:48:41 +02:00
|
|
|
if (clientDriverName)
|
2012-03-21 20:55:09 +01:00
|
|
|
rep.clientDriverNameLength = strlen(clientDriverName);
|
2009-07-06 04:41:29 +02:00
|
|
|
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
|
2012-03-21 20:55:09 +01:00
|
|
|
SIZEOF(xGenericReply) +
|
|
|
|
pad_to_int32(rep.clientDriverNameLength));
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xXF86DRIGetClientDriverNameReply), &rep);
|
2007-08-14 22:48:41 +02:00
|
|
|
if (rep.clientDriverNameLength)
|
2012-03-21 20:55:09 +01:00
|
|
|
WriteToClient(client, rep.clientDriverNameLength, clientDriverName);
|
|
|
|
EPHYR_LOG("leave\n");
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRICreateContext(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
2012-07-10 04:12:43 +02:00
|
|
|
xXF86DRICreateContextReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0
|
|
|
|
};
|
2007-08-14 22:48:41 +02:00
|
|
|
ScreenPtr pScreen;
|
|
|
|
VisualPtr visual;
|
2012-03-21 20:55:09 +01:00
|
|
|
int i = 0;
|
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
REQUEST(xXF86DRICreateContextReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86DRICreateContextReq);
|
2009-04-25 08:51:48 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
if (stuff->screen >= screenInfo.numScreens) {
|
2012-03-21 20:55:09 +01:00
|
|
|
client->errorValue = stuff->screen;
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
pScreen = screenInfo.screens[stuff->screen];
|
|
|
|
visual = pScreen->visuals;
|
|
|
|
|
|
|
|
/* Find the requested X visual */
|
|
|
|
for (i = 0; i < pScreen->numVisuals; i++, visual++)
|
2012-03-21 20:55:09 +01:00
|
|
|
if (visual->vid == stuff->visual)
|
|
|
|
break;
|
2007-08-14 22:48:41 +02:00
|
|
|
if (i == pScreen->numVisuals) {
|
2012-03-21 20:55:09 +01:00
|
|
|
/* No visual found */
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!ephyrDRICreateContext(stuff->screen,
|
|
|
|
stuff->visual,
|
2013-08-17 14:50:37 +02:00
|
|
|
stuff->context,
|
2012-11-06 06:50:58 +01:00
|
|
|
(drm_context_t *) &rep.hHWContext)) {
|
2007-09-08 00:33:59 +02:00
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xXF86DRICreateContextReply), &rep);
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("leave\n");
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRIDestroyContext(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXF86DRIDestroyContextReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86DRIDestroyContextReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2009-04-25 08:51:48 +02:00
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
if (stuff->screen >= screenInfo.numScreens) {
|
2007-08-23 11:53:02 +02:00
|
|
|
client->errorValue = stuff->screen;
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!ephyrDRIDestroyContext(stuff->screen, stuff->context)) {
|
|
|
|
return BadValue;
|
|
|
|
}
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("leave\n");
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2007-09-08 00:33:59 +02:00
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
getWindowVisual(const WindowPtr a_win, VisualPtr * a_visual)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int i = 0, visual_id = 0;
|
|
|
|
|
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(a_win
|
|
|
|
&& a_win->drawable.pScreen
|
|
|
|
&& a_win->drawable.pScreen->visuals, FALSE);
|
|
|
|
|
|
|
|
visual_id = wVisual(a_win);
|
|
|
|
for (i = 0; i < a_win->drawable.pScreen->numVisuals; i++) {
|
2007-09-08 00:33:59 +02:00
|
|
|
if (a_win->drawable.pScreen->visuals[i].vid == visual_id) {
|
2012-03-21 20:55:09 +01:00
|
|
|
*a_visual = &a_win->drawable.pScreen->visuals[i];
|
|
|
|
return TRUE;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#define NUM_WINDOW_PAIRS 256
|
2012-03-21 20:55:09 +01:00
|
|
|
static EphyrWindowPair window_pairs[NUM_WINDOW_PAIRS];
|
2007-09-08 00:33:59 +02:00
|
|
|
|
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
appendWindowPairToList(WindowPtr a_local, int a_remote)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int i = 0;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(a_local, FALSE);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("(local,remote):(%p, %d)\n", a_local, a_remote);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < NUM_WINDOW_PAIRS; i++) {
|
2007-09-08 00:33:59 +02:00
|
|
|
if (window_pairs[i].local == NULL) {
|
2012-03-21 20:55:09 +01:00
|
|
|
window_pairs[i].local = a_local;
|
|
|
|
window_pairs[i].remote = a_remote;
|
|
|
|
return TRUE;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
findWindowPairFromLocal(WindowPtr a_local, EphyrWindowPair ** a_pair)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int i = 0;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(a_pair && a_local, FALSE);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < NUM_WINDOW_PAIRS; i++) {
|
2007-09-08 00:33:59 +02:00
|
|
|
if (window_pairs[i].local == a_local) {
|
2012-03-21 20:55:09 +01:00
|
|
|
*a_pair = &window_pairs[i];
|
|
|
|
EPHYR_LOG("found (%p, %d)\n", (*a_pair)->local, (*a_pair)->remote);
|
|
|
|
return TRUE;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
|
2008-02-21 15:33:02 +01:00
|
|
|
Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
findWindowPairFromRemote(int a_remote, EphyrWindowPair ** a_pair)
|
2008-02-21 15:33:02 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int i = 0;
|
2008-02-21 15:33:02 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(a_pair, FALSE);
|
2008-02-21 15:33:02 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < NUM_WINDOW_PAIRS; i++) {
|
2008-02-21 15:33:02 +01:00
|
|
|
if (window_pairs[i].remote == a_remote) {
|
2012-03-21 20:55:09 +01:00
|
|
|
*a_pair = &window_pairs[i];
|
|
|
|
EPHYR_LOG("found (%p, %d)\n", (*a_pair)->local, (*a_pair)->remote);
|
|
|
|
return TRUE;
|
2008-02-21 15:33:02 +01:00
|
|
|
}
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2008-02-21 15:33:02 +01:00
|
|
|
}
|
|
|
|
|
2007-09-08 00:33:59 +02:00
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
createHostPeerWindow(const WindowPtr a_win, int *a_peer_win)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool is_ok = FALSE;
|
|
|
|
VisualPtr visual = NULL;
|
|
|
|
EphyrBox geo;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(a_win && a_peer_win, FALSE);
|
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(a_win->drawable.pScreen, FALSE);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter. a_win '%p'\n", a_win);
|
|
|
|
if (!getWindowVisual(a_win, &visual)) {
|
|
|
|
EPHYR_LOG_ERROR("failed to get window visual\n");
|
|
|
|
goto out;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
if (!visual) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("failed to create visual\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
memset(&geo, 0, sizeof(geo));
|
|
|
|
geo.x = a_win->drawable.x;
|
|
|
|
geo.y = a_win->drawable.y;
|
|
|
|
geo.width = a_win->drawable.width;
|
|
|
|
geo.height = a_win->drawable.height;
|
|
|
|
if (!hostx_create_window(a_win->drawable.pScreen->myNum,
|
|
|
|
&geo, visual->vid, a_peer_win)) {
|
|
|
|
EPHYR_LOG_ERROR("failed to create host peer window\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (!appendWindowPairToList(a_win, *a_peer_win)) {
|
|
|
|
EPHYR_LOG_ERROR("failed to append window to pair list\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
is_ok = TRUE;
|
|
|
|
out:
|
|
|
|
EPHYR_LOG("leave:remote win%d\n", *a_peer_win);
|
|
|
|
return is_ok;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
destroyHostPeerWindow(const WindowPtr a_win)
|
2007-09-08 00:33:59 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool is_ok = FALSE;
|
|
|
|
EphyrWindowPair *pair = NULL;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_RETURN_VAL_IF_FAIL(a_win, FALSE);
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
|
|
|
|
|
|
|
if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
|
|
|
|
EPHYR_LOG_ERROR("failed to find peer to local window\n");
|
2007-09-08 00:33:59 +02:00
|
|
|
goto out;
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
hostx_destroy_window(pair->remote);
|
|
|
|
is_ok = TRUE;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
out:
|
|
|
|
EPHYR_LOG("leave\n");
|
2007-09-08 00:33:59 +02:00
|
|
|
return is_ok;
|
|
|
|
}
|
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRICreateDrawable(ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
2012-07-10 04:12:43 +02:00
|
|
|
xXF86DRICreateDrawableReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0
|
|
|
|
};
|
2012-03-21 20:55:09 +01:00
|
|
|
DrawablePtr drawable = NULL;
|
|
|
|
WindowPtr window = NULL;
|
|
|
|
EphyrWindowPair *pair = NULL;
|
|
|
|
EphyrDRIWindowPrivPtr win_priv = NULL;
|
|
|
|
int rc = 0, remote_win = 0;
|
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
REQUEST(xXF86DRICreateDrawableReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq);
|
2009-04-25 08:51:48 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
if (stuff->screen >= screenInfo.numScreens) {
|
2007-08-23 11:53:02 +02:00
|
|
|
client->errorValue = stuff->screen;
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
|
|
|
|
DixReadAccess);
|
2007-08-14 22:48:41 +02:00
|
|
|
if (rc != Success)
|
2007-08-23 11:53:02 +02:00
|
|
|
return rc;
|
2007-09-08 00:33:59 +02:00
|
|
|
if (drawable->type != DRAWABLE_WINDOW) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("non drawable windows are not yet supported\n");
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
EPHYR_LOG("lookedup drawable %p\n", drawable);
|
|
|
|
window = (WindowPtr) drawable;
|
|
|
|
if (findWindowPairFromLocal(window, &pair) && pair) {
|
|
|
|
remote_win = pair->remote;
|
|
|
|
EPHYR_LOG("found window '%p' paire with remote '%d'\n",
|
|
|
|
window, remote_win);
|
|
|
|
}
|
|
|
|
else if (!createHostPeerWindow(window, &remote_win)) {
|
|
|
|
EPHYR_LOG_ERROR("failed to create host peer window\n");
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ephyrDRICreateDrawable(stuff->screen,
|
|
|
|
remote_win,
|
2012-11-06 06:50:58 +01:00
|
|
|
(drm_drawable_t *) &rep.hHWDrawable)) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("failed to create dri drawable\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
win_priv = GET_EPHYR_DRI_WINDOW_PRIV(window);
|
2007-09-08 00:33:59 +02:00
|
|
|
if (!win_priv) {
|
2012-03-21 20:55:09 +01:00
|
|
|
win_priv = calloc(1, sizeof(EphyrDRIWindowPrivRec));
|
2007-09-08 00:33:59 +02:00
|
|
|
if (!win_priv) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("failed to allocate window private\n");
|
|
|
|
return BadAlloc;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
dixSetPrivate(&window->devPrivates, ephyrDRIWindowKey, win_priv);
|
|
|
|
EPHYR_LOG("paired window '%p' with remote '%d'\n", window, remote_win);
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
|
|
|
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), &rep);
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("leave\n");
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRIDestroyDrawable(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
DrawablePtr drawable = NULL;
|
|
|
|
WindowPtr window = NULL;
|
|
|
|
EphyrWindowPair *pair = NULL;
|
|
|
|
int rc = 0;
|
|
|
|
|
2009-04-25 08:51:48 +02:00
|
|
|
REQUEST(xXF86DRIDestroyDrawableReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq);
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
if (stuff->screen >= screenInfo.numScreens) {
|
2007-08-23 11:53:02 +02:00
|
|
|
client->errorValue = stuff->screen;
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2007-09-08 00:33:59 +02:00
|
|
|
rc = dixLookupDrawable(&drawable,
|
2012-03-21 20:55:09 +01:00
|
|
|
stuff->drawable, client, 0, DixReadAccess);
|
2007-08-14 22:48:41 +02:00
|
|
|
if (rc != Success)
|
2007-08-23 11:53:02 +02:00
|
|
|
return rc;
|
2007-09-08 00:33:59 +02:00
|
|
|
if (drawable->type != DRAWABLE_WINDOW) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("non drawable windows are not yet supported\n");
|
|
|
|
return BadImplementation;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
window = (WindowPtr) drawable;
|
|
|
|
if (!findWindowPairFromLocal(window, &pair) && pair) {
|
|
|
|
EPHYR_LOG_ERROR("failed to find pair window\n");
|
2007-09-08 00:33:59 +02:00
|
|
|
return BadImplementation;
|
|
|
|
}
|
2007-08-14 22:48:41 +02:00
|
|
|
if (!ephyrDRIDestroyDrawable(stuff->screen,
|
2012-03-21 20:55:09 +01:00
|
|
|
pair->remote /*drawable in host x */ )) {
|
|
|
|
EPHYR_LOG_ERROR("failed to destroy dri drawable\n");
|
2007-09-08 00:33:59 +02:00
|
|
|
return BadImplementation;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
pair->local = NULL;
|
|
|
|
pair->remote = 0;
|
2007-09-08 00:33:59 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("leave\n");
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
2012-07-10 04:12:43 +02:00
|
|
|
xXF86DRIGetDrawableInfoReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0
|
|
|
|
};
|
2007-08-30 23:54:49 +02:00
|
|
|
DrawablePtr drawable;
|
2012-03-21 20:55:09 +01:00
|
|
|
WindowPtr window = NULL;
|
|
|
|
EphyrWindowPair *pair = NULL;
|
|
|
|
int X = 0, Y = 0, W = 0, H = 0, backX = 0, backY = 0, rc = 0, i = 0;
|
|
|
|
drm_clip_rect_t *clipRects = NULL;
|
|
|
|
drm_clip_rect_t *backClipRects = NULL;
|
|
|
|
|
2009-04-25 08:51:48 +02:00
|
|
|
REQUEST(xXF86DRIGetDrawableInfoReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
if (stuff->screen >= screenInfo.numScreens) {
|
2007-08-23 11:53:02 +02:00
|
|
|
client->errorValue = stuff->screen;
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2007-08-30 23:54:49 +02:00
|
|
|
rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
|
|
|
|
DixReadAccess);
|
2007-09-08 00:33:59 +02:00
|
|
|
if (rc != Success || !drawable) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("could not get drawable\n");
|
2007-08-23 11:53:02 +02:00
|
|
|
return rc;
|
2007-09-08 00:33:59 +02:00
|
|
|
}
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2007-09-08 00:33:59 +02:00
|
|
|
if (drawable->type != DRAWABLE_WINDOW) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("non windows type drawables are not yes supported\n");
|
|
|
|
return BadImplementation;
|
|
|
|
}
|
|
|
|
window = (WindowPtr) drawable;
|
|
|
|
memset(&pair, 0, sizeof(pair));
|
|
|
|
if (!findWindowPairFromLocal(window, &pair) || !pair) {
|
|
|
|
EPHYR_LOG_ERROR("failed to find remote peer drawable\n");
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
EPHYR_LOG("clip list of xephyr gl drawable:\n");
|
|
|
|
for (i = 0; i < RegionNumRects(&window->clipList); i++) {
|
|
|
|
EPHYR_LOG("x1:%d, y1:%d, x2:%d, y2:%d\n",
|
|
|
|
RegionRects(&window->clipList)[i].x1,
|
|
|
|
RegionRects(&window->clipList)[i].y1,
|
|
|
|
RegionRects(&window->clipList)[i].x2,
|
|
|
|
RegionRects(&window->clipList)[i].y2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ephyrDRIGetDrawableInfo(stuff->screen,
|
|
|
|
pair->remote /*the drawable in hostx */ ,
|
|
|
|
(unsigned int *) &rep.drawableTableIndex,
|
|
|
|
(unsigned int *) &rep.drawableTableStamp,
|
|
|
|
(int *) &X,
|
|
|
|
(int *) &Y,
|
|
|
|
(int *) &W,
|
|
|
|
(int *) &H,
|
|
|
|
(int *) &rep.numClipRects,
|
|
|
|
&clipRects,
|
|
|
|
&backX,
|
|
|
|
&backY,
|
|
|
|
(int *) &rep.numBackClipRects,
|
|
|
|
&backClipRects)) {
|
2007-08-23 11:53:02 +02:00
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("num clip rects:%d, num back clip rects:%d\n",
|
|
|
|
(int) rep.numClipRects, (int) rep.numBackClipRects);
|
2007-08-14 22:48:41 +02:00
|
|
|
|
|
|
|
rep.drawableX = X;
|
|
|
|
rep.drawableY = Y;
|
|
|
|
rep.drawableWidth = W;
|
|
|
|
rep.drawableHeight = H;
|
2012-03-21 20:55:09 +01:00
|
|
|
rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) - SIZEOF(xGenericReply));
|
2007-08-14 22:48:41 +02:00
|
|
|
|
|
|
|
rep.backX = backX;
|
|
|
|
rep.backY = backY;
|
2007-08-23 11:53:02 +02:00
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
if (rep.numClipRects) {
|
2007-09-17 22:13:51 +02:00
|
|
|
if (clipRects) {
|
2007-08-23 11:53:02 +02:00
|
|
|
ScreenPtr pScreen = screenInfo.screens[stuff->screen];
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
EPHYR_LOG("clip list of host gl drawable:\n");
|
2007-09-17 18:15:03 +02:00
|
|
|
for (i = 0; i < rep.numClipRects; i++) {
|
2012-03-21 20:55:09 +01:00
|
|
|
clipRects[i].x1 = max(clipRects[i].x1, 0);
|
|
|
|
clipRects[i].y1 = max(clipRects[i].y1, 0);
|
|
|
|
clipRects[i].x2 = min(clipRects[i].x2,
|
|
|
|
pScreen->width + clipRects[i].x1);
|
|
|
|
clipRects[i].y2 = min(clipRects[i].y2,
|
|
|
|
pScreen->width + clipRects[i].y1);
|
|
|
|
|
|
|
|
EPHYR_LOG("x1:%d, y1:%d, x2:%d, y2:%d\n",
|
|
|
|
clipRects[i].x1, clipRects[i].y1,
|
|
|
|
clipRects[i].x2, clipRects[i].y2);
|
2007-08-23 11:53:02 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else {
|
2007-08-23 11:53:02 +02:00
|
|
|
rep.numClipRects = 0;
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
EPHYR_LOG("got zero host gl drawable clipping rects\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
2007-09-17 22:13:51 +02:00
|
|
|
rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects;
|
2012-03-21 20:55:09 +01:00
|
|
|
backClipRects = clipRects;
|
|
|
|
rep.numBackClipRects = rep.numClipRects;
|
2007-09-17 22:13:51 +02:00
|
|
|
if (rep.numBackClipRects)
|
|
|
|
rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects;
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("num host clip rects:%d\n", (int) rep.numClipRects);
|
|
|
|
EPHYR_LOG("num host back clip rects:%d\n", (int) rep.numBackClipRects);
|
2007-08-23 11:53:02 +02:00
|
|
|
|
2009-07-06 04:41:29 +02:00
|
|
|
rep.length = bytes_to_int32(rep.length);
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), &rep);
|
2007-08-14 22:48:41 +02:00
|
|
|
|
|
|
|
if (rep.numClipRects) {
|
2007-09-17 18:15:03 +02:00
|
|
|
WriteToClient(client,
|
|
|
|
sizeof(drm_clip_rect_t) * rep.numClipRects,
|
2012-05-13 09:03:35 +02:00
|
|
|
clipRects);
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rep.numBackClipRects) {
|
2007-09-17 18:15:03 +02:00
|
|
|
WriteToClient(client,
|
|
|
|
sizeof(drm_clip_rect_t) * rep.numBackClipRects,
|
2012-05-13 09:03:35 +02:00
|
|
|
backClipRects);
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
2010-05-05 20:44:06 +02:00
|
|
|
free(clipRects);
|
2012-03-21 20:55:09 +01:00
|
|
|
clipRects = NULL;
|
2010-01-02 00:43:26 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("leave\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRIGetDeviceInfo(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
2012-07-10 04:12:43 +02:00
|
|
|
xXF86DRIGetDeviceInfoReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0
|
|
|
|
};
|
2007-08-14 22:48:41 +02:00
|
|
|
drm_handle_t hFrameBuffer;
|
|
|
|
void *pDevPrivate;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2007-08-14 22:48:41 +02:00
|
|
|
REQUEST(xXF86DRIGetDeviceInfoReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86DRIGetDeviceInfoReq);
|
2009-04-25 08:51:48 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
if (stuff->screen >= screenInfo.numScreens) {
|
2007-08-23 11:53:02 +02:00
|
|
|
client->errorValue = stuff->screen;
|
|
|
|
return BadValue;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!ephyrDRIGetDeviceInfo(stuff->screen,
|
|
|
|
&hFrameBuffer,
|
|
|
|
(int *) &rep.framebufferOrigin,
|
|
|
|
(int *) &rep.framebufferSize,
|
|
|
|
(int *) &rep.framebufferStride,
|
|
|
|
(int *) &rep.devPrivateSize, &pDevPrivate)) {
|
2007-08-14 22:48:41 +02:00
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
rep.hFrameBufferLow = (CARD32) (hFrameBuffer & 0xffffffff);
|
2007-08-14 22:48:41 +02:00
|
|
|
#if defined(LONG64) && !defined(__linux__)
|
2012-03-21 20:55:09 +01:00
|
|
|
rep.hFrameBufferHigh = (CARD32) (hFrameBuffer >> 32);
|
2007-08-14 22:48:41 +02:00
|
|
|
#else
|
|
|
|
rep.hFrameBufferHigh = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (rep.devPrivateSize) {
|
2009-07-06 04:41:29 +02:00
|
|
|
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
|
2012-03-21 20:55:09 +01:00
|
|
|
SIZEOF(xGenericReply) +
|
|
|
|
pad_to_int32(rep.devPrivateSize));
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep);
|
2007-08-14 22:48:41 +02:00
|
|
|
if (rep.length) {
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, rep.devPrivateSize, pDevPrivate);
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("leave\n");
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXF86DRIDispatch(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
switch (stuff->data) {
|
|
|
|
case X_XF86DRIQueryVersion:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRIQueryVersion(client);
|
|
|
|
}
|
|
|
|
case X_XF86DRIQueryDirectRenderingCapable:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRIQueryDirectRenderingCapable(client);
|
|
|
|
}
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
|
2012-09-20 19:16:59 +02:00
|
|
|
if (!client->local)
|
2007-08-14 22:48:41 +02:00
|
|
|
return DRIErrorBase + XF86DRIClientNotLocal;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
switch (stuff->data) {
|
|
|
|
case X_XF86DRIOpenConnection:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRIOpenConnection(client);
|
|
|
|
}
|
|
|
|
case X_XF86DRICloseConnection:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRICloseConnection(client);
|
|
|
|
}
|
|
|
|
case X_XF86DRIGetClientDriverName:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRIGetClientDriverName(client);
|
|
|
|
}
|
|
|
|
case X_XF86DRICreateContext:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRICreateContext(client);
|
|
|
|
}
|
|
|
|
case X_XF86DRIDestroyContext:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRIDestroyContext(client);
|
|
|
|
}
|
|
|
|
case X_XF86DRICreateDrawable:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRICreateDrawable(client);
|
|
|
|
}
|
|
|
|
case X_XF86DRIDestroyDrawable:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRIDestroyDrawable(client);
|
|
|
|
}
|
|
|
|
case X_XF86DRIGetDrawableInfo:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRIGetDrawableInfo(client);
|
|
|
|
}
|
|
|
|
case X_XF86DRIGetDeviceInfo:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRIGetDeviceInfo(client);
|
|
|
|
}
|
|
|
|
case X_XF86DRIAuthConnection:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return ProcXF86DRIAuthConnection(client);
|
|
|
|
}
|
|
|
|
/* {Open,Close}FullScreen are deprecated now */
|
|
|
|
default:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return BadRequest;
|
|
|
|
}
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXF86DRIQueryVersion(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXF86DRIQueryVersionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2007-08-14 22:48:41 +02:00
|
|
|
return ProcXF86DRIQueryVersion(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->screen);
|
2007-08-14 22:48:41 +02:00
|
|
|
return ProcXF86DRIQueryDirectRenderingCapable(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXF86DRIDispatch(register ClientPtr client)
|
2007-08-14 22:48:41 +02:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2007-08-14 22:48:41 +02:00
|
|
|
/*
|
|
|
|
* Only local clients are allowed DRI access, but remote clients still need
|
|
|
|
* these requests to find out cleanly.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
switch (stuff->data) {
|
|
|
|
case X_XF86DRIQueryVersion:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return SProcXF86DRIQueryVersion(client);
|
|
|
|
}
|
|
|
|
case X_XF86DRIQueryDirectRenderingCapable:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return SProcXF86DRIQueryDirectRenderingCapable(client);
|
|
|
|
}
|
|
|
|
default:{
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return DRIErrorBase + XF86DRIClientNotLocal;
|
|
|
|
}
|
2007-08-14 22:48:41 +02:00
|
|
|
}
|
|
|
|
}
|
2010-07-16 19:19:50 +02:00
|
|
|
|
|
|
|
Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
ephyrDRIExtensionInit(ScreenPtr a_screen)
|
2010-07-16 19:19:50 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool is_ok = FALSE;
|
|
|
|
ExtensionEntry *extEntry = NULL;
|
|
|
|
EphyrDRIScreenPrivPtr screen_priv = NULL;
|
2010-07-16 19:19:50 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("enter\n");
|
2013-08-18 14:12:45 +02:00
|
|
|
if (!host_has_extension(&xcb_xf86dri_id)) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("host does not have DRI extension\n");
|
|
|
|
goto out;
|
2010-07-16 19:19:50 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("host X does have DRI extension\n");
|
2013-08-18 14:12:45 +02:00
|
|
|
if (!host_has_extension(&xcb_shape_id)) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("host does not have XShape extension\n");
|
|
|
|
goto out;
|
2010-07-16 19:19:50 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG("host X does have XShape extension\n");
|
2010-07-16 19:19:50 +02:00
|
|
|
|
|
|
|
#ifdef XF86DRI_EVENTS
|
2012-03-21 20:55:09 +01:00
|
|
|
EventType = CreateNewResourceType(XF86DRIFreeEvents, "DRIEvents");
|
2010-07-16 19:19:50 +02:00
|
|
|
if (!EventType) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("failed to register DRI event resource type\n");
|
|
|
|
goto out;
|
2010-07-16 19:19:50 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if ((extEntry = AddExtension(XF86DRINAME,
|
2012-03-21 20:55:09 +01:00
|
|
|
XF86DRINumberEvents,
|
|
|
|
XF86DRINumberErrors,
|
|
|
|
ProcXF86DRIDispatch,
|
|
|
|
SProcXF86DRIDispatch,
|
|
|
|
NULL, StandardMinorOpcode))) {
|
|
|
|
DRIReqCode = (unsigned char) extEntry->base;
|
|
|
|
DRIErrorBase = extEntry->errorBase;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
EPHYR_LOG_ERROR("failed to register DRI extension\n");
|
|
|
|
goto out;
|
2010-07-16 19:19:50 +02:00
|
|
|
}
|
2011-07-07 19:18:03 +02:00
|
|
|
if (!dixRegisterPrivateKey(&ephyrDRIScreenKeyRec, PRIVATE_SCREEN, 0))
|
2012-03-21 20:55:09 +01:00
|
|
|
goto out;
|
2011-07-07 19:18:03 +02:00
|
|
|
if (!dixRegisterPrivateKey(&ephyrDRIWindowKeyRec, PRIVATE_WINDOW, 0))
|
2012-03-21 20:55:09 +01:00
|
|
|
goto out;
|
|
|
|
screen_priv = calloc(1, sizeof(EphyrDRIScreenPrivRec));
|
2010-07-16 19:19:50 +02:00
|
|
|
if (!screen_priv) {
|
2012-03-21 20:55:09 +01:00
|
|
|
EPHYR_LOG_ERROR("failed to allocate screen_priv\n");
|
|
|
|
goto out;
|
2010-07-16 19:19:50 +02:00
|
|
|
}
|
|
|
|
dixSetPrivate(&a_screen->devPrivates, ephyrDRIScreenKey, screen_priv);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!ephyrDRIScreenInit(a_screen)) {
|
|
|
|
EPHYR_LOG_ERROR("ephyrDRIScreenInit() failed\n");
|
|
|
|
goto out;
|
2010-07-16 19:19:50 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
EphyrMirrorHostVisuals(a_screen);
|
|
|
|
is_ok = TRUE;
|
|
|
|
out:
|
|
|
|
EPHYR_LOG("leave\n");
|
|
|
|
return is_ok;
|
2010-07-16 19:19:50 +02:00
|
|
|
}
|