1/* 2 * Xephyr - A kdrive X server that runs in a host X window. 3 * Authored by Matthew Allum <mallum@o-hand.com> 4 * 5 * Copyright © 2004 Nokia 6 * 7 * Permission to use, copy, modify, distribute, and sell this software and its 8 * documentation for any purpose is hereby granted without fee, provided that 9 * the above copyright notice appear in all copies and that both that 10 * copyright notice and this permission notice appear in supporting 11 * documentation, and that the name of Nokia not be used in 12 * advertising or publicity pertaining to distribution of the software without 13 * specific, written prior permission. Nokia makes no 14 * representations about the suitability of this software for any purpose. It 15 * is provided "as is" without express or implied warranty. 16 * 17 * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 19 * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR 20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 21 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 22 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 23 * PERFORMANCE OF THIS SOFTWARE. 24 */ 25 26#ifndef _EPHYR_H_ 27#define _EPHYR_H_ 28#include <stdio.h> 29#include <unistd.h> 30#include <libgen.h> 31#include <xcb/xcb_image.h> 32 33#include "os.h" /* for OsSignal() */ 34#include "kdrive.h" 35#include "hostx.h" 36#include "exa.h" 37 38#ifdef RANDR 39#include "randrstr.h" 40#endif 41 42#include "damage.h" 43 44typedef struct _ephyrPriv { 45 CARD8 *base; 46 int bytes_per_line; 47} EphyrPriv; 48 49typedef struct _ephyrFakexaPriv { 50 ExaDriverPtr exa; 51 Bool is_synced; 52 53 /* The following are arguments and other information from Prepare* calls 54 * which are stored for use in the inner calls. 55 */ 56 int op; 57 PicturePtr pSrcPicture, pMaskPicture, pDstPicture; 58 void *saved_ptrs[3]; 59 PixmapPtr pDst, pSrc, pMask; 60 GCPtr pGC; 61} EphyrFakexaPriv; 62 63typedef struct _ephyrScrPriv { 64 /* ephyr server info */ 65 Rotation randr; 66 Bool shadow; 67 DamagePtr pDamage; 68 EphyrFakexaPriv *fakexa; 69 70 /* Host X window info */ 71 xcb_window_t win; 72 xcb_window_t win_pre_existing; /* Set via -parent option like xnest */ 73 xcb_window_t peer_win; /* Used for GL; should be at most one */ 74 xcb_image_t *ximg; 75 Bool win_explicit_position; 76 int win_x, win_y; 77 int win_width, win_height; 78 int server_depth; 79 const char *output; /* Set via -output option */ 80 unsigned char *fb_data; /* only used when host bpp != server bpp */ 81 xcb_shm_segment_info_t shminfo; 82 size_t shmsize; 83 84 KdScreenInfo *screen; 85 int mynum; /* Screen number */ 86 unsigned long cmap[256]; 87 88 ScreenBlockHandlerProcPtr BlockHandler; 89 90 /** 91 * Per-screen Xlib-using state for glamor (private to 92 * ephyr_glamor_glx.c) 93 */ 94 struct ephyr_glamor *glamor; 95} EphyrScrPriv; 96 97extern KdCardFuncs ephyrFuncs; 98extern KdKeyboardInfo *ephyrKbd; 99extern KdPointerInfo *ephyrMouse; 100 101extern miPointerScreenFuncRec ephyrPointerScreenFuncs; 102 103Bool 104 ephyrInitialize(KdCardInfo * card, EphyrPriv * priv); 105 106Bool 107 ephyrCardInit(KdCardInfo * card); 108 109Bool 110ephyrScreenInitialize(KdScreenInfo *screen); 111 112Bool 113 ephyrInitScreen(ScreenPtr pScreen); 114 115Bool 116 ephyrFinishInitScreen(ScreenPtr pScreen); 117 118Bool 119 ephyrCreateResources(ScreenPtr pScreen); 120 121void 122 ephyrPreserve(KdCardInfo * card); 123 124Bool 125 ephyrEnable(ScreenPtr pScreen); 126 127Bool 128 ephyrDPMS(ScreenPtr pScreen, int mode); 129 130void 131 ephyrDisable(ScreenPtr pScreen); 132 133void 134 ephyrRestore(KdCardInfo * card); 135 136void 137 ephyrScreenFini(KdScreenInfo * screen); 138 139void 140ephyrCloseScreen(ScreenPtr pScreen); 141 142void 143 ephyrCardFini(KdCardInfo * card); 144 145void 146 ephyrGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs); 147 148void 149 ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs); 150 151Bool 152 ephyrMapFramebuffer(KdScreenInfo * screen); 153 154void *ephyrWindowLinear(ScreenPtr pScreen, 155 CARD32 row, 156 CARD32 offset, int mode, CARD32 *size, void *closure); 157 158void 159 ephyrSetScreenSizes(ScreenPtr pScreen); 160 161Bool 162 ephyrUnmapFramebuffer(KdScreenInfo * screen); 163 164void 165 ephyrUnsetInternalDamage(ScreenPtr pScreen); 166 167Bool 168 ephyrSetInternalDamage(ScreenPtr pScreen); 169 170Bool 171 ephyrCreateColormap(ColormapPtr pmap); 172 173#ifdef RANDR 174Bool 175 ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations); 176 177Bool 178 179ephyrRandRSetConfig(ScreenPtr pScreen, 180 Rotation randr, int rate, RRScreenSizePtr pSize); 181Bool 182 ephyrRandRInit(ScreenPtr pScreen); 183 184void 185 ephyrShadowUpdate(ScreenPtr pScreen, shadowBufPtr pBuf); 186 187#endif 188 189void 190 ephyrUpdateModifierState(unsigned int state); 191 192extern KdPointerDriver EphyrMouseDriver; 193 194extern KdKeyboardDriver EphyrKeyboardDriver; 195 196extern Bool ephyrCursorInit(ScreenPtr pScreen); 197 198extern int ephyrBufferHeight(KdScreenInfo * screen); 199 200/* ephyr_draw.c */ 201 202Bool 203 ephyrDrawInit(ScreenPtr pScreen); 204 205void 206 ephyrDrawEnable(ScreenPtr pScreen); 207 208void 209 ephyrDrawDisable(ScreenPtr pScreen); 210 211void 212 ephyrDrawFini(ScreenPtr pScreen); 213 214/* hostx.c glamor support */ 215Bool ephyr_glamor_init(ScreenPtr pScreen); 216Bool ephyr_glamor_create_screen_resources(ScreenPtr pScreen); 217void ephyr_glamor_enable(ScreenPtr pScreen); 218void ephyr_glamor_disable(ScreenPtr pScreen); 219void ephyr_glamor_fini(ScreenPtr pScreen); 220void ephyr_glamor_host_paint_rect(ScreenPtr pScreen); 221 222/*ephyvideo.c*/ 223 224Bool ephyrInitVideo(ScreenPtr pScreen); 225 226/* ephyr_glamor_xv.c */ 227#ifdef GLAMOR 228void ephyr_glamor_xv_init(ScreenPtr screen); 229#else /* !GLAMOR */ 230static inline void 231ephyr_glamor_xv_init(ScreenPtr screen) 232{ 233} 234#endif /* !GLAMOR */ 235 236#endif 237