Drop Xephyr / kdrive DDX

This commit is contained in:
Michel Dänzer 2020-10-23 12:39:00 +02:00 committed by Michel Dänzer
parent 4f4b8e00fc
commit 9335ee7994
34 changed files with 2 additions and 12627 deletions

View File

@ -72,7 +72,7 @@ cache:
- '%CYGWIN_ROOT%\home\%USERNAME%\.ccache'
build_script:
- SET PATH=%CYGWIN_ROOT%/bin
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Dxephyr=true -Dxvfb=true -Dhal=false -Dudev=false build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Dxvfb=true -Dhal=false -Dudev=false build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson configure build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ccache -s"'

View File

@ -62,7 +62,7 @@ debian-buster:
meson:
extends: .common-build-and-test
script:
- meson -Dc_args="-fno-common" -Dprefix=/usr -Dxephyr=true -Dwerror=true $MESON_EXTRA_OPTIONS build/
- meson -Dc_args="-fno-common" -Dprefix=/usr -Dwerror=true $MESON_EXTRA_OPTIONS build/
- ninja -j${FDO_CI_CONCURRENT:-4} -C build/ dist
- PIGLIT_DIR=/root/piglit XTEST_DIR=/root/xts ninja -j${FDO_CI_CONCURRENT:-4} -C build/ test
- .gitlab-ci/manpages-check

View File

@ -1,50 +0,0 @@
.\" $RCSId: xc/programs/Xserver/hw/kdrive/Xkdrive.man,v 1.3 2001/01/24 00:06:10 dawes Exp $
.\"
.TH Xkdrive 1 @vendorversion@
.SH NAME
Xkdrive \- tiny X server
.SH SYNOPSIS
.B Xfbdev
.RI [ :display ]
.RI [ option ...]
.SH DESCRIPTION
.B Xkdrive
is a family of X servers designed to be particularly small. This
manual page describes the common functionality of the
.B Xkdrive
servers; for information on a specific X server, please refer to the
relevant manual page.
.SH OPTIONS
In addition to the standard options accepted by all X servers (see
Xserver(1)), all the
.B Xkdrive
servers accept the following options:
.TP 8
.B -dumb
disable hardware acceleration.
.TP 8
.B -origin \fIX\fP,\fIY\fP
Locates the next screen in the Xinerama virtual screen.
.TP 8
.B -screen \fIwidth\fBx\fIheight\fR[\fBx\fIdepth\fR[\fBx\fIfreq\fR]]\fR[\fB@\fIrotation\fR]\fB
use a screen of the specified \fIwidth\fP, \fIheight\fP, screen \fIdepth\fP, \fIfrequency\fP, and \fIrotation\fP (0, 90, 180 and 270 are legal values).
.TP 8
.B -softCursor
disable the hardware cursor.
.TP 8
.B -videoTest
start the server, pause momentarily, and exit.
.TP 8
.B -zaphod
disable switching screens by moving the pointer across a screen boundary.
.TP 8
.B -2button
enable emulation of a middle mouse button by chording.
.TP 8
.B -3button
disable emulation of a middle mouse button by chording.
.SH SEE ALSO
X(@miscmansuffix@), Xserver(1), xdm(1), xinit(1), Xvesa(1), Xfbdev(1).
.SH AUTHORS
The Xkdrive common core was written by Keith Packard,
and is based on the Sample Implementation of X.

View File

@ -1 +0,0 @@
Xephyr

View File

@ -1,71 +0,0 @@
Xephyr README
=============
What Is It ?
============
Xephyr is a a kdrive server that outputs to a window on a pre-existing
'host' X display. Think Xnest but with support for modern extensions
like composite, damage and randr.
Unlike Xnest which is an X proxy, i.e. limited to the
capabilities of the host X server, Xephyr is a real X server which
uses the host X server window as "framebuffer" via fast SHM XImages.
It also has support for 'visually' debugging what the server is
painting.
How To Use
==========
You probably want to run like;
Xephyr :1 -ac -screen 800x600 &
Then set DISPLAY=:1 and run whatever X apps you like.
Use 'xrandr' to change to orientation/size.
There is a '-parent' switch which works just like Xnest's ( for use
with things like matchbox-nest - http://matchbox.handhelds.org ).
There is also a '-host-cursor' switch to set 'cursor acceleration' -
The host's cursor is reused. This is only really there to aid
debugging by avoiding server paints for the cursor. Performance
improvement is negligible.
Send a SIGUSR1 to the server ( eg kill -USR1 `pidof Xephyr` ) to
toggle the debugging mode. In this mode red rectangles are painted to
screen areas getting painted before painting the actual content. The
delay between this can be altered by setting a XEPHYR_PAUSE env var to
a value in microseconds.
Caveats
=======
- Depth is limited to being the same as the host.
*Update* As of 8/11/2004. Xephyr can now do 8bpp & 16bpp
on 24bpp host.
- Rotated displays are currently updated via full blits. This
is slower than a normal oprientated display. Debug mode will
therefore not be of much use rotated.
- The '-host-cursor' cursor is static in its appearance.
- The build gets a warning about 'nanosleep'. I think the various '-D'
build flags are causing this. I haven't figured as yet how to work
around it. It doesn't appear to break anything however.
- Keyboard handling is basic but works.
- Mouse button 5 probably won't work.
Matthew Allum <mallum@o-hand.com> 2004

File diff suppressed because it is too large Load Diff

View File

@ -1,236 +0,0 @@
/*
* Xephyr - A kdrive X server that runs in a host X window.
* Authored by Matthew Allum <mallum@o-hand.com>
*
* Copyright © 2004 Nokia
*
* 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 Nokia not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Nokia makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL NOKIA 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.
*/
#ifndef _EPHYR_H_
#define _EPHYR_H_
#include <stdio.h>
#include <unistd.h>
#include <libgen.h>
#include <xcb/xcb_image.h>
#include "os.h" /* for OsSignal() */
#include "kdrive.h"
#include "hostx.h"
#include "exa.h"
#ifdef RANDR
#include "randrstr.h"
#endif
#include "damage.h"
typedef struct _ephyrPriv {
CARD8 *base;
int bytes_per_line;
} EphyrPriv;
typedef struct _ephyrFakexaPriv {
ExaDriverPtr exa;
Bool is_synced;
/* The following are arguments and other information from Prepare* calls
* which are stored for use in the inner calls.
*/
int op;
PicturePtr pSrcPicture, pMaskPicture, pDstPicture;
void *saved_ptrs[3];
PixmapPtr pDst, pSrc, pMask;
GCPtr pGC;
} EphyrFakexaPriv;
typedef struct _ephyrScrPriv {
/* ephyr server info */
Rotation randr;
Bool shadow;
DamagePtr pDamage;
EphyrFakexaPriv *fakexa;
/* Host X window info */
xcb_window_t win;
xcb_window_t win_pre_existing; /* Set via -parent option like xnest */
xcb_window_t peer_win; /* Used for GL; should be at most one */
xcb_image_t *ximg;
Bool win_explicit_position;
int win_x, win_y;
int win_width, win_height;
int server_depth;
const char *output; /* Set via -output option */
unsigned char *fb_data; /* only used when host bpp != server bpp */
xcb_shm_segment_info_t shminfo;
size_t shmsize;
KdScreenInfo *screen;
int mynum; /* Screen number */
unsigned long cmap[256];
ScreenBlockHandlerProcPtr BlockHandler;
/**
* Per-screen Xlib-using state for glamor (private to
* ephyr_glamor_glx.c)
*/
struct ephyr_glamor *glamor;
} EphyrScrPriv;
extern KdCardFuncs ephyrFuncs;
extern KdKeyboardInfo *ephyrKbd;
extern KdPointerInfo *ephyrMouse;
extern miPointerScreenFuncRec ephyrPointerScreenFuncs;
Bool
ephyrInitialize(KdCardInfo * card, EphyrPriv * priv);
Bool
ephyrCardInit(KdCardInfo * card);
Bool
ephyrScreenInitialize(KdScreenInfo *screen);
Bool
ephyrInitScreen(ScreenPtr pScreen);
Bool
ephyrFinishInitScreen(ScreenPtr pScreen);
Bool
ephyrCreateResources(ScreenPtr pScreen);
void
ephyrPreserve(KdCardInfo * card);
Bool
ephyrEnable(ScreenPtr pScreen);
Bool
ephyrDPMS(ScreenPtr pScreen, int mode);
void
ephyrDisable(ScreenPtr pScreen);
void
ephyrRestore(KdCardInfo * card);
void
ephyrScreenFini(KdScreenInfo * screen);
void
ephyrCloseScreen(ScreenPtr pScreen);
void
ephyrCardFini(KdCardInfo * card);
void
ephyrGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs);
void
ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs);
Bool
ephyrMapFramebuffer(KdScreenInfo * screen);
void *ephyrWindowLinear(ScreenPtr pScreen,
CARD32 row,
CARD32 offset, int mode, CARD32 *size, void *closure);
void
ephyrSetScreenSizes(ScreenPtr pScreen);
Bool
ephyrUnmapFramebuffer(KdScreenInfo * screen);
void
ephyrUnsetInternalDamage(ScreenPtr pScreen);
Bool
ephyrSetInternalDamage(ScreenPtr pScreen);
Bool
ephyrCreateColormap(ColormapPtr pmap);
#ifdef RANDR
Bool
ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations);
Bool
ephyrRandRSetConfig(ScreenPtr pScreen,
Rotation randr, int rate, RRScreenSizePtr pSize);
Bool
ephyrRandRInit(ScreenPtr pScreen);
void
ephyrShadowUpdate(ScreenPtr pScreen, shadowBufPtr pBuf);
#endif
void
ephyrUpdateModifierState(unsigned int state);
extern KdPointerDriver EphyrMouseDriver;
extern KdKeyboardDriver EphyrKeyboardDriver;
extern Bool ephyrCursorInit(ScreenPtr pScreen);
extern int ephyrBufferHeight(KdScreenInfo * screen);
/* ephyr_draw.c */
Bool
ephyrDrawInit(ScreenPtr pScreen);
void
ephyrDrawEnable(ScreenPtr pScreen);
void
ephyrDrawDisable(ScreenPtr pScreen);
void
ephyrDrawFini(ScreenPtr pScreen);
/* hostx.c glamor support */
Bool ephyr_glamor_init(ScreenPtr pScreen);
Bool ephyr_glamor_create_screen_resources(ScreenPtr pScreen);
void ephyr_glamor_enable(ScreenPtr pScreen);
void ephyr_glamor_disable(ScreenPtr pScreen);
void ephyr_glamor_fini(ScreenPtr pScreen);
void ephyr_glamor_host_paint_rect(ScreenPtr pScreen);
/*ephyvideo.c*/
Bool ephyrInitVideo(ScreenPtr pScreen);
/* ephyr_glamor_xv.c */
#ifdef GLAMOR
void ephyr_glamor_xv_init(ScreenPtr screen);
#else /* !GLAMOR */
static inline void
ephyr_glamor_xv_init(ScreenPtr screen)
{
}
#endif /* !GLAMOR */
#endif

View File

