work on xorg driver

ulab-next
Jay Sorg 11 years ago
parent bca7e7a023
commit 39b749e09d

@ -3,17 +3,18 @@ OBJS = rdpDraw.o rdpPri.o rdpGC.o rdpFillSpans.o rdpSetSpans.o rdpPutImage.o \
rdpCopyArea.o rdpCopyPlane.o rdpPolyPoint.o rdpPolylines.o rdpPolySegment.o \
rdpPolyRectangle.o rdpPolyArc.o rdpFillPolygon.o rdpPolyFillRect.o \
rdpPolyFillArc.o rdpPolyText8.o rdpPolyText16.o rdpImageText8.o \
rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o
rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o \
rdpCursor.o
CFLAGS = -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1
CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1
LDFLAGS =
LIBS =
all: xrdpdev_drv.so
all: libxorgxrdp.so
xrdpdev_drv.so: $(OBJS) Makefile
libxorgxrdp.so: $(OBJS) Makefile
$(CC) -shared -o libxorgxrdp.so $(LDFLAGS) $(OBJS) $(LIBS)
clean:

@ -25,6 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <xorg-server.h>
#include <scrnintstr.h>
#include <gcstruct.h>
#include <mipointer.h>
#include "rdpPri.h"
@ -46,6 +47,8 @@ struct _rdpRec
DestroyPixmapProcPtr DestroyPixmap;
ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
miPointerScreenFuncPtr pCursorFuncs;
};
typedef struct _rdpRec rdpRec;
typedef struct _rdpRec * rdpPtr;

@ -0,0 +1,91 @@
/*
Copyright 2005-2013 Jay Sorg
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.
The above copyright notice and this permission notice 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
OPEN GROUP 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.
cursor
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <mipointer.h>
#include <fb.h>
#include <micmap.h>
#include <mi.h>
#include "rdp.h"
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
Bool
rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
{
LLOGLN(0, ("rdpSpriteRealizeCursor:"));
return 1;
}
/******************************************************************************/
Bool
rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
{
LLOGLN(0, ("rdpSpriteUnrealizeCursor:"));
return 1;
}
/******************************************************************************/
void
rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int x, int y)
{
LLOGLN(0, ("rdpSpriteSetCursor:"));
}
/******************************************************************************/
void
rdpSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y)
{
LLOGLN(0, ("rdpSpriteMoveCursor:"));
}
/******************************************************************************/
Bool
rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
{
LLOGLN(0, ("rdpSpriteDeviceCursorInitialize:"));
return 1;
}
/******************************************************************************/
void
rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
{
LLOGLN(0, ("rdpSpriteDeviceCursorCleanup:"));
}

@ -0,0 +1,44 @@
/*
Copyright 2005-2013 Jay Sorg
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.
The above copyright notice and this permission notice 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
OPEN GROUP 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.
misc draw calls
*/
#ifndef __RDPCURSOR_H
#define __RDPCURSOR_H
#include <xorg-server.h>
#include <xf86.h>
Bool
rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs);
Bool
rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs);
void
rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int x, int y);
void
rdpSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y);
Bool
rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr);
void
rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr);
#endif

@ -61,10 +61,12 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
rdpPtr dev;
PixmapPtr rv;
LLOGLN(10, ("rdpCreatePixmap: width %d height %d depth %d",
width, height, depth));
pScrn = xf86Screens[pScreen->myNum];
dev = XRDPPTR(pScrn);
pScreen->CreatePixmap = dev->CreatePixmap;
rv = pScreen->CreatePixmap(pScreen, 0, 0, 0, 0);
rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
pScreen->CreatePixmap = rdpCreatePixmap;
return rv;
}
@ -73,19 +75,19 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
Bool
rdpDestroyPixmap(PixmapPtr pPixmap)
{
Bool rv;
ScreenPtr pScreen;
rdpPtr dev;
ScrnInfoPtr pScrn;
LLOGLN(10, ("rdpDestroyPixmap: refcnt %d", pPixmap->refcnt));
pScreen = pPixmap->drawable.pScreen;
pScrn = xf86Screens[pScreen->myNum];
dev = XRDPPTR(pScrn);
pScreen->DestroyPixmap = dev->DestroyPixmap;
rv = pScreen->DestroyPixmap(pPixmap);
pScreen->DestroyPixmap = rdpDestroyPixmap;
return rv;
Bool rv;
ScreenPtr pScreen;
rdpPtr dev;
ScrnInfoPtr pScrn;
LLOGLN(10, ("rdpDestroyPixmap: refcnt %d", pPixmap->refcnt));
pScreen = pPixmap->drawable.pScreen;
pScrn = xf86Screens[pScreen->myNum];
dev = XRDPPTR(pScrn);
pScreen->DestroyPixmap = dev->DestroyPixmap;
rv = pScreen->DestroyPixmap(pPixmap);
pScreen->DestroyPixmap = rdpDestroyPixmap;
return rv;
}
/******************************************************************************/
@ -93,19 +95,20 @@ Bool
rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData)
{
Bool rv;
ScreenPtr pScreen;
rdpPtr dev;
ScrnInfoPtr pScrn;
pScreen = pPixmap->drawable.pScreen;
pScrn = xf86Screens[pScreen->myNum];
dev = XRDPPTR(pScrn);
pScreen->ModifyPixmapHeader = dev->ModifyPixmapHeader;
rv = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel,
devKind, pPixData);
pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader;
return rv;
Bool rv;
ScreenPtr pScreen;
rdpPtr dev;
ScrnInfoPtr pScrn;
LLOGLN(10, ("rdpModifyPixmapHeader:"));
pScreen = pPixmap->drawable.pScreen;
pScrn = xf86Screens[pScreen->myNum];
dev = XRDPPTR(pScrn);
pScreen->ModifyPixmapHeader = dev->ModifyPixmapHeader;
rv = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel,
devKind, pPixData);
pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader;
return rv;
}
/*****************************************************************************/
@ -134,8 +137,6 @@ RDPSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor)
if (!initialised)
{
initialised = 1;
//xf86AddModuleInfo(&THINC, Module);
//LoaderRefSymLists(cursorSymbols, NULL);
}
return (pointer) 1;
}

