xserver: Branch 'master' - 3 commits
Adam Jackson
ajax at kemper.freedesktop.org
Thu Jan 28 06:02:28 PST 2016
hw/kdrive/ephyr/Makefile.am | 14
hw/kdrive/ephyr/ephyr.c | 76 --
hw/kdrive/ephyr/ephyrdri.c | 356 ----------
hw/kdrive/ephyr/ephyrdri.h | 70 --
hw/kdrive/ephyr/ephyrdriext.c | 1376 -----------------------------------------
hw/kdrive/ephyr/ephyrdriext.h | 40 -
hw/kdrive/ephyr/ephyrglxext.c | 854 -------------------------
hw/kdrive/ephyr/ephyrglxext.h | 34 -
hw/kdrive/ephyr/ephyrhostglx.c | 490 --------------
hw/kdrive/ephyr/ephyrhostglx.h | 75 --
hw/kdrive/ephyr/ephyrinit.c | 13
hw/kdrive/ephyr/hostx.c | 78 --
hw/kdrive/ephyr/hostx.h | 14
hw/xfree86/common/xf86Config.c | 8
hw/xfree86/doc/Makefile.am | 1
hw/xfree86/doc/README.DRIcomp | 551 ----------------
16 files changed, 4050 deletions(-)
New commits:
commit 623ff251dd025929f5bb6174ca86580c5e707261
Author: Adam Jackson <ajax at redhat.com>
Date: Tue Dec 8 17:41:38 2015 -0500
xephyr: Remove DRI1
This only worked if the backend server supported DRI1, which is
stunningly unlikely these days.
Signed-off-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index 155e11e..6ce0d6f 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -46,19 +46,6 @@ GLAMOR_SRCS = \
$()
endif
-if DRI
-DRI_SRCS = \
- ephyrdriext.c \
- ephyrdriext.h \
- ephyrdri.c \
- ephyrdri.h \
- ephyrglxext.c \
- ephyrglxext.h \
- ephyrhostglx.c \
- ephyrhostglx.h \
- $()
-endif
-
bin_PROGRAMS = Xephyr
Xephyr_SOURCES = \
@@ -72,7 +59,6 @@ Xephyr_SOURCES = \
hostx.c \
hostx.h \
$(XV_SRCS) \
- $(DRI_SRCS) \
$(GLAMOR_SRCS) \
$()
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 896bac5..a272882 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -36,13 +36,6 @@
#include "scrnintstr.h"
#include "ephyrlog.h"
-#ifdef XF86DRI
-#include <xcb/xf86dri.h>
-#include "ephyrdri.h"
-#include "ephyrdriext.h"
-#include "ephyrglxext.h"
-#endif /* XF86DRI */
-
#ifdef GLAMOR
#include "glamor.h"
#endif
@@ -658,16 +651,6 @@ ephyrInitScreen(ScreenPtr pScreen)
}
}
#endif /*XV*/
-#ifdef XF86DRI
- if (!ephyrNoDRI && !hostx_has_extension(&xcb_xf86dri_id)) {
- EPHYR_LOG("host x does not support DRI. Disabling DRI forwarding\n");
- ephyrNoDRI = TRUE;
- }
- if (!ephyrNoDRI) {
- ephyrDRIExtensionInit(pScreen);
- ephyrHijackGLXExtension();
- }
-#endif
return TRUE;
}
@@ -849,40 +832,6 @@ miPointerScreenFuncRec ephyrPointerScreenFuncs = {
ephyrWarpCursor,
};
-#ifdef XF86DRI
-/**
- * find if the remote window denoted by a_remote
- * is paired with an internal Window within the Xephyr server.
- * If the remove window is paired with an internal window, send an
- * expose event to the client insterested in the internal window expose event.
- *
- * Pairing happens when a drawable inside Xephyr is associated with
- * a GL surface in a DRI environment.
- * Look at the function ProcXF86DRICreateDrawable in ephyrdriext.c to
- * know a paired window is created.
- *
- * This is useful to make GL drawables (only windows for now) handle
- * expose events and send those events to clients.
- */
-static void
-ephyrExposePairedWindow(int a_remote)
-{
- EphyrWindowPair *pair = NULL;
- RegionRec reg;
- ScreenPtr screen;
-
- if (!findWindowPairFromRemote(a_remote, &pair)) {
- EPHYR_LOG("did not find a pair for this window\n");
- return;
- }
- screen = pair->local->drawable.pScreen;
- RegionNull(®);
- RegionCopy(®, &pair->local->clipList);
- screen->WindowExposures(pair->local, ®);
- RegionUninit(®);
-}
-#endif /* XF86DRI */
-
static KdScreenInfo *
screen_from_window(Window w)
{
@@ -939,16 +888,6 @@ ephyrProcessExpose(xcb_generic_event_t *xev)
scrpriv->win_height);
} else {
EPHYR_LOG_ERROR("failed to get host screen\n");
-#ifdef XF86DRI
- /*
- * We only receive expose events when the expose event
- * have be generated for a drawable that is a host X
- * window managed by Xephyr. Host X windows managed by
- * Xephyr exists for instance when Xephyr is asked to
- * create a GL drawable in a DRI environment.
- */
- ephyrExposePairedWindow(expose->window);
-#endif /* XF86DRI */
}
}
@@ -974,25 +913,10 @@ ephyrProcessMouseMotion(xcb_generic_event_t *xev)
else {
int x = 0, y = 0;
-#ifdef XF86DRI
- EphyrWindowPair *pair = NULL;
-#endif
EPHYR_LOG("enqueuing mouse motion:%d\n", screen->pScreen->myNum);
x = motion->event_x;
y = motion->event_y;
EPHYR_LOG("initial (x,y):(%d,%d)\n", x, y);
-#ifdef XF86DRI
- EPHYR_LOG("is this window peered by a gl drawable ?\n");
- if (findWindowPairFromRemote(motion->event, &pair)) {
- EPHYR_LOG("yes, it is peered\n");
- x += pair->local->drawable.x;
- y += pair->local->drawable.y;
- }
- else {
- EPHYR_LOG("no, it is not peered\n");
- }
- EPHYR_LOG("final (x,y):(%d,%d)\n", x, y);
-#endif
/* convert coords into desktop-wide coordinates.
* fill_pointer_events will convert that back to
diff --git a/hw/kdrive/ephyr/ephyrdri.c b/hw/kdrive/ephyr/ephyrdri.c
deleted file mode 100644
index 1e34301..0000000
--- a/hw/kdrive/ephyr/ephyrdri.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- * Authored by Matthew Allum <mallum at 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 at openedhand.com>
- */
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-
-#include <X11/Xdefs.h>
-#include <xcb/xf86dri.h>
-#include "hostx.h"
-#include "ephyrdri.h"
-#define _HAVE_XALLOC_DECLS
-#include "ephyrlog.h"
-#include "dixstruct.h"
-#include "pixmapstr.h"
-
-#ifndef TRUE
-#define TRUE 1
-#endif /*TRUE*/
-#ifndef FALSE
-#define FALSE 0
-#endif /*FALSE*/
- Bool
-ephyrDRIQueryDirectRenderingCapable(int a_screen, Bool *a_is_capable)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- Bool is_ok = FALSE;
- xcb_xf86dri_query_direct_rendering_capable_cookie_t cookie;
- xcb_xf86dri_query_direct_rendering_capable_reply_t *reply;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_is_capable, FALSE);
- EPHYR_LOG("enter\n");
- cookie = xcb_xf86dri_query_direct_rendering_capable(conn,
- hostx_get_screen());
- reply = xcb_xf86dri_query_direct_rendering_capable_reply(conn, cookie, NULL);
- if (reply) {
- is_ok = TRUE;
- *a_is_capable = reply->is_capable;
- free(reply);
- }
- EPHYR_LOG("leave. is_capable:%d, is_ok=%d\n", *a_is_capable, is_ok);
-
- return is_ok;
-}
-
-Bool
-ephyrDRIOpenConnection(int a_screen,
- drm_handle_t * a_sarea, char **a_bus_id_string)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- Bool is_ok = FALSE;
- xcb_xf86dri_open_connection_cookie_t cookie;
- xcb_xf86dri_open_connection_reply_t *reply;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_bus_id_string, FALSE);
- EPHYR_LOG("enter. screen:%d\n", a_screen);
- cookie = xcb_xf86dri_open_connection(conn, hostx_get_screen());
- reply = xcb_xf86dri_open_connection_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- *a_sarea = reply->sarea_handle_low;
- if (sizeof(drm_handle_t) == 8) {
- int shift = 32;
- *a_sarea |= ((drm_handle_t) reply->sarea_handle_high) << shift;
- }
- *a_bus_id_string = malloc(reply->bus_id_len + 1);
- if (!*a_bus_id_string)
- goto out;
- memcpy(*a_bus_id_string, xcb_xf86dri_open_connection_bus_id(reply), reply->bus_id_len);
- *a_bus_id_string[reply->bus_id_len] = '\0';
- is_ok = TRUE;
-out:
- free(reply);
- EPHYR_LOG("leave. bus_id_string:%s, is_ok:%d\n", *a_bus_id_string, is_ok);
- return is_ok;
-}
-
-Bool
-ephyrDRIAuthConnection(int a_screen, drm_magic_t a_magic)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- int screen = hostx_get_screen();
- xcb_xf86dri_auth_connection_cookie_t cookie;
- xcb_xf86dri_auth_connection_reply_t *reply;
- Bool is_ok = FALSE;
-
- EPHYR_LOG("enter\n");
- cookie = xcb_xf86dri_auth_connection(conn, screen, a_magic);
- reply = xcb_xf86dri_auth_connection_reply(conn, cookie, NULL);
- is_ok = reply->authenticated;
- free(reply);
- EPHYR_LOG("leave. is_ok:%d\n", is_ok);
- return is_ok;
-}
-
-Bool
-ephyrDRICloseConnection(int a_screen)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- int screen = hostx_get_screen();
-
- EPHYR_LOG("enter\n");
- xcb_xf86dri_close_connection(conn, screen);
- EPHYR_LOG("leave\n");
- return TRUE;
-}
-
-Bool
-ephyrDRIGetClientDriverName(int a_screen,
- int *a_ddx_driver_major_version,
- int *a_ddx_driver_minor_version,
- int *a_ddx_driver_patch_version,
- char **a_client_driver_name)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- int screen = hostx_get_screen();
- xcb_xf86dri_get_client_driver_name_cookie_t cookie;
- xcb_xf86dri_get_client_driver_name_reply_t *reply;
- Bool is_ok = FALSE;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_ddx_driver_major_version
- && a_ddx_driver_minor_version
- && a_ddx_driver_patch_version
- && a_client_driver_name, FALSE);
- EPHYR_LOG("enter\n");
- cookie = xcb_xf86dri_get_client_driver_name(conn, screen);
- reply = xcb_xf86dri_get_client_driver_name_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- *a_ddx_driver_major_version = reply->client_driver_major_version;
- *a_ddx_driver_minor_version = reply->client_driver_minor_version;
- *a_ddx_driver_patch_version = reply->client_driver_patch_version;
- *a_client_driver_name = malloc(reply->client_driver_name_len + 1);
- if (!*a_client_driver_name)
- goto out;
- memcpy(*a_client_driver_name,
- xcb_xf86dri_get_client_driver_name_client_driver_name(reply),
- reply->client_driver_name_len);
- (*a_client_driver_name)[reply->client_driver_name_len] = '\0';
- is_ok = TRUE;
- EPHYR_LOG("major:%d, minor:%d, patch:%d, name:%s\n",
- *a_ddx_driver_major_version,
- *a_ddx_driver_minor_version,
- *a_ddx_driver_patch_version, *a_client_driver_name);
- out:
- free(reply);
- EPHYR_LOG("leave:%d\n", is_ok);
- return is_ok;
-}
-
-Bool
-ephyrDRICreateContext(int a_screen,
- int a_visual_id,
- CARD32 ctxt_id, drm_context_t * a_hw_ctxt)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- int screen = hostx_get_screen();
- Bool is_ok = FALSE;
- xcb_xf86dri_create_context_cookie_t cookie;
- xcb_xf86dri_create_context_reply_t *reply;
-
- ctxt_id = xcb_generate_id(conn);
-
- EPHYR_LOG("enter. screen:%d, visual:%d\n", a_screen, a_visual_id);
- cookie = xcb_xf86dri_create_context(conn, screen, a_visual_id, ctxt_id);
- reply = xcb_xf86dri_create_context_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- *a_hw_ctxt = reply->hw_context;
- is_ok = TRUE;
-out:
- free(reply);
- EPHYR_LOG("leave:%d\n", is_ok);
- return is_ok;
-}
-
-Bool
-ephyrDRIDestroyContext(int a_screen, int a_context_id)
-{
- xcb_connection_t *conn = hostx_get_xcbconn ();
- int screen = hostx_get_screen();
-
- EPHYR_LOG("enter\n");
- xcb_xf86dri_destroy_context(conn, screen, a_context_id);
- EPHYR_LOG("leave\n");
- return TRUE;
-}
-
-Bool
-ephyrDRICreateDrawable(int a_screen,
- int a_drawable, drm_drawable_t * a_hw_drawable)
-{
- Bool is_ok = FALSE;
- xcb_connection_t *conn = hostx_get_xcbconn();
- int screen = hostx_get_screen();
- xcb_xf86dri_create_drawable_cookie_t cookie;
- xcb_xf86dri_create_drawable_reply_t *reply;
-
- EPHYR_LOG("enter\n");
- cookie = xcb_xf86dri_create_drawable(conn, screen, a_drawable);
- reply = xcb_xf86dri_create_drawable_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- *a_hw_drawable = reply->hw_drawable_handle;
- is_ok = TRUE;
-out:
- free(reply);
- EPHYR_LOG("leave. is_ok:%d\n", is_ok);
- return is_ok;
-}
-
-Bool
-ephyrDRIDestroyDrawable(int a_screen, int a_drawable)
-{
- EPHYR_LOG("enter\n");
- EPHYR_LOG_ERROR("not implemented yet\n");
- EPHYR_LOG("leave\n");
- return FALSE;
-}
-
-Bool
-ephyrDRIGetDrawableInfo(int a_screen,
- int a_drawable,
- unsigned int *a_index,
- unsigned int *a_stamp,
- int *a_x,
- int *a_y,
- int *a_w,
- int *a_h,
- int *a_num_clip_rects,
- drm_clip_rect_t ** a_clip_rects,
- int *a_back_x,
- int *a_back_y,
- int *a_num_back_clip_rects,
- drm_clip_rect_t ** a_back_clip_rects)
-{
- Bool is_ok = FALSE;
- xcb_connection_t *conn = hostx_get_xcbconn();
- int screen = hostx_get_screen();
- xcb_xf86dri_get_drawable_info_cookie_t cookie;
- xcb_xf86dri_get_drawable_info_reply_t *reply = NULL;
- EphyrHostWindowAttributes attrs;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_x && a_y && a_w && a_h
- && a_num_clip_rects, FALSE);
-
- EPHYR_LOG("enter\n");
- memset(&attrs, 0, sizeof(attrs));
- if (!hostx_get_window_attributes(a_drawable, &attrs)) {
- EPHYR_LOG_ERROR("failed to query host window attributes\n");
- goto out;
- }
- cookie = xcb_xf86dri_get_drawable_info(conn, screen, a_drawable);
- reply = xcb_xf86dri_get_drawable_info_reply(conn, cookie, NULL);
- if (!reply) {
- EPHYR_LOG_ERROR ("XF86DRIGetDrawableInfo ()\n");
- goto out;
- }
- *a_index = reply->drawable_table_index;
- *a_stamp = reply->drawable_table_stamp;
- *a_x = reply->drawable_origin_X;
- *a_y = reply->drawable_origin_Y;
- *a_w = reply->drawable_size_W;
- *a_h = reply->drawable_size_H;
- *a_num_clip_rects = reply->num_clip_rects;
- *a_clip_rects = calloc(*a_num_clip_rects, sizeof(drm_clip_rect_t));
- memcpy(*a_clip_rects, xcb_xf86dri_get_drawable_info_clip_rects(reply),
- *a_num_clip_rects * sizeof(drm_clip_rect_t));
- EPHYR_LOG("host x,y,w,h: (%d,%d,%d,%d)\n", *a_x, *a_y, *a_w, *a_h);
- if (*a_num_clip_rects) {
- free(*a_back_clip_rects);
- *a_back_clip_rects = calloc(*a_num_clip_rects, sizeof(drm_clip_rect_t));
- memmove(*a_back_clip_rects,
- *a_clip_rects, *a_num_clip_rects * sizeof(drm_clip_rect_t));
- *a_num_back_clip_rects = *a_num_clip_rects;
- }
- EPHYR_LOG("num back clip rects:%d, num clip rects:%d\n",
- *a_num_clip_rects, *a_num_back_clip_rects);
- *a_back_x = *a_x;
- *a_back_y = *a_y;
- *a_w = attrs.width;
- *a_h = attrs.height;
-
- is_ok = TRUE;
- out:
- EPHYR_LOG("leave. index:%d, stamp:%d, x,y:(%d,%d), w,y:(%d,%d)\n",
- *a_index, *a_stamp, *a_x, *a_y, *a_w, *a_h);
- free(reply);
- return is_ok;
-}
-
-Bool
-ephyrDRIGetDeviceInfo(int a_screen,
- drm_handle_t * a_frame_buffer,
- int *a_fb_origin,
- int *a_fb_size,
- int *a_fb_stride,
- int *a_dev_private_size, void **a_dev_private)
-{
- Bool is_ok = FALSE;
- xcb_connection_t *conn = hostx_get_xcbconn ();
- int screen = hostx_get_screen();
- xcb_xf86dri_get_device_info_cookie_t cookie;
- xcb_xf86dri_get_device_info_reply_t *reply;
-
- EPHYR_RETURN_VAL_IF_FAIL(conn, FALSE);
- EPHYR_LOG("enter\n");
- cookie = xcb_xf86dri_get_device_info(conn, screen);
- reply = xcb_xf86dri_get_device_info_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- *a_frame_buffer = reply->framebuffer_handle_low;
- if (sizeof(drm_handle_t) == 8) {
- int shift = 32;
- *a_frame_buffer |= ((drm_handle_t)reply->framebuffer_handle_high) << shift;
- }
- *a_fb_origin = reply->framebuffer_origin_offset;
- *a_fb_size = reply->framebuffer_size;
- *a_fb_stride = reply->framebuffer_stride;
- *a_dev_private_size = reply->device_private_size;
- *a_dev_private = calloc(reply->device_private_size, 1);
- if (!*a_dev_private)
- goto out;
- memcpy(*a_dev_private,
- xcb_xf86dri_get_device_info_device_private(reply),
- reply->device_private_size);
- is_ok = TRUE;
-out:
- free(reply);
- EPHYR_LOG("leave:%d\n", is_ok);
- return is_ok;
-}
diff --git a/hw/kdrive/ephyr/ephyrdri.h b/hw/kdrive/ephyr/ephyrdri.h
deleted file mode 100644
index b312e62..0000000
--- a/hw/kdrive/ephyr/ephyrdri.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- * Authored by Matthew Allum <mallum at 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 at openedhand.com>
- */
-
-#ifndef __EPHYRDRI_H__
-#define __EPHYRDRI_H__
-
-#include <xf86drm.h>
-
-Bool ephyrDRIQueryDirectRenderingCapable(int a_screen, Bool *a_is_capable);
-Bool ephyrDRIOpenConnection(int screen, drm_handle_t * a_sarea,
- char **a_bus_id_string);
-Bool ephyrDRIAuthConnection(int a_screen, drm_magic_t a_magic);
-Bool ephyrDRICloseConnection(int a_screen);
-Bool ephyrDRIGetClientDriverName(int a_screen,
- int *a_ddx_driver_major_version,
- int *a_ddx_driver_minor_version,
- int *a_ddx_driver_patch_version,
- char **a_client_driver_name);
-Bool ephyrDRICreateContext(int a_screen,
- int a_visual_id,
- CARD32 ctx_id, drm_context_t * a_hw_ctx);
-Bool ephyrDRIDestroyContext(int a_screen, int a_context_id);
-Bool ephyrDRICreateDrawable(int a_screen,
- int a_drawable, drm_drawable_t * a_hw_drawable);
-Bool ephyrDRIDestroyDrawable(int a_screen, int a_drawable);
-Bool ephyrDRIGetDrawableInfo(int a_screen, int /*Drawable */ a_drawable,
- unsigned int *a_index,
- unsigned int *a_stamp,
- int *a_x,
- int *a_y,
- int *a_w,
- int *a_h,
- int *a_num_clip_rects,
- drm_clip_rect_t ** a_clip_rects,
- int *a_back_x,
- int *a_back_y,
- int *num_back_clip_rects,
- drm_clip_rect_t ** a_back_clip_rects);
-Bool ephyrDRIGetDeviceInfo(int a_screen,
- drm_handle_t * a_frame_buffer,
- int *a_fb_origin,
- int *a_fb_size,
- int *a_fb_stride,
- int *a_dev_private_size, void **a_dev_private);
-#endif /*__EPHYRDRI_H__*/
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
deleted file mode 100644
index 3703adf..0000000
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ /dev/null
@@ -1,1376 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- * Authored by Matthew Allum <mallum at 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 at openedhand.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-
-#include <string.h>
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#define _XF86DRI_SERVER_
-#include <X11/dri/xf86dri.h>
-#include <X11/dri/xf86driproto.h>
-#include <xcb/xcb.h>
-#include <xcb/shape.h>
-#include <xcb/xf86dri.h>
-#include "misc.h"
-#include "privates.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "colormapst.h"
-#include "cursorstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "servermd.h"
-#include "swaprep.h"
-#include "ephyrdri.h"
-#include "ephyrdriext.h"
-#include "hostx.h"
-#define _HAVE_XALLOC_DECLS
-#include "ephyrlog.h"
-#include "protocol-versions.h"
-
-typedef struct {
- int foo;
-} EphyrDRIWindowPrivRec;
-typedef EphyrDRIWindowPrivRec *EphyrDRIWindowPrivPtr;
-
-typedef struct {
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- MoveWindowProcPtr MoveWindow;
- PositionWindowProcPtr PositionWindow;
- ClipNotifyProcPtr ClipNotify;
-} EphyrDRIScreenPrivRec;
-typedef EphyrDRIScreenPrivRec *EphyrDRIScreenPrivPtr;
-
-static int DRIErrorBase;
-
-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);
-
-static Bool EphyrMirrorHostVisuals(ScreenPtr a_screen);
-static Bool destroyHostPeerWindow(const WindowPtr a_win);
-static Bool findWindowPairFromLocal(WindowPtr a_local,
- EphyrWindowPair ** a_pair);
-
-static unsigned char DRIReqCode = 0;
-
-static DevPrivateKeyRec ephyrDRIWindowKeyRec;
-
-#define ephyrDRIWindowKey (&ephyrDRIWindowKeyRec)
-static DevPrivateKeyRec ephyrDRIScreenKeyRec;
-
-#define ephyrDRIScreenKey (&ephyrDRIScreenKeyRec)
-
-#define GET_EPHYR_DRI_WINDOW_PRIV(win) ((EphyrDRIWindowPrivPtr) \
- dixLookupPrivate(&(win)->devPrivates, ephyrDRIWindowKey))
-#define GET_EPHYR_DRI_SCREEN_PRIV(screen) ((EphyrDRIScreenPrivPtr) \
- dixLookupPrivate(&(screen)->devPrivates, ephyrDRIScreenKey))
-
-static Bool
-ephyrDRIScreenInit(ScreenPtr a_screen)
-{
- Bool is_ok = FALSE;
- EphyrDRIScreenPrivPtr screen_priv = NULL;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_screen, FALSE);
-
- screen_priv = GET_EPHYR_DRI_SCREEN_PRIV(a_screen);
- EPHYR_RETURN_VAL_IF_FAIL(screen_priv, FALSE);
-
- 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;
-
- a_screen->CreateWindow = ephyrDRICreateWindow;
- a_screen->DestroyWindow = ephyrDRIDestroyWindow;
- a_screen->MoveWindow = ephyrDRIMoveWindow;
- a_screen->PositionWindow = ephyrDRIPositionWindow;
- a_screen->ClipNotify = ephyrDRIClipNotify;
-
- is_ok = TRUE;
-
- return is_ok;
-}
-
-static Bool
-ephyrDRICreateWindow(WindowPtr a_win)
-{
- 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->CreateWindow, FALSE);
-
- EPHYR_LOG("enter. win:%p\n", a_win);
-
- screen->CreateWindow = screen_priv->CreateWindow;
- is_ok = (*screen->CreateWindow) (a_win);
- screen->CreateWindow = ephyrDRICreateWindow;
-
- if (is_ok) {
- dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
- }
- return is_ok;
-}
-
-static Bool
-ephyrDRIDestroyWindow(WindowPtr a_win)
-{
- 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;
- if (screen->DestroyWindow) {
- is_ok = (*screen->DestroyWindow) (a_win);
- }
- screen->DestroyWindow = ephyrDRIDestroyWindow;
-
- if (is_ok) {
- EphyrDRIWindowPrivPtr win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
-
- if (win_priv) {
- destroyHostPeerWindow(a_win);
- free(win_priv);
- dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
- EPHYR_LOG("destroyed the remote peer window\n");
- }
- }
- return is_ok;
-}
-
-static void
-ephyrDRIMoveWindow(WindowPtr a_win,
- int a_x, int a_y, WindowPtr a_siblings, VTKind a_kind)
-{
- ScreenPtr screen = NULL;
- EphyrDRIScreenPrivPtr screen_priv = NULL;
- EphyrDRIWindowPrivPtr win_priv = NULL;
- EphyrWindowPair *pair = NULL;
- EphyrBox geo;
- int x = 0, y = 0; /*coords relative to parent window */
-
- 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->MoveWindow);
-
- screen->MoveWindow = screen_priv->MoveWindow;
- if (screen->MoveWindow) {
- (*screen->MoveWindow) (a_win, a_x, a_y, a_siblings, a_kind);
- }
- screen->MoveWindow = ephyrDRIMoveWindow;
-
- EPHYR_LOG("window: %p\n", a_win);
- if (!a_win->parent) {
- EPHYR_LOG("cannot move root window\n");
- return;
- }
- win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
- if (!win_priv) {
- EPHYR_LOG("not a DRI peered window\n");
- return;
- }
- if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
- EPHYR_LOG_ERROR("failed to get window pair\n");
- return;
- }
- /*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);
-}
-
-static Bool
-ephyrDRIPositionWindow(WindowPtr a_win, int a_x, int a_y)
-{
- Bool is_ok = FALSE;
- ScreenPtr screen = NULL;
- EphyrDRIScreenPrivPtr screen_priv = NULL;
- EphyrDRIWindowPrivPtr win_priv = NULL;
- EphyrWindowPair *pair = NULL;
- EphyrBox geo;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_win, FALSE);
-
- 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);
-
- screen->PositionWindow = screen_priv->PositionWindow;
- if (screen->PositionWindow) {
- (*screen->PositionWindow) (a_win, a_x, a_y);
- }
- screen->PositionWindow = ephyrDRIPositionWindow;
-
- EPHYR_LOG("window: %p\n", a_win);
- win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
- if (!win_priv) {
- 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;
-}
-
-static void
-ephyrDRIClipNotify(WindowPtr a_win, int a_x, int a_y)
-{
- 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;
- if (screen->ClipNotify) {
- (*screen->ClipNotify) (a_win, a_x, a_y);
- }
- screen->ClipNotify = ephyrDRIClipNotify;
-
- EPHYR_LOG("window: %p\n", a_win);
- win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
- if (!win_priv) {
- 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));
- 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
- */
- hostx_set_window_bounding_rectangles
- (pair->remote, rects, RegionNumRects(&a_win->clipList));
-
- out:
- free(rects);
- rects = NULL;
-
- EPHYR_LOG("leave.\n");
- /*do cleanup here */
-}
-
-/**
- * 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
-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)
-{
- Bool is_ok = FALSE, found_visual = FALSE, found_depth = FALSE;
- ScreenPtr screen = NULL;
- VisualRec new_visual, *new_visuals = NULL;
- int i = 0;
-
- EPHYR_LOG("enter\n");
- if (a_screen >= screenInfo.numScreens) {
- EPHYR_LOG_ERROR("bad screen number\n");
- goto out;
- }
- memset(&new_visual, 0, sizeof(VisualRec));
-
- /*get the screen pointed to by a_screen */
- screen = screenInfo.screens[a_screen];
- EPHYR_RETURN_VAL_IF_FAIL(screen, FALSE);
-
- /*
- * 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.
- */
- for (i = 0; i < screen->numVisuals; i++) {
- if (screen->visuals[i].bitsPerRGBValue == a_bits_per_rgb_values &&
- 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);
- break;
- }
- }
- if (!found_visual) {
- EPHYR_LOG("did not find any visual matching %d\n", a_new_id);
- goto out;
- }
- /*
- * be prepare to extend screen->visuals to add new_visual to it
- */
- 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));
- /*
- * 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
- */
- for (i = 0; i < screen->numDepths; i++) {
- VisualID *vids = NULL;
- DepthPtr cur_depth = NULL;
-
- /*find the entry matching a_depth */
- if (screen->allowedDepths[i].depth != a_depth)
- continue;
- cur_depth = &screen->allowedDepths[i];
- /*
- * extend the list of visual IDs in that entry,
- * so to add a_new_id in there.
- */
- vids = reallocarray(cur_depth->vids,
- cur_depth->numVids + 1, sizeof(VisualID));
- if (!vids) {
- EPHYR_LOG_ERROR("failed to realloc numids\n");
- goto out;
- }
- vids[cur_depth->numVids] = a_new_id;
- /*
- * Okay now commit our change.
- * Do really update screen->allowedDepths[i]
- */
- cur_depth->numVids++;
- cur_depth->vids = vids;
- found_depth = TRUE;
- }
- if (!found_depth) {
- EPHYR_LOG_ERROR("failed to update screen[%d]->allowedDepth\n",
- a_screen);
- goto out;
- }
- /*
- * Commit our change to screen->visuals
- */
- 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;
-}
-
-/**
- * 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
-EphyrMirrorHostVisuals(ScreenPtr a_screen)
-{
- 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);
- }
- }
-
- is_ok = TRUE;
- out:
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
-static int
-ProcXF86DRIQueryVersion(register ClientPtr client)
-{
- 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
- };
-
- REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
-
- EPHYR_LOG("enter\n");
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
- swapl(&rep.patchVersion);
- }
- WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), &rep);
- EPHYR_LOG("leave\n");
- return Success;
-}
-
-static int
-ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
-{
- xXF86DRIQueryDirectRenderingCapableReply rep;
- Bool isCapable;
-
- REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
- REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
-
- EPHYR_LOG("enter\n");
- if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
- }
-
- if (!ephyrDRIQueryDirectRenderingCapable(stuff->screen, &isCapable)) {
- return BadValue;
- }
-
- if (!client->local || client->swapped)
- isCapable = 0;
-
- rep = (xXF86DRIQueryDirectRenderingCapableReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0,
- .isCapable = isCapable
- };
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- }
-
- WriteToClient(client, sizeof(xXF86DRIQueryDirectRenderingCapableReply),
- &rep);
- EPHYR_LOG("leave\n");
-
- return Success;
-}
-
-static int
-ProcXF86DRIOpenConnection(register ClientPtr client)
-{
- xXF86DRIOpenConnectionReply rep;
- drm_handle_t hSAREA;
- char *busIdString = NULL;
- CARD32 busIdStringLength = 0;
-
- REQUEST(xXF86DRIOpenConnectionReq);
- REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
-
- EPHYR_LOG("enter\n");
- if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
- }
-
- if (!ephyrDRIOpenConnection(stuff->screen, &hSAREA, &busIdString)) {
- return BadValue;
- }
-
- if (busIdString)
- busIdStringLength = strlen(busIdString);
-
- rep = (xXF86DRIOpenConnectionReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
- SIZEOF(xGenericReply) +
- pad_to_int32(busIdStringLength)),
- .hSAREALow = (CARD32) (hSAREA & 0xffffffff),
-#if defined(LONG64) && !defined(__linux__)
- .hSAREAHigh = (CARD32) (hSAREA >> 32),
-#else
- .hSAREAHigh = 0,
-#endif
- .busIdStringLength = busIdStringLength
- };
-
- WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
- if (busIdStringLength)
- WriteToClient(client, busIdStringLength, busIdString);
- free(busIdString);
- EPHYR_LOG("leave\n");
- return Success;
-}
-
-static int
-ProcXF86DRIAuthConnection(register ClientPtr client)
-{
- xXF86DRIAuthConnectionReply rep;
-
- REQUEST(xXF86DRIAuthConnectionReq);
- REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
-
- EPHYR_LOG("enter\n");
- if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
- }
-
- rep = (xXF86DRIAuthConnectionReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0,
- .authenticated = 1
- };
-
- if (!ephyrDRIAuthConnection(stuff->screen, stuff->magic)) {
- ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
- rep.authenticated = 0;
- }
- WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), &rep);
- EPHYR_LOG("leave\n");
- return Success;
-}
-
-static int
-ProcXF86DRICloseConnection(register ClientPtr client)
-{
- REQUEST(xXF86DRICloseConnectionReq);
- REQUEST_SIZE_MATCH(xXF86DRICloseConnectionReq);
- EPHYR_LOG("enter\n");
- if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
- }
-
- /*
- DRICloseConnection( screenInfo.screens[stuff->screen]);
- */
-
- EPHYR_LOG("leave\n");
- return Success;
-}
-
-static int
-ProcXF86DRIGetClientDriverName(register ClientPtr client)
-{
- xXF86DRIGetClientDriverNameReply rep = {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .clientDriverNameLength = 0
- };
- char *clientDriverName;
-
- REQUEST(xXF86DRIGetClientDriverNameReq);
- REQUEST_SIZE_MATCH(xXF86DRIGetClientDriverNameReq);
-
- EPHYR_LOG("enter\n");
- if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
- }
-
- ephyrDRIGetClientDriverName(stuff->screen,
- (int *) &rep.ddxDriverMajorVersion,
- (int *) &rep.ddxDriverMinorVersion,
- (int *) &rep.ddxDriverPatchVersion,
- &clientDriverName);
- if (clientDriverName)
- rep.clientDriverNameLength = strlen(clientDriverName);
- rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
- SIZEOF(xGenericReply) +
- pad_to_int32(rep.clientDriverNameLength));
-
- WriteToClient(client, sizeof(xXF86DRIGetClientDriverNameReply), &rep);
- if (rep.clientDriverNameLength)
- WriteToClient(client, rep.clientDriverNameLength, clientDriverName);
- EPHYR_LOG("leave\n");
- return Success;
-}
-
-static int
-ProcXF86DRICreateContext(register ClientPtr client)
-{
- xXF86DRICreateContextReply rep = {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0
- };
- ScreenPtr pScreen;
- VisualPtr visual;
- int i = 0;
-
- REQUEST(xXF86DRICreateContextReq);
- REQUEST_SIZE_MATCH(xXF86DRICreateContextReq);
-
- EPHYR_LOG("enter\n");
- if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
- }
-
- pScreen = screenInfo.screens[stuff->screen];
- visual = pScreen->visuals;
-
- /* Find the requested X visual */
- for (i = 0; i < pScreen->numVisuals; i++, visual++)
- if (visual->vid == stuff->visual)
- break;
- if (i == pScreen->numVisuals) {
- /* No visual found */
- return BadValue;
- }
-
- if (!ephyrDRICreateContext(stuff->screen,
- stuff->visual,
- stuff->context,
- (drm_context_t *) &rep.hHWContext)) {
- return BadValue;
- }
-
- WriteToClient(client, sizeof(xXF86DRICreateContextReply), &rep);
- EPHYR_LOG("leave\n");
- return Success;
-}
-
-static int
-ProcXF86DRIDestroyContext(register ClientPtr client)
-{
- REQUEST(xXF86DRIDestroyContextReq);
- REQUEST_SIZE_MATCH(xXF86DRIDestroyContextReq);
- EPHYR_LOG("enter\n");
-
- if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
- }
-
- if (!ephyrDRIDestroyContext(stuff->screen, stuff->context)) {
- return BadValue;
- }
-
- EPHYR_LOG("leave\n");
- return Success;
-}
-
-static Bool
-getWindowVisual(const WindowPtr a_win, VisualPtr * a_visual)
-{
- 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++) {
- if (a_win->drawable.pScreen->visuals[i].vid == visual_id) {
- *a_visual = &a_win->drawable.pScreen->visuals[i];
- return TRUE;
- }
- }
- return FALSE;
-}
-
-#define NUM_WINDOW_PAIRS 256
-static EphyrWindowPair window_pairs[NUM_WINDOW_PAIRS];
-
-static Bool
-appendWindowPairToList(WindowPtr a_local, int a_remote)
-{
- int i = 0;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_local, FALSE);
-
- EPHYR_LOG("(local,remote):(%p, %d)\n", a_local, a_remote);
-
- for (i = 0; i < NUM_WINDOW_PAIRS; i++) {
- if (window_pairs[i].local == NULL) {
- window_pairs[i].local = a_local;
- window_pairs[i].remote = a_remote;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static Bool
-findWindowPairFromLocal(WindowPtr a_local, EphyrWindowPair ** a_pair)
-{
- int i = 0;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_pair && a_local, FALSE);
-
- for (i = 0; i < NUM_WINDOW_PAIRS; i++) {
- if (window_pairs[i].local == a_local) {
- *a_pair = &window_pairs[i];
- EPHYR_LOG("found (%p, %d)\n", (*a_pair)->local, (*a_pair)->remote);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-Bool
-findWindowPairFromRemote(int a_remote, EphyrWindowPair ** a_pair)
-{
- int i = 0;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_pair, FALSE);
-
- for (i = 0; i < NUM_WINDOW_PAIRS; i++) {
- if (window_pairs[i].remote == a_remote) {
- *a_pair = &window_pairs[i];
- EPHYR_LOG("found (%p, %d)\n", (*a_pair)->local, (*a_pair)->remote);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static Bool
-createHostPeerWindow(const WindowPtr a_win, int *a_peer_win)
-{
- Bool is_ok = FALSE;
- VisualPtr visual = NULL;
- EphyrBox geo;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_win && a_peer_win, FALSE);
- EPHYR_RETURN_VAL_IF_FAIL(a_win->drawable.pScreen, FALSE);
-
- 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;
- }
- if (!visual) {
- 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;
-}
-
-static Bool
-destroyHostPeerWindow(const WindowPtr a_win)
-{
- Bool is_ok = FALSE;
- EphyrWindowPair *pair = NULL;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_win, FALSE);
-
- EPHYR_LOG("enter\n");
-
- if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
- EPHYR_LOG_ERROR("failed to find peer to local window\n");
- goto out;
- }
- hostx_destroy_window(pair->remote);
- is_ok = TRUE;
-
- out:
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
-static int
-ProcXF86DRICreateDrawable(ClientPtr client)
-{
- xXF86DRICreateDrawableReply rep = {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0
- };
- DrawablePtr drawable = NULL;
- WindowPtr window = NULL;
- EphyrWindowPair *pair = NULL;
- EphyrDRIWindowPrivPtr win_priv = NULL;
- int rc = 0, remote_win = 0;
-
- REQUEST(xXF86DRICreateDrawableReq);
- REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq);
-
- EPHYR_LOG("enter\n");
- if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
- }
-
- rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
- DixReadAccess);
- if (rc != Success)
- return rc;
- if (drawable->type != DRAWABLE_WINDOW) {
- 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,
- (drm_drawable_t *) &rep.hHWDrawable)) {
- EPHYR_LOG_ERROR("failed to create dri drawable\n");
- return BadValue;
- }
-
- win_priv = GET_EPHYR_DRI_WINDOW_PRIV(window);
- if (!win_priv) {
- win_priv = calloc(1, sizeof(EphyrDRIWindowPrivRec));
- if (!win_priv) {
- EPHYR_LOG_ERROR("failed to allocate window private\n");
- return BadAlloc;
- }
- dixSetPrivate(&window->devPrivates, ephyrDRIWindowKey, win_priv);
- EPHYR_LOG("paired window '%p' with remote '%d'\n", window, remote_win);
- }
-
- WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), &rep);
- EPHYR_LOG("leave\n");
- return Success;
-}
-
-static int
-ProcXF86DRIDestroyDrawable(register ClientPtr client)
-{
- DrawablePtr drawable = NULL;
- WindowPtr window = NULL;
- EphyrWindowPair *pair = NULL;
- int rc = 0;
-
- REQUEST(xXF86DRIDestroyDrawableReq);
- REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq);
-
- EPHYR_LOG("enter\n");
- if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
- }
-
- rc = dixLookupDrawable(&drawable,
- stuff->drawable, client, 0, DixReadAccess);
- if (rc != Success)
- return rc;
- if (drawable->type != DRAWABLE_WINDOW) {
- EPHYR_LOG_ERROR("non drawable windows are not yet supported\n");
- return BadImplementation;
- }
- window = (WindowPtr) drawable;
- if (!findWindowPairFromLocal(window, &pair) && pair) {
- EPHYR_LOG_ERROR("failed to find pair window\n");
- return BadImplementation;
- }
- if (!ephyrDRIDestroyDrawable(stuff->screen,
- pair->remote /*drawable in host x */ )) {
- EPHYR_LOG_ERROR("failed to destroy dri drawable\n");
- return BadImplementation;
- }
- pair->local = NULL;
- pair->remote = 0;
-
- EPHYR_LOG("leave\n");
- return Success;
-}
-
-static int
-ProcXF86DRIGetDrawableInfo(register ClientPtr client)
-{
- xXF86DRIGetDrawableInfoReply rep = {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0
- };
- DrawablePtr drawable;
- 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;
-
- REQUEST(xXF86DRIGetDrawableInfoReq);
- REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
-
- EPHYR_LOG("enter\n");
- if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
- }
-
- rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
- DixReadAccess);
- if (rc != Success || !drawable) {
- EPHYR_LOG_ERROR("could not get drawable\n");
- return rc;
- }
-
- if (drawable->type != DRAWABLE_WINDOW) {
- 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)) {
- return BadValue;
- }
- EPHYR_LOG("num clip rects:%d, num back clip rects:%d\n",
- (int) rep.numClipRects, (int) rep.numBackClipRects);
-
- rep.drawableX = X;
- rep.drawableY = Y;
- rep.drawableWidth = W;
- rep.drawableHeight = H;
- rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) - SIZEOF(xGenericReply));
-
- rep.backX = backX;
- rep.backY = backY;
-
- if (rep.numClipRects) {
- if (clipRects) {
- ScreenPtr pScreen = screenInfo.screens[stuff->screen];
-
- EPHYR_LOG("clip list of host gl drawable:\n");
- for (i = 0; i < rep.numClipRects; i++) {
- 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);
- }
- }
- else {
- rep.numClipRects = 0;
- }
- }
- else {
- EPHYR_LOG("got zero host gl drawable clipping rects\n");
- }
- rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects;
- backClipRects = clipRects;
- rep.numBackClipRects = rep.numClipRects;
- if (rep.numBackClipRects)
- rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects;
- EPHYR_LOG("num host clip rects:%d\n", (int) rep.numClipRects);
- EPHYR_LOG("num host back clip rects:%d\n", (int) rep.numBackClipRects);
-
- rep.length = bytes_to_int32(rep.length);
-
- WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), &rep);
-
- if (rep.numClipRects) {
- WriteToClient(client,
- sizeof(drm_clip_rect_t) * rep.numClipRects,
- clipRects);
- }
-
- if (rep.numBackClipRects) {
- WriteToClient(client,
- sizeof(drm_clip_rect_t) * rep.numBackClipRects,
- backClipRects);
- }
- free(clipRects);
- clipRects = NULL;
-
- EPHYR_LOG("leave\n");
-
- return Success;
-}
-
-static int
-ProcXF86DRIGetDeviceInfo(register ClientPtr client)
-{
- xXF86DRIGetDeviceInfoReply rep = {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0
- };
- drm_handle_t hFrameBuffer;
- void *pDevPrivate;
-
- REQUEST(xXF86DRIGetDeviceInfoReq);
- REQUEST_SIZE_MATCH(xXF86DRIGetDeviceInfoReq);
-
- EPHYR_LOG("enter\n");
- if (stuff->screen >= screenInfo.numScreens) {
- client->errorValue = stuff->screen;
- return BadValue;
- }
-
- if (!ephyrDRIGetDeviceInfo(stuff->screen,
- &hFrameBuffer,
- (int *) &rep.framebufferOrigin,
- (int *) &rep.framebufferSize,
- (int *) &rep.framebufferStride,
- (int *) &rep.devPrivateSize, &pDevPrivate)) {
- return BadValue;
- }
-
- rep.hFrameBufferLow = (CARD32) (hFrameBuffer & 0xffffffff);
-#if defined(LONG64) && !defined(__linux__)
- rep.hFrameBufferHigh = (CARD32) (hFrameBuffer >> 32);
-#else
- rep.hFrameBufferHigh = 0;
-#endif
-
- if (rep.devPrivateSize) {
- rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
- SIZEOF(xGenericReply) +
- pad_to_int32(rep.devPrivateSize));
- }
-
- WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep);
- if (rep.length) {
- WriteToClient(client, rep.devPrivateSize, pDevPrivate);
- }
- EPHYR_LOG("leave\n");
- return Success;
-}
-
-static int
-ProcXF86DRIDispatch(register ClientPtr client)
-{
- REQUEST(xReq);
- EPHYR_LOG("enter\n");
-
- switch (stuff->data) {
- case X_XF86DRIQueryVersion:{
- EPHYR_LOG("leave\n");
- return ProcXF86DRIQueryVersion(client);
- }
- case X_XF86DRIQueryDirectRenderingCapable:{
- EPHYR_LOG("leave\n");
- return ProcXF86DRIQueryDirectRenderingCapable(client);
- }
- }
-
- if (!client->local)
- return DRIErrorBase + XF86DRIClientNotLocal;
-
- 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;
- }
- }
-}
-
-static int
-SProcXF86DRIQueryVersion(register ClientPtr client)
-{
- REQUEST(xXF86DRIQueryVersionReq);
- swaps(&stuff->length);
- return ProcXF86DRIQueryVersion(client);
-}
-
-static int
-SProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
-{
- REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
- swaps(&stuff->length);
- swapl(&stuff->screen);
- return ProcXF86DRIQueryDirectRenderingCapable(client);
-}
-
-static int
-SProcXF86DRIDispatch(register ClientPtr client)
-{
- REQUEST(xReq);
-
- EPHYR_LOG("enter\n");
- /*
- * Only local clients are allowed DRI access, but remote clients still need
- * these requests to find out cleanly.
- */
- 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;
- }
- }
-}
-
-Bool
-ephyrDRIExtensionInit(ScreenPtr a_screen)
-{
- Bool is_ok = FALSE;
- ExtensionEntry *extEntry = NULL;
- EphyrDRIScreenPrivPtr screen_priv = NULL;
-
- EPHYR_LOG("enter\n");
- if (!hostx_has_extension(&xcb_xf86dri_id)) {
- EPHYR_LOG("host does not have DRI extension\n");
- goto out;
- }
- EPHYR_LOG("host X does have DRI extension\n");
- if (!hostx_has_extension(&xcb_shape_id)) {
- EPHYR_LOG("host does not have XShape extension\n");
- goto out;
- }
- EPHYR_LOG("host X does have XShape extension\n");
-
-#ifdef XF86DRI_EVENTS
- EventType = CreateNewResourceType(XF86DRIFreeEvents, "DRIEvents");
- if (!EventType) {
- EPHYR_LOG_ERROR("failed to register DRI event resource type\n");
- goto out;
- }
-#endif
-
- if ((extEntry = AddExtension(XF86DRINAME,
- 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;
- }
- if (!dixRegisterPrivateKey(&ephyrDRIScreenKeyRec, PRIVATE_SCREEN, 0))
- goto out;
- if (!dixRegisterPrivateKey(&ephyrDRIWindowKeyRec, PRIVATE_WINDOW, 0))
- goto out;
- screen_priv = calloc(1, sizeof(EphyrDRIScreenPrivRec));
- if (!screen_priv) {
- EPHYR_LOG_ERROR("failed to allocate screen_priv\n");
- goto out;
- }
- dixSetPrivate(&a_screen->devPrivates, ephyrDRIScreenKey, screen_priv);
-
- if (!ephyrDRIScreenInit(a_screen)) {
- EPHYR_LOG_ERROR("ephyrDRIScreenInit() failed\n");
- goto out;
- }
- EphyrMirrorHostVisuals(a_screen);
- is_ok = TRUE;
- out:
- EPHYR_LOG("leave\n");
- return is_ok;
-}
diff --git a/hw/kdrive/ephyr/ephyrdriext.h b/hw/kdrive/ephyr/ephyrdriext.h
deleted file mode 100644
index 9755715..0000000
--- a/hw/kdrive/ephyr/ephyrdriext.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- * Authored by Matthew Allum <mallum at 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 at openedhand.com>
- */
-#ifndef __EPHYRDRIEXT_H__
-#define __EPHYRDRIEXT_H__
-
-typedef struct {
- WindowPtr local;
- int remote;
-} EphyrWindowPair;
-
-Bool ephyrDRIExtensionInit(ScreenPtr a_screen);
-
-Bool findWindowPairFromRemote(int a_remote, EphyrWindowPair ** a_pair);
-
-#endif /*__EPHYRDRIEXT_H__*/
diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c
deleted file mode 100644
index c6d1569..0000000
--- a/hw/kdrive/ephyr/ephyrglxext.c
+++ /dev/null
@@ -1,854 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- * Authored by Matthew Allum <mallum at 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 at openedhand.com>
- */
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-
-#include <xcb/glx.h>
-#include "extnsionst.h"
-#include "ephyrglxext.h"
-#include "ephyrhostglx.h"
-#define _HAVE_XALLOC_DECLS
-#include "ephyrlog.h"
-#include <GL/glxproto.h>
-#include "glx/glxserver.h"
-#include "glx/indirect_table.h"
-#include "glx/indirect_util.h"
-#include "glx/unpack.h"
-#include "hostx.h"
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-int ephyrGLXQueryVersion(__GLXclientState * cl, GLbyte * pc);
-int ephyrGLXQueryVersionSwap(__GLXclientState * cl, GLbyte * pc);
-int ephyrGLXGetVisualConfigs(__GLXclientState * cl, GLbyte * pc);
-int ephyrGLXGetVisualConfigsSwap(__GLXclientState * cl, GLbyte * pc);
-int ephyrGLXClientInfo(__GLXclientState * cl, GLbyte * pc);
-int ephyrGLXClientInfoSwap(__GLXclientState * cl, GLbyte * pc);
-int ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXQueryServerStringSwap(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXGetFBConfigsSGIX(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXGetFBConfigsSGIXSwap(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXCreateContext(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXCreateContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXCreateNewContext(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXCreateNewContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXDestroyContext(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXDestroyContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXMakeCurrent(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXMakeCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXMakeCurrentReadSGI(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXMakeCurrentReadSGISwap(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXMakeContextCurrent(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXMakeContextCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXGetString(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXGetStringSwap(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXGetIntegerv(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXGetIntegervSwap(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXIsDirect(__GLXclientState * a_cl, GLbyte * a_pc);
-int ephyrGLXIsDirectSwap(__GLXclientState * a_cl, GLbyte * a_pc);
-
-Bool
-ephyrHijackGLXExtension(void)
-{
- const void *(*dispatch_functions)[2];
-
- if (!hostx_has_extension(&xcb_glx_id)) {
- EPHYR_LOG("host X does not have GLX\n");
- return FALSE;
- }
- EPHYR_LOG("host X does have GLX\n");
-
- if (!Single_dispatch_info.dispatch_functions) {
- EPHYR_LOG_ERROR("could not get dispatch functions table\n");
- return FALSE;
- }
- /*
- * hijack some single entry point dispatch functions
- */
- dispatch_functions = Single_dispatch_info.dispatch_functions;
- EPHYR_RETURN_VAL_IF_FAIL(dispatch_functions, FALSE);
-
- dispatch_functions[X_GLXQueryVersion][0] = ephyrGLXQueryVersion;
- dispatch_functions[X_GLXQueryVersion][1] = ephyrGLXQueryVersionSwap;
-
- dispatch_functions[X_GLXGetVisualConfigs][0] = ephyrGLXGetVisualConfigs;
- dispatch_functions[X_GLXGetVisualConfigs][1] = ephyrGLXGetVisualConfigsSwap;
- dispatch_functions[X_GLXClientInfo][0] = ephyrGLXClientInfo;
- dispatch_functions[X_GLXClientInfo][1] = ephyrGLXClientInfoSwap;
-
- dispatch_functions[X_GLXQueryServerString][0] = ephyrGLXQueryServerString;
- dispatch_functions[X_GLXQueryServerString][1] =
- ephyrGLXQueryServerStringSwap;
-
- dispatch_functions[X_GLXCreateContext][0] = ephyrGLXCreateContext;
- dispatch_functions[X_GLXCreateContext][1] = ephyrGLXCreateContextSwap;
-
- dispatch_functions[X_GLXCreateNewContext][0] = ephyrGLXCreateNewContext;
- dispatch_functions[X_GLXCreateNewContext][1] = ephyrGLXCreateNewContextSwap;
-
- dispatch_functions[X_GLXDestroyContext][0] = ephyrGLXDestroyContext;
- dispatch_functions[X_GLXDestroyContext][1] = ephyrGLXDestroyContextSwap;
-
- dispatch_functions[X_GLXMakeCurrent][0] = ephyrGLXMakeCurrent;
- dispatch_functions[X_GLXMakeCurrent][1] = ephyrGLXMakeCurrentSwap;
-
- dispatch_functions[X_GLXIsDirect][0] = ephyrGLXIsDirect;
- dispatch_functions[X_GLXIsDirect][1] = ephyrGLXIsDirectSwap;
-
- dispatch_functions[73][0] = ephyrGLXGetString;
- dispatch_functions[73][1] = ephyrGLXGetStringSwap;
-
- dispatch_functions[61][0] = ephyrGLXGetIntegerv;
- dispatch_functions[61][1] = ephyrGLXGetIntegervSwap;
-
- dispatch_functions[X_GLXMakeContextCurrent][0] =
- ephyrGLXMakeContextCurrent;
- dispatch_functions[X_GLXMakeContextCurrent][1] =
- ephyrGLXMakeContextCurrentSwap;
-
- /*
- * hijack some vendor priv entry point dispatch functions
- */
- dispatch_functions = VendorPriv_dispatch_info.dispatch_functions;
- dispatch_functions[92][0] = ephyrGLXGetFBConfigsSGIX;
- dispatch_functions[92][1] = ephyrGLXGetFBConfigsSGIXSwap;
-
- dispatch_functions[89][0] = ephyrGLXMakeCurrentReadSGI;
- dispatch_functions[89][1] = ephyrGLXMakeCurrentReadSGISwap;
-
- EPHYR_LOG("hijacked glx entry points to forward requests to host X\n");
-
-
- return TRUE;
-}
-
-/*********************
- * implementation of
- * hijacked GLX entry
- * points
- ********************/
-
-int
-ephyrGLXQueryVersion(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- ClientPtr client = a_cl->client;
- xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) a_pc;
- xGLXQueryVersionReply reply;
- int major, minor;
- int res = BadImplementation;
-
- EPHYR_LOG("enter\n");
-
- major = req->majorVersion;
- minor = req->minorVersion;
-
- if (!ephyrHostGLXQueryVersion(&major, &minor)) {
- EPHYR_LOG_ERROR("ephyrHostGLXQueryVersion() failed\n");
- goto out;
- }
- EPHYR_LOG("major:%d, minor:%d\n", major, minor);
- reply = (xGLXQueryVersionReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0,
- .majorVersion = major,
- .minorVersion = minor
- };
-
- if (client->swapped) {
- __glXSwapQueryVersionReply(client, &reply);
- }
- else {
- WriteToClient(client, sz_xGLXQueryVersionReply, &reply);
- }
-
- res = Success;
- out:
- EPHYR_LOG("leave\n");
- return res;
-}
-
-int
-ephyrGLXQueryVersionSwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) a_pc;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->majorVersion);
- __GLX_SWAP_INT(&req->minorVersion);
- return ephyrGLXQueryVersion(a_cl, a_pc);
-}
-
-static int
-ephyrGLXGetVisualConfigsReal(__GLXclientState * a_cl,
- GLbyte * a_pc, Bool a_do_swap)
-{
- xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) a_pc;
- ClientPtr client = a_cl->client;
- xGLXGetVisualConfigsReply reply;
- int32_t *props_buf = NULL, num_visuals = 0,
- num_props = 0, res = BadImplementation, i = 0,
- props_per_visual_size = 0, props_buf_size = 0;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- EPHYR_LOG("enter\n");
-
- if (!ephyrHostGLXGetVisualConfigs(req->screen,
- &num_visuals,
- &num_props,
- &props_buf_size, &props_buf)) {
- EPHYR_LOG_ERROR("ephyrHostGLXGetVisualConfigs() failed\n");
- goto out;
- }
- EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);
-
- reply = (xGLXGetVisualConfigsReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = (num_visuals * __GLX_SIZE_CARD32 * num_props) >> 2,
- .numVisuals = num_visuals,
- .numProps = num_props
- };
-
- if (a_do_swap) {
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numVisuals);
- __GLX_SWAP_INT(&reply.numProps);
- __GLX_SWAP_INT_ARRAY(props_buf, num_props);
- }
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
- props_per_visual_size = props_buf_size / num_visuals;
- for (i = 0; i < num_visuals; i++) {
- WriteToClient(client,
- props_per_visual_size,
- (char *) props_buf + i * props_per_visual_size);
- }
- res = Success;
-
- out:
- EPHYR_LOG("leave\n");
- free(props_buf);
- props_buf = NULL;
-
- return res;
-}
-
-static int
-ephyrGLXGetFBConfigsSGIXReal(__GLXclientState * a_cl,
- GLbyte * a_pc, Bool a_do_swap)
-{
- xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) a_pc;
- ClientPtr client = a_cl->client;
- xGLXGetVisualConfigsReply reply;
- int32_t *props_buf = NULL, num_visuals = 0,
- num_props = 0, res = BadImplementation, i = 0,
- props_per_visual_size = 0, props_buf_size = 0;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- EPHYR_LOG("enter\n");
-
- if (!ephyrHostGLXVendorPrivGetFBConfigsSGIX(req->screen,
- &num_visuals,
- &num_props,
- &props_buf_size, &props_buf)) {
- EPHYR_LOG_ERROR("ephyrHostGLXGetVisualConfigs() failed\n");
- goto out;
- }
- EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);
-
- reply = (xGLXGetVisualConfigsReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = props_buf_size >> 2,
- .numVisuals = num_visuals,
- .numProps = num_props
- };
-
- if (a_do_swap) {
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numVisuals);
- __GLX_SWAP_INT(&reply.numProps);
- __GLX_SWAP_INT_ARRAY(props_buf, num_props);
- }
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
- props_per_visual_size = props_buf_size / num_visuals;
- for (i = 0; i < num_visuals; i++) {
- WriteToClient(client,
- props_per_visual_size,
- &((char *) props_buf)[i * props_per_visual_size]);
- }
- res = Success;
-
- out:
- EPHYR_LOG("leave\n");
- free(props_buf);
- props_buf = NULL;
-
- return res;
-}
-
-int
-ephyrGLXGetVisualConfigs(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXGetVisualConfigsReal(a_cl, a_pc, FALSE);
-}
-
-int
-ephyrGLXGetVisualConfigsSwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXGetVisualConfigsReal(a_cl, a_pc, TRUE);
-}
-
-int
-ephyrGLXClientInfo(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- int res = BadImplementation;
- xGLXClientInfoReq *req = (xGLXClientInfoReq *) a_pc;
-
- EPHYR_LOG("enter\n");
- if (!ephyrHostGLXSendClientInfo(req->major, req->minor, (char *) req + 1)) {
- EPHYR_LOG_ERROR("failed to send client info to host\n");
- goto out;
- }
- res = Success;
-
- out:
- EPHYR_LOG("leave\n");
- return res;
-}
-
-int
-ephyrGLXClientInfoSwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- xGLXClientInfoReq *req = (xGLXClientInfoReq *) a_pc;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->major);
- __GLX_SWAP_INT(&req->minor);
- __GLX_SWAP_INT(&req->numbytes);
-
- return ephyrGLXClientInfo(a_cl, a_pc);
-}
-
-int
-ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- int res = BadImplementation;
- ClientPtr client = a_cl->client;
- xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) a_pc;
- xGLXQueryServerStringReply reply;
- char *server_string = NULL;
- int length = 0;
-
- EPHYR_LOG("enter\n");
- if (!ephyrHostGLXQueryServerString(req->screen,
- req->name,
- &server_string)) {
- EPHYR_LOG_ERROR("failed to query string from host\n");
- goto out;
- }
- EPHYR_LOG("string: %s\n", server_string);
- length = strlen(server_string) + 1;
- reply = (xGLXQueryServerStringReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = __GLX_PAD(length) >> 2,
- .n = length
- };
-
- WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
- WriteToClient(client, (int) (reply.length << 2), server_string);
-
- res = Success;
-
- out:
- EPHYR_LOG("leave\n");
- free(server_string);
- server_string = NULL;
-
- return res;
-}
-
-int
-ephyrGLXQueryServerStringSwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- EPHYR_LOG_ERROR("not yet implemented\n");
- return BadImplementation;
-}
-
-int
-ephyrGLXGetFBConfigsSGIX(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXGetFBConfigsSGIXReal(a_cl, a_pc, FALSE);
-}
-
-int
-ephyrGLXGetFBConfigsSGIXSwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXGetFBConfigsSGIXReal(a_cl, a_pc, TRUE);
-}
-
-static int
-ephyrGLXCreateContextReal(xGLXCreateContextReq * a_req, Bool a_do_swap)
-{
- int res = BadImplementation;
- EphyrHostWindowAttributes host_w_attrs;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_req, BadValue);
- EPHYR_LOG("enter\n");
-
- if (a_do_swap) {
- __GLX_SWAP_SHORT(&a_req->length);
- __GLX_SWAP_INT(&a_req->context);
- __GLX_SWAP_INT(&a_req->visual);
- __GLX_SWAP_INT(&a_req->screen);
- __GLX_SWAP_INT(&a_req->shareList);
- }
-
- EPHYR_LOG("context creation requested. localid:%d, "
- "screen:%d, visual:%d, direct:%d\n",
- (int) a_req->context, (int) a_req->screen,
- (int) a_req->visual, (int) a_req->isDirect);
-
- memset(&host_w_attrs, 0, sizeof(host_w_attrs));
- if (!hostx_get_window_attributes(hostx_get_window(a_req->screen),
- &host_w_attrs)) {
- EPHYR_LOG_ERROR("failed to get host window attrs\n");
- goto out;
- }
-
- EPHYR_LOG("host window visual id: %d\n", host_w_attrs.visualid);
-
- if (!ephyrHostGLXCreateContext(a_req->screen,
- host_w_attrs.visualid,
- a_req->context,
- a_req->shareList, 0,
- a_req->isDirect, X_GLXCreateContext)) {
- EPHYR_LOG_ERROR("ephyrHostGLXCreateContext() failed\n");
- goto out;
- }
- res = Success;
- out:
- EPHYR_LOG("leave\n");
- return res;
-}
-
-static int
-ephyrGLXCreateNewContextReal(xGLXCreateNewContextReq * a_req, Bool a_do_swap)
-{
- int res = BadImplementation;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_req, BadValue);
- EPHYR_LOG("enter\n");
-
- if (a_do_swap) {
- __GLX_SWAP_SHORT(&a_req->length);
- __GLX_SWAP_INT(&a_req->context);
- __GLX_SWAP_INT(&a_req->fbconfig);
- __GLX_SWAP_INT(&a_req->screen);
- __GLX_SWAP_INT(&a_req->renderType);
- __GLX_SWAP_INT(&a_req->shareList);
- }
-
- EPHYR_LOG("context creation requested. localid:%d, "
- "screen:%d, fbconfig:%d, renderType:%d, direct:%d\n",
- (int) a_req->context, (int) a_req->screen,
- (int) a_req->fbconfig, (int) a_req->renderType,
- (int) a_req->isDirect);
-
- if (!ephyrHostGLXCreateContext(a_req->screen,
- a_req->fbconfig,
- a_req->context,
- a_req->shareList, a_req->renderType,
- a_req->isDirect, X_GLXCreateNewContext)) {
- EPHYR_LOG_ERROR("ephyrHostGLXCreateNewContext() failed\n");
- goto out;
- }
- res = Success;
- out:
- EPHYR_LOG("leave\n");
- return res;
-}
-
-int
-ephyrGLXCreateContext(__GLXclientState * cl, GLbyte * pc)
-{
- xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
-
- return ephyrGLXCreateContextReal(req, FALSE);
-}
-
-int
-ephyrGLXCreateContextSwap(__GLXclientState * cl, GLbyte * pc)
-{
- xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
-
- return ephyrGLXCreateContextReal(req, TRUE);
-}
-
-int
-ephyrGLXCreateNewContext(__GLXclientState * cl, GLbyte * pc)
-{
- xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
-
- return ephyrGLXCreateNewContextReal(req, FALSE);
-}
-
-int
-ephyrGLXCreateNewContextSwap(__GLXclientState * cl, GLbyte * pc)
-{
- xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
-
- return ephyrGLXCreateNewContextReal(req, TRUE);
-}
-
-static int
-ephyrGLXDestroyContextReal(__GLXclientState * a_cl,
- GLbyte * a_pc, Bool a_do_swap)
-{
- int res = BadImplementation;
- ClientPtr client = a_cl->client;
- xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) a_pc;
-
- EPHYR_LOG("enter. id:%d\n", (int) req->context);
- if (!ephyrHostDestroyContext(req->context)) {
- EPHYR_LOG_ERROR("ephyrHostDestroyContext() failed\n");
- client->errorValue = req->context;
- goto out;
- }
- res = Success;
-
- out:
- EPHYR_LOG("leave\n");
- return res;
-}
-
-int
-ephyrGLXDestroyContext(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXDestroyContextReal(a_cl, a_pc, FALSE);
-}
-
-int
-ephyrGLXDestroyContextSwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXDestroyContextReal(a_cl, a_pc, TRUE);
-}
-
-static int
-ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLXDrawable write,
- GLXDrawable read, GLXContextTag ctx,
- GLXContextTag old_ctx, Bool a_do_swap)
-{
- int res = BadImplementation;
- xGLXMakeCurrentReply reply;
- DrawablePtr drawableR = NULL, drawableW = NULL;
- GLXContextTag new_ctx = 0;
-
- EPHYR_LOG("enter\n");
- res = dixLookupDrawable(&drawableW, write, a_cl->client, 0, DixReadAccess);
- EPHYR_RETURN_VAL_IF_FAIL(drawableW, BadValue);
- EPHYR_RETURN_VAL_IF_FAIL(drawableW->pScreen, BadValue);
- EPHYR_LOG("screen nummber requested:%d\n", drawableW->pScreen->myNum);
-
- if (read != write) {
- res = dixLookupDrawable(&drawableR, read, a_cl->client, 0,
- DixReadAccess);
- EPHYR_RETURN_VAL_IF_FAIL(drawableR, BadValue);
- EPHYR_RETURN_VAL_IF_FAIL(drawableR->pScreen, BadValue);
- }
- else {
- drawableR = drawableW;
- }
-
- if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawableW->pScreen->myNum),
- hostx_get_window(drawableR->pScreen->myNum),
- ctx, old_ctx, (int *) &new_ctx)) {
- EPHYR_LOG_ERROR("ephyrHostGLXMakeCurrent() failed\n");
- goto out;
- }
- reply = (xGLXMakeCurrentReply) {
- .type = X_Reply,
- .sequenceNumber = a_cl->client->sequence,
- .length = 0,
- .contextTag = new_ctx
- };
- if (a_do_swap) {
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.contextTag);
- }
- WriteToClient(a_cl->client, sz_xGLXMakeCurrentReply, &reply);
-
- res = Success;
- out:
- EPHYR_LOG("leave\n");
- return res;
-}
-
-int
-ephyrGLXMakeCurrent(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
- return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->drawable,
- req->context, req->oldContextTag, FALSE);
-}
-
-int
-ephyrGLXMakeCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT(&req->drawable);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->oldContextTag);
-
- return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->drawable,
- req->context, req->oldContextTag, TRUE);
-}
-
-int
-ephyrGLXMakeCurrentReadSGI(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) a_pc;
-
- return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readable,
- req->context, req->oldContextTag, FALSE);
-}
-
-int
-ephyrGLXMakeCurrentReadSGISwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) a_pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT(&req->drawable);
- __GLX_SWAP_INT(&req->readable);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->oldContextTag);
-
- return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readable,
- req->context, req->oldContextTag, TRUE);
-}
-
-int
-ephyrGLXMakeContextCurrent(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) a_pc;
-
- return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readdrawable,
- req->context, req->oldContextTag, FALSE);
-}
-
-int
-ephyrGLXMakeContextCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) a_pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT(&req->drawable);
- __GLX_SWAP_INT(&req->readdrawable);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->oldContextTag);
-
- return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readdrawable,
- req->context, req->oldContextTag, TRUE);
-}
-
-static int
-ephyrGLXGetStringReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
-{
- ClientPtr client = NULL;
- int context_tag = 0, name = 0, res = BadImplementation, length = 0;
- char *string = NULL;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_cl && a_pc, BadValue);
-
- EPHYR_LOG("enter\n");
-
- client = a_cl->client;
-
- if (a_do_swap) {
- __GLX_SWAP_INT(a_pc + 4);
- __GLX_SWAP_INT(a_pc + __GLX_SINGLE_HDR_SIZE);
- }
- context_tag = __GLX_GET_SINGLE_CONTEXT_TAG(a_pc);
- a_pc += __GLX_SINGLE_HDR_SIZE;
- name = *(GLenum *) (a_pc + 0);
- EPHYR_LOG("context_tag:%d, name:%d\n", context_tag, name);
- if (!ephyrHostGLXGetString(context_tag, name, &string)) {
- EPHYR_LOG_ERROR("failed to get string from server\n");
- goto out;
- }
- if (string) {
- length = strlen(string) + 1;
- EPHYR_LOG("got string:'%s', size:%d\n", string, length);
- }
- else {
- EPHYR_LOG("got string: string (null)\n");
- }
- __GLX_BEGIN_REPLY(length);
- __GLX_PUT_SIZE(length);
- __GLX_SEND_HEADER();
- if (a_do_swap) {
- __GLX_SWAP_REPLY_SIZE();
- __GLX_SWAP_REPLY_HEADER();
- }
- WriteToClient(client, length, string);
-
- res = Success;
- out:
- EPHYR_LOG("leave\n");
- return res;
-}
-
-int
-ephyrGLXGetString(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXGetStringReal(a_cl, a_pc, FALSE);
-}
-
-int
-ephyrGLXGetStringSwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXGetStringReal(a_cl, a_pc, TRUE);
-}
-
-static int
-ephyrGLXGetIntegervReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
-{
- int res = BadImplementation;
- xGLXSingleReq *const req = (xGLXSingleReq *) a_pc;
- GLenum int_name;
- int value = 0;
- GLint answer_buf_room[200];
- GLint *buf = NULL;
-
- EPHYR_LOG("enter\n");
-
- a_pc += __GLX_SINGLE_HDR_SIZE;
-
- int_name = *(GLenum *) (a_pc + 0);
- if (!ephyrHostGetIntegerValue(req->contextTag, int_name, &value)) {
- EPHYR_LOG_ERROR("ephyrHostGetIntegerValue() failed\n");
- goto out;
- }
- buf = __glXGetAnswerBuffer(a_cl, sizeof(value),
- answer_buf_room, sizeof(answer_buf_room), 4);
-
- if (!buf) {
- EPHYR_LOG_ERROR("failed to allocate reply buffer\n");
- res = BadAlloc;
- goto out;
- }
- __glXSendReply(a_cl->client, buf, 1, sizeof(value), GL_FALSE, 0);
- res = Success;
-
- out:
- EPHYR_LOG("leave\n");
- return res;
-}
-
-int
-ephyrGLXGetIntegerv(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXGetIntegervReal(a_cl, a_pc, FALSE);
-}
-
-int
-ephyrGLXGetIntegervSwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXGetIntegervReal(a_cl, a_pc, TRUE);
-}
-
-static int
-ephyrGLXIsDirectReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
-{
- int res = BadImplementation;
- ClientPtr client = a_cl->client;
- xGLXIsDirectReq *req = (xGLXIsDirectReq *) a_pc;
- xGLXIsDirectReply reply;
- int is_direct = 0;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_cl && a_pc, FALSE);
-
- EPHYR_LOG("enter\n");
-
- if (!ephyrHostIsContextDirect(req->context, (int *) &is_direct)) {
- EPHYR_LOG_ERROR("ephyrHostIsContextDirect() failed\n");
- goto out;
- }
- reply = (xGLXIsDirectReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0,
- .isDirect = is_direct
- };
-
- WriteToClient(client, sz_xGLXIsDirectReply, &reply);
- res = Success;
-
- out:
- EPHYR_LOG("leave\n");
- return res;
-}
-
-int
-ephyrGLXIsDirect(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXIsDirectReal(a_cl, a_pc, FALSE);
-}
-
-int
-ephyrGLXIsDirectSwap(__GLXclientState * a_cl, GLbyte * a_pc)
-{
- return ephyrGLXIsDirectReal(a_cl, a_pc, TRUE);
-}
diff --git a/hw/kdrive/ephyr/ephyrglxext.h b/hw/kdrive/ephyr/ephyrglxext.h
deleted file mode 100644
index 8b4b3a2..0000000
--- a/hw/kdrive/ephyr/ephyrglxext.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- * Authored by Matthew Allum <mallum at 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 at openedhand.com>
- */
-#ifndef __EPHYR_GLXEXT_H__
-#define __EPHYR_GLXEXT_H__
-
-#include <X11/Xdefs.h>
-Bool ephyrHijackGLXExtension(void);
-
-#endif /*__EPHYR_GLXEXT_H__*/
diff --git a/hw/kdrive/ephyr/ephyrhostglx.c b/hw/kdrive/ephyr/ephyrhostglx.c
deleted file mode 100644
index 0b98cce..0000000
--- a/hw/kdrive/ephyr/ephyrhostglx.c
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- * Authored by Matthew Allum <mallum at 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.
- *
- * a lots of the content of this file has been adapted from the mesa source
- * code.
- * Authors:
- * Dodji Seketeli <dodji at openedhand.com>
- */
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-
-#include <X11/Xdefs.h>
-#include <X11/Xmd.h>
-#include <GL/glxproto.h>
-#include <xcb/glx.h>
-#include "ephyrhostglx.h"
-#define _HAVE_XALLOC_DECLS
-#include "ephyrlog.h"
-#include "hostx.h"
-
-static int glx_major, glx_minor;
-
-enum VisualConfRequestType {
- EPHYR_GET_FB_CONFIG,
- EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
- EPHYR_GET_VISUAL_CONFIGS
-};
-
-static Bool ephyrHostGLXGetVisualConfigsInternal
- (enum VisualConfRequestType a_type,
- xcb_glx_get_visual_configs_reply_t *reply,
- int32_t a_screen,
- int32_t *a_num_visuals,
- int32_t *a_num_props,
- int32_t *a_props_buf_size,
- int32_t **a_props_buf);
-
-Bool
-ephyrHostGLXQueryVersion(int *a_major, int *a_minor)
-{
- Bool is_ok = FALSE;
- xcb_connection_t *conn = hostx_get_xcbconn();
- xcb_glx_query_version_cookie_t cookie;
- xcb_glx_query_version_reply_t *reply;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_major && a_minor, FALSE);
- EPHYR_LOG("enter\n");
-
- if (glx_major) {
- *a_major = glx_major;
- *a_minor = glx_minor;
- return TRUE;
- }
-
- /* Send the glXQueryVersion request */
- cookie = xcb_glx_query_version(conn, 2, 1);
- reply = xcb_glx_query_version_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- *a_major = reply->major_version;
- *a_minor = reply->minor_version;
- free(reply);
-
- EPHYR_LOG("major:%d, minor:%d\n", *a_major, *a_minor);
-
- is_ok = TRUE;
- out:
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
-Bool
-ephyrHostGLXGetString(int a_context_tag,
- int a_string_name,
- char **a_string)
-{
- Bool is_ok = FALSE;
- xcb_connection_t *conn = hostx_get_xcbconn();
- xcb_glx_get_string_cookie_t cookie;
- xcb_glx_get_string_reply_t *reply;
-
- EPHYR_RETURN_VAL_IF_FAIL(conn && a_string, FALSE);
-
- EPHYR_LOG("enter\n");
- cookie = xcb_glx_get_string(conn, a_context_tag, a_string_name);
- reply = xcb_glx_get_string_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- *a_string = malloc(reply->n + 1);
- memcpy(*a_string, xcb_glx_get_string_string(reply), reply->n);
- (*a_string)[reply->n] = '\0';
- free(reply);
- is_ok = TRUE;
-out:
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
-Bool ephyrHostGLXQueryServerString(int a_screen_number,
- int a_string_name,
- char **a_string)
-{
- Bool is_ok = FALSE;
- xcb_connection_t *conn = hostx_get_xcbconn();
- int default_screen = hostx_get_screen();
- xcb_glx_query_server_string_cookie_t cookie;
- xcb_glx_query_server_string_reply_t *reply;
-
- EPHYR_RETURN_VAL_IF_FAIL(conn && a_string, FALSE);
-
- EPHYR_LOG("enter\n");
- cookie = xcb_glx_query_server_string(conn, default_screen, a_string_name);
- reply = xcb_glx_query_server_string_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- *a_string = malloc(reply->str_len + 1);
- memcpy(*a_string, xcb_glx_query_server_string_string(reply), reply->str_len);
- (*a_string)[reply->str_len] = '\0';
- free(reply);
- is_ok = TRUE;
-out:
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
-static Bool
-ephyrHostGLXGetVisualConfigsInternal(enum VisualConfRequestType a_type,
- xcb_glx_get_visual_configs_reply_t *reply,
- int32_t a_screen,
- int32_t * a_num_visuals,
- int32_t * a_num_props,
- int32_t * a_props_buf_size,
- int32_t ** a_props_buf)
-{
- Bool is_ok = FALSE;
- int num_props = 0, num_visuals = 0, props_buf_size = 0;
- int props_per_visual_size = 0;
- int32_t *props_buf = NULL;
-
- if (!reply->num_visuals) {
- EPHYR_LOG_ERROR("screen does not support GL rendering\n");
- goto out;
- }
- num_visuals = reply->num_visuals;
-
- num_props = reply->num_properties;
-
- if (a_type != EPHYR_GET_VISUAL_CONFIGS) {
- num_props *= 2;
- }
- props_per_visual_size = num_props * sizeof(uint32_t);
- props_buf_size = props_per_visual_size * reply->num_visuals;
- props_buf = malloc(props_buf_size);
- if (!props_buf)
- goto out;
- memcpy(props_buf, xcb_glx_get_visual_configs_property_list(reply),
- props_buf_size);
-
- *a_num_visuals = num_visuals;
- *a_num_props = reply->num_properties;
- *a_props_buf_size = props_buf_size;
- *a_props_buf = props_buf;
- is_ok = TRUE;
-
-out:
- return is_ok;
-}
-
-Bool
-ephyrHostGLXGetVisualConfigs(int32_t a_screen,
- int32_t * a_num_visuals,
- int32_t * a_num_props,
- int32_t * a_props_buf_size, int32_t ** a_props_buf)
-{
- Bool is_ok = FALSE;
- xcb_glx_get_visual_configs_cookie_t cookie;
- xcb_glx_get_visual_configs_reply_t *reply;
- xcb_connection_t *conn = hostx_get_xcbconn();
- int screen = hostx_get_screen();
-
- EPHYR_LOG("enter\n");
- cookie = xcb_glx_get_visual_configs(conn, screen);
- reply = xcb_glx_get_visual_configs_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- is_ok = ephyrHostGLXGetVisualConfigsInternal
- (EPHYR_GET_VISUAL_CONFIGS,
- reply,
- a_screen,
- a_num_visuals,
- a_num_props,
- a_props_buf_size,
- a_props_buf);
-
-out:
- free(reply);
- EPHYR_LOG("leave:%d\n", is_ok);
- return is_ok;
-}
-
-Bool
-ephyrHostGLXVendorPrivGetFBConfigsSGIX(int a_screen,
- int32_t * a_num_visuals,
- int32_t * a_num_props,
- int32_t * a_props_buf_size,
- int32_t ** a_props_buf)
-{
- Bool is_ok=FALSE;
- xcb_connection_t *conn = hostx_get_xcbconn();
- int screen = hostx_get_screen();
- xcb_glx_vendor_private_with_reply_cookie_t cookie;
- union {
- xcb_glx_vendor_private_with_reply_reply_t *vprep;
- xcb_glx_get_visual_configs_reply_t *rep;
- } reply;
-
- EPHYR_LOG("enter\n");
- cookie = xcb_glx_vendor_private_with_reply(conn,
- X_GLXvop_GetFBConfigsSGIX,
- 0, 4, (uint8_t *)&screen);
- reply.vprep = xcb_glx_vendor_private_with_reply_reply(conn, cookie, NULL);
- if (!reply.vprep)
- goto out;
- is_ok = ephyrHostGLXGetVisualConfigsInternal
- (EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
- reply.rep,
- a_screen,
- a_num_visuals,
- a_num_props,
- a_props_buf_size,
- a_props_buf);
-out:
- free(reply.vprep);
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
-Bool
-ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor,
- const char *a_extension_list)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- int size;
-
- EPHYR_RETURN_VAL_IF_FAIL(conn && a_extension_list, FALSE);
-
- size = strlen (a_extension_list) + 1;
- xcb_glx_client_info(conn, a_major, a_minor, size, a_extension_list);
-
- return TRUE;
-}
-
-Bool
-ephyrHostGLXCreateContext(int a_screen,
- int a_generic_id,
- int a_context_id,
- int a_share_list_ctxt_id,
- int a_render_type,
- Bool a_direct,
- int code)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- Bool is_ok = FALSE;
- int remote_context_id = 0;
-
- EPHYR_LOG("enter. screen:%d, generic_id:%d, contextid:%d, rendertype:%d, "
- "direct:%d\n", a_screen, a_generic_id, a_context_id,
- a_render_type, a_direct);
-
- if (!hostx_allocate_resource_id_peer(a_context_id, &remote_context_id)) {
- EPHYR_LOG_ERROR("failed to peer the context id %d host X",
- remote_context_id);
- goto out;
- }
-
- switch (code) {
- case X_GLXCreateContext: {
- xcb_glx_create_context(conn,
- remote_context_id,
- a_generic_id,
- hostx_get_screen(),
- a_share_list_ctxt_id,
- a_direct);
- }
-
- case X_GLXCreateNewContext: {
- xcb_glx_create_new_context(conn,
- remote_context_id,
- a_generic_id,
- hostx_get_screen(),
- a_render_type,
- a_share_list_ctxt_id,
- a_direct);
- }
-
- default:
- /* This should never be reached !*/
- EPHYR_LOG("Internal error! Invalid CreateContext code!\n");
- }
-
- is_ok = TRUE;
-
- out:
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
-Bool
-ephyrHostDestroyContext(int a_ctxt_id)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- Bool is_ok = FALSE;
- int remote_ctxt_id = 0;
-
- EPHYR_LOG("enter:%d\n", a_ctxt_id);
-
- if (!hostx_get_resource_id_peer(a_ctxt_id, &remote_ctxt_id)) {
- EPHYR_LOG_ERROR("failed to get remote glx ctxt id\n");
- goto out;
- }
- EPHYR_LOG("host context id:%d\n", remote_ctxt_id);
-
- xcb_glx_destroy_context(conn, remote_ctxt_id);
-
- is_ok = TRUE;
-
- out:
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
-Bool
-ephyrHostGLXMakeCurrent(int a_drawable, int a_readable,
- int a_glx_ctxt_id, int a_old_ctxt_tag, int *a_ctxt_tag)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- Bool is_ok = FALSE;
- int remote_glx_ctxt_id = 0;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_ctxt_tag, FALSE);
-
- EPHYR_LOG("enter. drawable:%d, read:%d, context:%d, oldtag:%d\n",
- a_drawable, a_readable, a_glx_ctxt_id, a_old_ctxt_tag);
-
- if (!hostx_get_resource_id_peer(a_glx_ctxt_id, &remote_glx_ctxt_id)) {
- EPHYR_LOG_ERROR("failed to get remote glx ctxt id\n");
- goto out;
- }
-
- /* If both drawables are the same, use the old MakeCurrent request.
- * Otherwise, if we have GLX 1.3 or higher, use the MakeContextCurrent
- * request which supports separate read and draw targets. Failing that,
- * try the SGI MakeCurrentRead extension. Logic cribbed from Mesa. */
- if (a_drawable == a_readable) {
- xcb_glx_make_current_cookie_t cookie;
- xcb_glx_make_current_reply_t *reply;
- cookie = xcb_glx_make_current(conn,
- a_drawable,
- remote_glx_ctxt_id,
- a_old_ctxt_tag);
- reply = xcb_glx_make_current_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- *a_ctxt_tag = reply->context_tag;
- free(reply);
- }
- else if (glx_major > 1 || glx_minor >= 3) {
- xcb_glx_make_context_current_cookie_t cookie;
- xcb_glx_make_context_current_reply_t *reply;
- cookie = xcb_glx_make_context_current(conn,
- a_old_ctxt_tag,
- a_drawable,
- a_readable,
- remote_glx_ctxt_id);
- reply = xcb_glx_make_context_current_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- *a_ctxt_tag = reply->context_tag;
- free(reply);
- }
- else {
- xcb_glx_vendor_private_with_reply_cookie_t cookie;
- xcb_glx_vendor_private_with_reply_reply_t *reply;
- uint32_t data[3] = {
- a_drawable, a_readable, remote_glx_ctxt_id,
- };
-
- EPHYR_LOG("enter\n");
- cookie = xcb_glx_vendor_private_with_reply(conn,
- X_GLXvop_MakeCurrentReadSGI,
- a_old_ctxt_tag,
- sizeof(data),
- (uint8_t *)data);
- reply = xcb_glx_vendor_private_with_reply_reply(conn, cookie, NULL);
-
- *a_ctxt_tag = reply->retval;
-
- free(reply);
- }
-
- EPHYR_LOG("context tag:%d\n", *a_ctxt_tag);
- is_ok = TRUE;
-
- out:
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
-Bool
-ephyrHostGetIntegerValue(int a_current_context_tag, int a_int, int *a_val)
-{
- xcb_connection_t *conn = hostx_get_xcbconn();
- Bool is_ok = FALSE;
- int size = 0;
- xcb_glx_get_integerv_cookie_t cookie;
- xcb_glx_get_integerv_reply_t *reply;
-
- EPHYR_RETURN_VAL_IF_FAIL(a_val, FALSE);
-
- EPHYR_LOG("enter\n");
- cookie = xcb_glx_get_integerv(conn, a_current_context_tag, a_int);
- reply = xcb_glx_get_integerv_reply(conn, cookie, NULL);
- if (!reply)
- goto out;
- size = reply->n;
- if (!size) {
- EPHYR_LOG_ERROR("X_GLsop_GetIngerv failed\n");
- goto out;
- }
- *a_val = reply->datum;
- is_ok = TRUE;
-
-out:
- free(reply);
- EPHYR_LOG("leave\n");
- return is_ok;
-}
-
-Bool
-ephyrHostIsContextDirect(int a_ctxt_id, int *a_is_direct)
-{
- Bool is_ok = FALSE;
- xcb_connection_t *conn = hostx_get_xcbconn();
- xcb_glx_is_direct_cookie_t cookie;
- xcb_glx_is_direct_reply_t *reply = NULL;
- int remote_glx_ctxt_id = 0;
-
- EPHYR_LOG("enter\n");
- if (!hostx_get_resource_id_peer (a_ctxt_id, &remote_glx_ctxt_id)) {
- EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n");
- goto out;
- }
-
- /* Send the glXIsDirect request */
- cookie = xcb_glx_is_direct(conn, remote_glx_ctxt_id);
- reply = xcb_glx_is_direct_reply(conn, cookie, NULL);
- if (!reply) {
- EPHYR_LOG_ERROR("fail in reading reply from host\n");
- goto out;
- }
- *a_is_direct = reply->is_direct;
- is_ok = TRUE;
-
-out:
- free(reply);
- EPHYR_LOG("leave\n");
- return is_ok;
-}
diff --git a/hw/kdrive/ephyr/ephyrhostglx.h b/hw/kdrive/ephyr/ephyrhostglx.h
deleted file mode 100644
index f1eec5f..0000000
--- a/hw/kdrive/ephyr/ephyrhostglx.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- * Authored by Matthew Allum <mallum at 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 at openedhand.com>
- */
-#ifndef __EPHYRHOSTGLX_H__
-#define __EPHYRHOSTGLX_H__
-
-enum EphyrHostGLXGetStringOps {
- EPHYR_HOST_GLX_UNDEF,
- EPHYR_HOST_GLX_QueryServerString,
- EPHYR_HOST_GLX_GetString,
-};
-
-Bool ephyrHostGLXQueryVersion(int *a_maj, int *a_min);
-Bool ephyrHostGLXGetString(int a_context_tag,
- int a_string_name,
- char **a_string);
-Bool ephyrHostGLXQueryServerString(int a_screen_number,
- int a_string_name,
- char **a_string);
-Bool ephyrHostGLXGetVisualConfigs(int a_screen,
- int32_t * a_num_visuals,
- int32_t * a_num_props,
- int32_t * a_props_buf_size,
- int32_t ** a_props_buf);
-Bool
-
-ephyrHostGLXVendorPrivGetFBConfigsSGIX(int a_screen,
- int32_t * a_num_visuals,
- int32_t * a_num_props,
- int32_t * a_props_buf_size,
- int32_t ** a_props_buf);
-Bool ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor,
- const char *a_extension_list);
-Bool ephyrHostGLXCreateContext(int a_screen,
- int a_generic_id,
- int a_context_id,
- int a_share_list_ctxt_id,
- int a_render_type,
- Bool a_direct,
- int code);
-
-Bool ephyrHostDestroyContext(int a_ctxt_id);
-
-Bool ephyrHostGLXMakeCurrent(int a_drawable, int a_readable, int a_glx_ctxt_id,
- int a_olg_ctxt_tag, int *a_ctxt_tag);
-
-Bool ephyrHostGetIntegerValue(int a_current_context_tag, int a_int, int *a_val);
-
-Bool ephyrHostIsContextDirect(int a_ctxt_id, int *a_is_direct);
-
-#endif /*__EPHYRHOSTGLX_H__*/
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index d86baf2..6b6c4b1 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -38,9 +38,6 @@ extern Bool kdHasPointer;
extern Bool kdHasKbd;
extern Bool ephyr_glamor, ephyr_glamor_gles2;
-#ifdef GLXEXT
-extern Bool ephyrNoDRI;
-#endif
extern Bool ephyrNoXV;
#ifdef KDRIVE_EVDEV
@@ -154,9 +151,6 @@ ddxUseMsg(void)
ErrorF
("-fakexa Simulate acceleration using software rendering\n");
ErrorF("-verbosity <level> Set log verbosity level\n");
-#ifdef GLXEXT
- ErrorF("-nodri do not use DRI\n");
-#endif
ErrorF("-noxv do not use XV\n");
ErrorF("-name [name] define the name in the WM_CLASS property\n");
ErrorF
@@ -314,13 +308,6 @@ ddxProcessArgument(int argc, char **argv, int i)
exit(1);
}
}
-#ifdef GLXEXT
- else if (!strcmp(argv[i], "-nodri")) {
- ephyrNoDRI = TRUE;
- EPHYR_LOG("no direct rendering enabled\n");
- return 1;
- }
-#endif
else if (!strcmp(argv[i], "-noxv")) {
ephyrNoXV = TRUE;
EPHYR_LOG("no XVideo enabled\n");
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 49516bb..ce9faca 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -52,10 +52,6 @@
#include <xcb/shape.h>
#include <xcb/xcb_keysyms.h>
#include <xcb/randr.h>
-#ifdef XF86DRI
-#include <xcb/xf86dri.h>
-#include <xcb/glx.h>
-#endif /* XF86DRI */
#ifdef GLAMOR
#include <epoxy/gl.h>
#include "glamor.h"
@@ -1345,80 +1341,6 @@ out:
return is_ok;
}
-#ifdef XF86DRI
-typedef struct {
- int is_valid;
- int local_id;
- int remote_id;
-} ResourcePair;
-
-#define RESOURCE_PEERS_SIZE 1024*10
-static ResourcePair resource_peers[RESOURCE_PEERS_SIZE];
-
-int
-hostx_allocate_resource_id_peer(int a_local_resource_id,
- int *a_remote_resource_id)
-{
- int i = 0;
- ResourcePair *peer = NULL;
-
- /*
- * first make sure a resource peer
- * does not exist already for
- * a_local_resource_id
- */
- for (i = 0; i < RESOURCE_PEERS_SIZE; i++) {
- if (resource_peers[i].is_valid
- && resource_peers[i].local_id == a_local_resource_id) {
- peer = &resource_peers[i];
- break;
- }
- }
- /*
- * find one free peer entry, an feed it with
- */
- if (!peer) {
- for (i = 0; i < RESOURCE_PEERS_SIZE; i++) {
- if (!resource_peers[i].is_valid) {
- peer = &resource_peers[i];
- break;
- }
- }
- if (peer) {
- peer->remote_id = xcb_generate_id(HostX.conn);
- peer->local_id = a_local_resource_id;
- peer->is_valid = TRUE;
- }
- }
- if (peer) {
- *a_remote_resource_id = peer->remote_id;
- return TRUE;
- }
- return FALSE;
-}
-
-int
-hostx_get_resource_id_peer(int a_local_resource_id, int *a_remote_resource_id)
-{
- int i = 0;
- ResourcePair *peer = NULL;
-
- for (i = 0; i < RESOURCE_PEERS_SIZE; i++) {
- if (resource_peers[i].is_valid
- && resource_peers[i].local_id == a_local_resource_id) {
- peer = &resource_peers[i];
- break;
- }
- }
- if (peer) {
- *a_remote_resource_id = peer->remote_id;
- return TRUE;
- }
- return FALSE;
-}
-
-#endif /* XF86DRI */
-
#ifdef GLAMOR
Bool
ephyr_glamor_init(ScreenPtr screen)
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index d416dae..5e642dc 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -184,20 +184,6 @@ int hostx_set_window_bounding_rectangles(int a_window,
int hostx_has_extension(xcb_extension_t *extension);
-#ifdef XF86DRI
-int hostx_lookup_peer_window(void *a_local_window,
- int *a_host_peer /*out parameter */ );
-int
-
-hostx_allocate_resource_id_peer(int a_local_resource_id,
- int *a_remote_resource_id);
-int
- hostx_get_resource_id_peer(int a_local_resource_id, int *a_remote_resource_id);
-int hostx_has_dri(void);
-
-int hostx_has_glx(void);
-#endif /* XF86DRI */
-
int hostx_get_fd(void);
#endif /*_XLIBS_STUFF_H_*/
commit 953b71270cf12c59c8a836c9be403d07fb01fa22
Author: Adam Jackson <ajax at redhat.com>
Date: Tue Dec 8 17:41:37 2015 -0500
xfree86: Build parser for DRI config file subsection unconditionally
This applies regardless of which DRI you're asking for. Worse, leaving
it out means breaking the config file syntax in a pointless way, since
non-DRI servers can safely just parse it and ignore it.
Reviewed-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Adam Jackson <ajax at redhat.com>
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index d2c3225..0c067c0 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -46,10 +46,8 @@
#include <xorg-config.h>
#endif
-#ifdef XF86DRI
#include <sys/types.h>
#include <grp.h>
-#endif
#include "xf86.h"
#include "xf86Modes.h"
@@ -132,9 +130,7 @@ static Bool configInput(InputInfoPtr pInfo, XF86ConfInputPtr conf_input,
static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display);
static Bool addDefaultModes(MonPtr monitorp);
-#ifdef XF86DRI
static void configDRI(XF86ConfDRIPtr drip);
-#endif
static void configExtensions(XF86ConfExtensionsPtr conf_ext);
/*
@@ -2218,7 +2214,6 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active, Bool g
return TRUE;
}
-#ifdef XF86DRI
static void
configDRI(XF86ConfDRIPtr drip)
{
@@ -2239,7 +2234,6 @@ configDRI(XF86ConfDRIPtr drip)
xf86ConfigDRI.mode = drip->dri_mode;
}
}
-#endif
static void
configExtensions(XF86ConfExtensionsPtr conf_ext)
@@ -2532,9 +2526,7 @@ xf86HandleConfigFile(Bool autoconfig)
configServerFlags(xf86configptr->conf_flags, xf86ConfigLayout.options);
configFiles(xf86configptr->conf_files);
configExtensions(xf86configptr->conf_extensions);
-#ifdef XF86DRI
configDRI(xf86configptr->conf_dri);
-#endif
checkInput(&xf86ConfigLayout, implicit_layout);
commit 1a48a5863e4bceee6b99c1feda1b2c584ff3657c
Author: Adam Jackson <ajax at redhat.com>
Date: Tue Dec 8 17:41:36 2015 -0500
xfree86: Remove ancient DRI build instructions
Reviewed-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Adam Jackson <ajax at redhat.com>
diff --git a/hw/xfree86/doc/Makefile.am b/hw/xfree86/doc/Makefile.am
index 1c3620a..392bdfa 100644
--- a/hw/xfree86/doc/Makefile.am
+++ b/hw/xfree86/doc/Makefile.am
@@ -14,5 +14,4 @@ endif ENABLE_DEVEL_DOCS
EXTRA_DIST = \
Registry \
exa-driver.txt \
- README.DRIcomp \
README.modes
diff --git a/hw/xfree86/doc/README.DRIcomp b/hw/xfree86/doc/README.DRIcomp
deleted file mode 100644
index 7388650..0000000
--- a/hw/xfree86/doc/README.DRIcomp
+++ /dev/null
@@ -1,551 +0,0 @@
- DRI Compilation Guide
-
- VA Linux Systems, Inc. Professional Services - Graphics.
-
- 21 April 2001
-
-1. Preamble
-
-1.1 Copyright
-
-Copyright 2000-2001 by VA Linux Systems, Inc. All Rights Reserved.
-
-Permission is granted to make and distribute verbatim copies of this document
-provided the copyright notice and this permission notice are preserved on all
-copies.
-
-1.2 Trademarks
-
-OpenGL is a registered trademark and SGI is a trademark of Silicon Graphics,
-Inc. Unix is a registered trademark of The Open Group. The `X' device and X
-Window System are trademarks of The Open Group. XFree86 is a trademark of
-The XFree86 Project. Linux is a registered trademark of Linus Torvalds.
-Intel is a registered trademark of Intel Corporation. 3Dlabs, GLINT, and
-Oxygen are either registered trademarks or trademarks of 3Dlabs Inc. Ltd.
-3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Inter-
-active, Incorporated. Matrox is a registered trademark of Matrox Electronic
-Systems Ltd. ATI Rage and Radeon is a registered trademark of ATI Technolo-
-gies, Inc. All other trademarks mentioned are the property of their respec-
-tive owners.
-
-2. Introduction
-
-This document describes how to download, compile and install the DRI. The
-DRI provides 3D graphics hardware acceleration for the XFree86 project. This
-information is intended for experienced Linux developers. Beginners are
-probably better off installing precompiled packages.
-
-Edits, corrections and updates to this document may be mailed to <brian at tung-
-stengraphics.com>.
-
-Last updated on 13 February 2002 by Brian Paul.
-
-3. Prerequisites
-
-You'll need the following:
-
- o An installation of XFree86 4.1 or later. The DRI tree has been pruned
- down to minimize its size. But in order to build the DRI tree you need
- to have recent X header files, etc. already installed. If you don't
- have XFree86 4.1 (or later) installed you can probably install it from
- RPMs (or another package format). Or, you can download XFree86 as
- sources and compile/install it yourself.
-
- o At least 200MB of free disk space. If you compile for debugging (the -g
- option) then you'll need about 600MB.
-
- o GCC compiler and related tools.
-
- o ssh (secure shell) if you're a DRI developer and don't want to use
- anonymous CVS download.
-
- o A 2.4.x Linux Kernel. See below for details.
-
- o FreeBSD support is not currently being maintained and may not work.
-
-The DRI 3D drivers generally work on systems with Intel or AMD CPUs. How-
-ever, limited support for Alpha and PowerPC support is underway.
-
-For 3dfx Voodoo hardware, you'll also need the Glide3 runtime library
-(libglide3-v3.so for Voodoo3 or libglide3-v5.so for Voodoo4/5). These can be
-downloaded from the DRI website. You can compile them yourself, but it's
-often a painful process.
-
-For Matrox G200/G400, Intel i810/i830 or ATI Rage128/Radeon hardware, you'll
-also need AGP support in your Linux kernel, either built-in or as a loadable
-module.
-
-4. Linux Kernel Preparation
-
-Only the Linux 2.4.x kernels are currently supported by the DRI hardware
-drivers. 2.5.x kernels may work, but aren't tested.
-
-Most of the DRI drivers require AGP support and using Intel Pentium III SSE
-optimizations also requires an up-to-date Linux kernel. Configuring your
-kernel correctly is very important, as features such as SSE optimizations
-will be disabled if your kernel does not support them. Thus, if you have a
-Pentium III processor, you must configure your kernel for the Pentium III
-processor family.
-
-Building a new Linux kernel can be difficult for beginners but there are
-resources on the Internet to help. This document assumes experience with
-configuring, building and installing Linux kernels.
-
-Linux kernels can be downloaded from www.kernel.org
-
-Here are the basic steps for kernel setup.
-
- o Download the needed kernel and put it in /usr/src. Create a directory
- for the source and unpack it. For example:
-
- cd /usr/src
- rm -f linux
- mkdir linux-2.4.x
- ln -s linux-2.4.x linux
- bzcat linux-2.4.x.tar.bz2 | tar xf -
-
- It is critical that /usr/src/linux point to your new kernel sources,
- otherwise the kernel headers will not be used when building the DRI.
- This will almost certainly cause compilation problems.
-
- o Read /usr/src/linux/Documentation/Changes. This file lists the minimum
- requirements for all software packages required to build the kernel.
- You must upgrade at least gcc, make, binutils and modutils to at least
- the versions specified in this file. The other packages may not be
- needed. If you are upgrading from Linux 2.2.x you must upgrade your
- modutils package for Linux 2.4.x.
-
- o Configure your kernel. You might, for example, use make menuconfig and
- do the following:
-
- o Go to Code maturity level options
-
- o Enable Prompt for development and/or incomplete code/drivers
-
- o hit ESC to return to the top-level menu
-
- o Go to Processor type and features
-
- o Select your processor type from Processor Family
-
- o hit ESC to return to the top-level menu
-
- o Go to Character devices
-
- o Disable Direct Rendering Manager (XFree86 DRI support) since we'll
- use the DRI code from the XFree86/DRI tree and will compile it
- there.
-
- o Go to /dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW)
-
- o Hit SPACE twice to build AGP support into the kernel
-
- o Enable all chipsets' support for AGP
-
- o Configure the rest of the kernel as required for your system (i.e. Eth-
- ernet, SCSI, etc)
-
- o Exit, saving your kernel configuration.
-
- o Edit your /etc/lilo.conf file. Make sure you have an image entry as
- follows (or similar):
-
- image=/boot/vmlinuz
- label=linux.2.4.x
- read-only
- root=/dev/hda1
-
- The important part is that you have /boot/vmlinuz without a trailing
- version number. If this is the first entry in your /etc/lilo.conf AND
- you haven't set a default, then this will be your default kernel.
-
- o Compile the new kernel.
-
- cd /usr/src/linux-2.4.x
- make dep
- make bzImage
- make modules
- make modules_install
- make install
-
- Note that last make command will automatically run lilo for you.
-
- o Now reboot to use the new kernel.
-
-5. CPU Architectures
-
-In general, nothing special has to be done to use the DRI on different CPU
-architectures. There are, however, a few optimizations that are CPU-depen-
-dent. Mesa will determine at runtime which CPU-dependent optimizations
-should be used and enable them where appropriate.
-
-5.1 Intel Pentium III Features
-
-The Pentium III SSE instructions are used in optimized vertex transformation
-functions in the Mesa-based DRI drivers. On Linux, SSE requires a recent
-kernel (such as 2.4.0-test11 or later) both at compile time and runtime.
-
-5.2 AMD 3DNow! Features
-
-AMD's 3DNow! instructions are used in optimized vertex transformation func-
-tions in the Mesa-based DRI drivers. 3DNow! is supported in most versions of
-Linux.
-
-5.3 Alpha Features
-
-On newer Alpha processors a significant performance increase can be seen with
-the addition of the -mcpu= option to GCC. This option is dependent on the
-architecture of the processor. For example, -mcpu=ev6 will build specifi-
-cally for the EV6 based AXP's, giving both byte and word alignment access to
-the DRI/Mesa drivers.
-
-To enable this optimization edit your xc/config/host.def file and add the
-line:
-
-#define DefaultGcc2AxpOpt -O2 -mcpu=ev6
-
-Additional speed improvements to 3D rendering can be achieved by installing
-Compaq's Math Libraries (CPML) which can be obtained from http://www.sup-
-port.compaq.com/alpha-tools/software/index.html
-
-Once installed, you can add this line to your host.def to build with the CPML
-libraries:
-
-#define UseCompaqMathLibrary YES
-
-The host.def file is explained below.
-
-6. Downloading the XFree86/DRI CVS Sources
-
-The DRI project is hosted by SourceForge. The DRI source code, which is a
-subset of the XFree86 source tree, is kept in a CVS repository there.
-
-The DRI CVS sources may be accessed either anonymously or as a registered
-SourceForge user. It's recommended that you become a registered SourceForge
-user so that you may submit non-anonymous bug reports and can participate in
-the mailing lists.
-
-6.1 Anonymous CVS download:
-
- 1. Create a directory to store the CVS files:
-
- cd ~
- mkdir DRI-CVS
-
- You could put your CVS directory in a different place but we'll use
- ~/DRI-CVS/ here.
-
- 2. Check out the CVS sources:
-
- cd ~/DRI-CVS
- cvs -d:pserver:anonymous at cvs.dri.sourceforge.net:/cvsroot/dri login
- (hit ENTER when prompted for a password)
- cvs -z3 -d:pserver:anonymous at cvs.dri.sourceforge.net:/cvsroot/dri co xc
-
- The -z3 flag causes compression to be used in order to reduce the down-
- load time.
-
-6.2 Registered CVS download:
-
- 1. Create a directory to store the CVS files:
-
- cd ~
- mkdir DRI-CVS
-
- You could put your CVS directory in a different place but we'll use
- ~/DRI-CVS/ here.
-
- 2. Set the CVS_RSH environment variable:
-
- setenv CVS_RSH ssh // if using csh or tcsh
- export CVS_RSH=ssh // if using sh or bash
-
- 3. Check out the CVS sources:
-
- cd ~/DRI-CVS
- cvs -z3 -d:ext:YOURID at cvs.dri.sourceforge.net:/cvsroot/dri co xc
-
- Replace YOURID with your CVS login name. You'll be prompted to enter
- your sourceforge password.
-
- The -z3 flag causes compression to be used in order to reduce the down-
- load time.
-
-6.3 Updating your CVS sources
-
-In the future you'll want to occasionally update your local copy of the DRI
-source code to get the latest changes. This can be done with:
-
- cd ~/DRI-CVS
- cvs -z3 update -dA xc
-
-The -d flag causes any new subdirectories to be created and -A causes most
-recent trunk sources to be fetched, not branch sources.
-
-7. Mesa
-
-Most of the DRI 3D drivers are based on Mesa (the free implementation of the
-OpenGL API). The relevant files from Mesa are already included in the
-XFree86/DRI source tree. There is no need to download or install the Mesa
-source files separately.
-
-Sometimes a newer version of Mesa will be available than the version included
-in XFree86/DRI. Upgrading Mesa within XFree86/DRI is not always straightfor-
-ward. It can be an error-prone undertaking, especially for beginners, and is
-not generally recommended. The DRI developers will upgrade Mesa when appro-
-priate.
-
-8. Compiling the XFree86/DRI tree
-
-8.1 Make a build tree
-
-Rather than placing object files and library files right in the source tree,
-they're instead put into a parallel build tree. The build tree is made with
-the lndir command:
-
- cd ~/DRI-CVS
- ln -s xc XFree40
- mkdir build
- cd build
- lndir -silent -ignorelinks ../XFree40
-
-The build tree will be populated with symbolic links which point back into
-the CVS source tree.
-
-Advanced users may have several build trees for compiling and testing with
-different options.
-
-8.2 Edit the host.def file
-
-The ~/DRI-CVS/build/xc/config/cf/host.def file is used to configure the
-XFree86 build process. You can change it to customize your build options or
-make adjustments for your particular system configuration
-
-The default host.def file will look something like this:
-
- #define DefaultCCOptions -Wall
- (i386) #define DefaultGcc2i386Opt -O2
- (Alpha) #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 (or similar)
- #define LibraryCDebugFlags -O2
- #define BuildServersOnly YES
- #define XF86CardDrivers vga tdfx mga ati i810
- #define LinuxDistribution LinuxRedHat
- #define DefaultCCOptions -ansi GccWarningOptions -pipe
- #define BuildXF86DRI YES
- /* Optionally turn these on for debugging */
- /* #define GlxBuiltInTdfx YES */
- /* #define GlxBuiltInMga YES */
- /* #define GlxBuiltInR128 YES */
- /* #define GlxBuiltInRadeon YES */
- /* #define DoLoadableServer NO */
- #define SharedLibFont NO
-
-The ProjectRoot variable specifies where the XFree86 files will be installed.
-We recommend installing the DRI files over your existing XFree86 installation
-- it's generally safe to do and less error-prone. This policy is different
-than what we used to recommend.
-
-If XFree86 4.x is not installed in /usr/X11R6/ you'll have to add the follow-
-ing to the host.def file:
-
- #define ProjectRoot pathToYourXFree86installation
-
-Note the XF86CardDrivers line to be sure your card's driver is listed.
-
-If you want to enable 3DNow! optimizations in Mesa and the DRI drivers, you
-should add the following:
-
- #define MesaUse3DNow YES
-
-You don't have to be using an AMD processor in order to enable this option.
-The DRI will look for 3DNow! support and runtime and only enable it if appli-
-cable.
-
-If you want to enable SSE optimizations in Mesa and the DRI drivers, you must
-upgrade to a Linux 2.4.x kernel. Mesa will verify that SSE is supported by
-both your processor and your operating system, but to build Mesa inside the
-DRI you need to have the Linux 2.4.x kernel headers in /usr/src/linux. If
-you enable SSE optimizations with an earlier version of the Linux kernel in
-/usr/src/linux, Mesa will not compile. You have been warned. If you do have
-a 2.4.x kernel, you should add the following:
-
- #define MesaUseSSE YES
-
-If you want to build the DRM kernel modules as part of the full build pro-
-cess, add the following:
-
- #define BuildXF86DRM YES
-
-Otherwise, you'll need to build them separately as described below.
-
-8.3 Compilation
-
-To compile the complete DRI tree:
-
- cd ~/DRI-CVS/build/xc/
- make World >& world.log
-
-Or if you want to watch the compilation progress:
-
- cd ~/DRI-CVS/build/xc/
- make World >& world.log &
- tail -f world.log
-
-With the default compilation flags it's normal to get a lot of warnings dur-
-ing compilation.
-
-Building will take some time so you may want to go check your email or visit
-slashdot.
-
-WARNING: do not use the -j option with make. It's reported that it does not
-work with XFree86/DRI.
-
-8.4 Check for compilation errors
-
-Using your text editor, examine world.log for errors by searching for the
-pattern ***.
-
-After fixing the errors, run make World again. Later, you might just compile
-parts of the source tree but it's important that the whole tree will build
-first.
-
-If you edited your host.def file to enable automatic building of the DRI ker-
-nel module(s), verify that they were built:
-
- cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
- ls
-
-Otherwise, build them now by running
-
- cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
- make -f Makefile.linux
-
-For the 3dfx Voodoo, you should see tdfx.o. For the Matrox G200/G400, you
-should see mga.o. For the ATI Rage 128, you should see r128.o. For the ATI
-Radeon, you should see radeon.o. For the Intel i810, you should see i810.o.
-
-If the DRI kernel module(s) failed to build you should verify that you're
-using the right version of the Linux kernel. The most recent kernels are not
-always supported.
-
-If your build machine is running a different version of the kernel than your
-target machine (i.e. 2.2.x vs. 2.4.x), make will select the wrong kernel
-source tree. This can be fixed by explicitly setting the value of LINUXDIR.
-If the path to your kernel source is /usr/src/linux-2.4.x,
-
- cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
- make -f Makefile.linux LINUXDIR=/usr/src/linux-2.4.x
-
-or alternatively, edit Makefile.linux to set LINUXDIR before the ifndef LIN-
-UXDIR line.
-
-8.5 DRI kernel module installation
-
-The DRI kernel modules will be in ~/DRI-CVS/build/xc/pro-
-grams/Xserver/hw/xfree86/os-support/linux/drm/kernel/.
-
-To load the appropriate DRM module in your running kernel you can either use
-ismod and restart your X server or copy the kernel module to /lib/mod-
-ules/2.4.x/kernel/drivers/char/drm/ then run depmod and restart your X
-server.
-
-Make sure you first unload any older DRI kernel modules that might be already
-loaded.
-
-Note that some DRM modules require that the agpgart module be loaded first.
-
-9. Normal Installation and Configuration
-
-Most users will want to install the new X server and use it in place of their
-old X server. This section explains how to do that.
-
-Developers, on the other hand, may just want to test the X server without
-actually installing it as their default server. If you want to do that, skip
-to the next section.
-
-9.1 Installation
-
-Here are the installation commands:
-
- su
- cd ~/DRI-CVS/build/xc
- make install
-
-9.2 Update the XF86Config File
-
-You may need to edit your XF86Config file to enable the DRI. The config file
-is usually installed as /etc/X11/XF86Config-4. See the DRI User Guide for
-details, but basically, you need to load the "glx" and "dri" modules and add
-a "DRI" section.
-
-On the DRI web site, in the resources section, you'll find example XF86Config
-files for a number of graphics cards. These configuration files also setup
-DRI options so it's highly recommended that you look at these examples.
-
-The XFree86 4.x server can generate a basic configuration file itself. Sim-
-ply do this:
-
- cd /usr/X11R6/bin
- ./XFree86 -configure
-
-A file named /root/XF86Config.new will be created. It should allow you to
-try your X server but you'll almost certainly have to edit it. For example,
-you should add HorizSync and VertRefresh options to the Monitor section and
-Modes options to the Screen section. Also, the ModulePath option in the
-Files section should be set to /usr/X11R6/lib/modules.
-
-9.3 Start the New X Server
-
-The new X server should be ready to use now. Start your X server in your
-usual manner. Often times the startx command is used:
-
- startx
-
-10. Testing the Server Without Installing It
-
-As mentioned at the start of section 9, developers may want to simply run the
-X server without installing it. This can save some time and allow you to
-keep a number of X servers available for testing.
-
-10.1 Configuration
-
-As described in the preceding section, you'll need to create a configuration
-file for the new server. Put the XF86Config file in your ~/DRI-
-CVS/build/xc/programs/Xserver directory.
-
-Be sure the ModulePath option in your XF86Config file is set correctly.
-
-10.2 A Startup Script
-
-A simple shell script can be used to start the X server. Here's an example.
-
- #!/bin/sh
- export DISPLAY=:0
- ./XFree86 -xf86config XF86Config & \
- sleep 2
- fvwm2 &
- xset b off
- xmodmap -e "clear mod4"
- xsetroot -solid "#00306f"
- xterm -geometry 80x40+0+0
-
-You might name this script start-dri. Put it in your ~/DRI-CVS/build/xc/pro-
-grams/Xserver directory.
-
-To test the server run the script:
-
- cd ~/DRI-CVS/build/xc/programs/Xserver
- ./start-dri
-
-For debugging, you may also want to capture the log messages printed by the
-server in a file. If you're using the C-shell:
-
- ./start-dri >& log
-
-11. Where To Go From Here
-
-At this point your X server should be up and running with hardware-acceler-
-ated direct rendering. Please read the DRI User Guide for information about
-trouble shooting and how to use the DRI-enabled X server for 3D applications.
-
- Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.19 dawes Exp $
More information about the xorg-commit
mailing list