@ -1,533 +0,0 @@
/*
* Copyright © 2006 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Authors:
* Eric Anholt <eric@anholt.net>
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "ephyr.h"
#include "exa_priv.h"
#include "fbpict.h"
#define EPHYR_TRACE_DRAW 0
#if EPHYR_TRACE_DRAW
#define TRACE_DRAW() ErrorF("%s\n", __FUNCTION__);
#else
#define TRACE_DRAW() do { } while (0)
#endif
/* Use some oddball alignments, to expose issues in alignment handling in EXA. */
#define EPHYR_OFFSET_ALIGN 24
#define EPHYR_PITCH_ALIGN 24
#define EPHYR_OFFSCREEN_SIZE (16 * 1024 * 1024)
#define EPHYR_OFFSCREEN_BASE (1 * 1024 * 1024)
/**
* Forces a real devPrivate.ptr for hidden pixmaps, so that we can call down to
* fb functions.
*/
static void
ephyrPreparePipelinedAccess(PixmapPtr pPix, int index)
{
KdScreenPriv(pPix->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
assert(fakexa->saved_ptrs[index] == NULL);
fakexa->saved_ptrs[index] = pPix->devPrivate.ptr;
if (pPix->devPrivate.ptr != NULL)
return;
pPix->devPrivate.ptr = fakexa->exa->memoryBase + exaGetPixmapOffset(pPix);
}
/**
* Restores the original devPrivate.ptr of the pixmap from before we messed with
* it.
*/
static void
ephyrFinishPipelinedAccess(PixmapPtr pPix, int index)
{
KdScreenPriv(pPix->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
pPix->devPrivate.ptr = fakexa->saved_ptrs[index];
fakexa->saved_ptrs[index] = NULL;
}
/**
* Sets up a scratch GC for fbFill, and saves other parameters for the
* ephyrSolid implementation.
*/
static Bool
ephyrPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
ChangeGCVal tmpval[3];
ephyrPreparePipelinedAccess(pPix, EXA_PREPARE_DEST);
fakexa->pDst = pPix;
fakexa->pGC = GetScratchGC(pPix->drawable.depth, pScreen);
tmpval[0].val = alu;
tmpval[1].val = pm;
tmpval[2].val = fg;
ChangeGC(NullClient, fakexa->pGC, GCFunction | GCPlaneMask | GCForeground,
tmpval);
ValidateGC(&pPix->drawable, fakexa->pGC);
TRACE_DRAW();
return TRUE;
}
/**
* Does an fbFill of the rectangle to be drawn.
*/
static void
ephyrSolid(PixmapPtr pPix, int x1, int y1, int x2, int y2)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
fbFill(&fakexa->pDst->drawable, fakexa->pGC, x1, y1, x2 - x1, y2 - y1);
}
/**
* Cleans up the scratch GC created in ephyrPrepareSolid.
*/
static void
ephyrDoneSolid(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
FreeScratchGC(fakexa->pGC);
ephyrFinishPipelinedAccess(pPix, EXA_PREPARE_DEST);
}
/**
* Sets up a scratch GC for fbCopyArea, and saves other parameters for the
* ephyrCopy implementation.
*/
static Bool
ephyrPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu,
Pixel pm)
{
ScreenPtr pScreen = pDst->drawable.pScreen;
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
ChangeGCVal tmpval[2];
ephyrPreparePipelinedAccess(pDst, EXA_PREPARE_DEST);
ephyrPreparePipelinedAccess(pSrc, EXA_PREPARE_SRC);
fakexa->pSrc = pSrc;
fakexa->pDst = pDst;
fakexa->pGC = GetScratchGC(pDst->drawable.depth, pScreen);
tmpval[0].val = alu;
tmpval[1].val = pm;
ChangeGC(NullClient, fakexa->pGC, GCFunction | GCPlaneMask, tmpval);
ValidateGC(&pDst->drawable, fakexa->pGC);
TRACE_DRAW();
return TRUE;
}
/**
* Does an fbCopyArea to take care of the requested copy.
*/
static void
ephyrCopy(PixmapPtr pDst, int srcX, int srcY, int dstX, int dstY, int w, int h)
{
ScreenPtr pScreen = pDst->drawable.pScreen;
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
fbCopyArea(&fakexa->pSrc->drawable, &fakexa->pDst->drawable, fakexa->pGC,
srcX, srcY, w, h, dstX, dstY);
}
/**
* Cleans up the scratch GC created in ephyrPrepareCopy.
*/
static void
ephyrDoneCopy(PixmapPtr pDst)
{
ScreenPtr pScreen = pDst->drawable.pScreen;
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
FreeScratchGC(fakexa->pGC);
ephyrFinishPipelinedAccess(fakexa->pSrc, EXA_PREPARE_SRC);
ephyrFinishPipelinedAccess(fakexa->pDst, EXA_PREPARE_DEST);
}
/**
* Reports that we can always accelerate the given operation. This may not be
* desirable from an EXA testing standpoint -- testing the fallback paths would
* be useful, too.
*/
static Bool
ephyrCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
/* Exercise the component alpha helper, so fail on this case like a normal
* driver
*/
if (pMaskPicture && pMaskPicture->componentAlpha && op == PictOpOver)
return FALSE;
return TRUE;
}
/**
* Saves off the parameters for ephyrComposite.
*/
static Bool
ephyrPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask,
PixmapPtr pDst)
{
KdScreenPriv(pDst->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
ephyrPreparePipelinedAccess(pDst, EXA_PREPARE_DEST);
if (pSrc != NULL)
ephyrPreparePipelinedAccess(pSrc, EXA_PREPARE_SRC);
if (pMask != NULL)
ephyrPreparePipelinedAccess(pMask, EXA_PREPARE_MASK);
fakexa->op = op;
fakexa->pSrcPicture = pSrcPicture;
fakexa->pMaskPicture = pMaskPicture;
fakexa->pDstPicture = pDstPicture;
fakexa->pSrc = pSrc;
fakexa->pMask = pMask;
fakexa->pDst = pDst;
TRACE_DRAW();
return TRUE;
}
/**
* Does an fbComposite to complete the requested drawing operation.
*/
static void
ephyrComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
int dstX, int dstY, int w, int h)
{
KdScreenPriv(pDst->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
fbComposite(fakexa->op, fakexa->pSrcPicture, fakexa->pMaskPicture,
fakexa->pDstPicture, srcX, srcY, maskX, maskY, dstX, dstY,
w, h);
}
static void
ephyrDoneComposite(PixmapPtr pDst)
{
KdScreenPriv(pDst->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
if (fakexa->pMask != NULL)
ephyrFinishPipelinedAccess(fakexa->pMask, EXA_PREPARE_MASK);
if (fakexa->pSrc != NULL)
ephyrFinishPipelinedAccess(fakexa->pSrc, EXA_PREPARE_SRC);
ephyrFinishPipelinedAccess(fakexa->pDst, EXA_PREPARE_DEST);
}
/**
* Does fake acceleration of DownloadFromScren using memcpy.
*/
static Bool
ephyrDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
int dst_pitch)
{
KdScreenPriv(pSrc->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
unsigned char *src;
int src_pitch, cpp;
if (pSrc->drawable.bitsPerPixel < 8)
return FALSE;
ephyrPreparePipelinedAccess(pSrc, EXA_PREPARE_SRC);
cpp = pSrc->drawable.bitsPerPixel / 8;
src_pitch = exaGetPixmapPitch(pSrc);
src = fakexa->exa->memoryBase + exaGetPixmapOffset(pSrc);
src += y * src_pitch + x * cpp;
for (; h > 0; h--) {
memcpy(dst, src, w * cpp);
dst += dst_pitch;
src += src_pitch;
}
exaMarkSync(pSrc->drawable.pScreen);
ephyrFinishPipelinedAccess(pSrc, EXA_PREPARE_SRC);
return TRUE;
}
/**
* Does fake acceleration of UploadToScreen using memcpy.
*/
static Bool
ephyrUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
int src_pitch)
{
KdScreenPriv(pDst->drawable.pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
unsigned char *dst;
int dst_pitch, cpp;
if (pDst->drawable.bitsPerPixel < 8)
return FALSE;
ephyrPreparePipelinedAccess(pDst, EXA_PREPARE_DEST);
cpp = pDst->drawable.bitsPerPixel / 8;
dst_pitch = exaGetPixmapPitch(pDst);
dst = fakexa->exa->memoryBase + exaGetPixmapOffset(pDst);
dst += y * dst_pitch + x * cpp;
for (; h > 0; h--) {
memcpy(dst, src, w * cpp);
dst += dst_pitch;
src += src_pitch;
}
exaMarkSync(pDst->drawable.pScreen);
ephyrFinishPipelinedAccess(pDst, EXA_PREPARE_DEST);
return TRUE;
}
static Bool
ephyrPrepareAccess(PixmapPtr pPix, int index)
{
/* Make sure we don't somehow end up with a pointer that is in framebuffer
* and hasn't been readied for us.
*/
assert(pPix->devPrivate.ptr != NULL);
return TRUE;
}
/**
* In fakexa, we currently only track whether we have synced to the latest
* "accelerated" drawing that has happened or not. It's not used for anything
* yet.
*/
static int
ephyrMarkSync(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
fakexa->is_synced = FALSE;
return 0;
}
/**
* Assumes that we're waiting on the latest marker. When EXA gets smarter and
* starts using markers in a fine-grained way (for example, waiting on drawing
* to required pixmaps to complete, rather than waiting for all drawing to
* complete), we'll want to make the ephyrMarkSync/ephyrWaitMarker
* implementation fine-grained as well.
*/
static void
ephyrWaitMarker(ScreenPtr pScreen, int marker)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrFakexaPriv *fakexa = scrpriv->fakexa;
fakexa->is_synced = TRUE;
}
/**
* This function initializes EXA to use the fake acceleration implementation
* which just falls through to software. The purpose is to have a reliable,
* correct driver with which to test changes to the EXA core.
*/
Bool
ephyrDrawInit(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
EphyrPriv *priv = screen->card->driver;
EphyrFakexaPriv *fakexa;
Bool success;
fakexa = calloc(1, sizeof(*fakexa));
if (fakexa == NULL)
return FALSE;
fakexa->exa = exaDriverAlloc();
if (fakexa->exa == NULL) {
free(fakexa);
return FALSE;
}
fakexa->exa->memoryBase = (CARD8 *) (priv->base);
fakexa->exa->memorySize = priv->bytes_per_line * ephyrBufferHeight(screen);
fakexa->exa->offScreenBase = priv->bytes_per_line * screen->height;
/* Since we statically link against EXA, we shouldn't have to be smart about
* versioning.
*/
fakexa->exa->exa_major = 2;
fakexa->exa->exa_minor = 0;
fakexa->exa->PrepareSolid = ephyrPrepareSolid;
fakexa->exa->Solid = ephyrSolid;
fakexa->exa->DoneSolid = ephyrDoneSolid;
fakexa->exa->PrepareCopy = ephyrPrepareCopy;
fakexa->exa->Copy = ephyrCopy;
fakexa->exa->DoneCopy = ephyrDoneCopy;
fakexa->exa->CheckComposite = ephyrCheckComposite;
fakexa->exa->PrepareComposite = ephyrPrepareComposite;
fakexa->exa->Composite = ephyrComposite;
fakexa->exa->DoneComposite = ephyrDoneComposite;
fakexa->exa->DownloadFromScreen = ephyrDownloadFromScreen;
fakexa->exa->UploadToScreen = ephyrUploadToScreen;
fakexa->exa->MarkSync = ephyrMarkSync;
fakexa->exa->WaitMarker = ephyrWaitMarker;
fakexa->exa->PrepareAccess = ephyrPrepareAccess;
fakexa->exa->pixmapOffsetAlign = EPHYR_OFFSET_ALIGN;
fakexa->exa->pixmapPitchAlign = EPHYR_PITCH_ALIGN;
fakexa->exa->maxX = 1023;
fakexa->exa->maxY = 1023;
fakexa->exa->flags = EXA_OFFSCREEN_PIXMAPS;
success = exaDriverInit(pScreen, fakexa->exa);
if (success) {
ErrorF("Initialized fake EXA acceleration\n");
scrpriv->fakexa = fakexa;
}
else {
ErrorF("Failed to initialize EXA\n");
free(fakexa->exa);
free(fakexa);
}
return success;
}
void
ephyrDrawEnable(ScreenPtr pScreen)
{
}
void
ephyrDrawDisable(ScreenPtr pScreen)
{
}
void
ephyrDrawFini(ScreenPtr pScreen)
{
}
/**
* exaDDXDriverInit is required by the top-level EXA module, and is used by
* the xorg DDX to hook in its EnableDisableFB wrapper. We don't need it, since
* we won't be enabling/disabling the FB.
*/
void
exaDDXDriverInit(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
pExaScr->migration = ExaMigrationSmart;
pExaScr->checkDirtyCorrectness = TRUE;
}

View File

@ -1,429 +0,0 @@
/*
* Copyright © 2013 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/** @file ephyr_glamor_glx.c
*
* Separate file for hiding Xlib and GLX-using parts of xephyr from
* the rest of the server-struct-aware build.
*/
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#undef Xcalloc
#undef Xrealloc
#undef Xfree
#include <X11/Xlib-xcb.h>
#include <xcb/xcb_aux.h>
#include <pixman.h>
#include <epoxy/glx.h>
#include "ephyr_glamor_glx.h"
#include "os.h"
#include <X11/Xproto.h>
/* until we need geometry shaders GL3.1 should suffice. */
/* Xephyr has its own copy of this for build reasons */
#define GLAMOR_GL_CORE_VER_MAJOR 3
#define GLAMOR_GL_CORE_VER_MINOR 1
/** @{
*
* global state for Xephyr with glamor.
*
* Xephyr can render with multiple windows, but all the windows have
* to be on the same X connection and all have to have the same
* visual.
*/
static Display *dpy;
static XVisualInfo *visual_info;
static GLXFBConfig fb_config;
Bool ephyr_glamor_gles2;
Bool ephyr_glamor_skip_present;
/** @} */
/**
* Per-screen state for Xephyr with glamor.
*/
struct ephyr_glamor {
GLXContext ctx;
Window win;
GLXWindow glx_win;
GLuint tex;
GLuint texture_shader;
GLuint texture_shader_position_loc;
GLuint texture_shader_texcoord_loc;
/* Size of the window that we're rendering to. */
unsigned width, height;
GLuint vao, vbo;
};
static GLint
ephyr_glamor_compile_glsl_prog(GLenum type, const char *source)
{
GLint ok;
GLint prog;
prog = glCreateShader(type);
glShaderSource(prog, 1, (const GLchar **) &source, NULL);
glCompileShader(prog);
glGetShaderiv(prog, GL_COMPILE_STATUS, &ok);
if (!ok) {
GLchar *info;
GLint size;
glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size);
info = malloc(size);
if (info) {
glGetShaderInfoLog(prog, size, NULL, info);
ErrorF("Failed to compile %s: %s\n",
type == GL_FRAGMENT_SHADER ? "FS" : "VS", info);
ErrorF("Program source:\n%s", source);
free(info);
}
else
ErrorF("Failed to get shader compilation info.\n");
FatalError("GLSL compile failure\n");
}
return prog;
}
static GLuint
ephyr_glamor_build_glsl_prog(GLuint vs, GLuint fs)
{
GLint ok;
GLuint prog;
prog = glCreateProgram();
glAttachShader(prog, vs);
glAttachShader(prog, fs);
glLinkProgram(prog);
glGetProgramiv(prog, GL_LINK_STATUS, &ok);
if (!ok) {
GLchar *info;
GLint size;
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size);
info = malloc(size);
glGetProgramInfoLog(prog, size, NULL, info);
ErrorF("Failed to link: %s\n", info);
FatalError("GLSL link failure\n");
}
return prog;
}
static void
ephyr_glamor_setup_texturing_shader(struct ephyr_glamor *glamor)
{
const char *vs_source =
"attribute vec2 texcoord;\n"
"attribute vec2 position;\n"
"varying vec2 t;\n"
"\n"
"void main()\n"
"{\n"
" t = texcoord;\n"
" gl_Position = vec4(position, 0, 1);\n"
"}\n";
const char *fs_source =
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n"
"\n"
"varying vec2 t;\n"
"uniform sampler2D s; /* initially 0 */\n"
"\n"
"void main()\n"
"{\n"
" gl_FragColor = texture2D(s, t);\n"
"}\n";
GLuint fs, vs, prog;
vs = ephyr_glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source);
fs = ephyr_glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, fs_source);
prog = ephyr_glamor_build_glsl_prog(vs, fs);
glamor->texture_shader = prog;
glamor->texture_shader_position_loc = glGetAttribLocation(prog, "position");
assert(glamor->texture_shader_position_loc != -1);
glamor->texture_shader_texcoord_loc = glGetAttribLocation(prog, "texcoord");
assert(glamor->texture_shader_texcoord_loc != -1);
}
xcb_connection_t *
ephyr_glamor_connect(void)
{
dpy = XOpenDisplay(NULL);
if (!dpy)
return NULL;
XSetEventQueueOwner(dpy, XCBOwnsEventQueue);
return XGetXCBConnection(dpy);
}
void
ephyr_glamor_set_texture(struct ephyr_glamor *glamor, uint32_t tex)
{
glamor->tex = tex;
}
static void
ephyr_glamor_set_vertices(struct ephyr_glamor *glamor)
{
glVertexAttribPointer(glamor->texture_shader_position_loc,
2, GL_FLOAT, FALSE, 0, (void *) 0);
glVertexAttribPointer(glamor->texture_shader_texcoord_loc,
2, GL_FLOAT, FALSE, 0, (void *) (sizeof (float) * 8));
glEnableVertexAttribArray(glamor->texture_shader_position_loc);
glEnableVertexAttribArray(glamor->texture_shader_texcoord_loc);
}
void
ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
struct pixman_region16 *damage)
{
GLint old_vao;
/* Skip presenting the output in this mode. Presentation is
* expensive, and if we're just running the X Test suite headless,
* nobody's watching.
*/
if (ephyr_glamor_skip_present)
return;
glXMakeCurrent(dpy, glamor->glx_win, glamor->ctx);
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &old_vao);
glBindVertexArray(glamor->vao);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glUseProgram(glamor->texture_shader);
glViewport(0, 0, glamor->width, glamor->height);
if (!ephyr_glamor_gles2)
glDisable(GL_COLOR_LOGIC_OP);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, glamor->tex);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glBindVertexArray(old_vao);
glXSwapBuffers(dpy, glamor->glx_win);
}
/**
* Xlib-based handling of xcb events for glamor.
*
* We need to let the Xlib event filtering run on the event so that
* Mesa's dri2_glx.c userspace event mangling gets run, and we
* correctly get our invalidate events propagated into the driver.
*/
void
ephyr_glamor_process_event(xcb_generic_event_t *xev)
{
uint32_t response_type = xev->response_type & 0x7f;
/* Note the types on wire_to_event: there's an Xlib XEvent (with
* the broken types) that it returns, and a protocol xEvent that
* it inspects.
*/
Bool (*wire_to_event)(Display *dpy, XEvent *ret, xEvent *event);
XLockDisplay(dpy);
/* Set the event handler to NULL to get access to the current one. */
wire_to_event = XESetWireToEvent(dpy, response_type, NULL);
if (wire_to_event) {
XEvent processed_event;
/* OK they had an event handler. Plug it back in, and call
* through to it.
*/
XESetWireToEvent(dpy, response_type, wire_to_event);
xev->sequence = LastKnownRequestProcessed(dpy);
wire_to_event(dpy, &processed_event, (xEvent *)xev);
}
XUnlockDisplay(dpy);
}
static int
ephyr_glx_error_handler(Display * _dpy, XErrorEvent * ev)
{
return 0;
}
struct ephyr_glamor *
ephyr_glamor_glx_screen_init(xcb_window_t win)
{
int (*oldErrorHandler) (Display *, XErrorEvent *);
static const float position[] = {
-1, -1,
1, -1,
1, 1,
-1, 1,
0, 1,
1, 1,
1, 0,
0, 0,
};
GLint old_vao;
GLXContext ctx;
struct ephyr_glamor *glamor;
GLXWindow glx_win;
glamor = calloc(1, sizeof(struct ephyr_glamor));
if (!glamor) {
FatalError("malloc");
return NULL;
}
glx_win = glXCreateWindow(dpy, fb_config, win, NULL);
if (ephyr_glamor_gles2) {
static const int context_attribs[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES_PROFILE_BIT_EXT,
0,
};
if (epoxy_has_glx_extension(dpy, DefaultScreen(dpy),
"GLX_EXT_create_context_es2_profile")) {
ctx = glXCreateContextAttribsARB(dpy, fb_config, NULL, True,
context_attribs);
} else {
FatalError("Xephyr -glamor_gles2 requires "
"GLX_EXT_create_context_es2_profile\n");
}
} else {
if (epoxy_has_glx_extension(dpy, DefaultScreen(dpy),
"GLX_ARB_create_context")) {
static const int context_attribs[] = {
GLX_CONTEXT_PROFILE_MASK_ARB,
GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
GLX_CONTEXT_MAJOR_VERSION_ARB,
GLAMOR_GL_CORE_VER_MAJOR,
GLX_CONTEXT_MINOR_VERSION_ARB,
GLAMOR_GL_CORE_VER_MINOR,
0,
};
oldErrorHandler = XSetErrorHandler(ephyr_glx_error_handler);
ctx = glXCreateContextAttribsARB(dpy, fb_config, NULL, True,
context_attribs);
XSync(dpy, False);
XSetErrorHandler(oldErrorHandler);
} else {
ctx = NULL;
}
if (!ctx)
ctx = glXCreateContext(dpy, visual_info, NULL, True);
}
if (ctx == NULL)
FatalError("glXCreateContext failed\n");
if (!glXMakeCurrent(dpy, glx_win, ctx))
FatalError("glXMakeCurrent failed\n");
glamor->ctx = ctx;
glamor->win = win;
glamor->glx_win = glx_win;
ephyr_glamor_setup_texturing_shader(glamor);
glGenVertexArrays(1, &glamor->vao);
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &old_vao);
glBindVertexArray(glamor->vao);
glGenBuffers(1, &glamor->vbo);
glBindBuffer(GL_ARRAY_BUFFER, glamor->vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof (position), position, GL_STATIC_DRAW);
ephyr_glamor_set_vertices(glamor);
glBindVertexArray(old_vao);
return glamor;
}
void
ephyr_glamor_glx_screen_fini(struct ephyr_glamor *glamor)
{
glXMakeCurrent(dpy, None, NULL);
glXDestroyContext(dpy, glamor->ctx);
glXDestroyWindow(dpy, glamor->glx_win);
free(glamor);
}
xcb_visualtype_t *
ephyr_glamor_get_visual(void)
{
xcb_screen_t *xscreen =
xcb_aux_get_screen(XGetXCBConnection(dpy), DefaultScreen(dpy));
int attribs[] = {
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER, 1,
None
};
int event_base = 0, error_base = 0, nelements;
GLXFBConfig *fbconfigs;
if (!glXQueryExtension (dpy, &error_base, &event_base))
FatalError("Couldn't find GLX extension\n");
fbconfigs = glXChooseFBConfig(dpy, DefaultScreen(dpy), attribs, &nelements);
if (!nelements)
FatalError("Couldn't choose an FBConfig\n");
fb_config = fbconfigs[0];
free(fbconfigs);
visual_info = glXGetVisualFromFBConfig(dpy, fb_config);
if (visual_info == NULL)
FatalError("Couldn't get RGB visual\n");
return xcb_aux_find_visual_by_id(xscreen, visual_info->visualid);
}
void
ephyr_glamor_set_window_size(struct ephyr_glamor *glamor,
unsigned width, unsigned height)
{
if (!glamor)
return;
glamor->width = width;
glamor->height = height;
}