@ -132,6 +132,7 @@ rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d)
LLOGLN(10, ("rdpValidateGC:"));
GC_FUNC_PROLOGUE(pGC);
pGC->funcs->ValidateGC(pGC, changes, d);
priv->ops = pGC->ops;
GC_FUNC_EPILOGUE(pGC);
}

@ -39,51 +39,135 @@ to deal with privates changing in xorg versions
#include "rdpPri.h"
/* not sure if these versions are right */
#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((5) * 100000) + ((1) * 1000) + 0)
#define FBDEV_PRI 1
#elif XORG_VERSION_CURRENT < (((1) * 10000000) + ((7) * 100000) + ((7) * 1000) + 1)
#define FBDEV_PRI 2
#else
#define FBDEV_PRI 3
#endif
#define PTR2INT(_ptr) ((int) ((long) ((void*) (_ptr))))
#define INT2PTR(_int) ((void *) ((long) ((int) (_int))))
#if FBDEV_PRI == 3
static DevPrivateKeyRec g_privateKeyRecGC;
static DevPrivateKeyRec g_privateKeyRecPixmap;
static DevPrivateKeyRec g_privateKeyRecWindow;
#elif FBDEV_PRI == 2
static int g_privateKeyRecGC = 0;
static int g_privateKeyRecPixmap = 0;
static int g_privateKeyRecWindow = 0;
#endif
/*****************************************************************************/
rdpDevPrivateKey
rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes)
{
return 0;
rdpDevPrivateKey rv;
#if FBDEV_PRI == 1
rv = INT2PTR(AllocateGCPrivateIndex());
AllocateGCPrivate(pScreen, PTR2INT(rv), bytes);
#elif FBDEV_PRI == 2
dixRequestPrivate(&g_privateKeyRecGC, bytes);
rv = &g_privateKeyRecGC;
#else
dixRegisterPrivateKey(&g_privateKeyRecGC, PRIVATE_GC, bytes);
rv = &g_privateKeyRecGC;
#endif
return rv;
}
/*****************************************************************************/
rdpDevPrivateKey
rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes)
{
return 0;
rdpDevPrivateKey rv;
#if FBDEV_PRI == 1
rv = INT2PTR(AllocatePixmapPrivateIndex());
AllocatePixmapPrivate(pScreen, PTR2INT(rv), bytes);
#elif FBDEV_PRI == 2
dixRequestPrivate(&g_privateKeyRecPixmap, bytes);
rv = &g_privateKeyRecPixmap;
#else
dixRegisterPrivateKey(&g_privateKeyRecPixmap, PRIVATE_PIXMAP, bytes);
rv = &g_privateKeyRecPixmap;
#endif
return rv;
}
/*****************************************************************************/
rdpDevPrivateKey
rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes)
{
return 0;
rdpDevPrivateKey rv;
#if FBDEV_PRI == 1
rv = INT2PTR(AllocateWindowPrivateIndex());
AllocateWindowPrivate(pScreen, PTR2INT(rv), bytes);
#elif FBDEV_PRI == 2
dixRequestPrivate(&g_privateKeyRecWindow, bytes);
rv = &g_privateKeyRecWindow;
#else
dixRegisterPrivateKey(&g_privateKeyRecWindow, PRIVATE_WINDOW, bytes);
rv = &g_privateKeyRecWindow;
#endif
return rv;
}
/*****************************************************************************/
void*
void *
rdpGetGCPrivate(GCPtr pGC, rdpDevPrivateKey key)
{
return 0;
void *rv;
#if FBDEV_PRI == 1
rv = pGC->devPrivates[PTR2INT(key)].ptr;
#else
rv = dixLookupPrivate(&(pGC->devPrivates), key);
#endif
return rv;
}
/*****************************************************************************/
void*
void *
rdpGetPixmapPrivate(PixmapPtr pPixmap, rdpDevPrivateKey key)
{
return 0;
void *rv;
#if FBDEV_PRI == 1
rv = pPixmap->devPrivates[PTR2INT(key)].ptr;
#else
rv = dixLookupPrivate(&(pPixmap->devPrivates), key);
#endif
return rv;
}
/*****************************************************************************/
void*
void *
rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key)
{
return 0;
void *rv;
#if FBDEV_PRI == 1
rv = pWindow->devPrivates[PTR2INT(key)].ptr;
#else
rv = dixLookupPrivate(&(pWindow->devPrivates), key);
#endif
return rv;
}
/*****************************************************************************/
int
rdpPrivateInit(void)
{
#if FBDEV_PRI == 3
memset(&g_privateKeyRecGC, 0, sizeof(g_privateKeyRecGC));
memset(&g_privateKeyRecWindow, 0, sizeof(g_privateKeyRecWindow));
memset(&g_privateKeyRecPixmap, 0, sizeof(g_privateKeyRecPixmap));
#endif
return 0;
}

Loading…
Cancel
Save