View File

@ -1,83 +0,0 @@
/*
* Copyright © 2013 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/**
* ephyr_glamor_glx.h
*
* Prototypes exposed by ephyr_glamor_glx.c, without including any
* server headers.
*/
#include <xcb/xcb.h>
#include "dix-config.h"
struct ephyr_glamor;
struct pixman_region16;
xcb_connection_t *
ephyr_glamor_connect(void);
void
ephyr_glamor_set_texture(struct ephyr_glamor *ephyr_glamor, uint32_t tex);
xcb_visualtype_t *
ephyr_glamor_get_visual(void);
struct ephyr_glamor *
ephyr_glamor_glx_screen_init(xcb_window_t win);
void
ephyr_glamor_glx_screen_fini(struct ephyr_glamor *glamor);
#ifdef GLAMOR
void
ephyr_glamor_set_window_size(struct ephyr_glamor *glamor,
unsigned width, unsigned height);
void
ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
struct pixman_region16 *damage);
void
ephyr_glamor_process_event(xcb_generic_event_t *xev);
#else /* !GLAMOR */
static inline void
ephyr_glamor_set_window_size(struct ephyr_glamor *glamor,
unsigned width, unsigned height)
{
}
static inline void
ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
struct pixman_region16 *damage)
{
}
static inline void
ephyr_glamor_process_event(xcb_generic_event_t *xev)
{
}
#endif /* !GLAMOR */

View File

@ -1,161 +0,0 @@
/*
* Copyright © 2014 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "kdrive.h"
#include "kxv.h"
#include "ephyr.h"
#include "glamor_priv.h"
#include <X11/extensions/Xv.h>
#include "fourcc.h"
#define NUM_FORMATS 3
static KdVideoFormatRec Formats[NUM_FORMATS] = {
{15, TrueColor}, {16, TrueColor}, {24, TrueColor}
};
static void
ephyr_glamor_xv_stop_video(KdScreenInfo *screen, void *data, Bool cleanup)
{
if (!cleanup)
return;
glamor_xv_stop_video(data);
}
static int
ephyr_glamor_xv_set_port_attribute(KdScreenInfo *screen,
Atom attribute, INT32 value, void *data)
{
return glamor_xv_set_port_attribute(data, attribute, value);
}
static int
ephyr_glamor_xv_get_port_attribute(KdScreenInfo *screen,
Atom attribute, INT32 *value, void *data)
{
return glamor_xv_get_port_attribute(data, attribute, value);
}
static void
ephyr_glamor_xv_query_best_size(KdScreenInfo *screen,
Bool motion,
short vid_w, short vid_h,
short drw_w, short drw_h,
unsigned int *p_w, unsigned int *p_h,
void *data)
{
*p_w = drw_w;
*p_h = drw_h;
}
static int
ephyr_glamor_xv_query_image_attributes(KdScreenInfo *screen,
int id,
unsigned short *w, unsigned short *h,
int *pitches, int *offsets)
{
return glamor_xv_query_image_attributes(id, w, h, pitches, offsets);
}
static int
ephyr_glamor_xv_put_image(KdScreenInfo *screen,
DrawablePtr pDrawable,
short src_x, short src_y,
short drw_x, short drw_y,
short src_w, short src_h,
short drw_w, short drw_h,
int id,
unsigned char *buf,
short width,
short height,
Bool sync,
RegionPtr clipBoxes, void *data)
{
return glamor_xv_put_image(data, pDrawable,
src_x, src_y,
drw_x, drw_y,
src_w, src_h,
drw_w, drw_h,
id, buf, width, height, sync, clipBoxes);
}
void
ephyr_glamor_xv_init(ScreenPtr screen)
{
KdVideoAdaptorRec *adaptor;
glamor_port_private *port_privates;
KdVideoEncodingRec encoding = {
0,
"XV_IMAGE",
/* These sizes should probably be GL_MAX_TEXTURE_SIZE instead
* of 2048, but our context isn't set up yet.
*/
2048, 2048,
{1, 1}
};
int i;
glamor_xv_core_init(screen);
adaptor = xnfcalloc(1, sizeof(*adaptor));
adaptor->name = "glamor textured video";
adaptor->type = XvWindowMask | XvInputMask | XvImageMask;
adaptor->flags = 0;
adaptor->nEncodings = 1;
adaptor->pEncodings = &encoding;
adaptor->pFormats = Formats;
adaptor->nFormats = NUM_FORMATS;
adaptor->nPorts = 16; /* Some absurd number */
port_privates = xnfcalloc(adaptor->nPorts,
sizeof(glamor_port_private));
adaptor->pPortPrivates = xnfcalloc(adaptor->nPorts,
sizeof(glamor_port_private *));
for (i = 0; i < adaptor->nPorts; i++) {
adaptor->pPortPrivates[i].ptr = &port_privates[i];
glamor_xv_init_port(&port_privates[i]);
}
adaptor->pAttributes = glamor_xv_attributes;
adaptor->nAttributes = glamor_xv_num_attributes;
adaptor->pImages = glamor_xv_images;
adaptor->nImages = glamor_xv_num_images;
adaptor->StopVideo = ephyr_glamor_xv_stop_video;
adaptor->SetPortAttribute = ephyr_glamor_xv_set_port_attribute;
adaptor->GetPortAttribute = ephyr_glamor_xv_get_port_attribute;
adaptor->QueryBestSize = ephyr_glamor_xv_query_best_size;
adaptor->PutImage = ephyr_glamor_xv_put_image;
adaptor->QueryImageAttributes = ephyr_glamor_xv_query_image_attributes;
KdXVScreenInit(screen, adaptor, 1);
}

View File

@ -1,258 +0,0 @@
/*
* Copyright © 2014 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author:
* Adam Jackson <ajax@redhat.com>
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "ephyr.h"
#include "ephyrlog.h"
#include "hostx.h"
#include "cursorstr.h"
#include <xcb/render.h>
#include <xcb/xcb_renderutil.h>
static DevPrivateKeyRec ephyrCursorPrivateKey;
typedef struct _ephyrCursor {
xcb_cursor_t cursor;
} ephyrCursorRec, *ephyrCursorPtr;
static ephyrCursorPtr
ephyrGetCursor(CursorPtr cursor)
{
return dixGetPrivateAddr(&cursor->devPrivates, &ephyrCursorPrivateKey);
}
static void
ephyrRealizeCoreCursor(EphyrScrPriv *scr, CursorPtr cursor)
{
ephyrCursorPtr hw = ephyrGetCursor(cursor);
xcb_connection_t *conn = hostx_get_xcbconn();
xcb_pixmap_t source, mask;
xcb_image_t *image;
xcb_gcontext_t gc;
int w = cursor->bits->width, h = cursor->bits->height;
uint32_t gcmask = XCB_GC_FUNCTION |
XCB_GC_PLANE_MASK |
XCB_GC_FOREGROUND |
XCB_GC_BACKGROUND |
XCB_GC_CLIP_MASK;
uint32_t val[] = {
XCB_GX_COPY, /* function */
~0, /* planemask */
1L, /* foreground */
0L, /* background */
None, /* clipmask */
};
source = xcb_generate_id(conn);
mask = xcb_generate_id(conn);
xcb_create_pixmap(conn, 1, source, scr->win, w, h);
xcb_create_pixmap(conn, 1, mask, scr->win, w, h);
gc = xcb_generate_id(conn);
xcb_create_gc(conn, gc, source, gcmask, val);
image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_XY_BITMAP,
1, NULL, ~0, NULL);
image->data = cursor->bits->source;
xcb_image_put(conn, source, gc, image, 0, 0, 0);
xcb_image_destroy(image);
image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_XY_BITMAP,
1, NULL, ~0, NULL);
image->data = cursor->bits->mask;
xcb_image_put(conn, mask, gc, image, 0, 0, 0);
xcb_image_destroy(image);
xcb_free_gc(conn, gc);
hw->cursor = xcb_generate_id(conn);
xcb_create_cursor(conn, hw->cursor, source, mask,
cursor->foreRed, cursor->foreGreen, cursor->foreBlue,
cursor->backRed, cursor->backGreen, cursor->backBlue,
cursor->bits->xhot, cursor->bits->yhot);
xcb_free_pixmap(conn, source);
xcb_free_pixmap(conn, mask);
}
static xcb_render_pictformat_t
get_argb_format(void)
{
static xcb_render_pictformat_t format;
if (format == None) {
xcb_connection_t *conn = hostx_get_xcbconn();
xcb_render_query_pict_formats_cookie_t cookie;
xcb_render_query_pict_formats_reply_t *formats;
cookie = xcb_render_query_pict_formats(conn);
formats =
xcb_render_query_pict_formats_reply(conn, cookie, NULL);
format =
xcb_render_util_find_standard_format(formats,
XCB_PICT_STANDARD_ARGB_32)->id;
free(formats);
}
return format;
}
static void
ephyrRealizeARGBCursor(EphyrScrPriv *scr, CursorPtr cursor)
{
ephyrCursorPtr hw = ephyrGetCursor(cursor);
xcb_connection_t *conn = hostx_get_xcbconn();
xcb_gcontext_t gc;
xcb_pixmap_t source;
xcb_render_picture_t picture;
xcb_image_t *image;
int w = cursor->bits->width, h = cursor->bits->height;
/* dix' storage is PICT_a8r8g8b8 */
source = xcb_generate_id(conn);
xcb_create_pixmap(conn, 32, source, scr->win, w, h);
gc = xcb_generate_id(conn);
xcb_create_gc(conn, gc, source, 0, NULL);
image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
32, NULL, ~0, NULL);
image->data = (void *)cursor->bits->argb;
xcb_image_put(conn, source, gc, image, 0, 0, 0);
xcb_free_gc(conn, gc);
xcb_image_destroy(image);
picture = xcb_generate_id(conn);
xcb_render_create_picture(conn, picture, source, get_argb_format(),
0, NULL);
xcb_free_pixmap(conn, source);
hw->cursor = xcb_generate_id(conn);
xcb_render_create_cursor(conn, hw->cursor, picture,
cursor->bits->xhot, cursor->bits->yhot);
xcb_render_free_picture(conn, picture);
}
static Bool
can_argb_cursor(void)
{
static const xcb_render_query_version_reply_t *v;
if (!v)
v = xcb_render_util_query_version(hostx_get_xcbconn());
return v->major_version == 0 && v->minor_version >= 5;
}
static Bool
ephyrRealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor)
{
KdScreenPriv(screen);
KdScreenInfo *kscr = pScreenPriv->screen;
EphyrScrPriv *scr = kscr->driver;
if (cursor->bits->argb && can_argb_cursor())
ephyrRealizeARGBCursor(scr, cursor);
else
{
ephyrRealizeCoreCursor(scr, cursor);
}
return TRUE;
}
static Bool
ephyrUnrealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor)
{
ephyrCursorPtr hw = ephyrGetCursor(cursor);
if (hw->cursor) {
xcb_free_cursor(hostx_get_xcbconn(), hw->cursor);
hw->cursor = None;
}
return TRUE;
}
static void
ephyrSetCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor, int x,
int y)
{
KdScreenPriv(screen);
KdScreenInfo *kscr = pScreenPriv->screen;
EphyrScrPriv *scr = kscr->driver;
uint32_t attr = None;
if (cursor)
attr = ephyrGetCursor(cursor)->cursor;
else
attr = hostx_get_empty_cursor();
xcb_change_window_attributes(hostx_get_xcbconn(), scr->win,
XCB_CW_CURSOR, &attr);
xcb_flush(hostx_get_xcbconn());
}
static void
ephyrMoveCursor(DeviceIntPtr dev, ScreenPtr screen, int x, int y)
{
}
static Bool
ephyrDeviceCursorInitialize(DeviceIntPtr dev, ScreenPtr screen)
{
return TRUE;
}
static void
ephyrDeviceCursorCleanup(DeviceIntPtr dev, ScreenPtr screen)
{
}
miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
ephyrRealizeCursor,
ephyrUnrealizeCursor,
ephyrSetCursor,
ephyrMoveCursor,
ephyrDeviceCursorInitialize,
ephyrDeviceCursorCleanup
};
Bool
ephyrCursorInit(ScreenPtr screen)
{
if (!dixRegisterPrivateKey(&ephyrCursorPrivateKey, PRIVATE_CURSOR_BITS,
sizeof(ephyrCursorRec)))
return FALSE;
miPointerInitialize(screen,
&EphyrPointerSpriteFuncs,
&ephyrPointerScreenFuncs, FALSE);
return TRUE;
}

View File

@ -1,398 +0,0 @@
/*
* Xephyr - A kdrive X server that runs in a host X window.
* Authored by Matthew Allum <mallum@o-hand.com>
*
* Copyright © 2004 Nokia
*
* 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 Nokia not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Nokia makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL NOKIA 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "ephyr.h"
#include "ephyrlog.h"
#include "glx_extinit.h"
extern Window EphyrPreExistingHostWin;
extern Bool EphyrWantGrayScale;
extern Bool EphyrWantResize;
extern Bool EphyrWantNoHostGrab;
extern Bool kdHasPointer;
extern Bool kdHasKbd;
extern Bool ephyr_glamor, ephyr_glamor_gles2, ephyr_glamor_skip_present;
extern Bool ephyrNoXV;
void processScreenOrOutputArg(const char *screen_size, const char *output, char *parent_id);
void processOutputArg(const char *output, char *parent_id);
void processScreenArg(const char *screen_size, char *parent_id);
int
main(int argc, char *argv[], char *envp[])
{
hostx_use_resname(basename(argv[0]), 0);
return dix_main(argc, argv, envp);
}
void
InitCard(char *name)
{
EPHYR_DBG("mark");
KdCardInfoAdd(&ephyrFuncs, 0);
}
void
InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
{
KdInitOutput(pScreenInfo, argc, argv);
}
void
InitInput(int argc, char **argv)
{
KdKeyboardInfo *ki;
KdPointerInfo *pi;
if (!SeatId) {
KdAddKeyboardDriver(&EphyrKeyboardDriver);
KdAddPointerDriver(&EphyrMouseDriver);
if (!kdHasKbd) {
ki = KdNewKeyboard();
if (!ki)
FatalError("Couldn't create Xephyr keyboard\n");
ki->driver = &EphyrKeyboardDriver;
KdAddKeyboard(ki);
}
if (!kdHasPointer) {
pi = KdNewPointer();
if (!pi)
FatalError("Couldn't create Xephyr pointer\n");
pi->driver = &EphyrMouseDriver;
KdAddPointer(pi);
}
}
KdInitInput();
}
void
CloseInput(void)
{
KdCloseInput();
}
#if INPUTTHREAD
/** This function is called in Xserver/os/inputthread.c when starting
the input thread. */
void
ddxInputThreadInit(void)
{
}
#endif
#ifdef DDXBEFORERESET
void
ddxBeforeReset(void)
{
}
#endif
void
ddxUseMsg(void)
{
KdUseMsg();
ErrorF("\nXephyr Option Usage:\n");
ErrorF("-parent <XID> Use existing window as Xephyr root win\n");
ErrorF("-sw-cursor Render cursors in software in Xephyr\n");
ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
ErrorF("-output <NAME> Attempt to run Xephyr fullscreen (restricted to given output geometry)\n");
ErrorF("-grayscale Simulate 8bit grayscale\n");
ErrorF("-resizeable Make Xephyr windows resizeable\n");
#ifdef GLAMOR
ErrorF("-glamor Enable 2D acceleration using glamor\n");
ErrorF("-glamor_gles2 Enable 2D acceleration using glamor (with GLES2 only)\n");
ErrorF("-glamor-skip-present Skip presenting the output when using glamor (for internal testing optimization)\n");
#endif
ErrorF
("-fakexa Simulate acceleration using software rendering\n");
ErrorF("-verbosity <level> Set log verbosity level\n");
ErrorF("-noxv do not use XV\n");
ErrorF("-name [name] define the name in the WM_CLASS property\n");
ErrorF
("-title [title] set the window title in the WM_NAME property\n");
ErrorF("-no-host-grab Disable grabbing the keyboard and mouse.\n");
ErrorF("\n");
}
void
processScreenOrOutputArg(const char *screen_size, const char *output, char *parent_id)
{
KdCardInfo *card;
InitCard(0); /*Put each screen on a separate card */
card = KdCardInfoLast();
if (card) {
KdScreenInfo *screen;
unsigned long p_id = 0;
Bool use_geometry;
screen = KdScreenInfoAdd(card);
KdParseScreen(screen, screen_size);
screen->driver = calloc(1, sizeof(EphyrScrPriv));
if (!screen->driver)
FatalError("Couldn't alloc screen private\n");
if (parent_id) {
p_id = strtol(parent_id, NULL, 0);
}
use_geometry = (strchr(screen_size, '+') != NULL);
EPHYR_DBG("screen number:%d\n", screen->mynum);
hostx_add_screen(screen, p_id, screen->mynum, use_geometry, output);
}
else {
ErrorF("No matching card found!\n");
}
}
void
processScreenArg(const char *screen_size, char *parent_id)
{
processScreenOrOutputArg(screen_size, NULL, parent_id);
}
void
processOutputArg(const char *output, char *parent_id)
{
processScreenOrOutputArg("100x100+0+0", output, parent_id);
}
int
ddxProcessArgument(int argc, char **argv, int i)
{
static char *parent = NULL;
EPHYR_DBG("mark argv[%d]='%s'", i, argv[i]);
if (!strcmp(argv[i], "-parent")) {
if (i + 1 < argc) {
int j;
/* If parent is specified and a screen argument follows, don't do
* anything, let the -screen handling init the rest */
for (j = i; j < argc; j++) {
if (!strcmp(argv[j], "-screen")) {
parent = argv[i + 1];
return 2;
}
}
processScreenArg("100x100", argv[i + 1]);
return 2;
}
UseMsg();
exit(1);
}
else if (!strcmp(argv[i], "-screen")) {
if ((i + 1) < argc) {
processScreenArg(argv[i + 1], parent);
parent = NULL;
return 2;
}
UseMsg();
exit(1);
}
else if (!strcmp(argv[i], "-output")) {
if (i + 1 < argc) {
processOutputArg(argv[i + 1], NULL);
return 2;
}
UseMsg();
exit(1);
}
else if (!strcmp(argv[i], "-sw-cursor")) {
hostx_use_sw_cursor();
return 1;
}
else if (!strcmp(argv[i], "-host-cursor")) {
/* Compatibility with the old command line argument, now the default. */
return 1;
}
else if (!strcmp(argv[i], "-fullscreen")) {
hostx_use_fullscreen();
return 1;
}
else if (!strcmp(argv[i], "-grayscale")) {
EphyrWantGrayScale = 1;
return 1;
}
else if (!strcmp(argv[i], "-resizeable")) {
EphyrWantResize = 1;
return 1;
}
#ifdef GLAMOR
else if (!strcmp (argv[i], "-glamor")) {
ephyr_glamor = TRUE;
ephyrFuncs.initAccel = ephyr_glamor_init;
ephyrFuncs.enableAccel = ephyr_glamor_enable;
ephyrFuncs.disableAccel = ephyr_glamor_disable;
ephyrFuncs.finiAccel = ephyr_glamor_fini;
return 1;
}
else if (!strcmp (argv[i], "-glamor_gles2")) {
ephyr_glamor = TRUE;
ephyr_glamor_gles2 = TRUE;
ephyrFuncs.initAccel = ephyr_glamor_init;
ephyrFuncs.enableAccel = ephyr_glamor_enable;
ephyrFuncs.disableAccel = ephyr_glamor_disable;
ephyrFuncs.finiAccel = ephyr_glamor_fini;
return 1;
}
else if (!strcmp (argv[i], "-glamor-skip-present")) {
ephyr_glamor_skip_present = TRUE;
return 1;
}
#endif
else if (!strcmp(argv[i], "-fakexa")) {
ephyrFuncs.initAccel = ephyrDrawInit;
ephyrFuncs.enableAccel = ephyrDrawEnable;
ephyrFuncs.disableAccel = ephyrDrawDisable;
ephyrFuncs.finiAccel = ephyrDrawFini;
return 1;
}
else if (!strcmp(argv[i], "-verbosity")) {
if (i + 1 < argc && argv[i + 1][0] != '-') {
int verbosity = atoi(argv[i + 1]);
LogSetParameter(XLOG_VERBOSITY, verbosity);
EPHYR_LOG("set verbosiry to %d\n", verbosity);
return 2;
}
else {
UseMsg();
exit(1);
}
}
else if (!strcmp(argv[i], "-noxv")) {
ephyrNoXV = TRUE;
EPHYR_LOG("no XVideo enabled\n");
return 1;
}
else if (!strcmp(argv[i], "-name")) {
if (i + 1 < argc && argv[i + 1][0] != '-') {
hostx_use_resname(argv[i + 1], 1);
return 2;
}
else {
UseMsg();
return 0;
}
}
else if (!strcmp(argv[i], "-title")) {
if (i + 1 < argc && argv[i + 1][0] != '-') {
hostx_set_title(argv[i + 1]);
return 2;
}
else {
UseMsg();
return 0;
}
}
else if (argv[i][0] == ':') {
hostx_set_display_name(argv[i]);
}
/* Xnest compatibility */
else if (!strcmp(argv[i], "-display")) {
hostx_set_display_name(argv[i + 1]);
return 2;
}
else if (!strcmp(argv[i], "-sync") ||
!strcmp(argv[i], "-full") ||
!strcmp(argv[i], "-sss") || !strcmp(argv[i], "-install")) {
return 1;
}
else if (!strcmp(argv[i], "-bw") ||
!strcmp(argv[i], "-class") ||
!strcmp(argv[i], "-geometry") || !strcmp(argv[i], "-scrns")) {
return 2;
}
/* end Xnest compat */
else if (!strcmp(argv[i], "-no-host-grab")) {
EphyrWantNoHostGrab = 1;
return 1;
}
else if (!strcmp(argv[i], "-sharevts") ||
!strcmp(argv[i], "-novtswitch")) {
return 1;
}
else if (!strcmp(argv[i], "-layout")) {
return 2;
}
return KdProcessArgument(argc, argv, i);
}
void
OsVendorInit(void)
{
EPHYR_DBG("mark");
if (SeatId)
hostx_use_sw_cursor();
if (hostx_want_host_cursor())
ephyrFuncs.initCursor = &ephyrCursorInit;
if (serverGeneration == 1) {
if (!KdCardInfoLast()) {
processScreenArg("640x480", NULL);
}
hostx_init();
}
}
KdCardFuncs ephyrFuncs = {
ephyrCardInit, /* cardinit */
ephyrScreenInitialize, /* scrinit */
ephyrInitScreen, /* initScreen */
ephyrFinishInitScreen, /* finishInitScreen */
ephyrCreateResources, /* createRes */
ephyrScreenFini, /* scrfini */
ephyrCardFini, /* cardfini */
0, /* initCursor */
0, /* initAccel */
0, /* enableAccel */
0, /* disableAccel */
0, /* finiAccel */
ephyrGetColors, /* getColors */
ephyrPutColors, /* putColors */
ephyrCloseScreen, /* closeScreen */
};

View File

@ -1,67 +0,0 @@
/*
* Xephyr - A kdrive X server that runs in a host X window.
* Authored by Matthew Allum <mallum@openedhand.com>
*
* Copyright © 2007 OpenedHand Ltd
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of OpenedHand Ltd not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. OpenedHand Ltd makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* Authors:
* Dodji Seketeli <dodji@openedhand.com>
*/
#ifndef __EPHYRLOG_H__
#define __EPHYRLOG_H__
#include <assert.h>
#include "os.h"
#ifndef DEBUG
/*we are not in debug mode*/
#define EPHYR_LOG(...)
#define EPHYR_LOG_ERROR(...)
#endif /*!DEBUG */
#define ERROR_LOG_LEVEL 3
#define INFO_LOG_LEVEL 4
#ifndef EPHYR_LOG
#define EPHYR_LOG(...) \
LogMessageVerb(X_NOTICE, INFO_LOG_LEVEL, "in %s:%d:%s: ",\
__FILE__, __LINE__, __func__) ; \
LogMessageVerb(X_NOTICE, INFO_LOG_LEVEL, __VA_ARGS__)
#endif /*nomadik_log */
#ifndef EPHYR_LOG_ERROR
#define EPHYR_LOG_ERROR(...) \
LogMessageVerb(X_NOTICE, ERROR_LOG_LEVEL, "Error:in %s:%d:%s: ",\
__FILE__, __LINE__, __func__) ; \
LogMessageVerb(X_NOTICE, ERROR_LOG_LEVEL, __VA_ARGS__)
#endif /*EPHYR_LOG_ERROR */
#ifndef EPHYR_RETURN_IF_FAIL
#define EPHYR_RETURN_IF_FAIL(cond) \
if (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return;}
#endif /*nomadik_return_if_fail */
#ifndef EPHYR_RETURN_VAL_IF_FAIL
#define EPHYR_RETURN_VAL_IF_FAIL(cond,val) \
if (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return val;}
#endif /*nomadik_return_val_if_fail */
#endif /*__EPHYRLOG_H__*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,193 +0,0 @@
/*
* Xephyr - A kdrive X server that runs in a host X window.
* Authored by Matthew Allum <mallum@o-hand.com>
*
* Copyright © 2004 Nokia
*
* 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 Nokia not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Nokia makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL NOKIA 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.
*/
#ifndef _XLIBS_STUFF_H_
#define _XLIBS_STUFF_H_
#include <X11/X.h>
#include <X11/Xmd.h>
#include <xcb/xcb.h>
#include <xcb/render.h>
#include "ephyr.h"
#define EPHYR_WANT_DEBUG 0
#if (EPHYR_WANT_DEBUG)
#define EPHYR_DBG(x, a...) \
fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a)
#else
#define EPHYR_DBG(x, a...) do {} while (0)
#endif
typedef struct EphyrHostXVars EphyrHostXVars;
typedef struct {
VisualID visualid;
int screen;
int depth;
int class;
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
int colormap_size;
int bits_per_rgb;
} EphyrHostVisualInfo;
typedef struct {
int x, y;
int width, height;
int visualid;
} EphyrHostWindowAttributes;
typedef struct {
int x, y, width, height;
} EphyrBox;
typedef struct {
short x1, y1, x2, y2;
} EphyrRect;
int
hostx_want_screen_geometry(KdScreenInfo *screen, int *width, int *height, int *x, int *y);
int
hostx_want_host_cursor(void);
void
hostx_use_sw_cursor(void);
xcb_cursor_t
hostx_get_empty_cursor(void);
void
hostx_get_output_geometry(const char *output,
int *x, int *y,
int *width, int *height);
void
hostx_use_fullscreen(void);
int
hostx_want_fullscreen(void);
int
hostx_want_preexisting_window(KdScreenInfo *screen);
void
hostx_use_preexisting_window(unsigned long win_id);
void
hostx_use_resname(char *name, int fromcmd);
void
hostx_set_title(char *name);
void
hostx_handle_signal(int signum);
int
hostx_init(void);
void
hostx_add_screen(KdScreenInfo *screen, unsigned long win_id, int screen_num, Bool use_geometry, const char *output);
void
hostx_set_display_name(char *name);
void
hostx_set_screen_number(KdScreenInfo *screen, int number);
void
hostx_set_win_title(KdScreenInfo *screen, const char *extra_text);
int
hostx_get_depth(void);
int
hostx_get_server_depth(KdScreenInfo *screen);
int
hostx_get_bpp(KdScreenInfo *screen);
void
hostx_get_visual_masks(KdScreenInfo *screen,
CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk);
void
hostx_set_cmap_entry(ScreenPtr pScreen, unsigned char idx,
unsigned char r, unsigned char g, unsigned char b);
void *hostx_screen_init(KdScreenInfo *screen,
int x, int y,
int width, int height, int buffer_height,
int *bytes_per_line, int *bits_per_pixel);
void
hostx_paint_rect(KdScreenInfo *screen,
int sx, int sy, int dx, int dy, int width, int height);
Bool
hostx_load_keymap(KeySymsPtr keySyms, CARD8 *modmap, XkbControlsPtr controls);
void
hostx_size_set_from_configure(Bool);
xcb_connection_t *
hostx_get_xcbconn(void);
xcb_generic_event_t *
hostx_get_event(Bool queued_only);
Bool
hostx_has_queued_event(void);
int
hostx_get_screen(void);
int
hostx_get_window(int a_screen_number);
int
hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attr);
int
hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries);
int hostx_create_window(int a_screen_number,
EphyrBox * a_geometry,
int a_visual_id, int *a_host_win /*out parameter */ );
int hostx_destroy_window(int a_win);
int hostx_set_window_geometry(int a_win, EphyrBox * a_geo);
int hostx_set_window_bounding_rectangles(int a_window,
EphyrRect * a_rects, int a_num_rects);
int hostx_has_extension(xcb_extension_t *extension);
int hostx_get_fd(void);
#endif /*_XLIBS_STUFF_H_*/

View File

@ -1,96 +0,0 @@
.\"
.\" Copyright (c) Matthieu Herrb <matthieu@herrb.eu>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, 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.
.\"
.TH Xephyr @appmansuffix@ @vendorversion@
.SH NAME
Xephyr - X server outputting to a window on a pre-existing X display
.SH SYNOPSIS
.B Xephyr
.RI [\fB:\fP display ]
.RI [ option
.IR ... ]
.SH DESCRIPTION
.B Xephyr
is a kdrive server that outputs to a window on a pre-existing "host"
X display.
Think
.I Xnest
but with support for modern extensions like composite, damage and randr.
.PP
Unlike
.I Xnest
which is an X proxy, i.e. limited to the capabilities of the host X server,
.B Xephyr
is a real X server which
uses the host X server window as "framebuffer" via fast SHM XImages.
.PP
It also has support for "visually" debugging what the server is
painting.
.SH OPTIONS
The server accepts all the standard options of Xserver(@appmansuffix@)
and the following additional options:
.TP 8
.BI -screen " width" x height
sets the screen size.
.TP 8
.BI -parent " id"
uses existing window
.I id .
If a
.BI -screen
argument follows a
.BI -parent
argument, this screen is embedded into the given window.
.TP 8
.B -host-cursor
set 'cursor acceleration':
The host's cursor is reused. This is only really there to aid
debugging by avoiding server paints for the cursor. Performance
improvement is negligible.
.TP 8
.B -resizeable
Allow the Xephyr window to be resized, even if not embedded into a parent
window. By default, the Xephyr window has a fixed size.
.TP 8
.B -no-host-grab
Disable grabbing the keyboard and mouse.
.SH "SIGNALS"
Send a SIGUSR1 to the server (e.g. pkill -USR1 Xephyr) to
toggle the debugging mode.
In this mode red rectangles are painted to
screen areas getting painted before painting the actual content.
The
delay between this can be altered by setting a XEPHYR_PAUSE env var to
a value in micro seconds.
.SH CAVEATS
.PP
.IP \(bu 2
Rotated displays are currently updated via full blits. This
is slower than a normal orientated display. Debug mode will
therefore not be of much use rotated.
.IP \(bu 2
The '-host-cursor' cursor is static in its appearance.
.IP \(bu 2
The build gets a warning about 'nanosleep'. I think the various '-D'
build flags are causing this. I haven't figured as yet how to work
round it. It doesn't appear to break anything however.
.IP \(bu 2
Keyboard handling is basic but works.
.IP \(bu 2
Mouse button 5 probably won't work.
.SH "SEE ALSO"
X(@miscmansuffix@), Xserver(@appmansuffix@)
.SH AUTHOR
Matthew Allum <mallum@o-hand.com> 2004

View File

@ -1,70 +0,0 @@
srcs = [
'ephyr.c',
'ephyrinit.c',
'ephyrcursor.c',
'ephyr_draw.c',
'hostx.c',
]
xephyr_dep = [
common_dep,
dependency('xcb'),
dependency('xcb-shape'),
dependency('xcb-render'),
dependency('xcb-renderutil'),
dependency('xcb-aux'),
dependency('xcb-image'),
dependency('xcb-icccm'),
dependency('xcb-shm', version : '>=1.9.3'),
dependency('xcb-keysyms'),
dependency('xcb-randr'),
dependency('xcb-xkb'),
]
xephyr_glamor = []
if build_glamor
srcs += 'ephyr_glamor_glx.c'
if build_xv
srcs += 'ephyr_glamor_xv.c'
endif
xephyr_glamor += glamor
xephyr_glamor += glamor_egl_stubs
xephyr_dep += dependency('x11-xcb')
xephyr_dep += epoxy_dep
endif
if build_xv
srcs += 'ephyrvideo.c'
xephyr_dep += dependency('xcb-xv')
endif
xephyr_server = executable(
'Xephyr',
srcs,
include_directories: [
inc,
include_directories('../src')
],
dependencies: xephyr_dep,
link_with: [
libxserver_main,
libxserver_exa,
xephyr_glamor,
kdrive,
libxserver_fb,
libxserver,
libxserver_config,
libxserver_xkb_stubs,
libxserver_xi_stubs,
libxserver_glx,
libglxvnd,
],
install: true,
)
xephyr_man = configure_file(
input: 'man/Xephyr.man',
output: 'Xephyr.1',
configuration: manpage_config,
)
install_man(xephyr_man)

View File

@ -1,2 +0,0 @@
subdir('src')
subdir('ephyr')

View File

@ -1,234 +0,0 @@
/*
* Copyright © 1999 Keith Packard
*
* 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 Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "kdrive.h"
/*
* Put the entire colormap into the DAC
*/
static void
KdSetColormap(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ColormapPtr pCmap = pScreenPriv->pInstalledmap;
Pixel pixels[KD_MAX_PSEUDO_SIZE];
xrgb colors[KD_MAX_PSEUDO_SIZE];
xColorItem defs[KD_MAX_PSEUDO_SIZE];
int i;
if (!pScreenPriv->card->cfuncs->putColors)
return;
if (pScreenPriv->screen->fb.depth > KD_MAX_PSEUDO_DEPTH)
return;
if (!pScreenPriv->enabled)
return;
if (!pCmap)
return;
/*
* Make DIX convert pixels into RGB values -- this handles
* true/direct as well as pseudo/static visuals
*/
for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
pixels[i] = i;
QueryColors(pCmap, (1 << pScreenPriv->screen->fb.depth), pixels, colors,
serverClient);
for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++) {
defs[i].pixel = i;
defs[i].red = colors[i].red;
defs[i].green = colors[i].green;
defs[i].blue = colors[i].blue;
defs[i].flags = DoRed | DoGreen | DoBlue;
}
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen,
(1 << pScreenPriv->screen->fb.
depth), defs);
}
/*
* When the hardware is enabled, save the hardware colors and store
* the current colormap
*/
void
KdEnableColormap(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
int i;
if (!pScreenPriv->card->cfuncs->putColors)
return;
if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH) {
for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
pScreenPriv->systemPalette[i].pixel = i;
(*pScreenPriv->card->cfuncs->getColors) (pScreen,
(1 << pScreenPriv->screen->fb.
depth),
pScreenPriv->systemPalette);
}
KdSetColormap(pScreen);
}
void
KdDisableColormap(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
if (!pScreenPriv->card->cfuncs->putColors)
return;
if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH) {
(*pScreenPriv->card->cfuncs->putColors) (pScreen,
(1 << pScreenPriv->screen->fb.
depth),
pScreenPriv->systemPalette);
}
}
/*
* KdInstallColormap
*
* This function is called when the server receives a request to install a
* colormap or when the server needs to install one on its own, like when
* there's no window manager running and the user has moved the pointer over
* an X client window. It needs to build an identity Windows palette for the
* colormap and realize it into the Windows system palette.
*/
void
KdInstallColormap(ColormapPtr pCmap)
{
KdScreenPriv(pCmap->pScreen);
if (pCmap == pScreenPriv->pInstalledmap)
return;
/* Tell X clients that the installed colormap is going away. */
if (pScreenPriv->pInstalledmap)
WalkTree(pScreenPriv->pInstalledmap->pScreen, TellLostMap,
(void *) &(pScreenPriv->pInstalledmap->mid));
/* Take note of the new installed colorscreen-> */
pScreenPriv->pInstalledmap = pCmap;
KdSetColormap(pCmap->pScreen);
/* Tell X clients of the new colormap */
WalkTree(pCmap->pScreen, TellGainedMap, (void *) &(pCmap->mid));
}
/*
* KdUninstallColormap
*
* This function uninstalls a colormap by either installing
* the default X colormap or erasing the installed colormap pointer.
* The default X colormap itself cannot be uninstalled.
*/
void
KdUninstallColormap(ColormapPtr pCmap)
{
KdScreenPriv(pCmap->pScreen);
Colormap defMapID;
ColormapPtr defMap;
/* ignore if not installed */
if (pCmap != pScreenPriv->pInstalledmap)
return;
/* ignore attempts to uninstall default colormap */
defMapID = pCmap->pScreen->defColormap;
if ((Colormap) pCmap->mid == defMapID)
return;
/* install default */
dixLookupResourceByType((void **) &defMap, defMapID, RT_COLORMAP,
serverClient, DixInstallAccess);
if (defMap)
(*pCmap->pScreen->InstallColormap) (defMap);
else {
/* uninstall and clear colormap pointer */
WalkTree(pCmap->pScreen, TellLostMap, (void *) &(pCmap->mid));
pScreenPriv->pInstalledmap = 0;
}
}
int
KdListInstalledColormaps(ScreenPtr pScreen, Colormap * pCmaps)
{
KdScreenPriv(pScreen);
int n = 0;
if (pScreenPriv->pInstalledmap) {
*pCmaps++ = pScreenPriv->pInstalledmap->mid;
n++;
}
return n;
}
/*
* KdStoreColors
*
* This function is called whenever the server receives a request to store
* color values into one or more entries in the currently installed X
* colormap; it can be either the default colormap or a private colorscreen->
*/
void
KdStoreColors(ColormapPtr pCmap, int ndef, xColorItem * pdefs)
{
KdScreenPriv(pCmap->pScreen);
VisualPtr pVisual;
xColorItem expanddefs[KD_MAX_PSEUDO_SIZE];
if (pCmap != pScreenPriv->pInstalledmap)
return;
if (!pScreenPriv->card->cfuncs->putColors)
return;
if (pScreenPriv->screen->fb.depth > KD_MAX_PSEUDO_DEPTH)
return;
if (!pScreenPriv->enabled)
return;
/* Check for DirectColor or TrueColor being simulated on a PseudoColor device. */
pVisual = pCmap->pVisual;
if ((pVisual->class | DynamicClass) == DirectColor) {
/*
* Expand DirectColor or TrueColor color values into a PseudoColor
* format. Defer to the Color Framebuffer (CFB) code to do that.
*/
ndef = fbExpandDirectColors(pCmap, ndef, pdefs, expanddefs);
pdefs = expanddefs;
}
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, ndef, pdefs);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,438 +0,0 @@
/*
* Copyright © 1999 Keith Packard
*
* 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 Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
#ifndef _KDRIVE_H_
#define _KDRIVE_H_
#include <stdio.h>
#include <string.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xos.h>
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "windowstr.h"
#include "servermd.h"
#include "colormapst.h"
#include "gcstruct.h"
#include "input.h"
#include "mipointer.h"
#include "mi.h"
#include "dix.h"
#include "fb.h"
#include "fboverlay.h"
#include "shadow.h"
#include "randrstr.h"
#include "globals.h"
#include "xkbstr.h"
#define KD_DPMS_NORMAL 0
#define KD_DPMS_STANDBY 1
#define KD_DPMS_SUSPEND 2
#define KD_DPMS_POWERDOWN 3
#define KD_DPMS_MAX KD_DPMS_POWERDOWN
#define Status int
typedef struct _KdCardInfo {
struct _KdCardFuncs *cfuncs;
void *closure;
void *driver;
struct _KdScreenInfo *screenList;
int selected;
struct _KdCardInfo *next;
} KdCardInfo;
extern KdCardInfo *kdCardInfo;
/*
* Configuration information per X screen
*/
typedef struct _KdFrameBuffer {
CARD8 *frameBuffer;
int depth;
int bitsPerPixel;
int pixelStride;
int byteStride;
Bool shadow;
unsigned long visuals;
Pixel redMask, greenMask, blueMask;
void *closure;
} KdFrameBuffer;
#define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
#define RR_Reflect_All (RR_Reflect_X|RR_Reflect_Y)
typedef struct _KdScreenInfo {
struct _KdScreenInfo *next;
KdCardInfo *card;
ScreenPtr pScreen;
void *driver;
Rotation randr; /* rotation and reflection */
int x;
int y;
int width;
int height;
int rate;
int width_mm;
int height_mm;
int subpixel_order;
Bool dumb;
Bool softCursor;
int mynum;
DDXPointRec origin;
KdFrameBuffer fb;
} KdScreenInfo;
typedef struct _KdCardFuncs {
Bool (*cardinit) (KdCardInfo *); /* detect and map device */
Bool (*scrinit) (KdScreenInfo *); /* initialize screen information */
Bool (*initScreen) (ScreenPtr); /* initialize ScreenRec */
Bool (*finishInitScreen) (ScreenPtr pScreen);
Bool (*createRes) (ScreenPtr); /* create screen resources */
void (*scrfini) (KdScreenInfo *); /* close down screen */
void (*cardfini) (KdCardInfo *); /* close down */
Bool (*initCursor) (ScreenPtr); /* detect and map cursor */
Bool (*initAccel) (ScreenPtr);
void (*enableAccel) (ScreenPtr);
void (*disableAccel) (ScreenPtr);
void (*finiAccel) (ScreenPtr);
void (*getColors) (ScreenPtr, int, xColorItem *);
void (*putColors) (ScreenPtr, int, xColorItem *);
void (*closeScreen) (ScreenPtr); /* close ScreenRec */
} KdCardFuncs;
#define KD_MAX_PSEUDO_DEPTH 8
#define KD_MAX_PSEUDO_SIZE (1 << KD_MAX_PSEUDO_DEPTH)
typedef struct {
KdScreenInfo *screen;
KdCardInfo *card;
Bool enabled;
Bool closed;
int bytesPerPixel;
int dpmsState;
ColormapPtr pInstalledmap; /* current colormap */
xColorItem systemPalette[KD_MAX_PSEUDO_SIZE]; /* saved windows colors */
CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen;
} KdPrivScreenRec, *KdPrivScreenPtr;
typedef enum _kdPointerState {
start,
button_1_pend,
button_1_down,
button_2_down,
button_3_pend,
button_3_down,
synth_2_down_13,
synth_2_down_3,
synth_2_down_1,
num_input_states
} KdPointerState;
#define KD_MAX_BUTTON 32
#define KD_KEYBOARD 1
#define KD_MOUSE 2
#define KD_TOUCHSCREEN 3
typedef struct _KdPointerInfo KdPointerInfo;
typedef struct _KdPointerDriver {
const char *name;
Status(*Init) (KdPointerInfo *);
Status(*Enable) (KdPointerInfo *);
void (*Disable) (KdPointerInfo *);
void (*Fini) (KdPointerInfo *);
struct _KdPointerDriver *next;
} KdPointerDriver;
struct _KdPointerInfo {
DeviceIntPtr dixdev;
char *name;
char *path;
char *protocol;
InputOption *options;
int inputClass;
CARD8 map[KD_MAX_BUTTON + 1];
int nButtons;
int nAxes;
Bool emulateMiddleButton;
unsigned long emulationTimeout;
int emulationDx, emulationDy;
Bool timeoutPending;
KdPointerState mouseState;
Bool eventHeld;
struct {
int type;
int x;
int y;
int z;
int flags;
int absrel;
} heldEvent;
unsigned char buttonState;
Bool transformCoordinates;
int pressureThreshold;
KdPointerDriver *driver;
void *driverPrivate;
struct _KdPointerInfo *next;
};
void KdAddPointerDriver(KdPointerDriver * driver);
void KdRemovePointerDriver(KdPointerDriver * driver);
KdPointerInfo *KdNewPointer(void);
void KdFreePointer(KdPointerInfo *);
int KdAddPointer(KdPointerInfo * ki);
int KdAddConfigPointer(char *pointer);
void KdRemovePointer(KdPointerInfo * ki);
#define KD_KEY_COUNT 248
#define KD_MIN_KEYCODE 8
#define KD_MAX_KEYCODE 255
#define KD_MAX_WIDTH 4
#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1)
typedef struct {
KeySym modsym;
int modbit;
} KdKeySymModsRec;
typedef struct _KdKeyboardInfo KdKeyboardInfo;
typedef struct _KdKeyboardDriver {
const char *name;
Bool (*Init) (KdKeyboardInfo *);
Bool (*Enable) (KdKeyboardInfo *);
void (*Leds) (KdKeyboardInfo *, int);
void (*Bell) (KdKeyboardInfo *, int, int, int);
void (*Disable) (KdKeyboardInfo *);
void (*Fini) (KdKeyboardInfo *);
struct _KdKeyboardDriver *next;
} KdKeyboardDriver;
struct _KdKeyboardInfo {
struct _KdKeyboardInfo *next;
DeviceIntPtr dixdev;
void *closure;
char *name;
char *path;
int inputClass;
char *xkbRules;
char *xkbModel;
char *xkbLayout;
char *xkbVariant;
char *xkbOptions;
int LockLed;
int minScanCode;
int maxScanCode;
int leds;
int bellPitch;
int bellDuration;
InputOption *options;
KdKeyboardDriver *driver;
void *driverPrivate;
};
void KdAddKeyboardDriver(KdKeyboardDriver * driver);
void KdRemoveKeyboardDriver(KdKeyboardDriver * driver);
KdKeyboardInfo *KdNewKeyboard(void);
void KdFreeKeyboard(KdKeyboardInfo * ki);
int KdAddConfigKeyboard(char *pointer);
int KdAddKeyboard(KdKeyboardInfo * ki);
void KdRemoveKeyboard(KdKeyboardInfo * ki);
typedef struct _KdPointerMatrix {
int matrix[2][3];
} KdPointerMatrix;
extern DevPrivateKeyRec kdScreenPrivateKeyRec;
#define kdScreenPrivateKey (&kdScreenPrivateKeyRec)
extern Bool kdEmulateMiddleButton;
extern Bool kdDisableZaphod;
#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey))
#define KdSetScreenPriv(pScreen,v) \
dixSetPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey, v)
#define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen)
/* kcmap.c */
void
KdEnableColormap(ScreenPtr pScreen);
void
KdDisableColormap(ScreenPtr pScreen);
void
KdInstallColormap(ColormapPtr pCmap);
void
KdUninstallColormap(ColormapPtr pCmap);
int
KdListInstalledColormaps(ScreenPtr pScreen, Colormap * pCmaps);
void
KdStoreColors(ColormapPtr pCmap, int ndef, xColorItem * pdefs);
/* kdrive.c */
extern miPointerScreenFuncRec kdPointerScreenFuncs;
void
KdDisableScreen(ScreenPtr pScreen);
Bool
KdEnableScreen(ScreenPtr pScreen);
void
KdEnableScreens(void);
void
KdProcessSwitch(void);
Rotation KdAddRotation(Rotation a, Rotation b);
Rotation KdSubRotation(Rotation a, Rotation b);
void
KdParseScreen(KdScreenInfo * screen, const char *arg);
const char *
KdParseFindNext(const char *cur, const char *delim, char *save, char *last);
void
KdUseMsg(void);
int
KdProcessArgument(int argc, char **argv, int i);
void
KdOsAddInputDrivers(void);
void
KdInitCard(ScreenInfo * pScreenInfo, KdCardInfo * card, int argc, char **argv);
void
KdInitOutput(ScreenInfo * pScreenInfo, int argc, char **argv);
void
KdSetSubpixelOrder(ScreenPtr pScreen, Rotation randr);
void
KdBacktrace(int signum);
/* kinfo.c */
KdCardInfo *KdCardInfoAdd(KdCardFuncs * funcs, void *closure);
KdCardInfo *KdCardInfoLast(void);
void
KdCardInfoDispose(KdCardInfo * ci);
KdScreenInfo *KdScreenInfoAdd(KdCardInfo * ci);
void
KdScreenInfoDispose(KdScreenInfo * si);
/* kinput.c */
void
KdInitInput(void);
void
KdCloseInput(void);
void
KdEnqueueKeyboardEvent(KdKeyboardInfo * ki, unsigned char scan_code,
unsigned char is_up);
#define KD_BUTTON_1 0x01
#define KD_BUTTON_2 0x02
#define KD_BUTTON_3 0x04
#define KD_BUTTON_4 0x08
#define KD_BUTTON_5 0x10
#define KD_BUTTON_8 0x80
#define KD_POINTER_DESKTOP 0x40000000
#define KD_MOUSE_DELTA 0x80000000
void
KdEnqueuePointerEvent(KdPointerInfo * pi, unsigned long flags, int rx, int ry,
int rz);
void
KdSetPointerMatrix(KdPointerMatrix *pointer);
void
KdComputePointerMatrix(KdPointerMatrix *pointer, Rotation randr, int width,
int height);
void
KdBlockHandler(ScreenPtr pScreen, void *timeout);
void
KdWakeupHandler(ScreenPtr pScreen, int result);
void
KdDisableInput(void);
void
KdEnableInput(void);
/* kshadow.c */
Bool
KdShadowFbAlloc(KdScreenInfo * screen, Bool rotate);
void
KdShadowFbFree(KdScreenInfo * screen);
Bool
KdShadowSet(ScreenPtr pScreen, int randr, ShadowUpdateProc update,
ShadowWindowProc window);
void
KdShadowUnset(ScreenPtr pScreen);
/* function prototypes to be implemented by the drivers */
void
InitCard(char *name);
#endif /* _KDRIVE_H_ */

View File

@ -1,154 +0,0 @@
/*
* Copyright © 1999 Keith Packard
*
* 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 Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "kdrive.h"
KdCardInfo *kdCardInfo;
KdCardInfo *
KdCardInfoAdd(KdCardFuncs * funcs, void *closure)
{
KdCardInfo *ci, **prev;
ci = calloc(1, sizeof(KdCardInfo));
if (!ci)
return 0;
for (prev = &kdCardInfo; *prev; prev = &(*prev)->next);
*prev = ci;
ci->cfuncs = funcs;
ci->closure = closure;
ci->screenList = 0;
ci->selected = 0;
ci->next = 0;
return ci;
}
KdCardInfo *
KdCardInfoLast(void)
{
KdCardInfo *ci;
if (!kdCardInfo)
return 0;
for (ci = kdCardInfo; ci->next; ci = ci->next);
return ci;
}
void
KdCardInfoDispose(KdCardInfo * ci)
{
KdCardInfo **prev;
for (prev = &kdCardInfo; *prev; prev = &(*prev)->next)
if (*prev == ci) {
*prev = ci->next;
free(ci);
break;
}
}
KdScreenInfo *
KdScreenInfoAdd(KdCardInfo * ci)
{
KdScreenInfo *si, **prev;
int n;
si = calloc(1, sizeof(KdScreenInfo));
if (!si)
return 0;
for (prev = &ci->screenList, n = 0; *prev; prev = &(*prev)->next, n++);
*prev = si;
si->next = 0;
si->card = ci;
si->mynum = n;
return si;
}
void
KdScreenInfoDispose(KdScreenInfo * si)
{
KdCardInfo *ci = si->card;
KdScreenInfo **prev;
for (prev = &ci->screenList; *prev; prev = &(*prev)->next) {
if (*prev == si) {
*prev = si->next;
free(si);
if (!ci->screenList)
KdCardInfoDispose(ci);
break;
}
}
}
KdPointerInfo *
KdNewPointer(void)
{
KdPointerInfo *pi;
int i;
pi = (KdPointerInfo *) calloc(1, sizeof(KdPointerInfo));
if (!pi)
return NULL;
pi->name = strdup("Generic Pointer");
pi->path = NULL;
pi->inputClass = KD_MOUSE;
pi->driver = NULL;
pi->driverPrivate = NULL;
pi->next = NULL;
pi->options = NULL;
pi->nAxes = 3;
pi->nButtons = KD_MAX_BUTTON;
for (i = 1; i < KD_MAX_BUTTON; i++)
pi->map[i] = i;
return pi;
}
void
KdFreePointer(KdPointerInfo * pi)
{
free(pi->name);
free(pi->path);
input_option_free_list(&pi->options);
pi->next = NULL;
free(pi);
}
void
KdFreeKeyboard(KdKeyboardInfo * ki)
{
free(ki->name);
free(ki->path);
free(ki->xkbRules);
free(ki->xkbModel);
free(ki->xkbLayout);
free(ki->xkbVariant);
free(ki->xkbOptions);
input_option_free_list(&ki->options);
ki->next = NULL;
free(ki);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,80 +0,0 @@
/*
* Copyright © 1999 Keith Packard
*
* 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 Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "kdrive.h"
Bool
KdShadowFbAlloc(KdScreenInfo * screen, Bool rotate)
{
int paddedWidth;
void *buf;
int width = rotate ? screen->height : screen->width;
int height = rotate ? screen->width : screen->height;
int bpp = screen->fb.bitsPerPixel;
/* use fb computation for width */
paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
buf = xallocarray(paddedWidth, height);
if (!buf)
return FALSE;
if (screen->fb.shadow)
free(screen->fb.frameBuffer);
screen->fb.shadow = TRUE;
screen->fb.frameBuffer = buf;
screen->fb.byteStride = paddedWidth;
screen->fb.pixelStride = paddedWidth * 8 / bpp;
return TRUE;
}
void
KdShadowFbFree(KdScreenInfo * screen)
{
if (screen->fb.shadow) {
free(screen->fb.frameBuffer);
screen->fb.frameBuffer = 0;
screen->fb.shadow = FALSE;
}
}
Bool
KdShadowSet(ScreenPtr pScreen, int randr, ShadowUpdateProc update,
ShadowWindowProc window)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
if (screen->fb.shadow) {
return shadowAdd(pScreen, pScreen->GetScreenPixmap(pScreen),
update, window, randr, 0);
}
return TRUE;
}
void
KdShadowUnset(ScreenPtr pScreen)
{
shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
}

File diff suppressed because it is too large Load Diff

View File

@ -1,197 +0,0 @@
/*
XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
Copyright (C) 2000, 2001 - Nokia Home Communications
Copyright (C) 1998, 1999 - The XFree86 Project Inc.
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, provided that the above
copyright notice(s) and this permission notice appear in all copies of
the Software and that both the above copyright notice(s) and this
permission notice appear in supporting documentation.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
of the copyright holder.
*/
#ifndef _XVDIX_H_
#define _XVDIX_H_
#include "scrnintstr.h"
#include "regionstr.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "mivalidate.h"
#include "validate.h"
#include "resource.h"
#include "gcstruct.h"
#include "dixstruct.h"
#include "../../Xext/xvdix.h"
#define VIDEO_OVERLAID_IMAGES 0x00000004
#define VIDEO_OVERLAID_STILLS 0x00000008
#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
typedef int (*PutVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
short vid_x, short vid_y, short drw_x,
short drw_y, short vid_w, short vid_h,
short drw_w, short drw_h, RegionPtr clipBoxes,
void *data);
typedef int (*PutStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
short vid_x, short vid_y, short drw_x,
short drw_y, short vid_w, short vid_h,
short drw_w, short drw_h, RegionPtr clipBoxes,
void *data);
typedef int (*GetVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
short vid_x, short vid_y, short drw_x,
short drw_y, short vid_w, short vid_h,
short drw_w, short drw_h, RegionPtr clipBoxes,
void *data);
typedef int (*GetStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
short vid_x, short vid_y, short drw_x,
short drw_y, short vid_w, short vid_h,
short drw_w, short drw_h, RegionPtr clipBoxes,
void *data);
typedef void (*StopVideoFuncPtr) (KdScreenInfo * screen, void *data,
Bool Exit);
typedef int (*SetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute,
int value, void *data);
typedef int (*GetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute,
int *value, void *data);
typedef void (*QueryBestSizeFuncPtr) (KdScreenInfo * screen, Bool motion,
short vid_w, short vid_h, short drw_w,
short drw_h, unsigned int *p_w,
unsigned int *p_h, void *data);
typedef int (*PutImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
short src_x, short src_y, short drw_x,
short drw_y, short src_w, short src_h,
short drw_w, short drw_h, int image,
unsigned char *buf, short width, short height,
Bool Sync, RegionPtr clipBoxes, void *data);
typedef int (*ReputImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
short drw_x, short drw_y, RegionPtr clipBoxes,
void *data);
typedef int (*QueryImageAttributesFuncPtr) (KdScreenInfo * screen, int image,
unsigned short *width,
unsigned short *height,
int *pitches, int *offsets);
typedef enum {
XV_OFF,
XV_PENDING,
XV_ON
} XvStatus;
/*** this is what the driver needs to fill out ***/
typedef struct {
int id;
const char *name;
unsigned short width, height;
XvRationalRec rate;
} KdVideoEncodingRec, *KdVideoEncodingPtr;
typedef struct {
char depth;
short class;
} KdVideoFormatRec, *KdVideoFormatPtr;
typedef struct {
unsigned int type;
int flags;
const char *name;
int nEncodings;
KdVideoEncodingPtr pEncodings;
int nFormats;
KdVideoFormatPtr pFormats;
int nPorts;
DevUnion *pPortPrivates;
int nAttributes;
XvAttributePtr pAttributes;
int nImages;
XvImagePtr pImages;
PutVideoFuncPtr PutVideo;
PutStillFuncPtr PutStill;
GetVideoFuncPtr GetVideo;
GetStillFuncPtr GetStill;
StopVideoFuncPtr StopVideo;
SetPortAttributeFuncPtr SetPortAttribute;
GetPortAttributeFuncPtr GetPortAttribute;
QueryBestSizeFuncPtr QueryBestSize;
PutImageFuncPtr PutImage;
ReputImageFuncPtr ReputImage;
QueryImageAttributesFuncPtr QueryImageAttributes;
} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
Bool
KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr Adaptors, int num);
/*** These are DDX layer privates ***/
typedef struct {
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify;
WindowExposuresProcPtr WindowExposures;
CloseScreenProcPtr CloseScreen;
} KdXVScreenRec, *KdXVScreenPtr;
typedef struct {
int flags;
PutVideoFuncPtr PutVideo;
PutStillFuncPtr PutStill;
GetVideoFuncPtr GetVideo;
GetStillFuncPtr GetStill;
StopVideoFuncPtr StopVideo;
SetPortAttributeFuncPtr SetPortAttribute;
GetPortAttributeFuncPtr GetPortAttribute;
QueryBestSizeFuncPtr QueryBestSize;
PutImageFuncPtr PutImage;
ReputImageFuncPtr ReputImage;
QueryImageAttributesFuncPtr QueryImageAttributes;
} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
typedef struct {
KdScreenInfo *screen;
DrawablePtr pDraw;
unsigned char type;
unsigned int subWindowMode;
DDXPointRec clipOrg;
RegionPtr clientClip;
RegionPtr pCompositeClip;
Bool FreeCompositeClip;
XvAdaptorRecPrivatePtr AdaptorRec;
XvStatus isOn;
Bool moved;
int vid_x, vid_y, vid_w, vid_h;
int drw_x, drw_y, drw_w, drw_h;
DevUnion DevPriv;
} XvPortRecPrivate, *XvPortRecPrivatePtr;
typedef struct _KdXVWindowRec {
XvPortRecPrivatePtr PortRec;
struct _KdXVWindowRec *next;
} KdXVWindowRec, *KdXVWindowPtr;
#endif /* _XVDIX_H_ */

View File

@ -1,20 +0,0 @@
srcs_kdrive = [
'kcmap.c',
'kdrive.c',
'kinfo.c',
'kinput.c',
'kshadow.c',
'../../../mi/miinitext.c',
'../../../mi/miinitext.h',
]
if build_xv
srcs_kdrive += 'kxv.c'
endif
kdrive = static_library('kdrive',
srcs_kdrive,
include_directories: inc,
dependencies: common_dep,
link_with: libxserver_miext_shadow,
)

View File

@ -1,7 +1,3 @@
if get_option('xephyr')
subdir('kdrive')
endif
if get_option('xvfb')
subdir('vfb')
endif

View File

@ -566,9 +566,6 @@ subdir('Xi')
if build_glamor
subdir('glamor')
endif
if get_option('xephyr')
subdir('exa')
endif
# Common static libraries of all X servers
libxserver = [

View File

@ -1,5 +1,3 @@
option('xephyr', type: 'boolean', value: false,
description: 'Enable Xephyr nested X server')
option('xwayland', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
description: 'Enable XWayland X server')
option('glamor', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',

View File

@ -68,36 +68,6 @@ if get_option('xvfb')
)
endforeach
endif
if get_option('xephyr') and build_glamor
test('XTS',
find_program('scripts/xephyr-glamor-piglit.sh'),
env: piglit_env,
timeout: 1200,
suite: 'xephr-glamor',
)
if rendercheck.found()
foreach rctest: rendercheck_tests
test(rctest[0],
simple_xinit,
args: [simple_xinit.full_path(),
rendercheck.path(),
rctest[1].split(' '),
'----',
xephyr_server.full_path(),
'-glamor',
'-glamor-skip-present',
'-schedMax', '2000',
'--',
xvfb_args,
],
suite: 'xephr-glamor',
timeout: 300,
)
endforeach
endif
endif
endif
if build_xwayland

View File

@ -1,32 +0,0 @@
#!/bin/sh
# this times out on Travis, because the tests take too long.
if test "x$TRAVIS_BUILD_DIR" != "x"; then
exit 77
fi
# Start a Xephyr server using glamor. Since the test environment is
# headless, we start an Xvfb first to host the Xephyr.
export PIGLIT_RESULTS_DIR=$XSERVER_BUILDDIR/test/piglit-results/xephyr-glamor
export SERVER_COMMAND="$XSERVER_BUILDDIR/hw/kdrive/ephyr/Xephyr \
-glamor \
-glamor-skip-present \
-noreset \
-schedMax 2000 \
-screen 1280x1024"
# Tests that currently fail on llvmpipe on CI
PIGLIT_ARGS="$PIGLIT_ARGS -x xcleararea@6"
PIGLIT_ARGS="$PIGLIT_ARGS -x xcleararea@7"
PIGLIT_ARGS="$PIGLIT_ARGS -x xclearwindow@4"
PIGLIT_ARGS="$PIGLIT_ARGS -x xclearwindow@5"
PIGLIT_ARGS="$PIGLIT_ARGS -x xcopyarea@1"
export PIGLIT_ARGS
$XSERVER_BUILDDIR/test/simple-xinit \
$XSERVER_DIR/test/scripts/run-piglit.sh \
-- \
$XSERVER_BUILDDIR/hw/vfb/Xvfb \
-screen scrn 1280x1024x24