Merge branch 'master' into dcdc_rework
Conflicts: Xext/xevie.c dix/dispatch.c
This commit is contained in:
commit
fd06e8f8c1
|
@ -8,11 +8,12 @@ Makefile.in
|
|||
*.a
|
||||
*.o
|
||||
*~
|
||||
.*.swp
|
||||
.*sw?
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
obj*
|
||||
build*
|
||||
local
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
compile
|
||||
|
@ -29,6 +30,7 @@ ltmain.sh
|
|||
missing
|
||||
TAGS
|
||||
tags
|
||||
cscope*
|
||||
ylwrap
|
||||
xorg-server.pc
|
||||
stamp-h?
|
||||
|
|
|
@ -11,10 +11,10 @@ AM_CPPFLAGS = \
|
|||
if HAVE_AGL_FRAMEWORK
|
||||
noinst_LIBRARIES = libAGLcore.a
|
||||
libAGLcore_a_SOURCES = aglGlx.c \
|
||||
$(top_srcdir)/hw/darwin/quartz/xpr/x-list.c \
|
||||
$(top_srcdir)/hw/darwin/quartz/xpr/x-list.h \
|
||||
$(top_srcdir)/hw/darwin/quartz/xpr/x-hash.c \
|
||||
$(top_srcdir)/hw/darwin/quartz/xpr/x-hash.h \
|
||||
$(top_srcdir)/hw/xquartz/xpr/x-list.c \
|
||||
$(top_srcdir)/hw/xquartz/xpr/x-list.h \
|
||||
$(top_srcdir)/hw/xquartz/xpr/x-hash.c \
|
||||
$(top_srcdir)/hw/xquartz/xpr/x-hash.h \
|
||||
$(top_srcdir)/hw/dmx/glxProxy/compsize.c
|
||||
endif
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@ INCLUDES = \
|
|||
|
||||
nodist_libglx_la_SOURCES = indirect_size.h \
|
||||
glapi.c \
|
||||
glcontextmodes.c \
|
||||
glcontextmode.h \
|
||||
glthread.c \
|
||||
indirect_dispatch.c \
|
||||
indirect_dispatch.h \
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include <windowstr.h>
|
||||
#include "glxutil.h"
|
||||
#include "glxext.h"
|
||||
#include "glcontextmodes.h"
|
||||
#include "glapitable.h"
|
||||
#include "glapi.h"
|
||||
#include "glthread.h"
|
||||
|
@ -83,9 +82,9 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
|
|||
|
||||
static int
|
||||
validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
|
||||
__GLcontextModes **config, int *err)
|
||||
__GLXconfig **config, int *err)
|
||||
{
|
||||
__GLcontextModes *m;
|
||||
__GLXconfig *m;
|
||||
|
||||
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next)
|
||||
if (m->fbconfigID == id) {
|
||||
|
@ -101,7 +100,7 @@ validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
|
|||
|
||||
static int
|
||||
validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
|
||||
__GLcontextModes **config, int *err)
|
||||
__GLXconfig **config, int *err)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -118,7 +117,7 @@ validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
|
|||
}
|
||||
|
||||
static int
|
||||
validGlxFBConfigForWindow(ClientPtr client, __GLcontextModes *config,
|
||||
validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
|
||||
DrawablePtr pDraw, int *err)
|
||||
{
|
||||
ScreenPtr pScreen = pDraw->pScreen;
|
||||
|
@ -135,7 +134,7 @@ validGlxFBConfigForWindow(ClientPtr client, __GLcontextModes *config,
|
|||
}
|
||||
|
||||
/* FIXME: What exactly should we check here... */
|
||||
if (pVisual->class != _gl_convert_to_x_visual_type(config->visualType) ||
|
||||
if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
|
||||
!(config->drawableType & GLX_WINDOW_BIT)) {
|
||||
client->errorValue = pDraw->id;
|
||||
*err = BadMatch;
|
||||
|
@ -161,7 +160,7 @@ static void __glXdirectContextDestroy(__GLXcontext *context)
|
|||
}
|
||||
|
||||
static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXconfig *modes,
|
||||
__GLXcontext *shareContext)
|
||||
{
|
||||
__GLXcontext *context;
|
||||
|
@ -186,7 +185,7 @@ static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
|
|||
|
||||
static int
|
||||
DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
||||
GLXContextID shareList, __GLcontextModes *config,
|
||||
GLXContextID shareList, __GLXconfig *config,
|
||||
__GLXscreen *pGlxScreen, GLboolean isDirect)
|
||||
{
|
||||
ClientPtr client = cl->client;
|
||||
|
@ -248,7 +247,7 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
|||
** a GL core that needs windowing information (e.g., Mesa).
|
||||
*/
|
||||
glxc->pGlxScreen = pGlxScreen;
|
||||
glxc->modes = config;
|
||||
glxc->config = config;
|
||||
|
||||
/*
|
||||
** Register this context as a resource.
|
||||
|
@ -276,7 +275,7 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
|||
int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -292,7 +291,7 @@ int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
|
|||
int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -309,7 +308,7 @@ int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
{
|
||||
xGLXCreateContextWithConfigSGIXReq *req =
|
||||
(xGLXCreateContextWithConfigSGIXReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -462,7 +461,7 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
|
|||
* GLXPixmap and we just return the __GLXdrawable. */
|
||||
pGlxDraw = (__GLXdrawable *) LookupIDByType(drawId, __glXDrawableRes);
|
||||
if (pGlxDraw != NULL) {
|
||||
if (glxc != NULL && pGlxDraw->modes != glxc->modes) {
|
||||
if (glxc != NULL && pGlxDraw->config != glxc->config) {
|
||||
client->errorValue = drawId;
|
||||
*error = BadMatch;
|
||||
return NULL;
|
||||
|
@ -479,7 +478,7 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
|
|||
* resource ID clashes. Effectively, the X Window is now also a
|
||||
* GLXWindow. */
|
||||
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
|
||||
if (rc != Success || pDraw->type != DRAWABLE_WINDOW) {
|
||||
client->errorValue = drawId;
|
||||
*error = __glXError(GLXBadDrawable);
|
||||
|
@ -497,12 +496,12 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
|
|||
* the context screen and that the context fbconfig is compatible
|
||||
* with the window visual. */
|
||||
if (pDraw->pScreen != glxc->pGlxScreen->pScreen ||
|
||||
!validGlxFBConfigForWindow(client, glxc->modes, pDraw, error))
|
||||
!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
|
||||
return NULL;
|
||||
|
||||
pGlxDraw = glxc->pGlxScreen->createDrawable(glxc->pGlxScreen,
|
||||
pDraw, GLX_DRAWABLE_WINDOW,
|
||||
drawId, glxc->modes);
|
||||
drawId, glxc->config);
|
||||
|
||||
/* since we are creating the drawablePrivate, drawId should be new */
|
||||
if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
|
||||
|
@ -878,7 +877,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
|
|||
ClientPtr client = cl->client;
|
||||
xGLXGetVisualConfigsReply reply;
|
||||
__GLXscreen *pGlxScreen;
|
||||
__GLcontextModes *modes;
|
||||
__GLXconfig *modes;
|
||||
CARD32 buf[__GLX_TOTAL_CONFIG];
|
||||
int p, i, err;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
@ -907,7 +906,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
|
|||
|
||||
p = 0;
|
||||
buf[p++] = modes->visualID;
|
||||
buf[p++] = _gl_convert_to_x_visual_type( modes->visualType );
|
||||
buf[p++] = glxConvertToXVisualType( modes->visualType );
|
||||
buf[p++] = modes->rgbMode;
|
||||
|
||||
buf[p++] = modes->redBits;
|
||||
|
@ -944,6 +943,12 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
|
|||
buf[p++] = modes->transparentAlpha;
|
||||
buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
|
||||
buf[p++] = modes->transparentIndex;
|
||||
buf[p++] = 0;
|
||||
buf[p++] = 0;
|
||||
buf[p++] = 0;
|
||||
buf[p++] = 0;
|
||||
buf[p++] = 0;
|
||||
buf[p++] = 0;
|
||||
|
||||
if (client->swapped) {
|
||||
__GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
|
||||
|
@ -954,7 +959,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
|
|||
return Success;
|
||||
}
|
||||
|
||||
#define __GLX_TOTAL_FBCONFIG_ATTRIBS (28)
|
||||
#define __GLX_TOTAL_FBCONFIG_ATTRIBS (33)
|
||||
#define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)
|
||||
/**
|
||||
* Send the set of GLXFBConfigs to the client. There is not currently
|
||||
|
@ -974,7 +979,7 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
|
|||
__GLXscreen *pGlxScreen;
|
||||
CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH];
|
||||
int p, err;
|
||||
__GLcontextModes *modes;
|
||||
__GLXconfig *modes;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
|
||||
|
||||
|
@ -1032,6 +1037,11 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
|
|||
WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
|
||||
WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
|
||||
WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
|
||||
WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType );
|
||||
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb );
|
||||
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba );
|
||||
WRITE_PAIR( GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture );
|
||||
WRITE_PAIR( GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets );
|
||||
|
||||
if (client->swapped) {
|
||||
__GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
|
||||
|
@ -1056,7 +1066,7 @@ int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
}
|
||||
|
||||
static int
|
||||
DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes *config,
|
||||
DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
|
||||
DrawablePtr pDraw, XID glxDrawableId, int type)
|
||||
{
|
||||
__GLXdrawable *pGlxDraw;
|
||||
|
@ -1080,13 +1090,13 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes
|
|||
}
|
||||
|
||||
static int
|
||||
DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes *config,
|
||||
DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
|
||||
XID drawableId, XID glxDrawableId)
|
||||
{
|
||||
DrawablePtr pDraw;
|
||||
int err;
|
||||
|
||||
err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixUnknownAccess);
|
||||
err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess);
|
||||
if (err != Success || pDraw->type != DRAWABLE_PIXMAP) {
|
||||
client->errorValue = drawableId;
|
||||
return BadPixmap;
|
||||
|
@ -1138,7 +1148,7 @@ determineTextureTarget(XID glxDrawableID, CARD32 *attribs, CARD32 numAttribs)
|
|||
int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -1154,7 +1164,7 @@ int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
|
|||
int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -1178,7 +1188,7 @@ int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
{
|
||||
xGLXCreateGLXPixmapWithConfigSGIXReq *req =
|
||||
(xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -1240,7 +1250,7 @@ static int
|
|||
DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
|
||||
int width, int height, XID glxDrawableId)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
PixmapPtr pPixmap;
|
||||
int err;
|
||||
|
@ -1353,7 +1363,7 @@ int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
ClientPtr client = cl->client;
|
||||
DrawablePtr pDraw;
|
||||
|
@ -1364,7 +1374,7 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
|
|||
if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err))
|
||||
return err;
|
||||
|
||||
err = dixLookupDrawable(&pDraw, req->window, client, 0, DixUnknownAccess);
|
||||
err = dixLookupDrawable(&pDraw, req->window, client, 0, DixAddAccess);
|
||||
if (err != Success || pDraw->type != DRAWABLE_WINDOW) {
|
||||
client->errorValue = req->window;
|
||||
return BadWindow;
|
||||
|
@ -1467,7 +1477,7 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
|
|||
*pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
|
||||
*pSendBuf++ = (int)(ctx->share_id);
|
||||
*pSendBuf++ = GLX_VISUAL_ID_EXT;
|
||||
*pSendBuf++ = (int)(ctx->modes->visualID);
|
||||
*pSendBuf++ = (int)(ctx->config->visualID);
|
||||
*pSendBuf++ = GLX_SCREEN_EXT;
|
||||
*pSendBuf++ = (int)(ctx->pGlxScreen->pScreen->myNum);
|
||||
|
||||
|
@ -2004,7 +2014,7 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
int screen, rc;
|
||||
__GLXscreen *pGlxScreen;
|
||||
|
||||
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixUnknownAccess);
|
||||
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixGetAttrAccess);
|
||||
pGlxScreen = glxGetScreen(pDraw->pScreen);
|
||||
if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) {
|
||||
screen = pDraw->pScreen->myNum;
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "GL/internal/glcore.h"
|
||||
|
||||
typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
|
||||
struct __GLXtextureFromPixmap {
|
||||
int (*bindTexImage) (__GLXcontext *baseContext,
|
||||
|
@ -77,9 +75,9 @@ struct __GLXcontext {
|
|||
__GLXcontext *nextReadPriv;
|
||||
|
||||
/*
|
||||
** mode struct for this context
|
||||
** config struct for this context
|
||||
*/
|
||||
__GLcontextModes *modes;
|
||||
__GLXconfig *config;
|
||||
|
||||
/*
|
||||
** Pointer to screen info data for this context. This is set
|
||||
|
|
|
@ -74,7 +74,7 @@ struct __GLXdrawable {
|
|||
/*
|
||||
** Configuration of the visual to which this drawable was created.
|
||||
*/
|
||||
__GLcontextModes *modes;
|
||||
__GLXconfig *config;
|
||||
|
||||
/*
|
||||
** Lists of contexts bound to this drawable. There are two lists here.
|
||||
|
|
251
GL/glx/glxdri.c
251
GL/glx/glxdri.c
|
@ -52,7 +52,6 @@
|
|||
#define DRI_NEW_INTERFACE_ONLY
|
||||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
#include "g_disptab.h"
|
||||
#include "glapitable.h"
|
||||
|
@ -61,26 +60,26 @@
|
|||
#include "dispatch.h"
|
||||
#include "extension_string.h"
|
||||
|
||||
#define containerOf(ptr, type, member) \
|
||||
(type *)( (char *)ptr - offsetof(type,member) )
|
||||
|
||||
typedef struct __GLXDRIscreen __GLXDRIscreen;
|
||||
typedef struct __GLXDRIcontext __GLXDRIcontext;
|
||||
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
|
||||
typedef struct __GLXDRIconfig __GLXDRIconfig;
|
||||
|
||||
struct __GLXDRIscreen {
|
||||
__GLXscreen base;
|
||||
__DRIscreen driScreen;
|
||||
__DRIscreen *driScreen;
|
||||
void *driver;
|
||||
|
||||
xf86EnterVTProc *enterVT;
|
||||
xf86LeaveVTProc *leaveVT;
|
||||
|
||||
__DRIcopySubBufferExtension *copySubBuffer;
|
||||
__DRIswapControlExtension *swapControl;
|
||||
const __DRIcoreExtension *core;
|
||||
const __DRIlegacyExtension *legacy;
|
||||
const __DRIcopySubBufferExtension *copySubBuffer;
|
||||
const __DRIswapControlExtension *swapControl;
|
||||
|
||||
#ifdef __DRI_TEX_OFFSET
|
||||
__DRItexOffsetExtension *texOffset;
|
||||
const __DRItexOffsetExtension *texOffset;
|
||||
DRITexOffsetStartProcPtr texOffsetStart;
|
||||
DRITexOffsetFinishProcPtr texOffsetFinish;
|
||||
__GLXDRIdrawable *texOffsetOverride[16];
|
||||
|
@ -92,13 +91,13 @@ struct __GLXDRIscreen {
|
|||
|
||||
struct __GLXDRIcontext {
|
||||
__GLXcontext base;
|
||||
__DRIcontext driContext;
|
||||
__DRIcontext *driContext;
|
||||
XID hwContextID;
|
||||
};
|
||||
|
||||
struct __GLXDRIdrawable {
|
||||
__GLXdrawable base;
|
||||
__DRIdrawable driDrawable;
|
||||
__DRIdrawable *driDrawable;
|
||||
|
||||
/* Pulled in from old __GLXpixmap */
|
||||
#ifdef __DRI_TEX_OFFSET
|
||||
|
@ -109,7 +108,10 @@ struct __GLXDRIdrawable {
|
|||
#endif
|
||||
};
|
||||
|
||||
static const char CREATE_NEW_SCREEN_FUNC[] = __DRI_CREATE_NEW_SCREEN_STRING;
|
||||
struct __GLXDRIconfig {
|
||||
__GLXconfig config;
|
||||
__DRIconfig *driConfig;
|
||||
};
|
||||
|
||||
static void
|
||||
__glXDRIleaveServer(GLboolean rendering)
|
||||
|
@ -151,7 +153,7 @@ __glXDRIleaveServer(GLboolean rendering)
|
|||
__GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
|
||||
|
||||
if (pGlxPix && pGlxPix->texname) {
|
||||
screen->texOffset->setTexOffset(&pGlxPix->ctx->driContext,
|
||||
screen->texOffset->setTexOffset(pGlxPix->ctx->driContext,
|
||||
pGlxPix->texname,
|
||||
pGlxPix->offset,
|
||||
pGlxPix->base.pDraw->depth,
|
||||
|
@ -219,20 +221,20 @@ static void
|
|||
__glXDRIdrawableDestroy(__GLXdrawable *drawable)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
||||
|
||||
__GLXDRIscreen *screen;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
__glXDRIdoReleaseTexImage((__GLXDRIscreen *)
|
||||
glxGetScreen(screenInfo.screens[i]),
|
||||
private);
|
||||
screen = (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
|
||||
__glXDRIdoReleaseTexImage(screen, private);
|
||||
}
|
||||
|
||||
(*private->driDrawable.destroyDrawable)(&private->driDrawable);
|
||||
|
||||
/* If the X window was destroyed, the dri DestroyWindow hook will
|
||||
* aready have taken care of this, so only call if pDraw isn't NULL. */
|
||||
if (drawable->pDraw != NULL) {
|
||||
screen = (__GLXDRIscreen *) glxGetScreen(drawable->pDraw->pScreen);
|
||||
(*screen->core->destroyDrawable)(private->driDrawable);
|
||||
|
||||
__glXenterServer(GL_FALSE);
|
||||
DRIDestroyDrawable(drawable->pDraw->pScreen,
|
||||
serverClient, drawable->pDraw);
|
||||
|
@ -255,8 +257,10 @@ static GLboolean
|
|||
__glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
||||
__GLXDRIscreen *screen =
|
||||
(__GLXDRIscreen *) glxGetScreen(basePrivate->pDraw->pScreen);
|
||||
|
||||
(*private->driDrawable.swapBuffers)(&private->driDrawable);
|
||||
(*screen->core->swapBuffers)(private->driDrawable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -266,11 +270,11 @@ static int
|
|||
__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval)
|
||||
{
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||
glxGetScreen(baseDrawable->pDraw->pScreen);
|
||||
__GLXDRIscreen *screen =
|
||||
(__GLXDRIscreen *) glxGetScreen(baseDrawable->pDraw->pScreen);
|
||||
|
||||
if (screen->swapControl)
|
||||
screen->swapControl->setSwapInterval(&draw->driDrawable, interval);
|
||||
screen->swapControl->setSwapInterval(draw->driDrawable, interval);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -285,20 +289,21 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
|
|||
glxGetScreen(basePrivate->pDraw->pScreen);
|
||||
|
||||
if (screen->copySubBuffer)
|
||||
screen->copySubBuffer->copySubBuffer(&private->driDrawable,
|
||||
x, y, w, h);
|
||||
screen->copySubBuffer->copySubBuffer(private->driDrawable, x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
__glXDRIcontextDestroy(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
Bool retval;
|
||||
|
||||
context->driContext.destroyContext(&context->driContext);
|
||||
screen->core->destroyContext(context->driContext);
|
||||
|
||||
__glXenterServer(GL_FALSE);
|
||||
retval = DRIDestroyContext(baseContext->pGlxScreen->pScreen, context->hwContextID);
|
||||
retval = DRIDestroyContext(baseContext->pGlxScreen->pScreen,
|
||||
context->hwContextID);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
||||
__glXContextDestroy(&context->base);
|
||||
|
@ -309,20 +314,22 @@ static int
|
|||
__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||
|
||||
return (*context->driContext.bindContext)(&context->driContext,
|
||||
&draw->driDrawable,
|
||||
&read->driDrawable);
|
||||
return (*screen->core->bindContext)(context->driContext,
|
||||
draw->driDrawable,
|
||||
read->driDrawable);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
return (*context->driContext.unbindContext)(&context->driContext);
|
||||
return (*screen->core->unbindContext)(context->driContext);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -331,13 +338,10 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
|
|||
{
|
||||
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
|
||||
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
|
||||
|
||||
/* FIXME: We will need to add DRIcontext::copyContext for this. */
|
||||
|
||||
(void) dst;
|
||||
(void) src;
|
||||
|
||||
return FALSE;
|
||||
return (*screen->core->copyContext)(dst->driContext,
|
||||
src->driContext, mask);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -346,10 +350,11 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext)
|
|||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
return (*context->driContext.bindContext)(&context->driContext,
|
||||
&draw->driDrawable,
|
||||
&read->driDrawable);
|
||||
return (*screen->core->bindContext)(context->driContext,
|
||||
draw->driDrawable,
|
||||
read->driDrawable);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -392,10 +397,8 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
|
|||
int bpp, override = 0, texname;
|
||||
GLenum format, type;
|
||||
ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
|
||||
__GLXDRIdrawable *driDraw =
|
||||
containerOf(glxPixmap, __GLXDRIdrawable, base);
|
||||
__GLXDRIscreen * const screen =
|
||||
(__GLXDRIscreen *) glxGetScreen(pScreen);
|
||||
__GLXDRIdrawable *driDraw = (__GLXDRIdrawable *) glxPixmap;
|
||||
__GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
|
||||
|
||||
CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
|
||||
GL_TEXTURE_BINDING_2D :
|
||||
|
@ -439,7 +442,7 @@ alreadyin:
|
|||
|
||||
driDraw->texname = texname;
|
||||
|
||||
screen->texOffset->setTexOffset(&driDraw->ctx->driContext, texname, 0,
|
||||
screen->texOffset->setTexOffset(driDraw->ctx->driContext, texname, 0,
|
||||
pixmap->drawable.depth,
|
||||
pixmap->devKind);
|
||||
}
|
||||
|
@ -568,9 +571,11 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext,
|
|||
int buffer,
|
||||
__GLXdrawable *pixmap)
|
||||
{
|
||||
__glXDRIdoReleaseTexImage((__GLXDRIscreen *)
|
||||
glxGetScreen(pixmap->pDraw->pScreen),
|
||||
containerOf(pixmap, __GLXDRIdrawable, base));
|
||||
__GLXDRIscreen *screen =
|
||||
(__GLXDRIscreen *) glxGetScreen(pixmap->pDraw->pScreen);
|
||||
__GLXDRIdrawable *drawable = (__GLXDRIdrawable *) pixmap;
|
||||
|
||||
__glXDRIdoReleaseTexImage(screen, drawable);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
@ -585,7 +590,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
|
|||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
|
||||
screen->driScreen.destroyScreen(&screen->driScreen);
|
||||
screen->core->destroyScreen(screen->driScreen);
|
||||
|
||||
dlclose(screen->driver);
|
||||
|
||||
|
@ -596,11 +601,12 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
|
|||
|
||||
static __GLXcontext *
|
||||
__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXconfig *glxConfig,
|
||||
__GLXcontext *baseShareContext)
|
||||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
__GLXDRIcontext *context, *shareContext;
|
||||
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
|
||||
VisualPtr visual;
|
||||
int i;
|
||||
GLboolean retval;
|
||||
|
@ -610,7 +616,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
|||
|
||||
shareContext = (__GLXDRIcontext *) baseShareContext;
|
||||
if (shareContext)
|
||||
driShare = &shareContext->driContext;
|
||||
driShare = shareContext->driContext;
|
||||
else
|
||||
driShare = NULL;
|
||||
|
||||
|
@ -632,7 +638,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
|||
/* Find the requested X visual */
|
||||
visual = pScreen->visuals;
|
||||
for (i = 0; i < pScreen->numVisuals; i++, visual++)
|
||||
if (visual->vid == modes->visualID)
|
||||
if (visual->vid == glxConfig->visualID)
|
||||
break;
|
||||
if (i == pScreen->numVisuals)
|
||||
return GL_FALSE;
|
||||
|
@ -644,15 +650,15 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
|||
context->hwContextID, &hwContext);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
||||
context->driContext.private =
|
||||
screen->driScreen.createNewContext(&screen->driScreen,
|
||||
modes,
|
||||
context->driContext =
|
||||
screen->legacy->createNewContext(screen->driScreen,
|
||||
config->driConfig,
|
||||
0, /* render type */
|
||||
driShare,
|
||||
hwContext,
|
||||
&context->driContext);
|
||||
context);
|
||||
|
||||
if (context->driContext.private == NULL) {
|
||||
if (context->driContext == NULL) {
|
||||
__glXenterServer(GL_FALSE);
|
||||
retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
@ -668,9 +674,10 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
DrawablePtr pDraw,
|
||||
int type,
|
||||
XID drawId,
|
||||
__GLcontextModes *modes)
|
||||
__GLXconfig *glxConfig)
|
||||
{
|
||||
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
|
||||
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
|
||||
__GLXDRIdrawable *private;
|
||||
GLboolean retval;
|
||||
drm_drawable_t hwDrawable;
|
||||
|
@ -682,7 +689,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
memset(private, 0, sizeof *private);
|
||||
|
||||
if (!__glXDrawableInit(&private->base, screen,
|
||||
pDraw, type, drawId, modes)) {
|
||||
pDraw, type, drawId, glxConfig)) {
|
||||
xfree(private);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -700,13 +707,12 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
/* The last argument is 'attrs', which is used with pbuffers which
|
||||
* we currently don't support. */
|
||||
|
||||
private->driDrawable.private =
|
||||
(driScreen->driScreen.createNewDrawable)(&driScreen->driScreen,
|
||||
modes,
|
||||
&private->driDrawable,
|
||||
hwDrawable, 0, NULL);
|
||||
private->driDrawable =
|
||||
(driScreen->legacy->createNewDrawable)(driScreen->driScreen,
|
||||
config->driConfig,
|
||||
hwDrawable, 0, NULL, private);
|
||||
|
||||
if (private->driDrawable.private == NULL) {
|
||||
if (private->driDrawable == NULL) {
|
||||
__glXenterServer(GL_FALSE);
|
||||
DRIDestroyDrawable(screen->pScreen, serverClient, pDraw);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
@ -723,10 +729,10 @@ getDrawableInfo(__DRIdrawable *driDrawable,
|
|||
int *x, int *y, int *width, int *height,
|
||||
int *numClipRects, drm_clip_rect_t **ppClipRects,
|
||||
int *backX, int *backY,
|
||||
int *numBackClipRects, drm_clip_rect_t **ppBackClipRects)
|
||||
int *numBackClipRects, drm_clip_rect_t **ppBackClipRects,
|
||||
void *data)
|
||||
{
|
||||
__GLXDRIdrawable *drawable = containerOf(driDrawable,
|
||||
__GLXDRIdrawable, driDrawable);
|
||||
__GLXDRIdrawable *drawable = data;
|
||||
ScreenPtr pScreen;
|
||||
drm_clip_rect_t *pClipRects, *pBackClipRects;
|
||||
GLboolean retval;
|
||||
|
@ -810,10 +816,10 @@ getUST(int64_t *ust)
|
|||
static void __glXReportDamage(__DRIdrawable *driDraw,
|
||||
int x, int y,
|
||||
drm_clip_rect_t *rects, int num_rects,
|
||||
GLboolean front_buffer)
|
||||
GLboolean front_buffer,
|
||||
void *data)
|
||||
{
|
||||
__GLXDRIdrawable *drawable =
|
||||
containerOf(driDraw, __GLXDRIdrawable, driDrawable);
|
||||
__GLXDRIdrawable *drawable = data;
|
||||
DrawablePtr pDraw = drawable->base.pDraw;
|
||||
RegionRec region;
|
||||
|
||||
|
@ -827,19 +833,31 @@ static void __glXReportDamage(__DRIdrawable *driDraw,
|
|||
__glXleaveServer(GL_FALSE);
|
||||
}
|
||||
|
||||
/* Table of functions that we export to the driver. */
|
||||
static const __DRIinterfaceMethods interface_methods = {
|
||||
_gl_context_modes_create,
|
||||
_gl_context_modes_destroy,
|
||||
|
||||
getDrawableInfo,
|
||||
|
||||
static const __DRIsystemTimeExtension systemTimeExtension = {
|
||||
{ __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION },
|
||||
getUST,
|
||||
NULL, /* glXGetMscRateOML, */
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = {
|
||||
{ __DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION },
|
||||
getDrawableInfo
|
||||
};
|
||||
|
||||
static const __DRIdamageExtension damageExtension = {
|
||||
{ __DRI_DAMAGE, __DRI_DAMAGE_VERSION },
|
||||
__glXReportDamage,
|
||||
};
|
||||
|
||||
static const __DRIextension *loader_extensions[] = {
|
||||
&systemTimeExtension.base,
|
||||
&getDrawableInfoExtension.base,
|
||||
&damageExtension.base,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
static const char dri_driver_path[] = DRI_DRIVER_PATH;
|
||||
|
||||
static Bool
|
||||
|
@ -877,7 +895,8 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
const __DRIextension **extensions;
|
||||
int i;
|
||||
|
||||
extensions = screen->driScreen.getExtensions(&screen->driScreen);
|
||||
extensions = screen->core->getExtensions(screen->driScreen);
|
||||
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
#ifdef __DRI_COPY_SUB_BUFFER
|
||||
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
|
||||
|
@ -911,12 +930,12 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
}
|
||||
}
|
||||
|
||||
#define COPY_SUB_BUFFER_INTERNAL_VERSION 20060314
|
||||
extern __GLXconfig *
|
||||
glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs);
|
||||
|
||||
static __GLXscreen *
|
||||
__glXDRIscreenProbe(ScreenPtr pScreen)
|
||||
{
|
||||
PFNCREATENEWSCREENFUNC createNewScreen;
|
||||
drm_handle_t hSAREA;
|
||||
drmAddress pSAREA = NULL;
|
||||
char *BusID;
|
||||
|
@ -926,7 +945,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
__DRIframebuffer framebuffer;
|
||||
int fd = -1;
|
||||
int status;
|
||||
int api_ver = 20070121;
|
||||
drm_magic_t magic;
|
||||
drmVersionPtr version;
|
||||
int newlyopened;
|
||||
|
@ -934,11 +952,13 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
drm_handle_t hFB;
|
||||
int junk;
|
||||
__GLXDRIscreen *screen;
|
||||
void *dev_priv = NULL;
|
||||
char filename[128];
|
||||
Bool isCapable;
|
||||
size_t buffer_size;
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
const __DRIconfig **driConfigs;
|
||||
const __DRIextension **extensions;
|
||||
int i;
|
||||
|
||||
if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
|
||||
!DRIQueryDirectRenderingCapable(pScreen, &isCapable) ||
|
||||
|
@ -966,9 +986,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
dri_version.minor = XF86DRI_MINOR_VERSION;
|
||||
dri_version.patch = XF86DRI_PATCH_VERSION;
|
||||
|
||||
framebuffer.base = NULL;
|
||||
framebuffer.dev_priv = NULL;
|
||||
|
||||
if (!DRIOpenConnection(pScreen, &hSAREA, &BusID)) {
|
||||
LogMessage(X_ERROR, "AIGLX error: DRIOpenConnection failed\n");
|
||||
goto handle_error;
|
||||
|
@ -1027,10 +1044,29 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
goto handle_error;
|
||||
}
|
||||
|
||||
createNewScreen = dlsym(screen->driver, CREATE_NEW_SCREEN_FUNC);
|
||||
if (createNewScreen == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: dlsym for %s failed (%s)\n",
|
||||
CREATE_NEW_SCREEN_FUNC, dlerror());
|
||||
extensions = dlsym(screen->driver, __DRI_DRIVER_EXTENSIONS);
|
||||
if (extensions == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n",
|
||||
driverName, dlerror());
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
if (strcmp(extensions[i]->name, __DRI_CORE) == 0 &&
|
||||
extensions[i]->version >= __DRI_CORE_VERSION) {
|
||||
screen->core = (__DRIcoreExtension *) extensions[i];
|
||||
}
|
||||
|
||||
if (strcmp(extensions[i]->name, __DRI_LEGACY) == 0 &&
|
||||
extensions[i]->version >= __DRI_LEGACY_VERSION) {
|
||||
screen->legacy = (__DRIlegacyExtension *) extensions[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (screen->core == NULL || screen->legacy == NULL) {
|
||||
LogMessage(X_ERROR,
|
||||
"AIGLX error: %s does not export required DRI extension\n",
|
||||
driverName);
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
|
@ -1047,19 +1083,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
goto handle_error;
|
||||
}
|
||||
|
||||
/* Sigh... the DRI interface is broken; the DRI driver will free
|
||||
* the dev private pointer using _mesa_free() on screen destroy,
|
||||
* but we can't use _mesa_malloc() here. In fact, the DRI driver
|
||||
* shouldn't free data it didn't allocate itself, but what can you
|
||||
* do... */
|
||||
dev_priv = xalloc(framebuffer.dev_priv_size);
|
||||
if (dev_priv == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: dev_priv allocation failed");
|
||||
goto handle_error;
|
||||
}
|
||||
memcpy(dev_priv, framebuffer.dev_priv, framebuffer.dev_priv_size);
|
||||
framebuffer.dev_priv = dev_priv;
|
||||
|
||||
framebuffer.width = pScreen->width;
|
||||
framebuffer.height = pScreen->height;
|
||||
|
||||
|
@ -1082,29 +1105,30 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
goto handle_error;
|
||||
}
|
||||
|
||||
screen->driScreen.private =
|
||||
(*createNewScreen)(pScreen->myNum,
|
||||
&screen->driScreen,
|
||||
screen->driScreen =
|
||||
(*screen->legacy->createNewScreen)(pScreen->myNum,
|
||||
&ddx_version,
|
||||
&dri_version,
|
||||
&drm_version,
|
||||
&framebuffer,
|
||||
pSAREA,
|
||||
fd,
|
||||
api_ver,
|
||||
&interface_methods,
|
||||
&screen->base.fbconfigs);
|
||||
loader_extensions,
|
||||
&driConfigs,
|
||||
screen);
|
||||
|
||||
if (screen->driScreen.private == NULL) {
|
||||
if (screen->driScreen == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed");
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
|
||||
&screen->texOffsetFinish);
|
||||
screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs);
|
||||
|
||||
initializeExtensions(screen);
|
||||
|
||||
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
|
||||
&screen->texOffsetFinish);
|
||||
|
||||
__glXScreenInit(&screen->base, pScreen);
|
||||
|
||||
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
|
||||
|
@ -1137,9 +1161,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
if (framebuffer.base != NULL)
|
||||
drmUnmap((drmAddress)framebuffer.base, framebuffer.size);
|
||||
|
||||
if (dev_priv != NULL)
|
||||
xfree(dev_priv);
|
||||
|
||||
if (fd >= 0)
|
||||
drmCloseOnce(fd);
|
||||
|
||||
|
|
443
GL/glx/glxdri2.c
443
GL/glx/glxdri2.c
|
@ -35,20 +35,18 @@
|
|||
#include <drm.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/internal/dri_interface.h>
|
||||
#include <GL/glxtokens.h>
|
||||
|
||||
#include <windowstr.h>
|
||||
#include <os.h>
|
||||
|
||||
#define _XF86DRI_SERVER_
|
||||
#include <xf86drm.h>
|
||||
#include <xf86dristr.h>
|
||||
#include <xf86str.h>
|
||||
#include <xf86.h>
|
||||
#include <dri2.h>
|
||||
|
||||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
#include "g_disptab.h"
|
||||
#include "glapitable.h"
|
||||
|
@ -57,53 +55,56 @@
|
|||
#include "dispatch.h"
|
||||
#include "extension_string.h"
|
||||
|
||||
#define containerOf(ptr, type, member) \
|
||||
(type *)( (char *)ptr - offsetof(type,member) )
|
||||
|
||||
typedef struct __GLXDRIscreen __GLXDRIscreen;
|
||||
typedef struct __GLXDRIcontext __GLXDRIcontext;
|
||||
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
|
||||
typedef struct __GLXDRIconfig __GLXDRIconfig;
|
||||
|
||||
struct __GLXDRIscreen {
|
||||
__GLXscreen base;
|
||||
__DRIscreen driScreen;
|
||||
__DRIscreen *driScreen;
|
||||
void *driver;
|
||||
int fd;
|
||||
|
||||
xf86EnterVTProc *enterVT;
|
||||
xf86LeaveVTProc *leaveVT;
|
||||
|
||||
__DRIcopySubBufferExtension *copySubBuffer;
|
||||
__DRIswapControlExtension *swapControl;
|
||||
__DRItexBufferExtension *texBuffer;
|
||||
const __DRIcoreExtension *core;
|
||||
const __DRIcopySubBufferExtension *copySubBuffer;
|
||||
const __DRIswapControlExtension *swapControl;
|
||||
const __DRItexBufferExtension *texBuffer;
|
||||
|
||||
unsigned char glx_enable_bits[__GLX_EXT_BYTES];
|
||||
};
|
||||
|
||||
struct __GLXDRIcontext {
|
||||
__GLXcontext base;
|
||||
__DRIcontext driContext;
|
||||
drm_context_t hwContext;
|
||||
__DRIcontext *driContext;
|
||||
};
|
||||
|
||||
struct __GLXDRIdrawable {
|
||||
__GLXdrawable base;
|
||||
__DRIdrawable driDrawable;
|
||||
__DRIdrawable *driDrawable;
|
||||
__GLXDRIscreen *screen;
|
||||
};
|
||||
|
||||
static const char CREATE_NEW_SCREEN_FUNC[] = __DRI2_CREATE_NEW_SCREEN_STRING;
|
||||
struct __GLXDRIconfig {
|
||||
__GLXconfig config;
|
||||
const __DRIconfig *driConfig;
|
||||
};
|
||||
|
||||
static void
|
||||
__glXDRIdrawableDestroy(__GLXdrawable *drawable)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
||||
const __DRIcoreExtension *core = private->screen->core;
|
||||
|
||||
(*private->driDrawable.destroyDrawable)(&private->driDrawable);
|
||||
(*core->destroyDrawable)(private->driDrawable);
|
||||
|
||||
/* If the X window was destroyed, the dri DestroyWindow hook will
|
||||
* aready have taken care of this, so only call if pDraw isn't NULL. */
|
||||
if (drawable->pDraw != NULL)
|
||||
DRI2DestroyDrawable(drawable->pDraw->pScreen, drawable->pDraw);
|
||||
DRI2DestroyDrawable(drawable->pDraw);
|
||||
|
||||
xfree(private);
|
||||
}
|
||||
|
@ -118,25 +119,25 @@ __glXDRIdrawableResize(__GLXdrawable *glxPriv)
|
|||
}
|
||||
|
||||
static GLboolean
|
||||
__glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
|
||||
__glXDRIdrawableSwapBuffers(__GLXdrawable *drawable)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
||||
const __DRIcoreExtension *core = private->screen->core;
|
||||
|
||||
(*private->driDrawable.swapBuffers)(&private->driDrawable);
|
||||
(*core->swapBuffers)(private->driDrawable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval)
|
||||
__glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval)
|
||||
{
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||
glxGetScreen(baseDrawable->pDraw->pScreen);
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
||||
const __DRIswapControlExtension *swapControl = private->screen->swapControl;
|
||||
|
||||
if (screen->swapControl)
|
||||
screen->swapControl->setSwapInterval(&draw->driDrawable, interval);
|
||||
if (swapControl)
|
||||
swapControl->setSwapInterval(private->driDrawable, interval);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -147,22 +148,20 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
|
|||
int x, int y, int w, int h)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||
glxGetScreen(basePrivate->pDraw->pScreen);
|
||||
const __DRIcopySubBufferExtension *copySubBuffer =
|
||||
private->screen->copySubBuffer;
|
||||
|
||||
if (screen->copySubBuffer)
|
||||
screen->copySubBuffer->copySubBuffer(&private->driDrawable,
|
||||
x, y, w, h);
|
||||
if (copySubBuffer)
|
||||
(*copySubBuffer->copySubBuffer)(private->driDrawable, x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
__glXDRIcontextDestroy(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseContext->pGlxScreen;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
context->driContext.destroyContext(&context->driContext);
|
||||
drmDestroyContext(screen->fd, context->hwContext);
|
||||
(*screen->core->destroyContext)(context->driContext);
|
||||
__glXContextDestroy(&context->base);
|
||||
xfree(context);
|
||||
}
|
||||
|
@ -173,18 +172,20 @@ __glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
|
|||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
return (*context->driContext.bindContext)(&context->driContext,
|
||||
&draw->driDrawable,
|
||||
&read->driDrawable);
|
||||
return (*screen->core->bindContext)(context->driContext,
|
||||
draw->driDrawable,
|
||||
read->driDrawable);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
return (*context->driContext.unbindContext)(&context->driContext);
|
||||
return (*screen->core->unbindContext)(context->driContext);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -193,13 +194,10 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
|
|||
{
|
||||
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
|
||||
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
|
||||
|
||||
/* FIXME: We will need to add DRIcontext::copyContext for this. */
|
||||
|
||||
(void) dst;
|
||||
(void) src;
|
||||
|
||||
return FALSE;
|
||||
return (*screen->core->copyContext)(dst->driContext,
|
||||
src->driContext, mask);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -208,46 +206,30 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext)
|
|||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
return (*context->driContext.bindContext)(&context->driContext,
|
||||
&draw->driDrawable,
|
||||
&read->driDrawable);
|
||||
return (*screen->core->bindContext)(context->driContext,
|
||||
draw->driDrawable,
|
||||
read->driDrawable);
|
||||
}
|
||||
|
||||
#ifdef __DRI_TEX_BUFFER
|
||||
|
||||
#define isPowerOfTwo(n) (((n) & ((n) - 1 )) == 0)
|
||||
|
||||
static int
|
||||
__glXDRIbindTexImage(__GLXcontext *baseContext,
|
||||
int buffer,
|
||||
__GLXdrawable *glxPixmap)
|
||||
{
|
||||
ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
|
||||
__GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
|
||||
PixmapPtr pixmap;
|
||||
__GLXDRIdrawable *drawable = (__GLXDRIdrawable *) glxPixmap;
|
||||
const __DRItexBufferExtension *texBuffer = drawable->screen->texBuffer;
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
unsigned int flags;
|
||||
int w, h, target;
|
||||
|
||||
if (screen->texBuffer == NULL)
|
||||
if (texBuffer == NULL)
|
||||
return Success;
|
||||
|
||||
pixmap = (PixmapPtr) glxPixmap->pDraw;
|
||||
w = pixmap->drawable.width;
|
||||
h = pixmap->drawable.height;
|
||||
|
||||
if (!isPowerOfTwo(w) || !isPowerOfTwo(h))
|
||||
target = GL_TEXTURE_RECTANGLE_ARB;
|
||||
else
|
||||
target = GL_TEXTURE_2D;
|
||||
|
||||
screen->texBuffer->setTexBuffer(&context->driContext,
|
||||
target,
|
||||
DRI2GetPixmapHandle(pixmap, &flags),
|
||||
pixmap->drawable.depth,
|
||||
pixmap->devKind,
|
||||
h);
|
||||
texBuffer->setTexBuffer(context->driContext,
|
||||
glxPixmap->target,
|
||||
drawable->driDrawable);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
@ -291,7 +273,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
|
|||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
|
||||
screen->driScreen.destroyScreen(&screen->driScreen);
|
||||
(*screen->core->destroyScreen)(screen->driScreen);
|
||||
|
||||
dlclose(screen->driver);
|
||||
|
||||
|
@ -302,16 +284,18 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
|
|||
|
||||
static __GLXcontext *
|
||||
__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXconfig *glxConfig,
|
||||
__GLXcontext *baseShareContext)
|
||||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
__GLXDRIcontext *context, *shareContext;
|
||||
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
|
||||
const __DRIcoreExtension *core = screen->core;
|
||||
__DRIcontext *driShare;
|
||||
|
||||
shareContext = (__GLXDRIcontext *) baseShareContext;
|
||||
if (shareContext)
|
||||
driShare = &shareContext->driContext;
|
||||
driShare = shareContext->driContext;
|
||||
else
|
||||
driShare = NULL;
|
||||
|
||||
|
@ -327,16 +311,9 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
|||
context->base.forceCurrent = __glXDRIcontextForceCurrent;
|
||||
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
|
||||
|
||||
if (drmCreateContext(screen->fd, &context->hwContext))
|
||||
return GL_FALSE;
|
||||
|
||||
context->driContext.private =
|
||||
screen->driScreen.createNewContext(&screen->driScreen,
|
||||
modes,
|
||||
0, /* render type */
|
||||
driShare,
|
||||
context->hwContext,
|
||||
&context->driContext);
|
||||
context->driContext =
|
||||
(*core->createNewContext)(screen->driScreen,
|
||||
config->driConfig, driShare, context);
|
||||
|
||||
return &context->base;
|
||||
}
|
||||
|
@ -346,12 +323,13 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
DrawablePtr pDraw,
|
||||
int type,
|
||||
XID drawId,
|
||||
__GLcontextModes *modes)
|
||||
__GLXconfig *glxConfig)
|
||||
{
|
||||
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
|
||||
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
|
||||
__GLXDRIdrawable *private;
|
||||
GLboolean retval;
|
||||
drm_drawable_t hwDrawable;
|
||||
unsigned int handle, head;
|
||||
|
||||
private = xalloc(sizeof *private);
|
||||
if (private == NULL)
|
||||
|
@ -359,8 +337,9 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
|
||||
memset(private, 0, sizeof *private);
|
||||
|
||||
private->screen = driScreen;
|
||||
if (!__glXDrawableInit(&private->base, screen,
|
||||
pDraw, type, drawId, modes)) {
|
||||
pDraw, type, drawId, glxConfig)) {
|
||||
xfree(private);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -370,13 +349,12 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
|
||||
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
|
||||
|
||||
retval = DRI2CreateDrawable(screen->pScreen, pDraw, &hwDrawable);
|
||||
retval = DRI2CreateDrawable(pDraw, &handle, &head);
|
||||
|
||||
private->driDrawable.private =
|
||||
(driScreen->driScreen.createNewDrawable)(&driScreen->driScreen,
|
||||
modes,
|
||||
&private->driDrawable,
|
||||
hwDrawable, 0, NULL);
|
||||
private->driDrawable =
|
||||
(*driScreen->core->createNewDrawable)(driScreen->driScreen,
|
||||
config->driConfig,
|
||||
handle, head, private);
|
||||
|
||||
return &private->base;
|
||||
}
|
||||
|
@ -397,33 +375,44 @@ getUST(int64_t *ust)
|
|||
}
|
||||
}
|
||||
|
||||
static void __glXReportDamage(__DRIdrawable *driDraw,
|
||||
int x, int y,
|
||||
drm_clip_rect_t *rects, int num_rects,
|
||||
GLboolean front_buffer)
|
||||
static const __DRIsystemTimeExtension systemTimeExtension = {
|
||||
{ __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION },
|
||||
getUST,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static void dri2ReemitDrawableInfo(__DRIdrawable *draw, unsigned int *tail,
|
||||
void *loaderPrivate)
|
||||
{
|
||||
__GLXDRIdrawable *drawable =
|
||||
containerOf(driDraw, __GLXDRIdrawable, driDrawable);
|
||||
__GLXDRIdrawable *pdraw = loaderPrivate;
|
||||
|
||||
DRI2ReemitDrawableInfo(pdraw->base.pDraw, tail);
|
||||
}
|
||||
|
||||
static void dri2PostDamage(__DRIdrawable *draw,
|
||||
struct drm_clip_rect *rects,
|
||||
int numRects, void *loaderPrivate)
|
||||
{
|
||||
__GLXDRIdrawable *drawable = loaderPrivate;
|
||||
DrawablePtr pDraw = drawable->base.pDraw;
|
||||
RegionRec region;
|
||||
|
||||
REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, num_rects);
|
||||
REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, numRects);
|
||||
REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y);
|
||||
DamageDamageRegion(pDraw, ®ion);
|
||||
REGION_UNINIT(pDraw->pScreen, ®ion);
|
||||
}
|
||||
|
||||
/* Table of functions that we export to the driver. */
|
||||
static const __DRIinterfaceMethods interface_methods = {
|
||||
_gl_context_modes_create,
|
||||
_gl_context_modes_destroy,
|
||||
static const __DRIloaderExtension loaderExtension = {
|
||||
{ __DRI_LOADER, __DRI_LOADER_VERSION },
|
||||
dri2ReemitDrawableInfo,
|
||||
dri2PostDamage
|
||||
};
|
||||
|
||||
NULL,
|
||||
|
||||
getUST,
|
||||
NULL,
|
||||
|
||||
__glXReportDamage,
|
||||
static const __DRIextension *loader_extensions[] = {
|
||||
&systemTimeExtension.base,
|
||||
&loaderExtension.base,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char dri_driver_path[] = DRI_DRIVER_PATH;
|
||||
|
@ -463,11 +452,13 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
const __DRIextension **extensions;
|
||||
int i;
|
||||
|
||||
extensions = screen->driScreen.getExtensions(&screen->driScreen);
|
||||
extensions = screen->core->getExtensions(screen->driScreen);
|
||||
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
#ifdef __DRI_COPY_SUB_BUFFER
|
||||
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
|
||||
screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
|
||||
screen->copySubBuffer =
|
||||
(const __DRIcopySubBufferExtension *) extensions[i];
|
||||
__glXEnableExtension(screen->glx_enable_bits,
|
||||
"GLX_MESA_copy_sub_buffer");
|
||||
|
||||
|
@ -477,7 +468,8 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
|
||||
#ifdef __DRI_SWAP_CONTROL
|
||||
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
|
||||
screen->swapControl = (__DRIswapControlExtension *) extensions[i];
|
||||
screen->swapControl =
|
||||
(const __DRIswapControlExtension *) extensions[i];
|
||||
__glXEnableExtension(screen->glx_enable_bits,
|
||||
"GLX_SGI_swap_control");
|
||||
__glXEnableExtension(screen->glx_enable_bits,
|
||||
|
@ -489,7 +481,8 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
|
||||
#ifdef __DRI_TEX_BUFFER
|
||||
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
|
||||
screen->texBuffer = (__DRItexBufferExtension *) extensions[i];
|
||||
screen->texBuffer =
|
||||
(const __DRItexBufferExtension *) extensions[i];
|
||||
/* GLX_EXT_texture_from_pixmap is always enabled. */
|
||||
LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n");
|
||||
}
|
||||
|
@ -498,20 +491,168 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
}
|
||||
}
|
||||
|
||||
#define __ATTRIB(attrib, field) \
|
||||
{ attrib, offsetof(__GLXconfig, field) }
|
||||
|
||||
static const struct { unsigned int attrib, offset; } attribMap[] = {
|
||||
__ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
|
||||
__ATTRIB(__DRI_ATTRIB_LEVEL, level),
|
||||
__ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
|
||||
__ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
|
||||
__ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
|
||||
__ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
|
||||
__ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
|
||||
__ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
|
||||
__ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
|
||||
__ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
|
||||
__ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
|
||||
__ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
|
||||
__ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode),
|
||||
__ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
|
||||
__ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
|
||||
__ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
|
||||
__ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
|
||||
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
|
||||
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
|
||||
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
|
||||
__ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
|
||||
};
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
|
||||
|
||||
static void
|
||||
setScalar(__GLXconfig *config, unsigned int attrib, unsigned int value)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(attribMap); i++)
|
||||
if (attribMap[i].attrib == attrib) {
|
||||
*(unsigned int *) ((char *) config + attribMap[i].offset) = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static __GLXconfig *
|
||||
createModeFromConfig(const __DRIcoreExtension *core,
|
||||
const __DRIconfig *driConfig,
|
||||
unsigned int visualType)
|
||||
{
|
||||
__GLXDRIconfig *config;
|
||||
unsigned int attrib, value;
|
||||
int i;
|
||||
|
||||
config = xalloc(sizeof *config);
|
||||
|
||||
config->driConfig = driConfig;
|
||||
|
||||
i = 0;
|
||||
while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
|
||||
switch (attrib) {
|
||||
case __DRI_ATTRIB_RENDER_TYPE:
|
||||
if (value & __DRI_ATTRIB_RGBA_BIT) {
|
||||
config->config.renderType |= GLX_RGBA_BIT;
|
||||
config->config.rgbMode = GL_TRUE;
|
||||
} else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
|
||||
config->config.renderType |= GLX_COLOR_INDEX_BIT;
|
||||
config->config.rgbMode = GL_FALSE;
|
||||
} else {
|
||||
config->config.renderType = 0;
|
||||
config->config.rgbMode = GL_FALSE;
|
||||
}
|
||||
break;
|
||||
case __DRI_ATTRIB_CONFIG_CAVEAT:
|
||||
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
|
||||
config->config.visualRating = GLX_NON_CONFORMANT_CONFIG;
|
||||
else if (value & __DRI_ATTRIB_SLOW_BIT)
|
||||
config->config.visualRating = GLX_SLOW_CONFIG;
|
||||
else
|
||||
config->config.visualRating = GLX_NONE;
|
||||
break;
|
||||
case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
|
||||
config->config.bindToTextureTargets = 0;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
|
||||
config->config.bindToTextureTargets |= GLX_TEXTURE_1D_BIT_EXT;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
|
||||
config->config.bindToTextureTargets |= GLX_TEXTURE_2D_BIT_EXT;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
|
||||
config->config.bindToTextureTargets |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
|
||||
break;
|
||||
default:
|
||||
setScalar(&config->config, attrib, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
config->config.next = NULL;
|
||||
config->config.xRenderable = GL_TRUE;
|
||||
config->config.visualType = visualType;
|
||||
config->config.drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
|
||||
|
||||
return &config->config;
|
||||
}
|
||||
|
||||
__GLXconfig *
|
||||
glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs);
|
||||
|
||||
__GLXconfig *
|
||||
glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs)
|
||||
{
|
||||
__GLXconfig head, *tail;
|
||||
int i;
|
||||
|
||||
tail = &head;
|
||||
head.next = NULL;
|
||||
|
||||
for (i = 0; configs[i]; i++) {
|
||||
tail->next = createModeFromConfig(core,
|
||||
configs[i], GLX_TRUE_COLOR);
|
||||
if (tail->next == NULL)
|
||||
break;
|
||||
|
||||
tail = tail->next;
|
||||
}
|
||||
|
||||
for (i = 0; configs[i]; i++) {
|
||||
tail->next = createModeFromConfig(core,
|
||||
configs[i], GLX_DIRECT_COLOR);
|
||||
if (tail->next == NULL)
|
||||
break;
|
||||
|
||||
tail = tail->next;
|
||||
}
|
||||
|
||||
return head.next;
|
||||
}
|
||||
|
||||
static __GLXscreen *
|
||||
__glXDRIscreenProbe(ScreenPtr pScreen)
|
||||
{
|
||||
__DRI2_CREATE_NEW_SCREEN_FUNC *createNewScreen;
|
||||
__DRIversion ddx_version;
|
||||
__DRIversion dri_version;
|
||||
__DRIversion drm_version;
|
||||
drmVersionPtr version;
|
||||
const char *driverName;
|
||||
__GLXDRIscreen *screen;
|
||||
char filename[128];
|
||||
size_t buffer_size;
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
unsigned int sareaHandle;
|
||||
const __DRIextension **extensions;
|
||||
const __DRIconfig **driConfigs;
|
||||
int i;
|
||||
|
||||
screen = xalloc(sizeof *screen);
|
||||
if (screen == NULL)
|
||||
|
@ -519,13 +660,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
memset(screen, 0, sizeof *screen);
|
||||
|
||||
if (!xf86LoaderCheckSymbol("DRI2Connect") ||
|
||||
!DRI2Connect(pScreen,
|
||||
&screen->fd,
|
||||
&driverName,
|
||||
&ddx_version.major,
|
||||
&ddx_version.minor,
|
||||
&ddx_version.patch,
|
||||
&sareaHandle)) {
|
||||
!DRI2Connect(pScreen, &screen->fd, &driverName, &sareaHandle)) {
|
||||
LogMessage(X_INFO,
|
||||
"AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
|
||||
return NULL;
|
||||
|
@ -539,26 +674,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
|
||||
__glXInitExtensionEnableBits(screen->glx_enable_bits);
|
||||
|
||||
/* DRI protocol version. */
|
||||
dri_version.major = XF86DRI_MAJOR_VERSION;
|
||||
dri_version.minor = XF86DRI_MINOR_VERSION;
|
||||
dri_version.patch = XF86DRI_PATCH_VERSION;
|
||||
|
||||
version = drmGetVersion(screen->fd);
|
||||
if (version) {
|
||||
drm_version.major = version->version_major;
|
||||
drm_version.minor = version->version_minor;
|
||||
drm_version.patch = version->version_patchlevel;
|
||||
drmFreeVersion(version);
|
||||
}
|
||||
else {
|
||||
drm_version.major = -1;
|
||||
drm_version.minor = -1;
|
||||
drm_version.patch = -1;
|
||||
}
|
||||
|
||||
snprintf(filename, sizeof filename, "%s/%s_dri.so",
|
||||
dri_driver_path, driverName);
|
||||
snprintf(filename, sizeof filename,
|
||||
"%s/%s_dri.so", dri_driver_path, driverName);
|
||||
|
||||
screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
|
||||
if (screen->driver == NULL) {
|
||||
|
@ -567,31 +684,43 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
goto handle_error;
|
||||
}
|
||||
|
||||
createNewScreen = dlsym(screen->driver, CREATE_NEW_SCREEN_FUNC);
|
||||
if (createNewScreen == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: dlsym for %s failed (%s)\n",
|
||||
CREATE_NEW_SCREEN_FUNC, dlerror());
|
||||
extensions = dlsym(screen->driver, __DRI_DRIVER_EXTENSIONS);
|
||||
if (extensions == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n",
|
||||
driverName, dlerror());
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
screen->driScreen.private =
|
||||
(*createNewScreen)(pScreen->myNum,
|
||||
&screen->driScreen,
|
||||
&ddx_version,
|
||||
&dri_version,
|
||||
&drm_version,
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
if (strcmp(extensions[i]->name, __DRI_CORE) == 0 &&
|
||||
extensions[i]->version >= __DRI_CORE_VERSION) {
|
||||
screen->core = (const __DRIcoreExtension *) extensions[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (screen->core == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: %s exports no DRI extension\n",
|
||||
driverName);
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
screen->driScreen =
|
||||
(*screen->core->createNewScreen)(pScreen->myNum,
|
||||
screen->fd,
|
||||
sareaHandle,
|
||||
&interface_methods,
|
||||
&screen->base.fbconfigs);
|
||||
loader_extensions,
|
||||
&driConfigs,
|
||||
screen);
|
||||
|
||||
if (screen->driScreen.private == NULL) {
|
||||
if (screen->driScreen == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed");
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
initializeExtensions(screen);
|
||||
|
||||
screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs);
|
||||
|
||||
__glXScreenInit(&screen->base, pScreen);
|
||||
|
||||
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
|
||||
|
|
|
@ -46,7 +46,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <glxcontext.h>
|
||||
#include <glxutil.h>
|
||||
|
||||
#include "glcontextmodes.h"
|
||||
#include "os.h"
|
||||
|
||||
typedef struct __GLXMESAscreen __GLXMESAscreen;
|
||||
|
@ -120,7 +119,7 @@ static __GLXdrawable *
|
|||
__glXMesaScreenCreateDrawable(__GLXscreen *screen,
|
||||
DrawablePtr pDraw, int type,
|
||||
XID drawId,
|
||||
__GLcontextModes *modes)
|
||||
__GLXconfig *modes)
|
||||
{
|
||||
__GLXMESAdrawable *glxPriv;
|
||||
XMesaVisual xm_vis;
|
||||
|
@ -217,7 +216,7 @@ __glXMesaContextForceCurrent(__GLXcontext *baseContext)
|
|||
|
||||
static __GLXcontext *
|
||||
__glXMesaScreenCreateContext(__GLXscreen *screen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXconfig *config,
|
||||
__GLXcontext *baseShareContext)
|
||||
{
|
||||
__GLXMESAcontext *context;
|
||||
|
@ -232,7 +231,7 @@ __glXMesaScreenCreateContext(__GLXscreen *screen,
|
|||
memset(context, 0, sizeof *context);
|
||||
|
||||
context->base.pGlxScreen = screen;
|
||||
context->base.modes = modes;
|
||||
context->base.config = config;
|
||||
|
||||
context->base.destroy = __glXMesaContextDestroy;
|
||||
context->base.makeCurrent = __glXMesaContextMakeCurrent;
|
||||
|
@ -240,10 +239,10 @@ __glXMesaScreenCreateContext(__GLXscreen *screen,
|
|||
context->base.copy = __glXMesaContextCopy;
|
||||
context->base.forceCurrent = __glXMesaContextForceCurrent;
|
||||
|
||||
xm_vis = find_mesa_visual(screen, modes->fbconfigID);
|
||||
xm_vis = find_mesa_visual(screen, config->fbconfigID);
|
||||
if (!xm_vis) {
|
||||
ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
|
||||
modes->visualID);
|
||||
config->visualID);
|
||||
xfree(context);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -282,11 +281,11 @@ static XMesaVisual
|
|||
find_mesa_visual(__GLXscreen *screen, XID fbconfigID)
|
||||
{
|
||||
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
|
||||
const __GLcontextModes *modes;
|
||||
const __GLXconfig *config;
|
||||
unsigned i = 0;
|
||||
|
||||
for (modes = screen->fbconfigs; modes != NULL; modes = modes->next) {
|
||||
if (modes->fbconfigID == fbconfigID)
|
||||
for (config = screen->fbconfigs; config != NULL; config = config->next) {
|
||||
if (config->fbconfigID == fbconfigID)
|
||||
return mesaScreen->xm_vis[i];
|
||||
i++;
|
||||
}
|
||||
|
@ -298,9 +297,18 @@ const static int numBack = 2;
|
|||
const static int numDepth = 2;
|
||||
const static int numStencil = 2;
|
||||
|
||||
static __GLcontextModes *
|
||||
static const int glx_visual_types[] = {
|
||||
GLX_STATIC_GRAY,
|
||||
GLX_GRAY_SCALE,
|
||||
GLX_STATIC_COLOR,
|
||||
GLX_PSEUDO_COLOR,
|
||||
GLX_TRUE_COLOR,
|
||||
GLX_DIRECT_COLOR
|
||||
};
|
||||
|
||||
static __GLXconfig *
|
||||
createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
|
||||
VisualPtr visual, __GLcontextModes *config)
|
||||
VisualPtr visual, __GLXconfig *config)
|
||||
{
|
||||
int back, depth, stencil;
|
||||
|
||||
|
@ -309,7 +317,10 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
|
|||
for (back = numBack - 1; back >= 0; back--)
|
||||
for (depth = 0; depth < numDepth; depth++)
|
||||
for (stencil = 0; stencil < numStencil; stencil++) {
|
||||
config->visualType = _gl_convert_from_x_visual_type(visual->class);
|
||||
config->next = xalloc(sizeof *config);
|
||||
config = config->next;
|
||||
|
||||
config->visualType = glx_visual_types[visual->class];
|
||||
config->xRenderable = GL_TRUE;
|
||||
config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
|
||||
config->rgbMode = (visual->class >= TrueColor);
|
||||
|
@ -333,7 +344,6 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
|
|||
config->alphaMask = 0;
|
||||
config->rgbBits = config->rgbMode ? visual->nplanes : 0;
|
||||
config->indexBits = config->colorIndexMode ? visual->nplanes : 0;
|
||||
config = config->next;
|
||||
}
|
||||
|
||||
return config;
|
||||
|
@ -342,26 +352,27 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
|
|||
static void
|
||||
createFBConfigs(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
|
||||
{
|
||||
__GLcontextModes *configs;
|
||||
__GLXconfig head, *tail;
|
||||
int i;
|
||||
|
||||
/* We assume here that each existing visual correspond to a
|
||||
* different visual class. Note, this runs before COMPOSITE adds
|
||||
* its visual, so it's not entirely crazy. */
|
||||
pGlxScreen->numFBConfigs = pScreen->numVisuals * numBack * numDepth * numStencil;
|
||||
pGlxScreen->fbconfigs = _gl_context_modes_create(pGlxScreen->numFBConfigs,
|
||||
sizeof *configs);
|
||||
|
||||
configs = pGlxScreen->fbconfigs;
|
||||
head.next = NULL;
|
||||
tail = &head;
|
||||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
configs = createFBConfigsForVisual(pGlxScreen, pScreen,
|
||||
&pScreen->visuals[i], configs);
|
||||
tail = createFBConfigsForVisual(pGlxScreen, pScreen,
|
||||
&pScreen->visuals[i], tail);
|
||||
|
||||
pGlxScreen->fbconfigs = head.next;
|
||||
}
|
||||
|
||||
static void
|
||||
createMesaVisuals(__GLXMESAscreen *pMesaScreen)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
ScreenPtr pScreen;
|
||||
VisualPtr visual = NULL;
|
||||
int i, j;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <GL/glxtokens.h>
|
||||
#include <string.h>
|
||||
#include <windowstr.h>
|
||||
#include <os.h>
|
||||
|
@ -46,7 +47,6 @@
|
|||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
#include "glxext.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
static DevPrivateKey glxScreenPrivateKey = &glxScreenPrivateKey;
|
||||
|
||||
|
@ -280,10 +280,23 @@ void GlxSetVisualConfigs(int nconfigs,
|
|||
* call it. */
|
||||
}
|
||||
|
||||
GLint glxConvertToXVisualType(int visualType)
|
||||
{
|
||||
static const int x_visual_types[] = {
|
||||
TrueColor, DirectColor,
|
||||
PseudoColor, StaticColor,
|
||||
GrayScale, StaticGray
|
||||
};
|
||||
|
||||
return ( (unsigned) (visualType - GLX_TRUE_COLOR) < 6 )
|
||||
? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
filterOutNativeConfigs(__GLXscreen *pGlxScreen)
|
||||
{
|
||||
__GLcontextModes *m, *next, *native_modes, **last;
|
||||
__GLXconfig *m, *next, **last;
|
||||
ScreenPtr pScreen = pGlxScreen->pScreen;
|
||||
int i, depth;
|
||||
|
||||
|
@ -305,12 +318,12 @@ filterOutNativeConfigs(__GLXscreen *pGlxScreen)
|
|||
}
|
||||
|
||||
static XID
|
||||
findVisualForConfig(ScreenPtr pScreen, __GLcontextModes *m)
|
||||
findVisualForConfig(ScreenPtr pScreen, __GLXconfig *m)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pScreen->numVisuals; i++) {
|
||||
if (_gl_convert_to_x_visual_type(m->visualType) == pScreen->visuals[i].class)
|
||||
if (glxConvertToXVisualType(m->visualType) == pScreen->visuals[i].class)
|
||||
return pScreen->visuals[i].vid;
|
||||
}
|
||||
|
||||
|
@ -405,10 +418,10 @@ findFirstSet(unsigned int v)
|
|||
}
|
||||
|
||||
static void
|
||||
initGlxVisual(VisualPtr visual, __GLcontextModes *config)
|
||||
initGlxVisual(VisualPtr visual, __GLXconfig *config)
|
||||
{
|
||||
config->visualID = visual->vid;
|
||||
visual->class = _gl_convert_to_x_visual_type(config->visualType);
|
||||
visual->class = glxConvertToXVisualType(config->visualType);
|
||||
visual->bitsPerRGBValue = config->redBits;
|
||||
visual->ColormapEntries = 1 << config->redBits;
|
||||
visual->nplanes = config->redBits + config->greenBits + config->blueBits;
|
||||
|
@ -426,15 +439,15 @@ typedef struct {
|
|||
GLboolean depthBuffer;
|
||||
} FBConfigTemplateRec, *FBConfigTemplatePtr;
|
||||
|
||||
static __GLcontextModes *
|
||||
static __GLXconfig *
|
||||
pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
|
||||
for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) {
|
||||
if (config->visualRating != GLX_NONE)
|
||||
continue;
|
||||
if (_gl_convert_to_x_visual_type(config->visualType) != class)
|
||||
if (glxConvertToXVisualType(config->visualType) != class)
|
||||
continue;
|
||||
if ((config->doubleBufferMode > 0) != template->doubleBuffer)
|
||||
continue;
|
||||
|
@ -450,32 +463,36 @@ pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class)
|
|||
static void
|
||||
addMinimalSet(__GLXscreen *pGlxScreen)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
VisualPtr visuals;
|
||||
int i;
|
||||
int i, j;
|
||||
FBConfigTemplateRec best = { GL_TRUE, GL_TRUE };
|
||||
FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE };
|
||||
|
||||
pGlxScreen->visuals = xcalloc(pGlxScreen->pScreen->numVisuals,
|
||||
sizeof (__GLcontextModes *));
|
||||
sizeof (__GLXconfig *));
|
||||
if (pGlxScreen->visuals == NULL) {
|
||||
ErrorF("Failed to allocate for minimal set of GLX visuals\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pGlxScreen->numVisuals = pGlxScreen->pScreen->numVisuals;
|
||||
visuals = pGlxScreen->pScreen->visuals;
|
||||
for (i = 0; i < pGlxScreen->numVisuals; i++) {
|
||||
for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) {
|
||||
if (visuals[i].nplanes == 32)
|
||||
config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class);
|
||||
else
|
||||
config = pickFBConfig(pGlxScreen, &best, visuals[i].class);
|
||||
if (config == NULL)
|
||||
config = pGlxScreen->fbconfigs;
|
||||
pGlxScreen->visuals[i] = config;
|
||||
config->visualID = visuals[i].vid;
|
||||
if (config == NULL)
|
||||
continue;
|
||||
|
||||
pGlxScreen->visuals[j] = config;
|
||||
config->visualID = visuals[j].vid;
|
||||
j++;
|
||||
}
|
||||
|
||||
pGlxScreen->numVisuals = j;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -487,12 +504,12 @@ addTypicalSet(__GLXscreen *pGlxScreen)
|
|||
static void
|
||||
addFullSet(__GLXscreen *pGlxScreen)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
VisualPtr visuals;
|
||||
int i, depth;
|
||||
|
||||
pGlxScreen->visuals =
|
||||
xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLcontextModes *));
|
||||
xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLXconfig *));
|
||||
if (pGlxScreen->visuals == NULL) {
|
||||
ErrorF("Failed to allocate for full set of GLX visuals\n");
|
||||
return;
|
||||
|
@ -522,7 +539,7 @@ void GlxSetVisualConfig(int config)
|
|||
|
||||
void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
|
||||
{
|
||||
__GLcontextModes *m;
|
||||
__GLXconfig *m;
|
||||
int i;
|
||||
|
||||
pGlxScreen->pScreen = pScreen;
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "GL/internal/glcore.h"
|
||||
|
||||
typedef struct {
|
||||
void * (* queryHyperpipeNetworkFunc)(int, int *, int *);
|
||||
void * (* queryHyperpipeConfigFunc)(int, int, int *, int *);
|
||||
|
@ -57,6 +55,84 @@ typedef struct {
|
|||
void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs);
|
||||
void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs);
|
||||
|
||||
typedef struct __GLXconfig __GLXconfig;
|
||||
struct __GLXconfig {
|
||||
__GLXconfig *next;
|
||||
GLboolean rgbMode;
|
||||
GLboolean floatMode;
|
||||
GLboolean colorIndexMode;
|
||||
GLuint doubleBufferMode;
|
||||
GLuint stereoMode;
|
||||
|
||||
GLboolean haveAccumBuffer;
|
||||
GLboolean haveDepthBuffer;
|
||||
GLboolean haveStencilBuffer;
|
||||
|
||||
GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */
|
||||
GLuint redMask, greenMask, blueMask, alphaMask;
|
||||
GLint rgbBits; /* total bits for rgb */
|
||||
GLint indexBits; /* total bits for colorindex */
|
||||
|
||||
GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
|
||||
GLint depthBits;
|
||||
GLint stencilBits;
|
||||
|
||||
GLint numAuxBuffers;
|
||||
|
||||
GLint level;
|
||||
|
||||
GLint pixmapMode;
|
||||
|
||||
/* GLX */
|
||||
GLint visualID;
|
||||
GLint visualType; /**< One of the GLX X visual types. (i.e.,
|
||||
* \c GLX_TRUE_COLOR, etc.)
|
||||
*/
|
||||
|
||||
/* EXT_visual_rating / GLX 1.2 */
|
||||
GLint visualRating;
|
||||
|
||||
/* EXT_visual_info / GLX 1.2 */
|
||||
GLint transparentPixel;
|
||||
/* colors are floats scaled to ints */
|
||||
GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
|
||||
GLint transparentIndex;
|
||||
|
||||
/* ARB_multisample / SGIS_multisample */
|
||||
GLint sampleBuffers;
|
||||
GLint samples;
|
||||
|
||||
/* SGIX_fbconfig / GLX 1.3 */
|
||||
GLint drawableType;
|
||||
GLint renderType;
|
||||
GLint xRenderable;
|
||||
GLint fbconfigID;
|
||||
|
||||
/* SGIX_pbuffer / GLX 1.3 */
|
||||
GLint maxPbufferWidth;
|
||||
GLint maxPbufferHeight;
|
||||
GLint maxPbufferPixels;
|
||||
GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */
|
||||
GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */
|
||||
|
||||
/* SGIX_visual_select_group */
|
||||
GLint visualSelectGroup;
|
||||
|
||||
/* OML_swap_method */
|
||||
GLint swapMethod;
|
||||
|
||||
GLint screen;
|
||||
|
||||
/* EXT_texture_from_pixmap */
|
||||
GLint bindToTextureRgb;
|
||||
GLint bindToTextureRgba;
|
||||
GLint bindToMipmapTexture;
|
||||
GLint bindToTextureTargets;
|
||||
GLint yInverted;
|
||||
};
|
||||
|
||||
GLint glxConvertToXVisualType(int visualType);
|
||||
|
||||
/*
|
||||
** Screen dependent data. These methods are the interface between the DIX
|
||||
** and DDX layers of the GLX server extension. The methods provide an
|
||||
|
@ -67,14 +143,14 @@ struct __GLXscreen {
|
|||
void (*destroy) (__GLXscreen *screen);
|
||||
|
||||
__GLXcontext *(*createContext) (__GLXscreen *screen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXconfig *modes,
|
||||
__GLXcontext *shareContext);
|
||||
|
||||
__GLXdrawable *(*createDrawable)(__GLXscreen *context,
|
||||
DrawablePtr pDraw,
|
||||
int type,
|
||||
XID drawId,
|
||||
__GLcontextModes *modes);
|
||||
__GLXconfig *modes);
|
||||
int (*swapInterval) (__GLXdrawable *drawable,
|
||||
int interval);
|
||||
|
||||
|
@ -84,11 +160,11 @@ struct __GLXscreen {
|
|||
ScreenPtr pScreen;
|
||||
|
||||
/* Linked list of valid fbconfigs for this screen. */
|
||||
__GLcontextModes *fbconfigs;
|
||||
__GLXconfig *fbconfigs;
|
||||
int numFBConfigs;
|
||||
|
||||
/* Subset of fbconfigs that are exposed as GLX visuals. */
|
||||
__GLcontextModes **visuals;
|
||||
__GLXconfig **visuals;
|
||||
GLint numVisuals;
|
||||
|
||||
char *GLextensions;
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "glxutil.h"
|
||||
#include "GL/internal/glcore.h"
|
||||
#include "GL/glxint.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* Context stuff */
|
||||
|
@ -140,13 +139,13 @@ __glXUnrefDrawable(__GLXdrawable *glxPriv)
|
|||
GLboolean
|
||||
__glXDrawableInit(__GLXdrawable *drawable,
|
||||
__GLXscreen *screen, DrawablePtr pDraw, int type,
|
||||
XID drawId, __GLcontextModes *modes)
|
||||
XID drawId, __GLXconfig *config)
|
||||
{
|
||||
drawable->pDraw = pDraw;
|
||||
drawable->type = type;
|
||||
drawable->drawId = drawId;
|
||||
drawable->refCount = 1;
|
||||
drawable->modes = modes;
|
||||
drawable->config = config;
|
||||
drawable->eventMask = 0;
|
||||
|
||||
return GL_TRUE;
|
||||
|
|
|
@ -51,7 +51,7 @@ extern void __glXUnrefDrawable(__GLXdrawable *glxPriv);
|
|||
extern GLboolean __glXDrawableInit(__GLXdrawable *drawable,
|
||||
__GLXscreen *screen,
|
||||
DrawablePtr pDraw, int type, XID drawID,
|
||||
__GLcontextModes *modes);
|
||||
__GLXconfig *config);
|
||||
|
||||
/* context helper routines */
|
||||
extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
SUBDIRS = main math swrast swrast_setup tnl shader X glapi vbo
|
||||
SUBDIRS = X
|
||||
SUBDIRS += main math swrast swrast_setup tnl shader glapi vbo
|
||||
|
||||
noinst_LTLIBRARIES = libGLcore.la
|
||||
|
||||
libGLcore_la_SOURCES = dummy.c
|
||||
libGLcore_la_LIBADD = main/libmain.la \
|
||||
MESA_LIBS = main/libmain.la \
|
||||
math/libmath.la \
|
||||
swrast/libswrast.la \
|
||||
swrast_setup/libss.la \
|
||||
|
@ -11,5 +12,7 @@ libGLcore_la_LIBADD = main/libmain.la \
|
|||
shader/libshader.la \
|
||||
shader/grammar/libgrammar.la \
|
||||
shader/slang/libslang.la \
|
||||
vbo/libvbo.la \
|
||||
vbo/libvbo.la
|
||||
|
||||
libGLcore_la_LIBADD = $(MESA_LIBS) \
|
||||
X/libX.la
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
noinst_LTLIBRARIES = libX.la
|
||||
|
||||
INCLUDES = -I@MESA_SOURCE@/include \
|
||||
-I../X \
|
||||
-I../glapi \
|
||||
-I../main \
|
||||
-I../math \
|
||||
-I../shader \
|
||||
-I../swrast \
|
||||
-I../swrast_setup \
|
||||
-I../tnl \
|
||||
-I.. \
|
||||
-I../../glx \
|
||||
-I$(top_srcdir)/GL/glx \
|
||||
-I$(top_srcdir)/GL/include \
|
||||
-I$(top_srcdir)/hw/xfree86/os-support
|
||||
-I. \
|
||||
-I@MESA_SOURCE@/src/mesa/glapi \
|
||||
-I@MESA_SOURCE@/src/mesa/main \
|
||||
-I@MESA_SOURCE@/src/mesa
|
||||
|
||||
# -DXFree86Server is required because the X11 driver in Mesa thinks that
|
||||
# symbol means "being built in the server"
|
||||
|
@ -22,12 +13,15 @@ AM_CFLAGS = \
|
|||
-DXFree86Server \
|
||||
@GLX_DEFINES@
|
||||
|
||||
nodist_libX_la_SOURCES = \
|
||||
XM_SOURCES = \
|
||||
xm_api.c \
|
||||
xm_buffer.c \
|
||||
xm_dd.c \
|
||||
xm_image.c \
|
||||
xm_line.c \
|
||||
xm_span.c \
|
||||
xm_tri.c \
|
||||
drivers/common/driverfuncs.c
|
||||
xm_tri.c
|
||||
|
||||
XM_SOURCES += drivers/common/driverfuncs.c
|
||||
|
||||
nodist_libX_la_SOURCES = $(XM_SOURCES)
|
||||
|
|
|
@ -227,8 +227,6 @@ symlink_glx() {
|
|||
dst_dir glx
|
||||
|
||||
action indirect_size.h
|
||||
action glcontextmodes.c
|
||||
action glcontextmodes.h
|
||||
action indirect_dispatch.c
|
||||
action indirect_dispatch.h
|
||||
action indirect_dispatch_swap.c
|
||||
|
|
|
@ -30,6 +30,10 @@ if DBE
|
|||
DBE_DIR=dbe
|
||||
endif
|
||||
|
||||
if RECORD
|
||||
RECORD_DIR=record
|
||||
endif
|
||||
|
||||
SUBDIRS = \
|
||||
doc \
|
||||
include \
|
||||
|
@ -48,7 +52,7 @@ SUBDIRS = \
|
|||
$(AFB_DIR) \
|
||||
$(CFB_DIR) \
|
||||
$(CFB32_DIR) \
|
||||
record \
|
||||
$(RECORD_DIR) \
|
||||
xfixes \
|
||||
damageext \
|
||||
$(XTRAP_DIR) \
|
||||
|
|
|
@ -188,12 +188,15 @@ static int
|
|||
ProcDPMSEnable(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
/* REQUEST(xDPMSEnableReq); */
|
||||
Bool was_enabled = DPMSEnabled;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSEnableReq);
|
||||
|
||||
if (DPMSCapableFlag)
|
||||
if (DPMSCapableFlag) {
|
||||
DPMSEnabled = TRUE;
|
||||
if (!was_enabled)
|
||||
SetScreenSaverTimer();
|
||||
}
|
||||
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
|
|
@ -919,7 +919,7 @@ ProcPanoramiXGetState(ClientPtr client)
|
|||
int n, rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -946,7 +946,7 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
|
|||
int n, rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -972,7 +972,7 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
|
|||
int n, rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
|
@ -525,7 +525,7 @@ int PanoramiXGetGeometry(ClientPtr client)
|
|||
REQUEST(xResourceReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xResourceReq);
|
||||
rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixUnknownAccess);
|
||||
rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -1024,7 +1024,7 @@ int PanoramiXCopyArea(ClientPtr client)
|
|||
|
||||
FOR_NSCREENS(j) {
|
||||
rc = dixLookupDrawable(drawables+j, src->info[j].id, client, 0,
|
||||
DixUnknownAccess);
|
||||
DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
|
@ -1779,7 +1779,7 @@ int PanoramiXGetImage(ClientPtr client)
|
|||
return (*SavedProcVector[X_GetImage])(client);
|
||||
|
||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
||||
DixUnknownAccess);
|
||||
DixReadAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -1817,7 +1817,7 @@ int PanoramiXGetImage(ClientPtr client)
|
|||
drawables[0] = pDraw;
|
||||
for(i = 1; i < PanoramiXNumScreens; i++) {
|
||||
rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
|
||||
DixUnknownAccess);
|
||||
DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -910,7 +910,7 @@ SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
{
|
||||
XacePropertyAccessRec *rec = calldata;
|
||||
SecurityStateRec *subj, *obj;
|
||||
ATOM name = rec->pProp->propertyName;
|
||||
ATOM name = (*rec->ppProp)->propertyName;
|
||||
Mask requested = rec->access_mode;
|
||||
Mask allowed = SecurityResourceMask | DixReadAccess;
|
||||
|
||||
|
|
|
@ -655,7 +655,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
return ProcShmGetImage(client);
|
||||
|
||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
||||
DixUnknownAccess);
|
||||
DixReadAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -692,7 +692,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
drawables[0] = pDraw;
|
||||
for(i = 1; i < PanoramiXNumScreens; i++) {
|
||||
rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
|
||||
DixUnknownAccess);
|
||||
DixReadAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ ProcPanoramiXShmCreatePixmap(
|
|||
return BadImplementation;
|
||||
LEGAL_NEW_RESOURCE(stuff->pid, client);
|
||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
|
||||
DixUnknownAccess);
|
||||
DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
|
@ -56,16 +56,17 @@ int XaceHookDispatch(ClientPtr client, int major)
|
|||
}
|
||||
|
||||
int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
|
||||
PropertyPtr pProp, Mask access_mode)
|
||||
PropertyPtr *ppProp, Mask access_mode)
|
||||
{
|
||||
XacePropertyAccessRec rec = { client, pWin, pProp, access_mode, Success };
|
||||
XacePropertyAccessRec rec = { client, pWin, ppProp, access_mode, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_PROPERTY_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
||||
int XaceHookSelectionAccess(ClientPtr client, Atom name, Mask access_mode)
|
||||
int XaceHookSelectionAccess(ClientPtr client,
|
||||
Selection **ppSel, Mask access_mode)
|
||||
{
|
||||
XaceSelectionAccessRec rec = { client, name, access_mode, Success };
|
||||
XaceSelectionAccessRec rec = { client, ppSel, access_mode, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_SELECTION_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "region.h"
|
||||
#include "window.h"
|
||||
#include "property.h"
|
||||
#include "selection.h"
|
||||
|
||||
/* Default window background */
|
||||
#define XaceBackgroundNoneState(w) ((w)->forcedBG ? BackgroundPixel : None)
|
||||
|
@ -68,9 +69,9 @@ extern int XaceHook(
|
|||
*/
|
||||
extern int XaceHookDispatch(ClientPtr ptr, int major);
|
||||
extern int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
||||
PropertyPtr pProp, Mask access_mode);
|
||||
extern int XaceHookSelectionAccess(ClientPtr ptr, Atom name,
|
||||
Mask access_mode);
|
||||
PropertyPtr *ppProp, Mask access_mode);
|
||||
extern int XaceHookSelectionAccess(ClientPtr ptr,
|
||||
Selection **ppSel, Mask access_mode);
|
||||
extern void XaceHookAuditEnd(ClientPtr ptr, int result);
|
||||
|
||||
/* Register a callback for a given hook.
|
||||
|
|
|
@ -59,7 +59,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
ClientPtr client;
|
||||
WindowPtr pWin;
|
||||
PropertyPtr pProp;
|
||||
PropertyPtr *ppProp;
|
||||
Mask access_mode;
|
||||
int status;
|
||||
} XacePropertyAccessRec;
|
||||
|
@ -110,7 +110,7 @@ typedef struct {
|
|||
/* XACE_SELECTION_ACCESS */
|
||||
typedef struct {
|
||||
ClientPtr client;
|
||||
Atom name;
|
||||
Selection **ppSel;
|
||||
Mask access_mode;
|
||||
int status;
|
||||
} XaceSelectionAccessRec;
|
||||
|
|
120
Xext/xevie.c
120
Xext/xevie.c
|
@ -63,11 +63,13 @@ extern Bool noXkbExtension;
|
|||
#endif
|
||||
extern int xeviegrabState;
|
||||
|
||||
static int ProcDispatch (ClientPtr client), SProcDispatch (ClientPtr client);
|
||||
static void ResetProc (ExtensionEntry *extEntry);
|
||||
static DISPATCH_PROC(ProcXevieDispatch);
|
||||
static DISPATCH_PROC(SProcXevieDispatch);
|
||||
|
||||
static unsigned char ReqCode = 0;
|
||||
static int ErrorBase;
|
||||
static void XevieResetProc (ExtensionEntry *extEntry);
|
||||
|
||||
static unsigned char XevieReqCode = 0;
|
||||
static int XevieErrorBase;
|
||||
|
||||
int xevieFlag = 0;
|
||||
int xevieClientIndex = 0;
|
||||
|
@ -108,11 +110,6 @@ typedef struct {
|
|||
static xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {{0, NULL}};
|
||||
static int keycqHead = 0, keycqTail = 0;
|
||||
|
||||
static int ProcDispatch (ClientPtr), SProcDispatch (ClientPtr);
|
||||
static void ResetProc (ExtensionEntry*);
|
||||
|
||||
static int ErrorBase;
|
||||
|
||||
static Bool XevieStart(void);
|
||||
static void XevieEnd(int clientIndex);
|
||||
static void XevieClientStateCallback(CallbackListPtr *pcbl, pointer nulldata,
|
||||
|
@ -140,25 +137,23 @@ XevieExtensionInit (void)
|
|||
if ((extEntry = AddExtension (XEVIENAME,
|
||||
0,
|
||||
XevieNumberErrors,
|
||||
ProcDispatch,
|
||||
SProcDispatch,
|
||||
ResetProc,
|
||||
ProcXevieDispatch,
|
||||
SProcXevieDispatch,
|
||||
XevieResetProc,
|
||||
StandardMinorOpcode))) {
|
||||
ReqCode = (unsigned char)extEntry->base;
|
||||
ErrorBase = extEntry->errorBase;
|
||||
XevieReqCode = (unsigned char)extEntry->base;
|
||||
XevieErrorBase = extEntry->errorBase;
|
||||
}
|
||||
|
||||
/* PC servers initialize the desktop colors (citems) here! */
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static
|
||||
void ResetProc (ExtensionEntry *extEntry)
|
||||
void XevieResetProc (ExtensionEntry *extEntry)
|
||||
{
|
||||
}
|
||||
|
||||
static
|
||||
int ProcQueryVersion (ClientPtr client)
|
||||
int ProcXevieQueryVersion (ClientPtr client)
|
||||
{
|
||||
xXevieQueryVersionReply rep;
|
||||
|
||||
|
@ -173,7 +168,7 @@ int ProcQueryVersion (ClientPtr client)
|
|||
}
|
||||
|
||||
static
|
||||
int ProcStart (ClientPtr client)
|
||||
int ProcXevieStart (ClientPtr client)
|
||||
{
|
||||
xXevieStartReply rep;
|
||||
|
||||
|
@ -214,10 +209,12 @@ int ProcStart (ClientPtr client)
|
|||
}
|
||||
|
||||
static
|
||||
int ProcEnd (ClientPtr client)
|
||||
int ProcXevieEnd (ClientPtr client)
|
||||
{
|
||||
xXevieEndReply rep;
|
||||
|
||||
REQUEST_SIZE_MATCH (xXevieEndReq);
|
||||
|
||||
if (xevieFlag) {
|
||||
if (client->index != xevieClientIndex)
|
||||
return BadAccess;
|
||||
|
@ -233,13 +230,15 @@ int ProcEnd (ClientPtr client)
|
|||
}
|
||||
|
||||
static
|
||||
int ProcSend (ClientPtr client)
|
||||
int ProcXevieSend (ClientPtr client)
|
||||
{
|
||||
REQUEST (xXevieSendReq);
|
||||
xXevieSendReply rep;
|
||||
xEvent *xE;
|
||||
static unsigned char lastDetail = 0, lastType = 0;
|
||||
|
||||
REQUEST_SIZE_MATCH (xXevieSendReq);
|
||||
|
||||
if (client->index != xevieClientIndex)
|
||||
return BadAccess;
|
||||
|
||||
|
@ -279,15 +278,17 @@ int ProcSend (ClientPtr client)
|
|||
}
|
||||
|
||||
static
|
||||
int ProcSelectInput (ClientPtr client)
|
||||
int ProcXevieSelectInput (ClientPtr client)
|
||||
{
|
||||
REQUEST (xXevieSelectInputReq);
|
||||
xXevieSelectInputReply rep;
|
||||
|
||||
REQUEST_SIZE_MATCH (xXevieSelectInputReq);
|
||||
|
||||
if (client->index != xevieClientIndex)
|
||||
return BadAccess;
|
||||
|
||||
xevieMask = (long)stuff->event_mask;
|
||||
xevieMask = stuff->event_mask;
|
||||
rep.type = X_Reply;
|
||||
rep.sequence_number = client->sequence;
|
||||
WriteToClient (client, sizeof (xXevieSelectInputReply), (char *)&rep);
|
||||
|
@ -295,101 +296,114 @@ int ProcSelectInput (ClientPtr client)
|
|||
}
|
||||
|
||||
static
|
||||
int ProcDispatch (ClientPtr client)
|
||||
int ProcXevieDispatch (ClientPtr client)
|
||||
{
|
||||
REQUEST (xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_XevieQueryVersion:
|
||||
return ProcQueryVersion (client);
|
||||
return ProcXevieQueryVersion (client);
|
||||
case X_XevieStart:
|
||||
return ProcStart (client);
|
||||
return ProcXevieStart (client);
|
||||
case X_XevieEnd:
|
||||
return ProcEnd (client);
|
||||
return ProcXevieEnd (client);
|
||||
case X_XevieSend:
|
||||
return ProcSend (client);
|
||||
return ProcXevieSend (client);
|
||||
case X_XevieSelectInput:
|
||||
return ProcSelectInput(client);
|
||||
return ProcXevieSelectInput(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
int SProcQueryVersion (ClientPtr client)
|
||||
int SProcXevieQueryVersion (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
|
||||
REQUEST(xXevieQueryVersionReq);
|
||||
swaps(&stuff->length, n);
|
||||
return ProcQueryVersion(client);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xXevieQueryVersionReq);
|
||||
swaps (&stuff->client_major_version, n);
|
||||
swaps (&stuff->client_minor_version, n);
|
||||
return ProcXevieQueryVersion(client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcStart (ClientPtr client)
|
||||
int SProcXevieStart (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
|
||||
REQUEST (xXevieStartReq);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xXevieStartReq);
|
||||
swapl (&stuff->screen, n);
|
||||
REQUEST_AT_LEAST_SIZE (xXevieStartReq);
|
||||
return ProcStart (client);
|
||||
return ProcXevieStart (client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcEnd (ClientPtr client)
|
||||
int SProcXevieEnd (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
|
||||
REQUEST (xXevieEndReq);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE (xXevieEndReq);
|
||||
swapl(&stuff->cmap, n);
|
||||
return ProcEnd (client);
|
||||
REQUEST_SIZE_MATCH (xXevieEndReq);
|
||||
swapl (&stuff->cmap, n);
|
||||
return ProcXevieEnd (client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcSend (ClientPtr client)
|
||||
int SProcXevieSend (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
xEvent eventT;
|
||||
EventSwapPtr proc;
|
||||
|
||||
REQUEST (xXevieSendReq);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE (xXevieSendReq);
|
||||
swapl(&stuff->event, n);
|
||||
return ProcSend (client);
|
||||
REQUEST_SIZE_MATCH (xXevieSendReq);
|
||||
swapl (&stuff->dataType, n);
|
||||
|
||||
/* Swap event */
|
||||
proc = EventSwapVector[stuff->event.u.u.type & 0177];
|
||||
if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */
|
||||
return (BadValue);
|
||||
(*proc)(&stuff->event, &eventT);
|
||||
stuff->event = eventT;
|
||||
|
||||
return ProcXevieSend (client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcSelectInput (ClientPtr client)
|
||||
int SProcXevieSelectInput (ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
|
||||
REQUEST (xXevieSelectInputReq);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE (xXevieSelectInputReq);
|
||||
swapl(&stuff->event_mask, n);
|
||||
return ProcSelectInput (client);
|
||||
REQUEST_SIZE_MATCH (xXevieSelectInputReq);
|
||||
swapl (&stuff->event_mask, n);
|
||||
return ProcXevieSelectInput (client);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
int SProcDispatch (ClientPtr client)
|
||||
int SProcXevieDispatch (ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_XevieQueryVersion:
|
||||
return SProcQueryVersion (client);
|
||||
return SProcXevieQueryVersion (client);
|
||||
case X_XevieStart:
|
||||
return SProcStart (client);
|
||||
return SProcXevieStart (client);
|
||||
case X_XevieEnd:
|
||||
return SProcEnd (client);
|
||||
return SProcXevieEnd (client);
|
||||
case X_XevieSend:
|
||||
return SProcSend (client);
|
||||
return SProcXevieSend (client);
|
||||
case X_XevieSelectInput:
|
||||
return SProcSelectInput(client);
|
||||
return SProcXevieSelectInput(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
|
|
|
@ -1800,7 +1800,7 @@ ProcXpPutDocumentData(ClientPtr client)
|
|||
if (pContext->state & DOC_RAW_STARTED)
|
||||
return BadDrawable;
|
||||
result = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
||||
DixUnknownAccess);
|
||||
DixWriteAccess);
|
||||
if (result != Success)
|
||||
return result;
|
||||
if (pDraw->pScreen->myNum != pContext->screenNum)
|
||||
|
|
1211
Xext/xselinux.c
1211
Xext/xselinux.c
File diff suppressed because it is too large
Load Diff
103
Xext/xselinux.h
103
Xext/xselinux.h
|
@ -31,21 +31,28 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
/* Extension protocol */
|
||||
#define X_SELinuxQueryVersion 0
|
||||
#define X_SELinuxSetSecurityManager 1
|
||||
#define X_SELinuxGetSecurityManager 2
|
||||
#define X_SELinuxSetDeviceCreateContext 3
|
||||
#define X_SELinuxGetDeviceCreateContext 4
|
||||
#define X_SELinuxSetDeviceContext 5
|
||||
#define X_SELinuxGetDeviceContext 6
|
||||
#define X_SELinuxSetPropertyCreateContext 7
|
||||
#define X_SELinuxGetPropertyCreateContext 8
|
||||
#define X_SELinuxGetPropertyContext 9
|
||||
#define X_SELinuxSetWindowCreateContext 10
|
||||
#define X_SELinuxGetWindowCreateContext 11
|
||||
#define X_SELinuxGetWindowContext 12
|
||||
#define X_SELinuxSetSelectionCreateContext 13
|
||||
#define X_SELinuxGetSelectionCreateContext 14
|
||||
#define X_SELinuxGetSelectionContext 15
|
||||
#define X_SELinuxSetDeviceCreateContext 1
|
||||
#define X_SELinuxGetDeviceCreateContext 2
|
||||
#define X_SELinuxSetDeviceContext 3
|
||||
#define X_SELinuxGetDeviceContext 4
|
||||
#define X_SELinuxSetWindowCreateContext 5
|
||||
#define X_SELinuxGetWindowCreateContext 6
|
||||
#define X_SELinuxGetWindowContext 7
|
||||
#define X_SELinuxSetPropertyCreateContext 8
|
||||
#define X_SELinuxGetPropertyCreateContext 9
|
||||
#define X_SELinuxSetPropertyUseContext 10
|
||||
#define X_SELinuxGetPropertyUseContext 11
|
||||
#define X_SELinuxGetPropertyContext 12
|
||||
#define X_SELinuxGetPropertyDataContext 13
|
||||
#define X_SELinuxListProperties 14
|
||||
#define X_SELinuxSetSelectionCreateContext 15
|
||||
#define X_SELinuxGetSelectionCreateContext 16
|
||||
#define X_SELinuxSetSelectionUseContext 17
|
||||
#define X_SELinuxGetSelectionUseContext 18
|
||||
#define X_SELinuxGetSelectionContext 19
|
||||
#define X_SELinuxGetSelectionDataContext 20
|
||||
#define X_SELinuxListSelections 21
|
||||
#define X_SELinuxGetClientContext 22
|
||||
|
||||
typedef struct {
|
||||
CARD8 reqType;
|
||||
|
@ -53,7 +60,6 @@ typedef struct {
|
|||
CARD16 length;
|
||||
CARD8 client_major;
|
||||
CARD8 client_minor;
|
||||
CARD16 unused;
|
||||
} SELinuxQueryVersionReq;
|
||||
|
||||
typedef struct {
|
||||
|
@ -74,35 +80,7 @@ typedef struct {
|
|||
CARD8 reqType;
|
||||
CARD8 SELinuxReqType;
|
||||
CARD16 length;
|
||||
CARD32 window;
|
||||
} SELinuxSetSecurityManagerReq;
|
||||
|
||||
typedef struct {
|
||||
CARD8 reqType;
|
||||
CARD8 SELinuxReqType;
|
||||
CARD16 length;
|
||||
} SELinuxGetSecurityManagerReq;
|
||||
|
||||
typedef struct {
|
||||
CARD8 type;
|
||||
CARD8 pad1;
|
||||
CARD16 sequenceNumber;
|
||||
CARD32 length;
|
||||
CARD32 window;
|
||||
CARD32 pad2;
|
||||
CARD32 pad3;
|
||||
CARD32 pad4;
|
||||
CARD32 pad5;
|
||||
CARD32 pad6;
|
||||
} SELinuxGetSecurityManagerReply;
|
||||
|
||||
typedef struct {
|
||||
CARD8 reqType;
|
||||
CARD8 SELinuxReqType;
|
||||
CARD16 length;
|
||||
CARD8 permanent;
|
||||
CARD8 unused;
|
||||
CARD16 context_len;
|
||||
CARD32 context_len;
|
||||
} SELinuxSetCreateContextReq;
|
||||
|
||||
typedef struct {
|
||||
|
@ -111,27 +89,12 @@ typedef struct {
|
|||
CARD16 length;
|
||||
} SELinuxGetCreateContextReq;
|
||||
|
||||
typedef struct {
|
||||
CARD8 type;
|
||||
CARD8 permanent;
|
||||
CARD16 sequenceNumber;
|
||||
CARD32 length;
|
||||
CARD16 context_len;
|
||||
CARD16 pad1;
|
||||
CARD32 pad2;
|
||||
CARD32 pad3;
|
||||
CARD32 pad4;
|
||||
CARD32 pad5;
|
||||
CARD32 pad6;
|
||||
} SELinuxGetCreateContextReply;
|
||||
|
||||
typedef struct {
|
||||
CARD8 reqType;
|
||||
CARD8 SELinuxReqType;
|
||||
CARD16 length;
|
||||
CARD32 id;
|
||||
CARD16 unused;
|
||||
CARD16 context_len;
|
||||
CARD32 context_len;
|
||||
} SELinuxSetContextReq;
|
||||
|
||||
typedef struct {
|
||||
|
@ -154,15 +117,27 @@ typedef struct {
|
|||
CARD8 pad1;
|
||||
CARD16 sequenceNumber;
|
||||
CARD32 length;
|
||||
CARD16 context_len;
|
||||
CARD16 pad2;
|
||||
CARD32 context_len;
|
||||
CARD32 pad2;
|
||||
CARD32 pad3;
|
||||
CARD32 pad4;
|
||||
CARD32 pad5;
|
||||
CARD32 pad6;
|
||||
CARD32 pad7;
|
||||
} SELinuxGetContextReply;
|
||||
|
||||
typedef struct {
|
||||
CARD8 type;
|
||||
CARD8 pad1;
|
||||
CARD16 sequenceNumber;
|
||||
CARD32 length;
|
||||
CARD32 count;
|
||||
CARD32 pad2;
|
||||
CARD32 pad3;
|
||||
CARD32 pad4;
|
||||
CARD32 pad5;
|
||||
CARD32 pad6;
|
||||
} SELinuxListItemsReply;
|
||||
|
||||
|
||||
/* Private Flask definitions */
|
||||
#define SECCLASS_X_DRAWABLE 1
|
||||
|
|
|
@ -1316,7 +1316,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
|
|||
} else
|
||||
effectiveFocus = pWin = inputFocus;
|
||||
} else
|
||||
dixLookupWindow(&pWin, dest, client, DixUnknownAccess);
|
||||
dixLookupWindow(&pWin, dest, client, DixSendAccess);
|
||||
if (!pWin)
|
||||
return BadWindow;
|
||||
if ((propagate != xFalse) && (propagate != xTrue)) {
|
||||
|
|
|
@ -289,6 +289,12 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
|
|||
if (!pPixmap)
|
||||
return BadMatch;
|
||||
|
||||
/* security creation/labeling check */
|
||||
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
|
||||
pPixmap, RT_WINDOW, pWin, DixCreateAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
++pPixmap->refcnt;
|
||||
|
||||
if (!AddResource (stuff->pixmap, RT_PIXMAP, (pointer) pPixmap))
|
||||
|
|
|
@ -92,7 +92,7 @@ static Bool
|
|||
compRepaintBorder (ClientPtr pClient, pointer closure)
|
||||
{
|
||||
WindowPtr pWindow;
|
||||
int rc = dixLookupWindow(&pWindow, (XID)closure, pClient,DixUnknownAccess);
|
||||
int rc = dixLookupWindow(&pWindow, (XID)closure, pClient, DixWriteAccess);
|
||||
|
||||
if (rc == Success) {
|
||||
RegionRec exposed;
|
||||
|
|
|
@ -213,7 +213,7 @@ remove_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
|
|||
MALFORMED_MESSAGE_ERROR();
|
||||
}
|
||||
|
||||
dixLookupDevice(&dev, deviceid, serverClient, DixUnknownAccess);
|
||||
dixLookupDevice(&dev, deviceid, serverClient, DixDestroyAccess);
|
||||
if (!dev) {
|
||||
DebugF("[config/dbus] bogus device id %d given\n", deviceid);
|
||||
ret = BadMatch;
|
||||
|
|
190
config/hal.c
190
config/hal.c
|
@ -38,9 +38,10 @@
|
|||
#include "config-backends.h"
|
||||
#include "os.h"
|
||||
|
||||
#define TYPE_NONE 0
|
||||
#define TYPE_KEYS 1
|
||||
#define TYPE_POINTER 2
|
||||
|
||||
#define LIBHAL_PROP_KEY "input.x11_options."
|
||||
#define LIBHAL_XKB_PROP_KEY "input.xkb."
|
||||
|
||||
|
||||
struct config_hal_info {
|
||||
DBusConnection *system_bus;
|
||||
|
@ -50,7 +51,8 @@ struct config_hal_info {
|
|||
static void
|
||||
remove_device(DeviceIntPtr dev)
|
||||
{
|
||||
DebugF("[config/hal] removing device %s\n", dev->name);
|
||||
/* this only gets called for devices that have already been added */
|
||||
LogMessage(X_INFO, "config/hal: removing device %s\n", dev->name);
|
||||
|
||||
/* Call PIE here so we don't try to dereference a device that's
|
||||
* already been removed. */
|
||||
|
@ -105,7 +107,7 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
|
|||
char *prop, *ret;
|
||||
|
||||
prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL);
|
||||
DebugF("[config/hal] getting %s on %s returned %s\n", name, udi, prop);
|
||||
LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n", name, udi, prop);
|
||||
if (prop) {
|
||||
ret = xstrdup(prop);
|
||||
libhal_free_string(prop);
|
||||
|
@ -117,6 +119,9 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* this function is no longer used... keep it here in case its needed in
|
||||
* the future. */
|
||||
#if 0
|
||||
static char *
|
||||
get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
|
||||
{
|
||||
|
@ -150,117 +155,146 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
|
|||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
device_added(LibHalContext *hal_ctx, const char *udi)
|
||||
{
|
||||
char **props;
|
||||
char *path = NULL, *driver = NULL, *name = NULL, *xkb_rules = NULL;
|
||||
char *xkb_model = NULL, *xkb_layout = NULL, *xkb_variant = NULL;
|
||||
char *xkb_options = NULL, *config_info = NULL;
|
||||
char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL;
|
||||
InputOption *options = NULL, *tmpo = NULL;
|
||||
DeviceIntPtr dev;
|
||||
DBusError error;
|
||||
int type = TYPE_NONE;
|
||||
int i;
|
||||
|
||||
LibHalPropertySet *set = NULL;
|
||||
LibHalPropertySetIterator set_iter;
|
||||
char *psi_key = NULL, *tmp_val, *tmp_key;
|
||||
|
||||
|
||||
dbus_error_init(&error);
|
||||
|
||||
props = libhal_device_get_property_strlist(hal_ctx, udi,
|
||||
"info.capabilities", &error);
|
||||
if (!props) {
|
||||
DebugF("[config/hal] couldn't get capabilities for %s: %s (%s)\n",
|
||||
udi, error.name, error.message);
|
||||
goto out_error;
|
||||
}
|
||||
for (i = 0; props[i]; i++) {
|
||||
/* input.keys is the new, of which input.keyboard is a subset, but
|
||||
* input.keyboard is the old 'we have keys', so we have to keep it
|
||||
* around. */
|
||||
if (strcmp(props[i], "input.keys") == 0 ||
|
||||
strcmp(props[i], "input.keyboard") == 0)
|
||||
type |= TYPE_KEYS;
|
||||
if (strcmp(props[i], "input.mouse") == 0 ||
|
||||
strcmp(props[i], "input.touchpad") == 0)
|
||||
type |= TYPE_POINTER;
|
||||
}
|
||||
libhal_free_string_array(props);
|
||||
|
||||
if (type == TYPE_NONE)
|
||||
goto out_error;
|
||||
|
||||
driver = get_prop_string(hal_ctx, udi, "input.x11_driver");
|
||||
path = get_prop_string(hal_ctx, udi, "input.device");
|
||||
if (!driver || !path) {
|
||||
DebugF("[config/hal] no driver or path specified for %s\n", udi);
|
||||
if (!driver){
|
||||
/* verbose, don't tell the user unless they _want_ to see it */
|
||||
LogMessageVerb(X_INFO,7,"config/hal: no driver specified for device %s\n", udi);
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
path = get_prop_string(hal_ctx, udi, "input.device");
|
||||
if (!path) {
|
||||
LogMessage(X_WARNING,"config/hal: no driver or path specified for %s\n", udi);
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
name = get_prop_string(hal_ctx, udi, "info.product");
|
||||
if (!name)
|
||||
name = xstrdup("(unnamed)");
|
||||
|
||||
if (type & TYPE_KEYS) {
|
||||
xkb_rules = get_prop_string(hal_ctx, udi, "input.xkb.rules");
|
||||
xkb_model = get_prop_string(hal_ctx, udi, "input.xkb.model");
|
||||
xkb_layout = get_prop_string(hal_ctx, udi, "input.xkb.layout");
|
||||
xkb_variant = get_prop_string(hal_ctx, udi, "input.xkb.variant");
|
||||
xkb_options = get_prop_string_array(hal_ctx, udi, "input.xkb.options");
|
||||
options = xcalloc(sizeof(*options), 1);
|
||||
if (!options){
|
||||
LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n");
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
options = xcalloc(sizeof(*options), 1);
|
||||
options->key = xstrdup("_source");
|
||||
options->value = xstrdup("server/hal");
|
||||
if (!options->key || !options->value) {
|
||||
ErrorF("[config] couldn't allocate first key/value pair\n");
|
||||
LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
/* most drivers use device.. not path. evdev uses both however, but the
|
||||
* path version isn't documented apparently. support both for now. */
|
||||
add_option(&options, "path", path);
|
||||
add_option(&options, "device", path);
|
||||
|
||||
add_option(&options, "driver", driver);
|
||||
add_option(&options, "name", name);
|
||||
|
||||
config_info = xalloc(strlen(udi) + 5); /* "hal:" and NULL */
|
||||
if (!config_info)
|
||||
if (!config_info) {
|
||||
LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
|
||||
goto unwind;
|
||||
}
|
||||
sprintf(config_info, "hal:%s", udi);
|
||||
|
||||
if (xkb_rules)
|
||||
add_option(&options, "xkb_rules", xkb_rules);
|
||||
if (xkb_model)
|
||||
add_option(&options, "xkb_model", xkb_model);
|
||||
if (xkb_layout)
|
||||
add_option(&options, "xkb_layout", xkb_layout);
|
||||
if (xkb_variant)
|
||||
add_option(&options, "xkb_variant", xkb_variant);
|
||||
if (xkb_options)
|
||||
add_option(&options, "xkb_options", xkb_options);
|
||||
/* ok, grab options from hal.. iterate through all properties
|
||||
* and lets see if any of them are options that we can add */
|
||||
set = libhal_device_get_all_properties(hal_ctx, udi, &error);
|
||||
|
||||
DebugF("[config/hal] Adding device %s\n", name);
|
||||
if (!set) {
|
||||
LogMessage(X_ERROR, "config/hal: couldn't get property list for %s: %s (%s)\n",
|
||||
udi, error.name, error.message);
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
libhal_psi_init(&set_iter,set);
|
||||
while (libhal_psi_has_more(&set_iter)) {
|
||||
/* we are looking for supported keys.. extract and add to options */
|
||||
psi_key = libhal_psi_get_key(&set_iter);
|
||||
|
||||
if (psi_key){
|
||||
|
||||
/* normal options first (input.x11_options.<propname>) */
|
||||
if (!strncasecmp(psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY)-1)){
|
||||
|
||||
/* only support strings for all values */
|
||||
tmp_val = get_prop_string(hal_ctx, udi, psi_key);
|
||||
|
||||
if (tmp_val){
|
||||
add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
|
||||
xfree(tmp_val);
|
||||
}
|
||||
|
||||
/* evdev's XKB options... we should probably depreciate this usage */
|
||||
} else if (!strncasecmp(psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY)-1)){
|
||||
|
||||
/* only support strings for all values */
|
||||
tmp_val = get_prop_string(hal_ctx, udi, psi_key);
|
||||
|
||||
if (tmp_val){
|
||||
/* add "xkb_" + NULL */
|
||||
tmp_key = xalloc(strlen(psi_key) - ( sizeof(LIBHAL_XKB_PROP_KEY) - 1) + 5);
|
||||
|
||||
if (!tmp_key){
|
||||
LogMessage(X_ERROR, "config/hal: couldn't allocate memory for option %s\n", psi_key);
|
||||
} else {
|
||||
sprintf(tmp_key, "xkb_%s", psi_key + sizeof(LIBHAL_XKB_PROP_KEY)-1);
|
||||
add_option(&options, tmp_key, tmp_val);
|
||||
|
||||
xfree(tmp_key);
|
||||
}
|
||||
xfree(tmp_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* psi_key doesn't need to be freed */
|
||||
libhal_psi_next(&set_iter);
|
||||
}
|
||||
|
||||
/* this isn't an error, but how else do you output something that the user can see? */
|
||||
LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
|
||||
if (NewInputDeviceRequest(options, &dev) != Success) {
|
||||
ErrorF("[config/hal] NewInputDeviceRequest failed\n");
|
||||
LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed\n");
|
||||
dev = NULL;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
for (; dev; dev = dev->next)
|
||||
for (; dev; dev = dev->next){
|
||||
if (dev->config_info)
|
||||
xfree(dev->config_info);
|
||||
dev->config_info = xstrdup(config_info);
|
||||
}
|
||||
|
||||
unwind:
|
||||
if (set)
|
||||
libhal_free_property_set(set);
|
||||
if (path)
|
||||
xfree(path);
|
||||
if (driver)
|
||||
xfree(driver);
|
||||
if (name)
|
||||
xfree(name);
|
||||
if (xkb_rules)
|
||||
xfree(xkb_rules);
|
||||
if (xkb_model)
|
||||
xfree(xkb_model);
|
||||
if (xkb_layout)
|
||||
xfree(xkb_layout);
|
||||
if (xkb_variant)
|
||||
xfree(xkb_variant);
|
||||
if (xkb_options)
|
||||
xfree(xkb_options);
|
||||
if (config_info)
|
||||
xfree(config_info);
|
||||
while (!dev && (tmpo = options)) {
|
||||
|
@ -270,7 +304,6 @@ unwind:
|
|||
xfree(tmpo);
|
||||
}
|
||||
|
||||
out_error:
|
||||
dbus_error_free(&error);
|
||||
|
||||
return;
|
||||
|
@ -286,7 +319,7 @@ disconnect_hook(void *data)
|
|||
if (dbus_connection_get_is_connected(info->system_bus)) {
|
||||
dbus_error_init(&error);
|
||||
if (!libhal_ctx_shutdown(info->hal_ctx, &error))
|
||||
DebugF("[config/hal] couldn't shut down context: %s (%s)\n",
|
||||
LogMessage(X_WARNING, "config/hal: disconnect_hook couldn't shut down context: %s (%s)\n",
|
||||
error.name, error.message);
|
||||
dbus_error_free(&error);
|
||||
}
|
||||
|
@ -312,21 +345,21 @@ connect_hook(DBusConnection *connection, void *data)
|
|||
if (!info->hal_ctx)
|
||||
info->hal_ctx = libhal_ctx_new();
|
||||
if (!info->hal_ctx) {
|
||||
ErrorF("[config/hal] couldn't create HAL context\n");
|
||||
LogMessage(X_ERROR, "config/hal: couldn't create HAL context\n");
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
if (!libhal_ctx_set_dbus_connection(info->hal_ctx, info->system_bus)) {
|
||||
ErrorF("[config/hal] couldn't associate HAL context with bus\n");
|
||||
LogMessage(X_ERROR, "config/hal: couldn't associate HAL context with bus\n");
|
||||
goto out_ctx;
|
||||
}
|
||||
if (!libhal_ctx_init(info->hal_ctx, &error)) {
|
||||
ErrorF("[config/hal] couldn't initialise context: %s (%s)\n",
|
||||
LogMessage(X_ERROR, "config/hal: couldn't initialise context: %s (%s)\n",
|
||||
error.name, error.message);
|
||||
goto out_ctx;
|
||||
}
|
||||
if (!libhal_device_property_watch_all(info->hal_ctx, &error)) {
|
||||
ErrorF("[config/hal] couldn't watch all properties: %s (%s)\n",
|
||||
LogMessage(X_ERROR, "config/hal: couldn't watch all properties: %s (%s)\n",
|
||||
error.name, error.message);
|
||||
goto out_ctx2;
|
||||
}
|
||||
|
@ -346,7 +379,7 @@ connect_hook(DBusConnection *connection, void *data)
|
|||
|
||||
out_ctx2:
|
||||
if (!libhal_ctx_shutdown(info->hal_ctx, &error))
|
||||
DebugF("[config/hal] couldn't shut down context: %s (%s)\n",
|
||||
LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n",
|
||||
error.name, error.message);
|
||||
out_ctx:
|
||||
libhal_ctx_free(info->hal_ctx);
|
||||
|
@ -374,10 +407,13 @@ config_hal_init(void)
|
|||
hal_info.hal_ctx = NULL;
|
||||
|
||||
if (!config_dbus_core_add_hook(&hook)) {
|
||||
ErrorF("[config/hal] failed to add D-Bus hook\n");
|
||||
LogMessage(X_ERROR, "config/hal: failed to add D-Bus hook\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* verbose message */
|
||||
LogMessageVerb(X_INFO,7,"config/hal: initialized");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<deviceinfo version="0.2">
|
||||
<device>
|
||||
<!-- FIXME: Support tablets too. -->
|
||||
|
||||
<!-- The way this works:
|
||||
|
||||
Match against some input device (see the HAL specification for more
|
||||
information), and then merge in keys, which you can use to specify
|
||||
the configuration similar to the way you would in xorg.conf. You will
|
||||
need to restart HAL after making changes. If you are having issues,
|
||||
starting X with the -logverbose 7 flag may yield useful information.
|
||||
|
||||
Keys Supported:
|
||||
|
||||
Key "input.x11_driver" (string)
|
||||
This specifies the driver to use. You MUST specify this option,
|
||||
or a driver will not be loaded and the rest will be ignored by
|
||||
Xorg
|
||||
|
||||
Key "input.x11_options.<option name>" (string)
|
||||
This allows you to specify arbitrary options to pass to the driver.
|
||||
Anything you would normally specify in xorg.conf goes here. So, for
|
||||
option "Mode" in xorg.conf, you would specify the key name of
|
||||
"input.x11_options.Mode".
|
||||
|
||||
Do not specify "input.x11_options.Device" since "input.device"
|
||||
will be used automatically.
|
||||
|
||||
Legacy Keys
|
||||
"input.xkb.rules"
|
||||
"input.xkb.model"
|
||||
"input.xkb.layout"
|
||||
"input.xkb.variant"
|
||||
"input.xkb.options"
|
||||
|
||||
These keys are deprecated. Use these instead:
|
||||
"input.x11_options.XkbRules"
|
||||
"input.x11_options.XkbModel"
|
||||
"input.x11_options.XkbLayout"
|
||||
"input.x11_options.XkbVariant"
|
||||
"input.x11_options.XkbOptions"
|
||||
|
||||
See the evdev documentation for more information.
|
||||
|
||||
You will probably want to add the following option to the ServerFlags of
|
||||
your xorg.conf:
|
||||
|
||||
Option "AllowEmptyInput" "True"
|
||||
|
||||
FIXME: Support tablets too.
|
||||
TODO: I think its fixed, can't test
|
||||
|
||||
-->
|
||||
|
||||
<match key="info.capabilities" contains="input.mouse">
|
||||
<merge key="input.x11_driver" type="string">mouse</merge>
|
||||
<match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
|
||||
|
@ -11,21 +61,21 @@
|
|||
</match>
|
||||
|
||||
<match key="info.capabilities" contains="input.keys">
|
||||
<merge key="input.xkb.rules" type="string">base</merge>
|
||||
<merge key="input.x11_options.XkbRules" type="string">base</merge>
|
||||
|
||||
<!-- If we're using Linux, we use evdev by default (falling back to
|
||||
keyboard otherwise). -->
|
||||
<merge key="input.x11_driver" type="string">keyboard</merge>
|
||||
<merge key="input.xkb.model" type="string">pc105</merge>
|
||||
<merge key="input.x11_options.XkbModel" type="string">pc105</merge>
|
||||
<match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
|
||||
string="Linux">
|
||||
<merge key="input.x11_driver" type="string">evdev</merge>
|
||||
<merge key="input.xkb.model" type="string">evdev</merge>
|
||||
<merge key="input.x11_options.XkbModel" type="string">evdev</merge>
|
||||
</match>
|
||||
|
||||
<merge key="input.xkb.layout" type="string">us</merge>
|
||||
<merge key="input.x11_options.XkbLayout" type="string">us</merge>
|
||||
|
||||
<merge key="input.xkb.variant" type="string" />
|
||||
<merge key="input.x11_options.XkbVariant" type="string" />
|
||||
</match>
|
||||
</device>
|
||||
</deviceinfo>
|
||||
|
|
83
configure.ac
83
configure.ac
|
@ -26,7 +26,7 @@ dnl
|
|||
dnl Process this file with autoconf to create configure.
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT([xorg-server], 1.4.99.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
|
||||
AC_INIT([xorg-server], 1.5.99.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
|
||||
AM_MAINTAINER_MODE
|
||||
|
@ -293,7 +293,6 @@ dnl Bus options and CPU capabilities. Replaces logic in
|
|||
dnl hw/xfree86/os-support/bus/Makefile.am, among others.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
DEFAULT_INT10="x86emu"
|
||||
use_x86_asm="no"
|
||||
|
||||
dnl Override defaults as needed for specific platforms:
|
||||
|
||||
|
@ -310,10 +309,8 @@ case $host_cpu in
|
|||
ARM_VIDEO=yes
|
||||
;;
|
||||
i*86)
|
||||
use_x86_asm="yes"
|
||||
I386_VIDEO=yes
|
||||
case $host_os in
|
||||
darwin*) use_x86_asm="no" ;;
|
||||
*linux*) DEFAULT_INT10=vm86 ;;
|
||||
*freebsd*) AC_DEFINE(USE_DEV_IO) ;;
|
||||
*netbsd*) AC_DEFINE(USE_I386_IOPL)
|
||||
|
@ -337,10 +334,8 @@ case $host_cpu in
|
|||
GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
|
||||
;;
|
||||
x86_64*|amd64*)
|
||||
use_x86_asm="yes"
|
||||
I386_VIDEO=yes
|
||||
case $host_os in
|
||||
darwin*) use_x86_asm="no" ;;
|
||||
*freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
|
||||
*netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
|
||||
SYS_LIBS=-lx86_64
|
||||
|
@ -710,6 +705,15 @@ if test "x$NEED_DBUS" = xyes; then
|
|||
fi
|
||||
CONFIG_LIB='$(top_builddir)/config/libconfig.a'
|
||||
|
||||
AC_MSG_CHECKING([for glibc...])
|
||||
AC_PREPROC_IFELSE([
|
||||
#include <features.h>
|
||||
#ifndef __GLIBC__
|
||||
#error
|
||||
#endif
|
||||
], glibc=yes, glibc=no)
|
||||
AC_MSG_RESULT([$glibc])
|
||||
|
||||
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
|
||||
[AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
|
||||
[have_clock_gettime=no])])
|
||||
|
@ -725,9 +729,13 @@ if ! test "x$have_clock_gettime" = xno; then
|
|||
|
||||
LIBS_SAVE="$LIBS"
|
||||
LIBS="$CLOCK_LIBS"
|
||||
CPPFLAGS_SAVE="$CPPFLAGS"
|
||||
|
||||
if test x"$glibc" = xyes; then
|
||||
CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=199309L"
|
||||
fi
|
||||
|
||||
AC_RUN_IFELSE([
|
||||
#define _POSIX_C_SOURCE 199309L
|
||||
#include <time.h>
|
||||
|
||||
int main(int argc, char *argv[[]]) {
|
||||
|
@ -742,6 +750,7 @@ int main(int argc, char *argv[[]]) {
|
|||
[MONOTONIC_CLOCK="cross compiling"])
|
||||
|
||||
LIBS="$LIBS_SAVE"
|
||||
CPPFLAGS="$CPPFLAGS_SAVE"
|
||||
else
|
||||
MONOTONIC_CLOCK=no
|
||||
fi
|
||||
|
@ -758,7 +767,6 @@ if test "x$XV" = xyes; then
|
|||
AC_DEFINE(XV, 1, [Support Xv extension])
|
||||
AC_DEFINE(XvExtension, 1, [Build Xv extension])
|
||||
REQUIRED_MODULES="$REQUIRED_MODULES videoproto"
|
||||
PKG_CHECK_MODULES(XV, [xv >= 0.22])
|
||||
else
|
||||
XVMC=no
|
||||
fi
|
||||
|
@ -866,7 +874,7 @@ AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
|
|||
if test "x$DRI2" = xyes; then
|
||||
# FIXME: Bump the versions once we have releases of these.
|
||||
AC_DEFINE(DRI2, 1, [Build DRI2 extension])
|
||||
PKG_CHECK_MODULES([DRIPROTO], [xf86driproto >= 2.0.3])
|
||||
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= 1.1])
|
||||
PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.1])
|
||||
fi
|
||||
|
||||
|
@ -1015,6 +1023,8 @@ XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
|
|||
|
||||
AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
|
||||
[Do not have 'strcasecmp'.]))
|
||||
AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1,
|
||||
[Do not have 'strncasecmp'.]))
|
||||
|
||||
if test "x$NULL_ROOT_CURSOR" = xyes; then
|
||||
AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor])
|
||||
|
@ -1143,6 +1153,9 @@ XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${LIBCRYPTO}"
|
|||
AC_SUBST([XSERVER_LIBS])
|
||||
AC_SUBST([XSERVER_SYS_LIBS])
|
||||
|
||||
UTILS_SYS_LIBS="${SYS_LIBS}"
|
||||
AC_SUBST([UTILS_SYS_LIBS])
|
||||
|
||||
# The Xorg binary needs to export symbols so that they can be used from modules
|
||||
# Some platforms require extra flags to do this. gcc should set these flags
|
||||
# when -rdynamic is passed to it, other compilers/linkers may need to be added
|
||||
|
@ -1160,9 +1173,6 @@ if test "x$GCC" = "xyes"; then
|
|||
LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
|
||||
fi
|
||||
case $host_os in
|
||||
darwin*)
|
||||
LD_EXPORT_SYMBOLS_FLAG=""
|
||||
;;
|
||||
openbsd*)
|
||||
LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
|
||||
;;
|
||||
|
@ -1314,6 +1324,13 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
|
|||
XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $SELINUX_LIB"
|
||||
|
||||
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
|
||||
SAVE_LIBS=$LIBS
|
||||
SAVE_CFLAGS=$CFLAGS
|
||||
CFLAGS=$PCIACCESS_CFLAGS
|
||||
LIBS=$PCIACCESS_LIBS
|
||||
AC_CHECK_FUNCS([pci_system_init_dev_mem])
|
||||
LIBS=$SAVE_LIBS
|
||||
CFLAGS=$SAVE_CFLAGS
|
||||
XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS"
|
||||
XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
|
||||
|
||||
|
@ -1423,17 +1440,9 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
|
|||
esac
|
||||
|
||||
case $host_cpu in
|
||||
i*86)
|
||||
case $host_os in
|
||||
darwin*) ;;
|
||||
*bsd*) ;;
|
||||
linux*) ;;
|
||||
*) xorg_bus_ix86pci=yes ;;
|
||||
esac
|
||||
;;
|
||||
powerpc*)
|
||||
case $host_os in
|
||||
darwin*|linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu)
|
||||
linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu)
|
||||
;;
|
||||
*)
|
||||
xorg_bus_ppcpci="yes"
|
||||
|
@ -1444,9 +1453,9 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
|
|||
xorg_bus_sparcpci="yes"
|
||||
xorg_bus_sparc="yes"
|
||||
;;
|
||||
x86_64*|amd64*)
|
||||
i*86|x86_64*|amd64*)
|
||||
case $host_os in
|
||||
darwin*|*bsd*|linux*)
|
||||
*bsd*|linux*)
|
||||
;;
|
||||
*)
|
||||
xorg_bus_ix86pci="yes"
|
||||
|
@ -1649,17 +1658,17 @@ fi
|
|||
AC_MSG_RESULT([$XWIN])
|
||||
|
||||
if test "x$XWIN" = xyes; then
|
||||
XWIN_SERVER_NAME=XWin
|
||||
case $host_os in
|
||||
cygwin*)
|
||||
XWIN_SERVER_NAME=XWin
|
||||
PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau xfont])
|
||||
AC_DEFINE(HAS_DEVWINDOWS,1,[Cygwin has /dev/windows for signaling new win32 messages])
|
||||
AC_DEFINE(ROOTLESS,1,[Build Rootless code])
|
||||
CFLAGS="$CFLAGS -DFD_SETSIZE=256"
|
||||
;;
|
||||
mingw*)
|
||||
PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau xfont])
|
||||
XWIN_SERVER_NAME=Xming
|
||||
PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau xfont])
|
||||
AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
|
||||
AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
|
||||
XWIN_SYS_LIBS=-lwinsock2
|
||||
|
@ -1755,10 +1764,6 @@ if test "x$XQUARTZ" = xyes; then
|
|||
AC_MSG_NOTICE([Disabling DGA extension])
|
||||
DGA=no
|
||||
fi
|
||||
if test "x$DMX" = xyes || test "x$DMX" = xauto; then
|
||||
AC_MSG_NOTICE([Disabling DMX DDX])
|
||||
DMX=no
|
||||
fi
|
||||
fi
|
||||
|
||||
# Support for objc in autotools is minimal and not documented.
|
||||
|
@ -1801,10 +1806,17 @@ if test "x$LAUNCHD" = "xyes" ; then
|
|||
fi
|
||||
AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
|
||||
|
||||
|
||||
dnl DMX DDX
|
||||
|
||||
AC_MSG_CHECKING([whether to build Xdmx DDX])
|
||||
PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfixes xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no])
|
||||
if test "x$DMX" = xauto; then
|
||||
DMX="$have_dmx"
|
||||
case $host_os in
|
||||
cygwin*) DMX="no" ;;
|
||||
darwin*) DMX="no" ;;
|
||||
esac
|
||||
fi
|
||||
AC_MSG_RESULT([$DMX])
|
||||
AM_CONDITIONAL(DMX, [test "x$DMX" = xyes])
|
||||
|
@ -1909,7 +1921,11 @@ if test "$KDRIVE" = yes; then
|
|||
XSDL_INCS="`sdl-config --cflags` $XSERVER_CFLAGS"
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"])
|
||||
XEPHYR_REQUIRED_LIBS="x11 xext xfont xau xdmcp"
|
||||
if test "x$XV" = xyes; then
|
||||
XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
|
||||
fi
|
||||
PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
|
||||
if test "x$XEPHYR" = xauto; then
|
||||
XEPHYR=$xephyr
|
||||
fi
|
||||
|
@ -1941,7 +1957,7 @@ if test "$KDRIVE" = yes; then
|
|||
KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
|
||||
KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
|
||||
|
||||
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS $XV_CFLAGS"
|
||||
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
|
||||
|
||||
KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
|
||||
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
|
||||
|
@ -1955,10 +1971,10 @@ if test "$KDRIVE" = yes; then
|
|||
KDRIVE_LOCAL_LIBS="$TSLIB_LIBS $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB $CONFIG_LIB"
|
||||
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
|
||||
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB $OS_LIB"
|
||||
KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $XV_LIBS"
|
||||
KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS"
|
||||
|
||||
# check if we can build Xephyr
|
||||
PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"])
|
||||
PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
|
||||
|
||||
AC_SUBST([XEPHYR_LIBS])
|
||||
AC_SUBST([XEPHYR_INCS])
|
||||
|
@ -2120,7 +2136,6 @@ miext/damage/Makefile
|
|||
miext/shadow/Makefile
|
||||
miext/cw/Makefile
|
||||
miext/rootless/Makefile
|
||||
miext/rootless/safeAlpha/Makefile
|
||||
miext/rootless/accel/Makefile
|
||||
os/Makefile
|
||||
randr/Makefile
|
||||
|
|
|
@ -30,6 +30,7 @@ libdix_la_SOURCES = \
|
|||
property.c \
|
||||
registry.c \
|
||||
resource.c \
|
||||
selection.c \
|
||||
swaprep.c \
|
||||
swapreq.c \
|
||||
tables.c \
|
||||
|
|
|
@ -1006,6 +1006,7 @@ FakeAllocColor (ColormapPtr pmap, xColorItem *item)
|
|||
switch (class) {
|
||||
case GrayScale:
|
||||
case PseudoColor:
|
||||
temp = 0;
|
||||
item->pixel = 0;
|
||||
if (FindColor(pmap, pmap->red, entries, &rgb, &temp, PSEUDOMAP,
|
||||
-1, AllComp) == Success) {
|
||||
|
|
275
dix/dispatch.c
275
dix/dispatch.c
|
@ -165,10 +165,6 @@ typedef const char *string;
|
|||
extern xConnSetupPrefix connSetupPrefix;
|
||||
extern char *ConnectionInfo;
|
||||
|
||||
_X_EXPORT Selection *CurrentSelections;
|
||||
_X_EXPORT int NumCurrentSelections;
|
||||
CallbackListPtr SelectionCallback = NULL;
|
||||
|
||||
static ClientPtr grabClient;
|
||||
#define GrabNone 0
|
||||
#define GrabActive 1
|
||||
|
@ -181,8 +177,6 @@ extern int connBlockScreenStart;
|
|||
|
||||
static void KillAllClients(void);
|
||||
|
||||
static void DeleteClientFromAnySelections(ClientPtr client);
|
||||
|
||||
static int nextFreeClientID; /* always MIN free client ID */
|
||||
|
||||
static int nClients; /* number of authorized clients */
|
||||
|
@ -246,14 +240,6 @@ UpdateCurrentTimeIf(void)
|
|||
currentTime = systime;
|
||||
}
|
||||
|
||||
static void
|
||||
InitSelections(void)
|
||||
{
|
||||
if (CurrentSelections)
|
||||
xfree(CurrentSelections);
|
||||
CurrentSelections = (Selection *)NULL;
|
||||
NumCurrentSelections = 0;
|
||||
}
|
||||
#ifdef SMART_SCHEDULE
|
||||
|
||||
#undef SMART_DEBUG
|
||||
|
@ -372,7 +358,6 @@ Dispatch(void)
|
|||
#endif
|
||||
|
||||
nextFreeClientID = 1;
|
||||
InitSelections();
|
||||
nClients = 0;
|
||||
|
||||
clientReady = (int *) xalloc(sizeof(int) * MaxClients);
|
||||
|
@ -967,218 +952,6 @@ ProcGetAtomName(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
ProcSetSelectionOwner(ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
TimeStamp time;
|
||||
int rc;
|
||||
REQUEST(xSetSelectionOwnerReq);
|
||||
REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
|
||||
|
||||
UpdateCurrentTime();
|
||||
time = ClientTimeToServerTime(stuff->time);
|
||||
|
||||
/* If the client's time stamp is in the future relative to the server's
|
||||
time stamp, do not set the selection, just return success. */
|
||||
if (CompareTimeStamps(time, currentTime) == LATER)
|
||||
return Success;
|
||||
if (stuff->window != None)
|
||||
{
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
else
|
||||
pWin = (WindowPtr)None;
|
||||
if (ValidAtom(stuff->selection))
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
rc = XaceHookSelectionAccess(client, stuff->selection,
|
||||
DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
/*
|
||||
* First, see if the selection is already set...
|
||||
*/
|
||||
while ((i < NumCurrentSelections) &&
|
||||
CurrentSelections[i].selection != stuff->selection)
|
||||
i++;
|
||||
if (i < NumCurrentSelections)
|
||||
{
|
||||
xEvent event;
|
||||
|
||||
/* If the timestamp in client's request is in the past relative
|
||||
to the time stamp indicating the last time the owner of the
|
||||
selection was set, do not set the selection, just return
|
||||
success. */
|
||||
if (CompareTimeStamps(time, CurrentSelections[i].lastTimeChanged)
|
||||
== EARLIER)
|
||||
return Success;
|
||||
if (CurrentSelections[i].client &&
|
||||
(!pWin || (CurrentSelections[i].client != client)))
|
||||
{
|
||||
event.u.u.type = SelectionClear;
|
||||
event.u.selectionClear.time = time.milliseconds;
|
||||
event.u.selectionClear.window = CurrentSelections[i].window;
|
||||
event.u.selectionClear.atom = CurrentSelections[i].selection;
|
||||
TryClientEvents (CurrentSelections[i].client, NULL,
|
||||
&event, 1,
|
||||
NoEventMask, NoEventMask /* CantBeFiltered */,
|
||||
NullGrab);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* It doesn't exist, so add it...
|
||||
*/
|
||||
Selection *newsels;
|
||||
|
||||
if (i == 0)
|
||||
newsels = (Selection *)xalloc(sizeof(Selection));
|
||||
else
|
||||
newsels = (Selection *)xrealloc(CurrentSelections,
|
||||
(NumCurrentSelections + 1) * sizeof(Selection));
|
||||
if (!newsels)
|
||||
return BadAlloc;
|
||||
NumCurrentSelections++;
|
||||
CurrentSelections = newsels;
|
||||
CurrentSelections[i].selection = stuff->selection;
|
||||
CurrentSelections[i].devPrivates = NULL;
|
||||
}
|
||||
CurrentSelections[i].lastTimeChanged = time;
|
||||
CurrentSelections[i].window = stuff->window;
|
||||
CurrentSelections[i].pWin = pWin;
|
||||
CurrentSelections[i].client = (pWin ? client : NullClient);
|
||||
if (SelectionCallback)
|
||||
{
|
||||
SelectionInfoRec info;
|
||||
|
||||
info.selection = &CurrentSelections[i];
|
||||
info.client = client;
|
||||
info.kind= SelectionSetOwner;
|
||||
CallCallbacks(&SelectionCallback, &info);
|
||||
}
|
||||
return (client->noClientException);
|
||||
}
|
||||
else
|
||||
{
|
||||
client->errorValue = stuff->selection;
|
||||
return (BadAtom);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ProcGetSelectionOwner(ClientPtr client)
|
||||
{
|
||||
REQUEST(xResourceReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xResourceReq);
|
||||
if (ValidAtom(stuff->id))
|
||||
{
|
||||
int rc, i;
|
||||
xGetSelectionOwnerReply reply;
|
||||
|
||||
rc = XaceHookSelectionAccess(client, stuff->id, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
i = 0;
|
||||
while ((i < NumCurrentSelections) &&
|
||||
CurrentSelections[i].selection != stuff->id) i++;
|
||||
reply.type = X_Reply;
|
||||
reply.length = 0;
|
||||
reply.sequenceNumber = client->sequence;
|
||||
if (i < NumCurrentSelections) {
|
||||
if (SelectionCallback) {
|
||||
SelectionInfoRec info;
|
||||
|
||||
info.selection = &CurrentSelections[i];
|
||||
info.client = client;
|
||||
info.kind= SelectionGetOwner;
|
||||
CallCallbacks(&SelectionCallback, &info);
|
||||
}
|
||||
reply.owner = CurrentSelections[i].window;
|
||||
} else
|
||||
reply.owner = None;
|
||||
WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply);
|
||||
return(client->noClientException);
|
||||
}
|
||||
else
|
||||
{
|
||||
client->errorValue = stuff->id;
|
||||
return (BadAtom);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ProcConvertSelection(ClientPtr client)
|
||||
{
|
||||
Bool paramsOkay;
|
||||
xEvent event;
|
||||
WindowPtr pWin;
|
||||
REQUEST(xConvertSelectionReq);
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xConvertSelectionReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
rc = XaceHookSelectionAccess(client, stuff->selection, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target));
|
||||
if (stuff->property != None)
|
||||
paramsOkay &= ValidAtom(stuff->property);
|
||||
if (paramsOkay)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while ((i < NumCurrentSelections) &&
|
||||
CurrentSelections[i].selection != stuff->selection) i++;
|
||||
if (i < NumCurrentSelections && CurrentSelections[i].window != None) {
|
||||
if (SelectionCallback) {
|
||||
SelectionInfoRec info;
|
||||
|
||||
info.selection = &CurrentSelections[i];
|
||||
info.client = client;
|
||||
info.kind= SelectionConvertSelection;
|
||||
CallCallbacks(&SelectionCallback, &info);
|
||||
}
|
||||
event.u.u.type = SelectionRequest;
|
||||
event.u.selectionRequest.time = stuff->time;
|
||||
event.u.selectionRequest.owner = CurrentSelections[i].window;
|
||||
event.u.selectionRequest.requestor = stuff->requestor;
|
||||
event.u.selectionRequest.selection = stuff->selection;
|
||||
event.u.selectionRequest.target = stuff->target;
|
||||
event.u.selectionRequest.property = stuff->property;
|
||||
if (TryClientEvents(
|
||||
CurrentSelections[i].client, NULL, &event, 1, NoEventMask,
|
||||
NoEventMask /* CantBeFiltered */, NullGrab))
|
||||
return (client->noClientException);
|
||||
}
|
||||
event.u.u.type = SelectionNotify;
|
||||
event.u.selectionNotify.time = stuff->time;
|
||||
event.u.selectionNotify.requestor = stuff->requestor;
|
||||
event.u.selectionNotify.selection = stuff->selection;
|
||||
event.u.selectionNotify.target = stuff->target;
|
||||
event.u.selectionNotify.property = None;
|
||||
TryClientEvents(client, NULL, &event, 1, NoEventMask,
|
||||
NoEventMask /* CantBeFiltered */, NullGrab);
|
||||
return (client->noClientException);
|
||||
}
|
||||
else
|
||||
{
|
||||
client->errorValue = stuff->property;
|
||||
return (BadAtom);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ProcGrabServer(ClientPtr client)
|
||||
{
|
||||
|
@ -3984,54 +3757,6 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
|
|||
WriteEventsToClient (client, 1, (xEvent *)&rep);
|
||||
}
|
||||
|
||||
void
|
||||
DeleteWindowFromAnySelections(WindowPtr pWin)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i< NumCurrentSelections; i++)
|
||||
if (CurrentSelections[i].pWin == pWin)
|
||||
{
|
||||
if (SelectionCallback)
|
||||
{
|
||||
SelectionInfoRec info;
|
||||
|
||||
info.selection = &CurrentSelections[i];
|
||||
info.kind = SelectionWindowDestroy;
|
||||
CallCallbacks(&SelectionCallback, &info);
|
||||
}
|
||||
dixFreePrivates(CurrentSelections[i].devPrivates);
|
||||
CurrentSelections[i].pWin = (WindowPtr)NULL;
|
||||
CurrentSelections[i].window = None;
|
||||
CurrentSelections[i].client = NullClient;
|
||||
CurrentSelections[i].devPrivates = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
DeleteClientFromAnySelections(ClientPtr client)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i< NumCurrentSelections; i++)
|
||||
if (CurrentSelections[i].client == client)
|
||||
{
|
||||
if (SelectionCallback)
|
||||
{
|
||||
SelectionInfoRec info;
|
||||
|
||||
info.selection = &CurrentSelections[i];
|
||||
info.kind = SelectionWindowDestroy;
|
||||
CallCallbacks(&SelectionCallback, &info);
|
||||
}
|
||||
dixFreePrivates(CurrentSelections[i].devPrivates);
|
||||
CurrentSelections[i].pWin = (WindowPtr)NULL;
|
||||
CurrentSelections[i].window = None;
|
||||
CurrentSelections[i].client = NullClient;
|
||||
CurrentSelections[i].devPrivates = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MarkClientException(ClientPtr client)
|
||||
{
|
||||
|
|
|
@ -400,7 +400,7 @@ getValuatorEvents(EventList *events, DeviceIntPtr pDev, int first_valuator,
|
|||
xv = (deviceValuator*)events->event;
|
||||
xv->type = DeviceValuator;
|
||||
xv->first_valuator = i;
|
||||
xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (num_valuators - i);
|
||||
xv->num_valuators = ((final_valuator - i) > 6) ? 6 : (final_valuator - i);
|
||||
xv->deviceid = pDev->id;
|
||||
switch (final_valuator - i) {
|
||||
case 6:
|
||||
|
|
16
dix/main.c
16
dix/main.c
|
@ -93,6 +93,7 @@ Equipment Corporation.
|
|||
#include "colormap.h"
|
||||
#include "colormapst.h"
|
||||
#include "cursorstr.h"
|
||||
#include "selection.h"
|
||||
#include <X11/fonts/font.h>
|
||||
#include "opaque.h"
|
||||
#include "servermd.h"
|
||||
|
@ -112,6 +113,9 @@ Equipment Corporation.
|
|||
#include "dispatch.h" /* InitProcVectors() */
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
pthread_key_t threadname_key=0;
|
||||
|
||||
#ifdef DPMSExtension
|
||||
#define DPMS_SERVER
|
||||
#include <X11/extensions/dpms.h>
|
||||
|
@ -247,6 +251,17 @@ main(int argc, char *argv[], char *envp[])
|
|||
char *xauthfile;
|
||||
HWEventQueueType alwaysCheckForInput[2];
|
||||
|
||||
if(threadname_key == 0) ErrorF("pthread_key_create returned %d\n", pthread_key_create(&threadname_key, NULL));
|
||||
ErrorF("threadname_key = %d\n", threadname_key);
|
||||
if(pthread_getspecific(threadname_key) == NULL) {
|
||||
char *nameptr = malloc(32);
|
||||
sprintf(nameptr, "main thread %d", random());
|
||||
// strcpy(nameptr, "main thread");
|
||||
ErrorF("calling: pthread_setspecific(%d, %s)=%d\n", threadname_key, nameptr, pthread_setspecific(threadname_key, nameptr));
|
||||
if (pthread_getspecific(threadname_key) != NULL) ErrorF("current thread: %s\n", (char *)pthread_getspecific(threadname_key));
|
||||
} else {
|
||||
if (pthread_getspecific(threadname_key) != NULL) ErrorF("thread was already: %s\n", (char *)pthread_getspecific(threadname_key));
|
||||
}
|
||||
display = "0";
|
||||
|
||||
InitGlobals();
|
||||
|
@ -346,6 +361,7 @@ main(int argc, char *argv[], char *envp[])
|
|||
|
||||
InitAtoms();
|
||||
InitEvents();
|
||||
InitSelections();
|
||||
InitGlyphCaching();
|
||||
if (!dixResetPrivates())
|
||||
FatalError("couldn't init private data storage");
|
||||
|
|
215
dix/property.c
215
dix/property.c
|
@ -63,11 +63,10 @@ SOFTWARE.
|
|||
/*****************************************************************
|
||||
* Property Stuff
|
||||
*
|
||||
* ChangeProperty, DeleteProperty, GetProperties,
|
||||
* ListProperties
|
||||
* dixLookupProperty, dixChangeProperty, DeleteProperty
|
||||
*
|
||||
* Properties below to windows. A allocate slots each time
|
||||
* a property is added. No fancy searching done.
|
||||
* Properties belong to windows. The list of properties should not be
|
||||
* traversed directly. Instead, use the three functions listed above.
|
||||
*
|
||||
*****************************************************************/
|
||||
|
||||
|
@ -91,17 +90,22 @@ PrintPropertys(WindowPtr pWin)
|
|||
}
|
||||
#endif
|
||||
|
||||
static _X_INLINE PropertyPtr
|
||||
FindProperty(WindowPtr pWin, Atom propertyName)
|
||||
_X_EXPORT int
|
||||
dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName,
|
||||
ClientPtr client, Mask access_mode)
|
||||
{
|
||||
PropertyPtr pProp = wUserProps(pWin);
|
||||
while (pProp)
|
||||
{
|
||||
PropertyPtr pProp;
|
||||
int rc = BadMatch;
|
||||
client->errorValue = propertyName;
|
||||
|
||||
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
|
||||
if (pProp->propertyName == propertyName)
|
||||
break;
|
||||
pProp = pProp->next;
|
||||
}
|
||||
return pProp;
|
||||
|
||||
if (pProp)
|
||||
rc = XaceHookPropertyAccess(client, pWin, &pProp, access_mode);
|
||||
*result = pProp;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -125,65 +129,69 @@ ProcRotateProperties(ClientPtr client)
|
|||
WindowPtr pWin;
|
||||
Atom * atoms;
|
||||
PropertyPtr * props; /* array of pointer */
|
||||
PropertyPtr pProp;
|
||||
PropertyPtr pProp, saved;
|
||||
|
||||
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
|
||||
UpdateCurrentTime();
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess);
|
||||
if (rc != Success)
|
||||
if (rc != Success || stuff->nAtoms <= 0)
|
||||
return rc;
|
||||
if (!stuff->nAtoms)
|
||||
return(Success);
|
||||
|
||||
atoms = (Atom *) & stuff[1];
|
||||
props = (PropertyPtr *)xalloc(stuff->nAtoms * sizeof(PropertyPtr));
|
||||
if (!props)
|
||||
return(BadAlloc);
|
||||
saved = (PropertyPtr)xalloc(stuff->nAtoms * sizeof(PropertyRec));
|
||||
if (!props || !saved) {
|
||||
rc = BadAlloc;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < stuff->nAtoms; i++)
|
||||
{
|
||||
if (!ValidAtom(atoms[i])) {
|
||||
xfree(props);
|
||||
rc = BadAtom;
|
||||
client->errorValue = atoms[i];
|
||||
return BadAtom;
|
||||
goto out;
|
||||
}
|
||||
for (j = i + 1; j < stuff->nAtoms; j++)
|
||||
if (atoms[j] == atoms[i])
|
||||
{
|
||||
xfree(props);
|
||||
return BadMatch;
|
||||
rc = BadMatch;
|
||||
goto out;
|
||||
}
|
||||
pProp = FindProperty(pWin, atoms[i]);
|
||||
if (!pProp) {
|
||||
xfree(props);
|
||||
return BadMatch;
|
||||
}
|
||||
rc = XaceHookPropertyAccess(client, pWin, pProp,
|
||||
|
||||
rc = dixLookupProperty(&pProp, pWin, atoms[i], client,
|
||||
DixReadAccess|DixWriteAccess);
|
||||
if (rc != Success) {
|
||||
xfree(props);
|
||||
client->errorValue = atoms[i];
|
||||
return rc;
|
||||
}
|
||||
if (rc != Success)
|
||||
goto out;
|
||||
|
||||
props[i] = pProp;
|
||||
saved[i] = *pProp;
|
||||
}
|
||||
delta = stuff->nPositions;
|
||||
|
||||
/* If the rotation is a complete 360 degrees, then moving the properties
|
||||
around and generating PropertyNotify events should be skipped. */
|
||||
|
||||
if ( (stuff->nAtoms != 0) && (abs(delta) % stuff->nAtoms) != 0 )
|
||||
if (abs(delta) % stuff->nAtoms)
|
||||
{
|
||||
while (delta < 0) /* faster if abs value is small */
|
||||
delta += stuff->nAtoms;
|
||||
for (i = 0; i < stuff->nAtoms; i++)
|
||||
{
|
||||
deliverPropertyNotifyEvent(pWin, PropertyNewValue,
|
||||
props[i]->propertyName);
|
||||
j = (i + delta) % stuff->nAtoms;
|
||||
deliverPropertyNotifyEvent(pWin, PropertyNewValue, atoms[i]);
|
||||
|
||||
props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms];
|
||||
/* Preserve name and devPrivates */
|
||||
props[j]->type = saved[i].type;
|
||||
props[j]->format = saved[i].format;
|
||||
props[j]->size = saved[i].size;
|
||||
props[j]->data = saved[i].data;
|
||||
}
|
||||
}
|
||||
out:
|
||||
xfree(saved);
|
||||
xfree(props);
|
||||
return Success;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -248,14 +256,16 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
PropertyPtr pProp;
|
||||
int sizeInBytes, totalSize, rc;
|
||||
pointer data;
|
||||
Mask access_mode;
|
||||
|
||||
sizeInBytes = format>>3;
|
||||
totalSize = len * sizeInBytes;
|
||||
access_mode = (mode == PropModeReplace) ? DixWriteAccess : DixBlendAccess;
|
||||
|
||||
/* first see if property already exists */
|
||||
pProp = FindProperty(pWin, property);
|
||||
rc = dixLookupProperty(&pProp, pWin, property, pClient, access_mode);
|
||||
|
||||
if (!pProp) /* just add to list */
|
||||
if (rc == BadMatch) /* just add to list */
|
||||
{
|
||||
if (!pWin->optional && !MakeWindowOptional (pWin))
|
||||
return(BadAlloc);
|
||||
|
@ -276,7 +286,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
memmove((char *)data, (char *)value, totalSize);
|
||||
pProp->size = len;
|
||||
pProp->devPrivates = NULL;
|
||||
rc = XaceHookPropertyAccess(pClient, pWin, pProp,
|
||||
rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
|
||||
DixCreateAccess|DixWriteAccess);
|
||||
if (rc != Success) {
|
||||
xfree(data);
|
||||
|
@ -287,13 +297,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
pProp->next = pWin->optional->userProps;
|
||||
pWin->optional->userProps = pProp;
|
||||
}
|
||||
else
|
||||
else if (rc == Success)
|
||||
{
|
||||
rc = XaceHookPropertyAccess(pClient, pWin, pProp, DixWriteAccess);
|
||||
if (rc != Success) {
|
||||
pClient->errorValue = property;
|
||||
return rc;
|
||||
}
|
||||
/* To append or prepend to a property the request format and type
|
||||
must match those of the already defined property. The
|
||||
existing format and type are irrelevant when using the mode
|
||||
|
@ -347,6 +352,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
pProp->size += len;
|
||||
}
|
||||
}
|
||||
else
|
||||
return rc;
|
||||
|
||||
if (sendevent)
|
||||
deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp->propertyName);
|
||||
|
@ -369,37 +376,29 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName)
|
|||
PropertyPtr pProp, prevProp;
|
||||
int rc;
|
||||
|
||||
if (!(pProp = wUserProps (pWin)))
|
||||
return(Success);
|
||||
prevProp = (PropertyPtr)NULL;
|
||||
while (pProp)
|
||||
{
|
||||
if (pProp->propertyName == propName)
|
||||
break;
|
||||
prevProp = pProp;
|
||||
pProp = pProp->next;
|
||||
}
|
||||
if (pProp)
|
||||
{
|
||||
rc = XaceHookPropertyAccess(client, pWin, pProp, DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
rc = dixLookupProperty(&pProp, pWin, propName, client, DixDestroyAccess);
|
||||
if (rc == BadMatch)
|
||||
return Success; /* Succeed if property does not exist */
|
||||
|
||||
if (prevProp == (PropertyPtr)NULL) /* takes care of head */
|
||||
{
|
||||
if (rc == Success) {
|
||||
if (pWin->optional->userProps == pProp) {
|
||||
/* Takes care of head */
|
||||
if (!(pWin->optional->userProps = pProp->next))
|
||||
CheckWindowOptionalNeed (pWin);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* Need to traverse to find the previous element */
|
||||
prevProp = pWin->optional->userProps;
|
||||
while (prevProp->next != pProp)
|
||||
prevProp = prevProp->next;
|
||||
prevProp->next = pProp->next;
|
||||
}
|
||||
|
||||
deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
|
||||
dixFreePrivates(pProp->devPrivates);
|
||||
xfree(pProp->data);
|
||||
xfree(pProp);
|
||||
}
|
||||
return(Success);
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -453,15 +452,16 @@ ProcGetProperty(ClientPtr client)
|
|||
int rc;
|
||||
WindowPtr pWin;
|
||||
xGetPropertyReply reply;
|
||||
Mask access_mode = DixGetPropAccess;
|
||||
Mask win_mode = DixGetPropAccess, prop_mode = DixReadAccess;
|
||||
REQUEST(xGetPropertyReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xGetPropertyReq);
|
||||
if (stuff->delete) {
|
||||
UpdateCurrentTime();
|
||||
access_mode |= DixSetPropAccess;
|
||||
win_mode |= DixSetPropAccess;
|
||||
prop_mode |= DixDestroyAccess;
|
||||
}
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, win_mode);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -481,30 +481,14 @@ ProcGetProperty(ClientPtr client)
|
|||
return(BadAtom);
|
||||
}
|
||||
|
||||
pProp = wUserProps (pWin);
|
||||
prevProp = (PropertyPtr)NULL;
|
||||
while (pProp)
|
||||
{
|
||||
if (pProp->propertyName == stuff->property)
|
||||
break;
|
||||
prevProp = pProp;
|
||||
pProp = pProp->next;
|
||||
}
|
||||
|
||||
reply.type = X_Reply;
|
||||
reply.sequenceNumber = client->sequence;
|
||||
if (!pProp)
|
||||
|
||||
rc = dixLookupProperty(&pProp, pWin, stuff->property, client, prop_mode);
|
||||
if (rc == BadMatch)
|
||||
return NullPropertyReply(client, None, 0, &reply);
|
||||
|
||||
access_mode = DixReadAccess;
|
||||
if (stuff->delete)
|
||||
access_mode |= DixDestroyAccess;
|
||||
|
||||
rc = XaceHookPropertyAccess(client, pWin, pProp, access_mode);
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->property;
|
||||
else if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* If the request type and actual type don't match. Return the
|
||||
property information, but not the data. */
|
||||
|
@ -560,15 +544,20 @@ ProcGetProperty(ClientPtr client)
|
|||
(char *)pProp->data + ind);
|
||||
}
|
||||
|
||||
if (stuff->delete && (reply.bytesAfter == 0))
|
||||
{ /* delete the Property */
|
||||
if (prevProp == (PropertyPtr)NULL) /* takes care of head */
|
||||
{
|
||||
if (stuff->delete && (reply.bytesAfter == 0)) {
|
||||
/* Delete the Property */
|
||||
if (pWin->optional->userProps == pProp) {
|
||||
/* Takes care of head */
|
||||
if (!(pWin->optional->userProps = pProp->next))
|
||||
CheckWindowOptionalNeed (pWin);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
/* Need to traverse to find the previous element */
|
||||
prevProp = pWin->optional->userProps;
|
||||
while (prevProp->next != pProp)
|
||||
prevProp = prevProp->next;
|
||||
prevProp->next = pProp->next;
|
||||
}
|
||||
|
||||
dixFreePrivates(pProp->devPrivates);
|
||||
xfree(pProp->data);
|
||||
xfree(pProp);
|
||||
|
@ -583,7 +572,7 @@ ProcListProperties(ClientPtr client)
|
|||
xListPropertiesReply xlpr;
|
||||
int rc, numProps = 0;
|
||||
WindowPtr pWin;
|
||||
PropertyPtr pProp;
|
||||
PropertyPtr pProp, realProp;
|
||||
REQUEST(xResourceReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xResourceReq);
|
||||
|
@ -591,34 +580,34 @@ ProcListProperties(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
pProp = wUserProps (pWin);
|
||||
while (pProp)
|
||||
{
|
||||
pProp = pProp->next;
|
||||
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
|
||||
numProps++;
|
||||
|
||||
if (numProps && !(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
|
||||
return BadAlloc;
|
||||
|
||||
numProps = 0;
|
||||
temppAtoms = pAtoms;
|
||||
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
|
||||
realProp = pProp;
|
||||
rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess);
|
||||
if (rc == Success && realProp == pProp) {
|
||||
*temppAtoms++ = pProp->propertyName;
|
||||
numProps++;
|
||||
}
|
||||
if (numProps)
|
||||
if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
|
||||
return(BadAlloc);
|
||||
}
|
||||
|
||||
xlpr.type = X_Reply;
|
||||
xlpr.nProperties = numProps;
|
||||
xlpr.length = (numProps * sizeof(Atom)) >> 2;
|
||||
xlpr.sequenceNumber = client->sequence;
|
||||
pProp = wUserProps (pWin);
|
||||
temppAtoms = pAtoms;
|
||||
while (pProp)
|
||||
{
|
||||
*temppAtoms++ = pProp->propertyName;
|
||||
pProp = pProp->next;
|
||||
}
|
||||
WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
|
||||
if (numProps)
|
||||
{
|
||||
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
|
||||
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
|
||||
xfree(pAtoms);
|
||||
}
|
||||
xfree(pAtoms);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,311 @@
|
|||
/************************************************************
|
||||
|
||||
Copyright 1987, 1989, 1998 The Open Group
|
||||
|
||||
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.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
|
||||
Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
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 Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL 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 "windowstr.h"
|
||||
#include "dixstruct.h"
|
||||
#include "dispatch.h"
|
||||
#include "selection.h"
|
||||
#include "xace.h"
|
||||
|
||||
/*****************************************************************
|
||||
* Selection Stuff
|
||||
*
|
||||
* dixLookupSelection
|
||||
*
|
||||
* Selections are global to the server. The list of selections should
|
||||
* not be traversed directly. Instead, use the functions listed above.
|
||||
*
|
||||
*****************************************************************/
|
||||
|
||||
_X_EXPORT Selection *CurrentSelections;
|
||||
CallbackListPtr SelectionCallback;
|
||||
|
||||
_X_EXPORT int
|
||||
dixLookupSelection(Selection **result, Atom selectionName,
|
||||
ClientPtr client, Mask access_mode)
|
||||
{
|
||||
Selection *pSel;
|
||||
int rc = BadMatch;
|
||||
client->errorValue = selectionName;
|
||||
|
||||
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
|
||||
if (pSel->selection == selectionName)
|
||||
break;
|
||||
|
||||
if (pSel)
|
||||
rc = XaceHookSelectionAccess(client, &pSel, access_mode);
|
||||
*result = pSel;
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
InitSelections(void)
|
||||
{
|
||||
Selection *pSel, *pNextSel;
|
||||
|
||||
pSel = CurrentSelections;
|
||||
while (pSel) {
|
||||
pNextSel = pSel->next;
|
||||
dixFreePrivates(pSel->devPrivates);
|
||||
xfree(pSel);
|
||||
pSel = pNextSel;
|
||||
}
|
||||
|
||||
CurrentSelections = NULL;
|
||||
}
|
||||
|
||||
static _X_INLINE void
|
||||
CallSelectionCallback(Selection *pSel, ClientPtr client,
|
||||
SelectionCallbackKind kind)
|
||||
{
|
||||
SelectionInfoRec info = { pSel, client, kind };
|
||||
CallCallbacks(&SelectionCallback, &info);
|
||||
}
|
||||
|
||||
void
|
||||
DeleteWindowFromAnySelections(WindowPtr pWin)
|
||||
{
|
||||
Selection *pSel;
|
||||
|
||||
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
|
||||
if (pSel->pWin == pWin) {
|
||||
CallSelectionCallback(pSel, NULL, SelectionWindowDestroy);
|
||||
|
||||
pSel->pWin = (WindowPtr)NULL;
|
||||
pSel->window = None;
|
||||
pSel->client = NullClient;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DeleteClientFromAnySelections(ClientPtr client)
|
||||
{
|
||||
Selection *pSel;
|
||||
|
||||
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
|
||||
if (pSel->client == client) {
|
||||
CallSelectionCallback(pSel, NULL, SelectionClientClose);
|
||||
|
||||
pSel->pWin = (WindowPtr)NULL;
|
||||
pSel->window = None;
|
||||
pSel->client = NullClient;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ProcSetSelectionOwner(ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin = NULL;
|
||||
TimeStamp time;
|
||||
Selection *pSel;
|
||||
int rc;
|
||||
|
||||
REQUEST(xSetSelectionOwnerReq);
|
||||
REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
|
||||
|
||||
UpdateCurrentTime();
|
||||
time = ClientTimeToServerTime(stuff->time);
|
||||
|
||||
/* If the client's time stamp is in the future relative to the server's
|
||||
time stamp, do not set the selection, just return success. */
|
||||
if (CompareTimeStamps(time, currentTime) == LATER)
|
||||
return Success;
|
||||
|
||||
if (stuff->window != None) {
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
if (!ValidAtom(stuff->selection)) {
|
||||
client->errorValue = stuff->selection;
|
||||
return BadAtom;
|
||||
}
|
||||
|
||||
/*
|
||||
* First, see if the selection is already set...
|
||||
*/
|
||||
rc = dixLookupSelection(&pSel, stuff->selection, client, DixSetAttrAccess);
|
||||
|
||||
if (rc == Success) {
|
||||
xEvent event;
|
||||
|
||||
/* If the timestamp in client's request is in the past relative
|
||||
to the time stamp indicating the last time the owner of the
|
||||
selection was set, do not set the selection, just return
|
||||
success. */
|
||||
if (CompareTimeStamps(time, pSel->lastTimeChanged) == EARLIER)
|
||||
return Success;
|
||||
if (pSel->client && (!pWin || (pSel->client != client)))
|
||||
{
|
||||
event.u.u.type = SelectionClear;
|
||||
event.u.selectionClear.time = time.milliseconds;
|
||||
event.u.selectionClear.window = pSel->window;
|
||||
event.u.selectionClear.atom = pSel->selection;
|
||||
TryClientEvents(pSel->client, NULL, &event, 1, NoEventMask,
|
||||
NoEventMask /* CantBeFiltered */, NullGrab);
|
||||
}
|
||||
}
|
||||
else if (rc == BadMatch)
|
||||
{
|
||||
/*
|
||||
* It doesn't exist, so add it...
|
||||
*/
|
||||
pSel = xalloc(sizeof(Selection));
|
||||
if (!pSel)
|
||||
return BadAlloc;
|
||||
|
||||
pSel->selection = stuff->selection;
|
||||
pSel->devPrivates = NULL;
|
||||
|
||||
/* security creation/labeling check */
|
||||
rc = XaceHookSelectionAccess(client, &pSel,
|
||||
DixCreateAccess|DixSetAttrAccess);
|
||||
if (rc != Success) {
|
||||
xfree(pSel);
|
||||
return rc;
|
||||
}
|
||||
|
||||
pSel->next = CurrentSelections;
|
||||
CurrentSelections = pSel;
|
||||
}
|
||||
else
|
||||
return rc;
|
||||
|
||||
pSel->lastTimeChanged = time;
|
||||
pSel->window = stuff->window;
|
||||
pSel->pWin = pWin;
|
||||
pSel->client = (pWin ? client : NullClient);
|
||||
|
||||
CallSelectionCallback(pSel, client, SelectionSetOwner);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
int
|
||||
ProcGetSelectionOwner(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
Selection *pSel;
|
||||
xGetSelectionOwnerReply reply;
|
||||
|
||||
REQUEST(xResourceReq);
|
||||
REQUEST_SIZE_MATCH(xResourceReq);
|
||||
|
||||
if (!ValidAtom(stuff->id)) {
|
||||
client->errorValue = stuff->id;
|
||||
return BadAtom;
|
||||
}
|
||||
|
||||
reply.type = X_Reply;
|
||||
reply.length = 0;
|
||||
reply.sequenceNumber = client->sequence;
|
||||
|
||||
rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess);
|
||||
if (rc == Success)
|
||||
reply.owner = pSel->window;
|
||||
else if (rc == BadMatch)
|
||||
reply.owner = None;
|
||||
else
|
||||
return rc;
|
||||
|
||||
WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
int
|
||||
ProcConvertSelection(ClientPtr client)
|
||||
{
|
||||
Bool paramsOkay;
|
||||
xEvent event;
|
||||
WindowPtr pWin;
|
||||
Selection *pSel;
|
||||
int rc;
|
||||
|
||||
REQUEST(xConvertSelectionReq);
|
||||
REQUEST_SIZE_MATCH(xConvertSelectionReq);
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
paramsOkay = ValidAtom(stuff->selection) && ValidAtom(stuff->target);
|
||||
paramsOkay &= (stuff->property == None) || ValidAtom(stuff->property);
|
||||
if (!paramsOkay) {
|
||||
client->errorValue = stuff->property;
|
||||
return BadAtom;
|
||||
}
|
||||
|
||||
rc = dixLookupSelection(&pSel, stuff->selection, client, DixReadAccess);
|
||||
|
||||
if (rc != Success && rc != BadMatch)
|
||||
return rc;
|
||||
else if (rc == Success && pSel->window != None) {
|
||||
event.u.u.type = SelectionRequest;
|
||||
event.u.selectionRequest.owner = pSel->window;
|
||||
event.u.selectionRequest.time = stuff->time;
|
||||
event.u.selectionRequest.requestor = stuff->requestor;
|
||||
event.u.selectionRequest.selection = stuff->selection;
|
||||
event.u.selectionRequest.target = stuff->target;
|
||||
event.u.selectionRequest.property = stuff->property;
|
||||
if (TryClientEvents(pSel->client, NULL, &event, 1, NoEventMask,
|
||||
NoEventMask /* CantBeFiltered */, NullGrab))
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
event.u.u.type = SelectionNotify;
|
||||
event.u.selectionNotify.time = stuff->time;
|
||||
event.u.selectionNotify.requestor = stuff->requestor;
|
||||
event.u.selectionNotify.selection = stuff->selection;
|
||||
event.u.selectionNotify.target = stuff->target;
|
||||
event.u.selectionNotify.property = None;
|
||||
TryClientEvents(client, NULL, &event, 1, NoEventMask,
|
||||
NoEventMask /* CantBeFiltered */, NullGrab);
|
||||
return client->noClientException;
|
||||
}
|
|
@ -56,7 +56,7 @@ struct _ExaOffscreenArea {
|
|||
int base_offset; /* allocation base */
|
||||
int offset; /* aligned offset */
|
||||
int size; /* total allocation size */
|
||||
int score;
|
||||
unsigned last_use;
|
||||
pointer privData;
|
||||
|
||||
ExaOffscreenSaveProc save;
|
||||
|
|
|
@ -71,6 +71,64 @@ ExaOffscreenKickOut (ScreenPtr pScreen, ExaOffscreenArea *area)
|
|||
return exaOffscreenFree (pScreen, area);
|
||||
}
|
||||
|
||||
#define AREA_SCORE(area) (area->size / (double)(pExaScr->offScreenCounter - area->last_use))
|
||||
|
||||
static ExaOffscreenArea *
|
||||
exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
|
||||
{
|
||||
ExaOffscreenArea *begin, *end, *best;
|
||||
double score, best_score;
|
||||
int avail, real_size, tmp;
|
||||
|
||||
best_score = UINT_MAX;
|
||||
begin = end = pExaScr->info->offScreenAreas;
|
||||
avail = 0;
|
||||
score = 0;
|
||||
best = 0;
|
||||
|
||||
while (end != NULL)
|
||||
{
|
||||
restart:
|
||||
while (begin != NULL && begin->state == ExaOffscreenLocked)
|
||||
begin = end = begin->next;
|
||||
|
||||
if (begin == NULL)
|
||||
break;
|
||||
|
||||
/* adjust size needed to account for alignment loss for this area */
|
||||
real_size = size;
|
||||
tmp = begin->base_offset % align;
|
||||
if (tmp)
|
||||
real_size += (align - tmp);
|
||||
|
||||
while (avail < real_size && end != NULL)
|
||||
{
|
||||
if (end->state == ExaOffscreenLocked) {
|
||||
/* Can't more room here, restart after this locked area */
|
||||
avail = 0;
|
||||
score = 0;
|
||||
begin = end;
|
||||
goto restart;
|
||||
}
|
||||
avail += end->size;
|
||||
score += AREA_SCORE(end);
|
||||
end = end->next;
|
||||
}
|
||||
|
||||
/* Check the score, update best */
|
||||
if (avail >= real_size && score < best_score) {
|
||||
best = begin;
|
||||
best_score = score;
|
||||
}
|
||||
|
||||
avail -= begin->size;
|
||||
score -= AREA_SCORE(begin);
|
||||
begin = begin->next;
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
/**
|
||||
* exaOffscreenAlloc allocates offscreen memory
|
||||
*
|
||||
|
@ -96,9 +154,9 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
|
|||
ExaOffscreenSaveProc save,
|
||||
pointer privData)
|
||||
{
|
||||
ExaOffscreenArea *area, *begin, *best;
|
||||
ExaOffscreenArea *area;
|
||||
ExaScreenPriv (pScreen);
|
||||
int tmp, real_size = 0, best_score;
|
||||
int tmp, real_size = 0;
|
||||
#if DEBUG_OFFSCREEN
|
||||
static int number = 0;
|
||||
ErrorF("================= ============ allocating a new pixmap %d\n", ++number);
|
||||
|
@ -143,53 +201,8 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
|
|||
|
||||
if (!area)
|
||||
{
|
||||
/*
|
||||
* Kick out existing users to make space.
|
||||
*
|
||||
* First, locate a region which can hold the desired object.
|
||||
*/
|
||||
area = exaFindAreaToEvict(pExaScr, size, align);
|
||||
|
||||
/* prev points at the first object to boot */
|
||||
best = NULL;
|
||||
best_score = INT_MAX;
|
||||
for (begin = pExaScr->info->offScreenAreas; begin != NULL;
|
||||
begin = begin->next)
|
||||
{
|
||||
int avail, score;
|
||||
ExaOffscreenArea *scan;
|
||||
|
||||
if (begin->state == ExaOffscreenLocked)
|
||||
continue;
|
||||
|
||||
/* adjust size needed to account for alignment loss for this area */
|
||||
real_size = size;
|
||||
tmp = begin->base_offset % align;
|
||||
if (tmp)
|
||||
real_size += (align - tmp);
|
||||
|
||||
avail = 0;
|
||||
score = 0;
|
||||
/* now see if we can make room here, and how "costly" it'll be. */
|
||||
for (scan = begin; scan != NULL; scan = scan->next)
|
||||
{
|
||||
if (scan->state == ExaOffscreenLocked) {
|
||||
/* Can't make room here, start after this locked area. */
|
||||
begin = scan;
|
||||
break;
|
||||
}
|
||||
/* Score should only be non-zero for ExaOffscreenRemovable */
|
||||
score += scan->score;
|
||||
avail += scan->size;
|
||||
if (avail >= real_size)
|
||||
break;
|
||||
}
|
||||
/* Is it the best option we've found so far? */
|
||||
if (avail >= real_size && score < best_score) {
|
||||
best = begin;
|
||||
best_score = score;
|
||||
}
|
||||
}
|
||||
area = best;
|
||||
if (!area)
|
||||
{
|
||||
DBG_OFFSCREEN (("Alloc 0x%x -> NOSPACE\n", size));
|
||||
|
@ -230,7 +243,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
|
|||
new_area->size = area->size - real_size;
|
||||
new_area->state = ExaOffscreenAvail;
|
||||
new_area->save = NULL;
|
||||
new_area->score = 0;
|
||||
new_area->last_use = 0;
|
||||
new_area->next = area->next;
|
||||
area->next = new_area;
|
||||
area->size = real_size;
|
||||
|
@ -244,7 +257,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
|
|||
area->state = ExaOffscreenRemovable;
|
||||
area->privData = privData;
|
||||
area->save = save;
|
||||
area->score = 0;
|
||||
area->last_use = pExaScr->offScreenCounter++;
|
||||
area->offset = (area->base_offset + align - 1);
|
||||
area->offset -= area->offset % align;
|
||||
|
||||
|
@ -395,7 +408,7 @@ exaOffscreenFree (ScreenPtr pScreen, ExaOffscreenArea *area)
|
|||
|
||||
area->state = ExaOffscreenAvail;
|
||||
area->save = NULL;
|
||||
area->score = 0;
|
||||
area->last_use = 0;
|
||||
/*
|
||||
* Find previous area
|
||||
*/
|
||||
|
@ -427,23 +440,11 @@ ExaOffscreenMarkUsed (PixmapPtr pPixmap)
|
|||
{
|
||||
ExaPixmapPriv (pPixmap);
|
||||
ExaScreenPriv (pPixmap->drawable.pScreen);
|
||||
static int iter = 0;
|
||||
|
||||
if (!pExaPixmap || !pExaPixmap->area)
|
||||
return;
|
||||
|
||||
/* The numbers here are arbitrary. We may want to tune these. */
|
||||
pExaPixmap->area->score += 100;
|
||||
if (++iter == 10) {
|
||||
ExaOffscreenArea *area;
|
||||
for (area = pExaScr->info->offScreenAreas; area != NULL;
|
||||
area = area->next)
|
||||
{
|
||||
if (area->state == ExaOffscreenRemovable)
|
||||
area->score = (area->score * 7) / 8;
|
||||
}
|
||||
iter = 0;
|
||||
}
|
||||
pExaPixmap->area->last_use = pExaScr->offScreenCounter++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -472,10 +473,11 @@ exaOffscreenInit (ScreenPtr pScreen)
|
|||
area->size = pExaScr->info->memorySize - area->base_offset;
|
||||
area->save = NULL;
|
||||
area->next = NULL;
|
||||
area->score = 0;
|
||||
area->last_use = 0;
|
||||
|
||||
/* Add it to the free areas */
|
||||
pExaScr->info->offScreenAreas = area;
|
||||
pExaScr->offScreenCounter = 1;
|
||||
|
||||
ExaOffscreenValidate (pScreen);
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ typedef struct {
|
|||
Bool checkDirtyCorrectness;
|
||||
unsigned disableFbCount;
|
||||
Bool optimize_migration;
|
||||
unsigned offScreenCounter;
|
||||
} ExaScreenPrivRec, *ExaScreenPrivPtr;
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <X11/XKBlib.h>
|
||||
#include <X11/extensions/XInput.h>
|
||||
#include <X11/extensions/XKB.h>
|
||||
#include "xkbstr.h"
|
||||
#include <X11/extensions/XKBstr.h>
|
||||
#include <X11/extensions/dmxext.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <X11/Xlib.h>
|
||||
#include <X11/XKBlib.h>
|
||||
#include <X11/extensions/XKB.h>
|
||||
#include "xkbstr.h"
|
||||
#include <X11/extensions/XKBstr.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
|
|
@ -431,7 +431,7 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
__glXWindow *pGlxWindow = NULL;
|
||||
int rc;
|
||||
|
||||
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess);
|
||||
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess);
|
||||
if (rc != Success) {
|
||||
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
|
||||
__glXPixmapRes);
|
||||
|
@ -461,7 +461,7 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
__glXWindow *pGlxWindow = NULL;
|
||||
int rc;
|
||||
|
||||
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess);
|
||||
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess);
|
||||
if (rc != Success) {
|
||||
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
|
||||
__glXPixmapRes);
|
||||
|
@ -481,7 +481,7 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
|
||||
if (req->member != None) {
|
||||
rc = dixLookupDrawable(&pMember, req->member, client, 0,
|
||||
DixUnknownAccess);
|
||||
DixGetAttrAccess);
|
||||
if (rc != Success) {
|
||||
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member,
|
||||
__glXPixmapRes);
|
||||
|
@ -780,7 +780,7 @@ static int MakeCurrent(__GLXclientState *cl,
|
|||
}
|
||||
|
||||
if (drawId != None) {
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
|
||||
if (rc == Success) {
|
||||
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||
/*
|
||||
|
@ -887,7 +887,7 @@ static int MakeCurrent(__GLXclientState *cl,
|
|||
}
|
||||
|
||||
if (readId != None && readId != drawId ) {
|
||||
rc = dixLookupDrawable(&pReadDraw, readId, client, 0,DixUnknownAccess);
|
||||
rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess);
|
||||
if (rc == Success) {
|
||||
if (pReadDraw->type == DRAWABLE_WINDOW) {
|
||||
/*
|
||||
|
@ -1645,7 +1645,7 @@ static int CreateGLXPixmap(__GLXclientState *cl,
|
|||
#endif
|
||||
|
||||
rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP,
|
||||
DixUnknownAccess);
|
||||
DixAddAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -1779,7 +1779,7 @@ static int CreateGLXPixmap(__GLXclientState *cl,
|
|||
#ifdef PANORAMIX
|
||||
if (pXinDraw) {
|
||||
dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
|
||||
DixUnknownAccess);
|
||||
DixAddAccess);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1950,7 +1950,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
|
|||
/*
|
||||
** Check that the GLX drawable is valid.
|
||||
*/
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
|
||||
if (rc == Success) {
|
||||
from_screen = to_screen = pDraw->pScreen->myNum;
|
||||
|
||||
|
@ -2104,7 +2104,7 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
|
|||
/*
|
||||
** Check that the GLX drawable is valid.
|
||||
*/
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
|
||||
if (rc == Success) {
|
||||
if (pDraw->type != DRAWABLE_WINDOW) {
|
||||
/*
|
||||
|
@ -2893,7 +2893,7 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
|
|||
** Check if windowId is valid
|
||||
*/
|
||||
rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW,
|
||||
DixUnknownAccess);
|
||||
DixAddAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -3277,7 +3277,7 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
|
|||
#endif
|
||||
|
||||
if (drawId != None) {
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
|
||||
if (rc == Success) {
|
||||
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||
WindowPtr pWin = (WindowPtr)pDraw;
|
||||
|
@ -3438,7 +3438,7 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
|
|||
#endif
|
||||
|
||||
if (drawId != None) {
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
|
||||
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess);
|
||||
if (rc == Success) {
|
||||
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||
WindowPtr pWin = (WindowPtr)pDraw;
|
||||
|
|
|
@ -35,6 +35,7 @@ if XEPHYR_HAS_DRI
|
|||
|
||||
libxephyr_hostdri_a_SOURCES= \
|
||||
ephyrdriext.c \
|
||||
ephyrdriext.h \
|
||||
ephyrdri.c \
|
||||
ephyrdri.h \
|
||||
XF86dri.c \
|
||||
|
|
|
@ -385,9 +385,8 @@ Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
|
|||
context, hHWContext );
|
||||
}
|
||||
|
||||
GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context)
|
||||
GLboolean XF86DRIDestroyContext( Display *dpy, int screen, XID context)
|
||||
{
|
||||
Display * const dpy = (Display *) ndpy;
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRIDestroyContextReq *req;
|
||||
|
||||
|
@ -407,10 +406,9 @@ GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid
|
|||
}
|
||||
|
||||
GLboolean
|
||||
XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
|
||||
__DRIid drawable, drm_drawable_t * hHWDrawable)
|
||||
XF86DRICreateDrawable (Display *dpy, int screen,
|
||||
XID drawable, drm_drawable_t * hHWDrawable)
|
||||
{
|
||||
Display * const dpy = (Display *) ndpy;
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRICreateDrawableReply rep;
|
||||
xXF86DRICreateDrawableReq *req;
|
||||
|
@ -437,16 +435,36 @@ XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
|
|||
return True;
|
||||
}
|
||||
|
||||
GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
|
||||
__DRIid drawable )
|
||||
static int noopErrorHandler(Display *dpy, XErrorEvent *xerr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen,
|
||||
XID drawable )
|
||||
{
|
||||
Display * const dpy = (Display *) ndpy;
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRIDestroyDrawableReq *req;
|
||||
int (*oldXErrorHandler)(Display *, XErrorEvent *);
|
||||
|
||||
TRACE("DestroyDrawable...");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
/* This is called from the DRI driver, which used call it like this
|
||||
*
|
||||
* if (windowExists(drawable))
|
||||
* destroyDrawable(drawable);
|
||||
*
|
||||
* which is a textbook race condition - the window may disappear
|
||||
* from the server between checking for its existance and
|
||||
* destroying it. Instead we change the semantics of
|
||||
* __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
|
||||
* the windows is gone, by wrapping the destroy call in an error
|
||||
* handler. */
|
||||
|
||||
XSync(dpy, GL_FALSE);
|
||||
oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRIDestroyDrawable, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
|
@ -455,6 +473,9 @@ GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
|
|||
req->drawable = drawable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
XSetErrorHandler(oldXErrorHandler);
|
||||
|
||||
TRACE("DestroyDrawable... return True");
|
||||
return True;
|
||||
}
|
||||
|
|
|
@ -891,9 +891,12 @@ ephyrPoll(void)
|
|||
continue;
|
||||
}
|
||||
{
|
||||
if (ephyrCurScreen != ev.data.mouse_motion.screen)
|
||||
if (ev.data.mouse_motion.screen >=0
|
||||
&& (ephyrCurScreen != ev.data.mouse_motion.screen))
|
||||
{
|
||||
EPHYR_LOG ("warping mouse cursor:%d\n", ephyrCurScreen) ;
|
||||
EPHYR_LOG ("warping mouse cursor. "
|
||||
"cur_screen%d, motion_screen:%d\n",
|
||||
ephyrCurScreen, ev.data.mouse_motion.screen) ;
|
||||
if (ev.data.mouse_motion.screen >= 0)
|
||||
{
|
||||
ephyrWarpCursor
|
||||
|
@ -904,11 +907,30 @@ ephyrPoll(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
int x=0, y=0;
|
||||
#ifdef XEPHYR_DRI
|
||||
EphyrWindowPair *pair = NULL;
|
||||
#endif
|
||||
EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
|
||||
KdEnqueuePointerEvent(ephyrMouse, mouseState,
|
||||
ev.data.mouse_motion.x,
|
||||
ev.data.mouse_motion.y,
|
||||
0);
|
||||
x = ev.data.mouse_motion.x;
|
||||
y = ev.data.mouse_motion.y;
|
||||
EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ;
|
||||
#ifdef XEPHYR_DRI
|
||||
EPHYR_LOG ("is this window peered by a gl drawable ?\n") ;
|
||||
if (findWindowPairFromRemote (ev.data.mouse_motion.window,
|
||||
&pair))
|
||||
{
|
||||
EPHYR_LOG ("yes, it is peered\n") ;
|
||||
x += pair->local->drawable.x;
|
||||
y += pair->local->drawable.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
EPHYR_LOG ("no, it is not peered\n") ;
|
||||
}
|
||||
EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ;
|
||||
#endif
|
||||
KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#include "os.h" /* for OsSignal() */
|
||||
#include "kdrive.h"
|
||||
|
|
|
@ -109,6 +109,7 @@ ddxUseMsg (void)
|
|||
ErrorF("-nodri do not use DRI\n");
|
||||
#endif
|
||||
ErrorF("-noxv do not use XV\n");
|
||||
ErrorF("-name [name] define the name in the WM_CLASS property\n");
|
||||
ErrorF("\n");
|
||||
|
||||
exit(1);
|
||||
|
@ -148,6 +149,11 @@ ddxProcessArgument (int argc, char **argv, int i)
|
|||
{
|
||||
EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] );
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
hostx_use_resname(basename(argv[0]), 0);
|
||||
}
|
||||
|
||||
if (!strcmp (argv[i], "-parent"))
|
||||
{
|
||||
if(i+1 < argc)
|
||||
|
@ -223,6 +229,19 @@ ddxProcessArgument (int argc, char **argv, int i)
|
|||
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 (argv[i][0] == ':')
|
||||
{
|
||||
hostx_set_display_name(argv[i]);
|
||||
|
|
|
@ -107,6 +107,9 @@ extern EphyrKeySyms ephyrKeySyms;
|
|||
|
||||
extern int monitorResolution;
|
||||
|
||||
char *ephyrResName = NULL;
|
||||
int ephyrResNameFromCmd = 0;
|
||||
|
||||
static void
|
||||
hostx_set_fullscreen_hint(void);
|
||||
|
||||
|
@ -296,6 +299,13 @@ hostx_handle_signal (int signum)
|
|||
HostXWantDamageDebug);
|
||||
}
|
||||
|
||||
void
|
||||
hostx_use_resname (char *name, int fromcmd)
|
||||
{
|
||||
ephyrResName = name;
|
||||
ephyrResNameFromCmd = fromcmd;
|
||||
}
|
||||
|
||||
int
|
||||
hostx_init (void)
|
||||
{
|
||||
|
@ -304,6 +314,8 @@ hostx_init (void)
|
|||
Pixmap cursor_pxm;
|
||||
XColor col;
|
||||
int index;
|
||||
char *tmpstr;
|
||||
XClassHint *class_hint;
|
||||
|
||||
attr.event_mask =
|
||||
ButtonPressMask
|
||||
|
@ -327,6 +339,8 @@ hostx_init (void)
|
|||
HostX.depth = DefaultDepth(HostX.dpy, HostX.screen);
|
||||
HostX.visual = DefaultVisual(HostX.dpy, HostX.screen);
|
||||
|
||||
class_hint = XAllocClassHint();
|
||||
|
||||
for (index = 0 ; index < HostX.n_screens ; index++)
|
||||
{
|
||||
struct EphyrHostScreen *host_screen = &HostX.screens[index];
|
||||
|
@ -389,9 +403,23 @@ hostx_init (void)
|
|||
|
||||
hostx_set_fullscreen_hint();
|
||||
}
|
||||
|
||||
if (class_hint)
|
||||
{
|
||||
tmpstr = getenv("RESOURCE_NAME");
|
||||
if (tmpstr && (!ephyrResNameFromCmd))
|
||||
ephyrResName = tmpstr;
|
||||
class_hint->res_name = ephyrResName;
|
||||
class_hint->res_class = "Xephyr";
|
||||
XSetClassHint(hostx_get_display(), host_screen->win, class_hint);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (class_hint)
|
||||
XFree(class_hint);
|
||||
|
||||
XParseColor (HostX.dpy, DefaultColormap (HostX.dpy,HostX.screen),
|
||||
"red", &col);
|
||||
|
@ -916,6 +944,7 @@ hostx_get_event(EphyrHostXEvent *ev)
|
|||
ev->type = EPHYR_EV_MOUSE_MOTION;
|
||||
ev->data.mouse_motion.x = xev.xmotion.x;
|
||||
ev->data.mouse_motion.y = xev.xmotion.y;
|
||||
ev->data.mouse_motion.window = xev.xmotion.window;
|
||||
ev->data.mouse_motion.screen = (host_screen ? host_screen->mynum : -1);
|
||||
}
|
||||
return 1;
|
||||
|
|
|
@ -70,6 +70,7 @@ struct EphyrHostXEvent
|
|||
int x;
|
||||
int y;
|
||||
int screen;
|
||||
int window;
|
||||
} mouse_motion;
|
||||
|
||||
struct mouse_down {
|
||||
|
@ -144,6 +145,9 @@ hostx_want_preexisting_window(EphyrScreenInfo screen);
|
|||
void
|
||||
hostx_use_preexisting_window(unsigned long win_id);
|
||||
|
||||
void
|
||||
hostx_use_resname (char *name, int fromcmd);
|
||||
|
||||
void
|
||||
hostx_handle_signal(int signum);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ manual page, \fIXvfb\fP accepts the following command line switches:
|
|||
.B "\-screen \fIscreennum\fP \fIWxHxD\fP"
|
||||
This option creates screen \fIscreennum\fP and sets its width, height,
|
||||
and depth to W, H, and D respectively. By default, only screen 0 exists
|
||||
and has the dimensions 1280x1024x12.
|
||||
and has the dimensions 1280x1024x8.
|
||||
.TP 4
|
||||
.B "\-pixdepths \fIlist-of-depths\fP"
|
||||
This option specifies a list of pixmap depths that the server should
|
||||
|
@ -106,12 +106,12 @@ will be depth 32 1600x1200.
|
|||
.TP 8
|
||||
Xvfb :1 -screen 1 1600x1200x16
|
||||
The server will listen for connections as server number 1, will have the
|
||||
default screen configuration (one screen, 1280x1024x12), and screen 1
|
||||
default screen configuration (one screen, 1280x1024x8), and screen 1
|
||||
will be depth 16 1600x1200.
|
||||
.TP 8
|
||||
Xvfb -pixdepths 3 27 -fbdir /var/tmp
|
||||
The server will listen for connections as server number 0, will have the
|
||||
default screen configuration (one screen, 1280x1024x12),
|
||||
default screen configuration (one screen, 1280x1024x8),
|
||||
will also support pixmap
|
||||
depths of 3 and 27,
|
||||
and will use memory mapped files in /var/tmp for the framebuffer.
|
||||
|
|
|
@ -30,7 +30,7 @@ BUILT_SOURCES = xf86DefModeSet.c
|
|||
|
||||
AM_LDFLAGS = -r
|
||||
libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
|
||||
xf86Cursor.c xf86cvt.c xf86DGA.c xf86DPMS.c \
|
||||
xf86Cursor.c xf86DGA.c xf86DPMS.c \
|
||||
xf86DoProbe.c xf86Events.c \
|
||||
xf86Globals.c xf86AutoConfig.c \
|
||||
xf86MiscExt.c xf86Option.c \
|
||||
|
|
|
@ -44,8 +44,6 @@ BEGIN {
|
|||
flagsdict["-hsync +vsync interlace"] = "V_NHSYNC | V_PVSYNC | V_INTERLACE"
|
||||
flagsdict["-hsync -vsync interlace"] = "V_NHSYNC | V_NVSYNC | V_INTERLACE"
|
||||
|
||||
print "/* $" "XFree86$ */"
|
||||
print
|
||||
print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at"
|
||||
print " * modeline2c.awk */"
|
||||
print ""
|
||||
|
@ -68,12 +66,12 @@ BEGIN {
|
|||
print ""
|
||||
print "#include \"globals.h\""
|
||||
print ""
|
||||
print "#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT"
|
||||
print "#define MODEPREFIX NULL, NULL, NULL, MODE_OK, M_T_DEFAULT"
|
||||
print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0"
|
||||
print ""
|
||||
print "DisplayModeRec xf86DefaultModes [] = {"
|
||||
print "const DisplayModeRec xf86DefaultModes [] = {"
|
||||
|
||||
modeline = "\t{MODEPREFIX(\"%dx%d\"),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n"
|
||||
modeline = "\t{MODEPREFIX,%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n"
|
||||
modeline_data = "^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+"
|
||||
}
|
||||
|
||||
|
@ -81,10 +79,10 @@ BEGIN {
|
|||
flags = $0
|
||||
gsub(modeline_data, "", flags)
|
||||
flags = tolower(flags)
|
||||
printf(modeline, $4, $8, $3 * 1000, $4, $5, $6, $7,
|
||||
printf(modeline, $3 * 1000, $4, $5, $6, $7,
|
||||
$8, $9, $10, $11, flagsdict[flags])
|
||||
# Half-width double scanned modes
|
||||
printf(modeline, $4/2, $8/2, $3 * 500, $4/2, $5/2, $6/2, $7/2,
|
||||
printf(modeline, $3 * 500, $4/2, $5/2, $6/2, $7/2,
|
||||
$8/2, $9/2, $10/2, $11/2, flagsdict[flags] " | V_DBLSCAN")
|
||||
}
|
||||
|
||||
|
@ -93,5 +91,6 @@ BEGIN {
|
|||
}
|
||||
|
||||
END {
|
||||
printf("\t{MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n")
|
||||
print "};"
|
||||
printf "const int xf86NumDefaultModes = sizeof(xf86DefaultModes) / sizeof(DisplayModeRec);"
|
||||
}
|
||||
|
|
|
@ -82,7 +82,6 @@ static int builtinLines = 0;
|
|||
static const char *deviceList[] = {
|
||||
"fbdev",
|
||||
"vesa",
|
||||
"vga",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -141,12 +140,13 @@ videoPtrToDriverName(struct pci_device *dev)
|
|||
{
|
||||
/*
|
||||
* things not handled yet:
|
||||
* amd/cyrix/nsc
|
||||
* xgi
|
||||
* cyrix/nsc. should be merged into geode anyway.
|
||||
* xgi.
|
||||
*/
|
||||
|
||||
switch (dev->vendor_id)
|
||||
{
|
||||
case 0x1022: return "amd";
|
||||
case 0x1142: return "apm";
|
||||
case 0xedd8: return "ark";
|
||||
case 0x1a03: return "ast";
|
||||
|
@ -436,9 +436,10 @@ chooseVideoDriver(void)
|
|||
if (!info) {
|
||||
ErrorF("Primary device is not PCI\n");
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
else {
|
||||
matchDriverFromFiles(matches, info->vendor_id, info->device_id);
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
||||
/* TODO Handle multiple drivers claiming to support the same PCI ID */
|
||||
|
@ -450,8 +451,6 @@ chooseVideoDriver(void)
|
|||
if (chosen_driver == NULL) {
|
||||
#if defined __i386__ || defined __amd64__ || defined __hurd__
|
||||
chosen_driver = "vesa";
|
||||
#elif defined __alpha__
|
||||
chosen_driver = "vga";
|
||||
#elif defined __sparc__
|
||||
chosen_driver = "sunffb";
|
||||
#else
|
||||
|
|
|
@ -119,8 +119,11 @@ static ModuleDefault ModuleDefaults[] = {
|
|||
{.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
|
||||
{.name = "glx", .toLoad = TRUE, .load_opt=NULL},
|
||||
{.name = "freetype", .toLoad = TRUE, .load_opt=NULL},
|
||||
#ifdef XRECORD
|
||||
{.name = "record", .toLoad = TRUE, .load_opt=NULL},
|
||||
#endif
|
||||
{.name = "dri", .toLoad = TRUE, .load_opt=NULL},
|
||||
{.name = "dri2", .toLoad = TRUE, .load_opt=NULL},
|
||||
{.name = NULL, .toLoad = FALSE, .load_opt=NULL}
|
||||
};
|
||||
|
||||
|
@ -494,7 +497,7 @@ xf86InputDriverlistFromConfig()
|
|||
static void
|
||||
fixup_video_driver_list(char **drivers)
|
||||
{
|
||||
static const char *fallback[5] = { "vga", "vesa", "fbdev", "wsfb", NULL };
|
||||
static const char *fallback[4] = { "vesa", "fbdev", "wsfb", NULL };
|
||||
char **end, **drv;
|
||||
char *x;
|
||||
char **ati, **atimisc;
|
||||
|
@ -2088,8 +2091,7 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
|
|||
*/
|
||||
cmodep = conf_monitor->mon_modeline_lst;
|
||||
while( cmodep ) {
|
||||
mode = xnfalloc(sizeof(DisplayModeRec));
|
||||
memset(mode,'\0',sizeof(DisplayModeRec));
|
||||
mode = xnfcalloc(1, sizeof(DisplayModeRec));
|
||||
mode->type = 0;
|
||||
mode->Clock = cmodep->ml_clock;
|
||||
mode->HDisplay = cmodep->ml_hdisplay;
|
||||
|
@ -2421,31 +2423,16 @@ addDefaultModes(MonPtr monitorp)
|
|||
DisplayModePtr last = monitorp->Last;
|
||||
int i = 0;
|
||||
|
||||
while (xf86DefaultModes[i].name != NULL)
|
||||
for (i = 0; i < xf86NumDefaultModes; i++)
|
||||
{
|
||||
if ( ! modeIsPresent(xf86DefaultModes[i].name,monitorp) )
|
||||
do
|
||||
mode = xf86DuplicateMode(&xf86DefaultModes[i]);
|
||||
if (!modeIsPresent(mode, monitorp))
|
||||
{
|
||||
mode = xnfalloc(sizeof(DisplayModeRec));
|
||||
memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec));
|
||||
if (xf86DefaultModes[i].name)
|
||||
mode->name = xnfstrdup(xf86DefaultModes[i].name);
|
||||
if( last ) {
|
||||
mode->prev = last;
|
||||
last->next = mode;
|
||||
}
|
||||
else {
|
||||
/* this is the first mode */
|
||||
monitorp->Modes = mode;
|
||||
mode->prev = NULL;
|
||||
}
|
||||
monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode);
|
||||
last = mode;
|
||||
i++;
|
||||
} else {
|
||||
xfree(mode);
|
||||
}
|
||||
while((xf86DefaultModes[i].name != NULL) &&
|
||||
(!strcmp(xf86DefaultModes[i].name,xf86DefaultModes[i-1].name)));
|
||||
else
|
||||
i++;
|
||||
}
|
||||
monitorp->Last = last;
|
||||
|
||||
|
|
|
@ -1093,7 +1093,6 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable)
|
|||
WindowPtr pChild;
|
||||
Bool WasViewable = (Bool)(pWin->viewable);
|
||||
Bool anyMarked = FALSE;
|
||||
RegionPtr pOldClip = NULL;
|
||||
#ifdef DO_SAVE_UNDERS
|
||||
Bool dosave = FALSE;
|
||||
#endif
|
||||
|
|
|
@ -172,12 +172,11 @@ xf86CreateRootWindow(WindowPtr pWin)
|
|||
Atom prop;
|
||||
|
||||
prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
|
||||
err = ChangeWindowProperty(pWin,
|
||||
err = dixChangeWindowProperty(serverClient, pWin,
|
||||
prop, pProp->type,
|
||||
pProp->format, PropModeReplace,
|
||||
pProp->size, pProp->data,
|
||||
FALSE
|
||||
);
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/* Look at err */
|
||||
|
|
|
@ -636,146 +636,6 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
|
|||
return MODE_OK;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* xf86SetModeCrtc
|
||||
*
|
||||
* Initialises the Crtc parameters for a mode. The initialisation includes
|
||||
* adjustments for interlaced and double scan modes.
|
||||
*/
|
||||
_X_EXPORT void
|
||||
xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
|
||||
{
|
||||
if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN))
|
||||
return;
|
||||
|
||||
p->CrtcHDisplay = p->HDisplay;
|
||||
p->CrtcHSyncStart = p->HSyncStart;
|
||||
p->CrtcHSyncEnd = p->HSyncEnd;
|
||||
p->CrtcHTotal = p->HTotal;
|
||||
p->CrtcHSkew = p->HSkew;
|
||||
p->CrtcVDisplay = p->VDisplay;
|
||||
p->CrtcVSyncStart = p->VSyncStart;
|
||||
p->CrtcVSyncEnd = p->VSyncEnd;
|
||||
p->CrtcVTotal = p->VTotal;
|
||||
if (p->Flags & V_INTERLACE) {
|
||||
if (adjustFlags & INTERLACE_HALVE_V) {
|
||||
p->CrtcVDisplay /= 2;
|
||||
p->CrtcVSyncStart /= 2;
|
||||
p->CrtcVSyncEnd /= 2;
|
||||
p->CrtcVTotal /= 2;
|
||||
}
|
||||
/* Force interlaced modes to have an odd VTotal */
|
||||
/* maybe we should only do this when INTERLACE_HALVE_V is set? */
|
||||
p->CrtcVTotal |= 1;
|
||||
}
|
||||
|
||||
if (p->Flags & V_DBLSCAN) {
|
||||
p->CrtcVDisplay *= 2;
|
||||
p->CrtcVSyncStart *= 2;
|
||||
p->CrtcVSyncEnd *= 2;
|
||||
p->CrtcVTotal *= 2;
|
||||
}
|
||||
if (p->VScan > 1) {
|
||||
p->CrtcVDisplay *= p->VScan;
|
||||
p->CrtcVSyncStart *= p->VScan;
|
||||
p->CrtcVSyncEnd *= p->VScan;
|
||||
p->CrtcVTotal *= p->VScan;
|
||||
}
|
||||
p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay);
|
||||
p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal);
|
||||
p->CrtcHBlankStart = min(p->CrtcHSyncStart, p->CrtcHDisplay);
|
||||
p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal);
|
||||
|
||||
p->CrtcHAdjusted = FALSE;
|
||||
p->CrtcVAdjusted = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Allocates and returns a copy of pMode, including pointers within pMode.
|
||||
*/
|
||||
_X_EXPORT DisplayModePtr
|
||||
xf86DuplicateMode(DisplayModePtr pMode)
|
||||
{
|
||||
DisplayModePtr pNew;
|
||||
|
||||
pNew = xnfalloc(sizeof(DisplayModeRec));
|
||||
*pNew = *pMode;
|
||||
pNew->next = NULL;
|
||||
pNew->prev = NULL;
|
||||
if (pNew->name == NULL) {
|
||||
xf86SetModeDefaultName(pMode);
|
||||
} else {
|
||||
pNew->name = xnfstrdup(pMode->name);
|
||||
}
|
||||
|
||||
return pNew;
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates every mode in the given list and returns a pointer to the first
|
||||
* mode.
|
||||
*
|
||||
* \param modeList doubly-linked mode list
|
||||
*/
|
||||
_X_EXPORT DisplayModePtr
|
||||
xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
|
||||
{
|
||||
DisplayModePtr first = NULL, last = NULL;
|
||||
DisplayModePtr mode;
|
||||
|
||||
for (mode = modeList; mode != NULL; mode = mode->next) {
|
||||
DisplayModePtr new;
|
||||
|
||||
new = xf86DuplicateMode(mode);
|
||||
|
||||
/* Insert pNew into modeList */
|
||||
if (last) {
|
||||
last->next = new;
|
||||
new->prev = last;
|
||||
} else {
|
||||
first = new;
|
||||
new->prev = NULL;
|
||||
}
|
||||
new->next = NULL;
|
||||
last = new;
|
||||
}
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given modes should program to the same timings.
|
||||
*
|
||||
* This doesn't use Crtc values, as it might be used on ModeRecs without the
|
||||
* Crtc values set. So, it's assumed that the other numbers are enough.
|
||||
*/
|
||||
_X_EXPORT Bool
|
||||
xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
|
||||
{
|
||||
if (pMode1->Clock == pMode2->Clock &&
|
||||
pMode1->HDisplay == pMode2->HDisplay &&
|
||||
pMode1->HSyncStart == pMode2->HSyncStart &&
|
||||
pMode1->HSyncEnd == pMode2->HSyncEnd &&
|
||||
pMode1->HTotal == pMode2->HTotal &&
|
||||
pMode1->HSkew == pMode2->HSkew &&
|
||||
pMode1->VDisplay == pMode2->VDisplay &&
|
||||
pMode1->VSyncStart == pMode2->VSyncStart &&
|
||||
pMode1->VSyncEnd == pMode2->VSyncEnd &&
|
||||
pMode1->VTotal == pMode2->VTotal &&
|
||||
pMode1->VScan == pMode2->VScan &&
|
||||
pMode1->Flags == pMode2->Flags)
|
||||
{
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* xf86CheckModeForMonitor
|
||||
*
|
||||
|
|
|
@ -154,7 +154,8 @@ Bool xf86PathIsSafe(const char *path);
|
|||
|
||||
/* xf86DefaultModes */
|
||||
|
||||
extern DisplayModeRec xf86DefaultModes [];
|
||||
extern const DisplayModeRec xf86DefaultModes[];
|
||||
extern const int xf86NumDefaultModes;
|
||||
|
||||
/* xf86DoProbe.c */
|
||||
void DoProbe(void);
|
||||
|
|
|
@ -1,292 +0,0 @@
|
|||
/*
|
||||
* Copyright 2005-2006 Luc Verhaegen.
|
||||
*
|
||||
* 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The reason for having this function in a file of its own is
|
||||
* so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
|
||||
* code is shared directly.
|
||||
*/
|
||||
|
||||
#include "xf86.h"
|
||||
|
||||
/*
|
||||
* Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
|
||||
*
|
||||
* These calculations are stolen from the CVT calculation spreadsheet written
|
||||
* by Graham Loveridge. He seems to be claiming no copyright and there seems to
|
||||
* be no license attached to this. He apparently just wants to see his name
|
||||
* mentioned.
|
||||
*
|
||||
* This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls
|
||||
*
|
||||
* Comments and structure corresponds to the comments and structure of the xls.
|
||||
* This should ease importing of future changes to the standard (not very
|
||||
* likely though).
|
||||
*
|
||||
* About margins; i'm sure that they are to be the bit between HDisplay and
|
||||
* HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
|
||||
* VTotal, where the overscan colour is shown. FB seems to call _all_ blanking
|
||||
* outside sync "margin" for some reason. Since we prefer seeing proper
|
||||
* blanking instead of the overscan colour, and since the Crtc* values will
|
||||
* probably get altered after us, we will disable margins altogether. With
|
||||
* these calculations, Margins will plainly expand H/VDisplay, and we don't
|
||||
* want that. -- libv
|
||||
*
|
||||
*/
|
||||
_X_EXPORT DisplayModePtr
|
||||
xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
||||
Bool Interlaced)
|
||||
{
|
||||
DisplayModeRec *Mode = xnfalloc(sizeof(DisplayModeRec));
|
||||
|
||||
/* 1) top/bottom margin size (% of height) - default: 1.8 */
|
||||
#define CVT_MARGIN_PERCENTAGE 1.8
|
||||
|
||||
/* 2) character cell horizontal granularity (pixels) - default 8 */
|
||||
#define CVT_H_GRANULARITY 8
|
||||
|
||||
/* 4) Minimum vertical porch (lines) - default 3 */
|
||||
#define CVT_MIN_V_PORCH 3
|
||||
|
||||
/* 4) Minimum number of vertical back porch lines - default 6 */
|
||||
#define CVT_MIN_V_BPORCH 6
|
||||
|
||||
/* Pixel Clock step (kHz) */
|
||||
#define CVT_CLOCK_STEP 250
|
||||
|
||||
Bool Margins = FALSE;
|
||||
float VFieldRate, HPeriod;
|
||||
int HDisplayRnd, HMargin;
|
||||
int VDisplayRnd, VMargin, VSync;
|
||||
float Interlace; /* Please rename this */
|
||||
|
||||
memset(Mode, 0, sizeof(DisplayModeRec));
|
||||
|
||||
/* CVT default is 60.0Hz */
|
||||
if (!VRefresh)
|
||||
VRefresh = 60.0;
|
||||
|
||||
/* 1. Required field rate */
|
||||
if (Interlaced)
|
||||
VFieldRate = VRefresh * 2;
|
||||
else
|
||||
VFieldRate = VRefresh;
|
||||
|
||||
/* 2. Horizontal pixels */
|
||||
HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY);
|
||||
|
||||
/* 3. Determine left and right borders */
|
||||
if (Margins) {
|
||||
/* right margin is actually exactly the same as left */
|
||||
HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
|
||||
HMargin -= HMargin % CVT_H_GRANULARITY;
|
||||
} else
|
||||
HMargin = 0;
|
||||
|
||||
/* 4. Find total active pixels */
|
||||
Mode->HDisplay = HDisplayRnd + 2*HMargin;
|
||||
|
||||
/* 5. Find number of lines per field */
|
||||
if (Interlaced)
|
||||
VDisplayRnd = VDisplay / 2;
|
||||
else
|
||||
VDisplayRnd = VDisplay;
|
||||
|
||||
/* 6. Find top and bottom margins */
|
||||
/* nope. */
|
||||
if (Margins)
|
||||
/* top and bottom margins are equal again. */
|
||||
VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
|
||||
else
|
||||
VMargin = 0;
|
||||
|
||||
Mode->VDisplay = VDisplay + 2*VMargin;
|
||||
|
||||
/* 7. Interlace */
|
||||
if (Interlaced)
|
||||
Interlace = 0.5;
|
||||
else
|
||||
Interlace = 0.0;
|
||||
|
||||
/* Determine VSync Width from aspect ratio */
|
||||
if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay))
|
||||
VSync = 4;
|
||||
else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay))
|
||||
VSync = 5;
|
||||
else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay))
|
||||
VSync = 6;
|
||||
else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay))
|
||||
VSync = 7;
|
||||
else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
|
||||
VSync = 7;
|
||||
else /* Custom */
|
||||
VSync = 10;
|
||||
|
||||
if (!Reduced) { /* simplified GTF calculation */
|
||||
|
||||
/* 4) Minimum time of vertical sync + back porch interval (µs)
|
||||
* default 550.0 */
|
||||
#define CVT_MIN_VSYNC_BP 550.0
|
||||
|
||||
/* 3) Nominal HSync width (% of line period) - default 8 */
|
||||
#define CVT_HSYNC_PERCENTAGE 8
|
||||
|
||||
float HBlankPercentage;
|
||||
int VSyncAndBackPorch, VBackPorch;
|
||||
int HBlank;
|
||||
|
||||
/* 8. Estimated Horizontal period */
|
||||
HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
|
||||
(VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
|
||||
|
||||
/* 9. Find number of lines in sync + backporch */
|
||||
if (((int)(CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH))
|
||||
VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
|
||||
else
|
||||
VSyncAndBackPorch = (int)(CVT_MIN_VSYNC_BP / HPeriod) + 1;
|
||||
|
||||
/* 10. Find number of lines in back porch */
|
||||
VBackPorch = VSyncAndBackPorch - VSync;
|
||||
|
||||
/* 11. Find total number of lines in vertical field */
|
||||
Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace
|
||||
+ CVT_MIN_V_PORCH;
|
||||
|
||||
/* 5) Definition of Horizontal blanking time limitation */
|
||||
/* Gradient (%/kHz) - default 600 */
|
||||
#define CVT_M_FACTOR 600
|
||||
|
||||
/* Offset (%) - default 40 */
|
||||
#define CVT_C_FACTOR 40
|
||||
|
||||
/* Blanking time scaling factor - default 128 */
|
||||
#define CVT_K_FACTOR 128
|
||||
|
||||
/* Scaling factor weighting - default 20 */
|
||||
#define CVT_J_FACTOR 20
|
||||
|
||||
#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256
|
||||
#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \
|
||||
CVT_J_FACTOR
|
||||
|
||||
/* 12. Find ideal blanking duty cycle from formula */
|
||||
HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod/1000.0;
|
||||
|
||||
/* 13. Blanking time */
|
||||
if (HBlankPercentage < 20)
|
||||
HBlankPercentage = 20;
|
||||
|
||||
HBlank = Mode->HDisplay * HBlankPercentage/(100.0 - HBlankPercentage);
|
||||
HBlank -= HBlank % (2*CVT_H_GRANULARITY);
|
||||
|
||||
/* 14. Find total number of pixels in a line. */
|
||||
Mode->HTotal = Mode->HDisplay + HBlank;
|
||||
|
||||
/* Fill in HSync values */
|
||||
Mode->HSyncEnd = Mode->HDisplay + HBlank / 2;
|
||||
|
||||
Mode->HSyncStart = Mode->HSyncEnd -
|
||||
(Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100;
|
||||
Mode->HSyncStart += CVT_H_GRANULARITY -
|
||||
Mode->HSyncStart % CVT_H_GRANULARITY;
|
||||
|
||||
/* Fill in VSync values */
|
||||
Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH;
|
||||
Mode->VSyncEnd = Mode->VSyncStart + VSync;
|
||||
|
||||
} else { /* Reduced blanking */
|
||||
/* Minimum vertical blanking interval time (µs) - default 460 */
|
||||
#define CVT_RB_MIN_VBLANK 460.0
|
||||
|
||||
/* Fixed number of clocks for horizontal sync */
|
||||
#define CVT_RB_H_SYNC 32.0
|
||||
|
||||
/* Fixed number of clocks for horizontal blanking */
|
||||
#define CVT_RB_H_BLANK 160.0
|
||||
|
||||
/* Fixed number of lines for vertical front porch - default 3 */
|
||||
#define CVT_RB_VFPORCH 3
|
||||
|
||||
int VBILines;
|
||||
|
||||
/* 8. Estimate Horizontal period. */
|
||||
HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
|
||||
(VDisplayRnd + 2*VMargin);
|
||||
|
||||
/* 9. Find number of lines in vertical blanking */
|
||||
VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
|
||||
|
||||
/* 10. Check if vertical blanking is sufficient */
|
||||
if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
|
||||
VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
|
||||
|
||||
/* 11. Find total number of lines in vertical field */
|
||||
Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
|
||||
|
||||
/* 12. Find total number of pixels in a line */
|
||||
Mode->HTotal = Mode->HDisplay + CVT_RB_H_BLANK;
|
||||
|
||||
/* Fill in HSync values */
|
||||
Mode->HSyncEnd = Mode->HDisplay + CVT_RB_H_BLANK / 2;
|
||||
Mode->HSyncStart = Mode->HSyncEnd - CVT_RB_H_SYNC;
|
||||
|
||||
/* Fill in VSync values */
|
||||
Mode->VSyncStart = Mode->VDisplay + CVT_RB_VFPORCH;
|
||||
Mode->VSyncEnd = Mode->VSyncStart + VSync;
|
||||
}
|
||||
|
||||
/* 15/13. Find pixel clock frequency (kHz for xf86) */
|
||||
Mode->Clock = Mode->HTotal * 1000.0 / HPeriod;
|
||||
Mode->Clock -= Mode->Clock % CVT_CLOCK_STEP;
|
||||
|
||||
/* 16/14. Find actual Horizontal Frequency (kHz) */
|
||||
Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal);
|
||||
|
||||
/* 17/15. Find actual Field rate */
|
||||
Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
|
||||
((float) (Mode->HTotal * Mode->VTotal));
|
||||
|
||||
/* 18/16. Find actual vertical frame frequency */
|
||||
/* ignore - just set the mode flag for interlaced */
|
||||
if (Interlaced)
|
||||
Mode->VTotal *= 2;
|
||||
|
||||
{
|
||||
char Name[256];
|
||||
Name[0] = 0;
|
||||
|
||||
snprintf(Name, 256, "%dx%d", HDisplay, VDisplay);
|
||||
|
||||
Mode->name = xnfalloc(strlen(Name) + 1);
|
||||
memcpy(Mode->name, Name, strlen(Name) + 1);
|
||||
}
|
||||
|
||||
if (Reduced)
|
||||
Mode->Flags |= V_PHSYNC | V_NVSYNC;
|
||||
else
|
||||
Mode->Flags |= V_NHSYNC | V_PVSYNC;
|
||||
|
||||
if (Interlaced)
|
||||
Mode->Flags |= V_INTERLACE;
|
||||
|
||||
return Mode;
|
||||
}
|
|
@ -6,24 +6,24 @@
|
|||
|
||||
When implementing DDC in the driver one has the choice between
|
||||
DDC1 and DDC2.
|
||||
DDC1 data is contiuously transmitted by a DDC1 capable display
|
||||
DDC1 data is continuously transmitted by a DDC1 capable display
|
||||
device. The data is send serially over a data line; the Vsync
|
||||
signal serves as clock. Only one EDID 1.x data block can be
|
||||
transmitted using DDC1. Since transmission of an EDID1 block
|
||||
using a regular Vsync frequency would take up several seconds
|
||||
the driver can increase the Vsync frequency to up to 25 kHz as
|
||||
soon as it detects DDC1 activety on the data line.
|
||||
soon as it detects DDC1 activity on the data line.
|
||||
DDC2 data is transmitted using the I2C protocol. This requires
|
||||
an additional clock line. DDC2 is capable of transmitting EDID1
|
||||
and EDID2 block as well as a VDIF block on display devices that
|
||||
support these.
|
||||
Display devices switch into the DDC2 mode as soon as they detect
|
||||
activety on the DDC clock line. Once the are in DDC2 mode they
|
||||
activity on the DDC clock line. Once the are in DDC2 mode they
|
||||
stop transmitting DDC1 signals until the next power cycle.
|
||||
|
||||
Some graphics chipset configurations which are not capable of
|
||||
DDC2 might still be able to read DDC1 data. Where available
|
||||
DDC2 it is preferrable.
|
||||
DDC2 it is preferable.
|
||||
|
||||
All relevant prototypes and defines are in xf86DDC.h.
|
||||
DDC2 additionally requires I2C support. The I2C prototypes
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
unsigned int XXX_ddc1Read(ScrnInfoPtr pScrn)
|
||||
|
||||
Additionally a function is required to inclrease the Vsync
|
||||
Additionally a function is required to increase the Vsync
|
||||
frequency to max. 25 kHz.
|
||||
|
||||
void XXX_ddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
|
||||
|
@ -58,7 +58,7 @@
|
|||
in PreInit(). DDC1SetSpeed is a pointer to the SetSpeed()
|
||||
function, DDC1Read has to point to the DDC1 read function.
|
||||
The function will return a pointer to the xf86Monitor structure
|
||||
which contains all information retreived by DDC.
|
||||
which contains all information retrieved by DDC.
|
||||
NULL will be returned on failure.
|
||||
|
||||
DDC2 Support
|
||||
|
@ -73,7 +73,7 @@
|
|||
to the I2CBusRec of the appropriate I2C Bus has to be passed
|
||||
as the second argument.
|
||||
The function will return a pointer to the xf86Monitor structure
|
||||
which contains all information retreived by DDC.
|
||||
which contains all information retrieved by DDC.
|
||||
NULL will be returned on failure.
|
||||
|
||||
Printing monitor parameters
|
||||
|
@ -86,7 +86,7 @@
|
|||
is provided.
|
||||
|
||||
Further processing of the xf86Monitor structure is not yet
|
||||
implemented. Howerver it is planned to use the information
|
||||
implemented. However, it is planned to use the information
|
||||
about video modes, gamma values etc.
|
||||
Therefore it is strongly recommended to read out DDC data
|
||||
before any video mode processing is done.
|
||||
|
|
|
@ -271,6 +271,39 @@
|
|||
#define K_2ND_GTF _K_2ND_GTF(c)
|
||||
#define _J_2ND_GTF(x) (x[17] / 2)
|
||||
#define J_2ND_GTF _J_2ND_GTF(c)
|
||||
#define _HAVE_CVT(x) (x[10] == 0x04)
|
||||
#define HAVE_CVT _HAVE_CVT(c)
|
||||
#define _MAX_CLOCK_KHZ(x) (x[12] >> 2)
|
||||
#define MAX_CLOCK_KHZ (MAX_CLOCK * 10000) - (_MAX_CLOCK_KHZ(c) * 250)
|
||||
#define _MAXWIDTH(x) ((x[13] == 0 ? 0 : x[13] + ((x[12] & 0x03) << 8)) * 8)
|
||||
#define MAXWIDTH _MAXWIDTH(c)
|
||||
#define _SUPPORTED_ASPECT(x) x[14]
|
||||
#define SUPPORTED_ASPECT _SUPPORTED_ASPECT(c)
|
||||
#define SUPPORTED_ASPECT_4_3 0x80
|
||||
#define SUPPORTED_ASPECT_16_9 0x40
|
||||
#define SUPPORTED_ASPECT_16_10 0x20
|
||||
#define SUPPORTED_ASPECT_5_4 0x10
|
||||
#define SUPPORTED_ASPECT_15_9 0x08
|
||||
#define _PREFERRED_ASPECT(x) ((x[15] & 0xe0) >> 5)
|
||||
#define PREFERRED_ASPECT _PREFERRED_ASPECT(c)
|
||||
#define PREFERRED_ASPECT_4_3 0
|
||||
#define PREFERRED_ASPECT_16_9 1
|
||||
#define PREFERRED_ASPECT_16_10 2
|
||||
#define PREFERRED_ASPECT_5_4 3
|
||||
#define PREFERRED_ASPECT_15_9 4
|
||||
#define _SUPPORTED_BLANKING(x) ((x[15] & 0x18) >> 3)
|
||||
#define SUPPORTED_BLANKING _SUPPORTED_BLANKING(c)
|
||||
#define CVT_STANDARD 0x01
|
||||
#define CVT_REDUCED 0x02
|
||||
#define _SUPPORTED_SCALING(x) ((x[16] & 0xf0) >> 4)
|
||||
#define SUPPORTED_SCALING _SUPPORTED_SCALING(c)
|
||||
#define SCALING_HSHRINK 0x08
|
||||
#define SCALING_HSTRETCH 0x04
|
||||
#define SCALING_VSHRINK 0x02
|
||||
#define SCALING_VSTRETCH 0x01
|
||||
#define _PREFERRED_REFRESH(x) x[17]
|
||||
#define PREFERRED_REFRESH _PREFERRED_REFRESH(c)
|
||||
|
||||
#define MONITOR_NAME 0xFC
|
||||
#define ADD_COLOR_POINT 0xFB
|
||||
#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
|
||||
|
@ -339,6 +372,8 @@
|
|||
#define STD_COLOR_SPACE(x) (x & 0x4)
|
||||
#define PREFERRED_TIMING_MODE(x) (x & 0x2)
|
||||
#define GFT_SUPPORTED(x) (x & 0x1)
|
||||
#define GTF_SUPPORTED(x) (x & 0x1)
|
||||
#define CVT_SUPPORTED(x) (x & 0x1)
|
||||
|
||||
/* detailed timing misc */
|
||||
#define IS_INTERLACED(x) (x)
|
||||
|
@ -445,12 +480,19 @@ struct monitor_ranges {
|
|||
int max_v;
|
||||
int min_h;
|
||||
int max_h;
|
||||
int max_clock;
|
||||
int max_clock; /* in mhz */
|
||||
int gtf_2nd_f;
|
||||
int gtf_2nd_c;
|
||||
int gtf_2nd_m;
|
||||
int gtf_2nd_k;
|
||||
int gtf_2nd_j;
|
||||
int max_clock_khz;
|
||||
int maxwidth; /* in pixels */
|
||||
char supported_aspect;
|
||||
char preferred_aspect;
|
||||
char supported_blanking;
|
||||
char supported_scaling;
|
||||
int preferred_refresh; /* in hz */
|
||||
};
|
||||
|
||||
struct whitePoints{
|
||||
|
@ -480,7 +522,7 @@ struct detailed_monitor_section {
|
|||
Uchar serial[13];
|
||||
Uchar ascii_data[13];
|
||||
Uchar name[13];
|
||||
struct monitor_ranges ranges; /* 40 */
|
||||
struct monitor_ranges ranges; /* 56 */
|
||||
struct std_timings std_t[5]; /* 80 */
|
||||
struct whitePoints wp[2]; /* 32 */
|
||||
/* color management data */
|
||||
|
|
|
@ -329,8 +329,21 @@ get_monitor_ranges(Uchar *c, struct monitor_ranges *r)
|
|||
r->gtf_2nd_m = M_2ND_GTF;
|
||||
r->gtf_2nd_k = K_2ND_GTF;
|
||||
r->gtf_2nd_j = J_2ND_GTF;
|
||||
} else
|
||||
} else {
|
||||
r->gtf_2nd_f = 0;
|
||||
}
|
||||
if (HAVE_CVT) {
|
||||
r->max_clock_khz = MAX_CLOCK_KHZ;
|
||||
r->max_clock = r->max_clock_khz / 1000;
|
||||
r->maxwidth = MAXWIDTH;
|
||||
r->supported_aspect = SUPPORTED_ASPECT;
|
||||
r->preferred_aspect = PREFERRED_ASPECT;
|
||||
r->supported_blanking = SUPPORTED_BLANKING;
|
||||
r->supported_scaling = SUPPORTED_SCALING;
|
||||
r->preferred_refresh = PREFERRED_REFRESH;
|
||||
} else {
|
||||
r->max_clock_khz = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
/* XXX kinda gross */
|
||||
#define _PARSE_EDID_
|
||||
|
||||
#include "misc.h"
|
||||
#include "xf86.h"
|
||||
#include "xf86_OSproc.h"
|
||||
|
@ -350,23 +353,63 @@ print_detailed_monitor_section(int scrnIndex,
|
|||
xf86DrvMsg(scrnIndex,X_INFO,"Monitor name: %s\n",m[i].section.name);
|
||||
break;
|
||||
case DS_RANGES:
|
||||
{
|
||||
struct monitor_ranges *r = &m[i].section.ranges;
|
||||
xf86DrvMsg(scrnIndex,X_INFO,
|
||||
"Ranges: V min: %i V max: %i Hz, H min: %i H max: %i kHz,",
|
||||
m[i].section.ranges.min_v, m[i].section.ranges.max_v,
|
||||
m[i].section.ranges.min_h, m[i].section.ranges.max_h);
|
||||
if (m[i].section.ranges.max_clock != 0)
|
||||
xf86ErrorF(" PixClock max %i MHz\n",m[i].section.ranges.max_clock);
|
||||
else
|
||||
r->min_v, r->max_v, r->min_h, r->max_h);
|
||||
if (r->max_clock_khz != 0) {
|
||||
xf86ErrorF(" PixClock max %i kHz\n", r->max_clock_khz);
|
||||
if (r->maxwidth)
|
||||
xf86DrvMsg(scrnIndex, X_INFO, "Maximum pixel width: %d\n",
|
||||
r->maxwidth);
|
||||
xf86DrvMsg(scrnIndex, X_INFO, "Supported aspect ratios:");
|
||||
if (r->supported_aspect & SUPPORTED_ASPECT_4_3)
|
||||
xf86ErrorF(" 4:3%s",
|
||||
r->preferred_aspect == PREFERRED_ASPECT_4_3?"*":"");
|
||||
if (r->supported_aspect & SUPPORTED_ASPECT_16_9)
|
||||
xf86ErrorF(" 16:9%s",
|
||||
r->preferred_aspect == PREFERRED_ASPECT_16_9?"*":"");
|
||||
if (r->supported_aspect & SUPPORTED_ASPECT_16_10)
|
||||
xf86ErrorF(" 16:10%s",
|
||||
r->preferred_aspect == PREFERRED_ASPECT_16_10?"*":"");
|
||||
if (r->supported_aspect & SUPPORTED_ASPECT_5_4)
|
||||
xf86ErrorF(" 5:4%s",
|
||||
r->preferred_aspect == PREFERRED_ASPECT_5_4?"*":"");
|
||||
if (r->supported_aspect & SUPPORTED_ASPECT_15_9)
|
||||
xf86ErrorF(" 15:9%s",
|
||||
r->preferred_aspect == PREFERRED_ASPECT_15_9?"*":"");
|
||||
xf86ErrorF("\n");
|
||||
if (m[i].section.ranges.gtf_2nd_f > 0)
|
||||
xf86DrvMsg(scrnIndex, X_INFO, "Supported blankings:");
|
||||
if (r->supported_blanking & CVT_STANDARD)
|
||||
xf86ErrorF(" standard");
|
||||
if (r->supported_blanking & CVT_REDUCED)
|
||||
xf86ErrorF(" reduced");
|
||||
xf86ErrorF("\n");
|
||||
xf86DrvMsg(scrnIndex, X_INFO, "Supported scalings:");
|
||||
if (r->supported_scaling & SCALING_HSHRINK)
|
||||
xf86ErrorF(" hshrink");
|
||||
if (r->supported_scaling & SCALING_HSTRETCH)
|
||||
xf86ErrorF(" hstretch");
|
||||
if (r->supported_scaling & SCALING_VSHRINK)
|
||||
xf86ErrorF(" vshrink");
|
||||
if (r->supported_scaling & SCALING_VSTRETCH)
|
||||
xf86ErrorF(" vstretch");
|
||||
xf86ErrorF("\n");
|
||||
xf86DrvMsg(scrnIndex, X_INFO, "Preferred refresh rate: %d\n",
|
||||
r->preferred_refresh);
|
||||
} else if (r->max_clock != 0) {
|
||||
xf86ErrorF(" PixClock max %i MHz\n", r->max_clock);
|
||||
} else {
|
||||
xf86ErrorF("\n");
|
||||
}
|
||||
if (r->gtf_2nd_f > 0)
|
||||
xf86DrvMsg(scrnIndex,X_INFO," 2nd GTF parameters: f: %i kHz "
|
||||
"c: %i m: %i k %i j %i\n",
|
||||
m[i].section.ranges.gtf_2nd_f,
|
||||
m[i].section.ranges.gtf_2nd_c,
|
||||
m[i].section.ranges.gtf_2nd_m,
|
||||
m[i].section.ranges.gtf_2nd_k,
|
||||
m[i].section.ranges.gtf_2nd_j);
|
||||
"c: %i m: %i k %i j %i\n", r->gtf_2nd_f,
|
||||
r->gtf_2nd_c, r->gtf_2nd_m, r->gtf_2nd_k,
|
||||
r->gtf_2nd_j);
|
||||
break;
|
||||
}
|
||||
case DS_STD_TIMINGS:
|
||||
for (j = 0; j<5; j++)
|
||||
xf86DrvMsg(scrnIndex,X_INFO,"#%i: hsize: %i vsize %i refresh: %i "
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
*
|
||||
* Copyright 1998,1999 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Note that DDC1 does not define any method for returning blocks beyond
|
||||
* the first. DDC2 does, but the original implementation would only ever
|
||||
* read the first block. If you want to read and parse all blocks, use
|
||||
* xf86DoEEDID().
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
@ -13,8 +21,6 @@
|
|||
#include "ddcPriv.h"
|
||||
#include <string.h>
|
||||
|
||||
static const OptionInfoRec *DDCAvailableOptions(void *unused);
|
||||
|
||||
#define RETRIES 4
|
||||
|
||||
static unsigned char *EDIDRead_DDC1(
|
||||
|
@ -33,18 +39,6 @@ static unsigned int *FetchEDID_DDC1(
|
|||
register unsigned int (*)(ScrnInfoPtr)
|
||||
);
|
||||
|
||||
static unsigned char* EDID1Read_DDC2(
|
||||
int scrnIndex,
|
||||
I2CBusPtr pBus
|
||||
);
|
||||
|
||||
static unsigned char * DDCRead_DDC2(
|
||||
int scrnIndex,
|
||||
I2CBusPtr pBus,
|
||||
int start,
|
||||
int len
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
DDCOPT_NODDC1,
|
||||
DDCOPT_NODDC2,
|
||||
|
@ -58,13 +52,6 @@ static const OptionInfoRec DDCOptions[] = {
|
|||
{ -1, NULL, OPTV_NONE, {0}, FALSE },
|
||||
};
|
||||
|
||||
/*ARGSUSED*/
|
||||
static const OptionInfoRec *
|
||||
DDCAvailableOptions(void *unused)
|
||||
{
|
||||
return (DDCOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to probe the monitor for EDID information, if NoDDC and NoDDC1 are
|
||||
* unset. EDID information blocks are interpreted and the results returned in
|
||||
|
@ -116,6 +103,158 @@ xf86DoEDID_DDC1(
|
|||
return tmp;
|
||||
}
|
||||
|
||||
static I2CDevPtr
|
||||
DDC2MakeDevice(I2CBusPtr pBus, int address, char *name)
|
||||
{
|
||||
I2CDevPtr dev = NULL;
|
||||
|
||||
if (!(dev = xf86I2CFindDev(pBus, address))) {
|
||||
dev = xf86CreateI2CDevRec();
|
||||
dev->DevName = name;
|
||||
dev->SlaveAddr = address;
|
||||
dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
|
||||
dev->StartTimeout = 550;
|
||||
dev->BitTimeout = 40;
|
||||
dev->AcknTimeout = 40;
|
||||
|
||||
dev->pI2CBus = pBus;
|
||||
if (!xf86I2CDevInit(dev)) {
|
||||
xf86DrvMsg(pBus->scrnIndex, X_PROBED, "No DDC2 device\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
static I2CDevPtr
|
||||
DDC2Init(int scrnIndex, I2CBusPtr pBus)
|
||||
{
|
||||
I2CDevPtr dev = NULL;
|
||||
|
||||
/*
|
||||
* Slow down the bus so that older monitors don't
|
||||
* miss things.
|
||||
*/
|
||||
pBus->RiseFallTime = 20;
|
||||
|
||||
DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register");
|
||||
dev = DDC2MakeDevice(pBus, 0x00A0, "ddc2");
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
/* Mmmm, smell the hacks */
|
||||
static void
|
||||
EEDIDStop(I2CDevPtr d)
|
||||
{
|
||||
}
|
||||
|
||||
/* block is the EDID block number. a segment is two blocks. */
|
||||
static Bool
|
||||
DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer)
|
||||
{
|
||||
unsigned char W_Buffer[1];
|
||||
int i, segment;
|
||||
I2CDevPtr seg;
|
||||
void (*stop)(I2CDevPtr);
|
||||
|
||||
for (i = 0; i < RETRIES; i++) {
|
||||
/* Stop bits reset the segment pointer to 0, so be careful here. */
|
||||
segment = block >> 1;
|
||||
if (segment) {
|
||||
Bool b;
|
||||
|
||||
if (!(seg = xf86I2CFindDev(dev->pI2CBus, 0x0060)))
|
||||
return FALSE;
|
||||
|
||||
W_Buffer[0] = segment;
|
||||
|
||||
stop = dev->pI2CBus->I2CStop;
|
||||
dev->pI2CBus->I2CStop = EEDIDStop;
|
||||
|
||||
b = xf86I2CWriteRead(seg, W_Buffer, 1, NULL, 0);
|
||||
|
||||
dev->pI2CBus->I2CStop = stop;
|
||||
if (!b) {
|
||||
dev->pI2CBus->I2CStop(dev);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
W_Buffer[0] = (block & 0x01) * EDID1_LEN;
|
||||
|
||||
if (xf86I2CWriteRead(dev, W_Buffer, 1, R_Buffer, EDID1_LEN)) {
|
||||
if (!DDC_checksum(R_Buffer, EDID1_LEN))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are
|
||||
* unset. EDID information blocks are interpreted and the results returned in
|
||||
* an xf86MonPtr. Unlike xf86DoEDID_DDC[12](), this function will return
|
||||
* the complete EDID data, including all extension blocks.
|
||||
*
|
||||
* This function does not affect the list of modes used by drivers -- it is up
|
||||
* to the driver to decide policy on what to do with EDID information.
|
||||
*
|
||||
* @return pointer to a new xf86MonPtr containing the EDID information.
|
||||
* @return NULL if no monitor attached or failure to interpret the EDID.
|
||||
*
|
||||
* nblocks is an in/out parameter. If non-zero, it defines the number of
|
||||
* blocks to read from the monitor; zero (or NULL pointer) means read all.
|
||||
* If non-NULL, on return it will be filled in with the number of blocks
|
||||
* read.
|
||||
*/
|
||||
xf86MonPtr
|
||||
xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
|
||||
unsigned char *EDID_block = NULL;
|
||||
xf86MonPtr tmp = NULL;
|
||||
I2CDevPtr dev = NULL;
|
||||
/* Default DDC and DDC2 to enabled. */
|
||||
Bool noddc = FALSE, noddc2 = FALSE;
|
||||
OptionInfoPtr options;
|
||||
|
||||
options = xalloc(sizeof(DDCOptions));
|
||||
if (!options)
|
||||
return NULL;
|
||||
memcpy(options, DDCOptions, sizeof(DDCOptions));
|
||||
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
|
||||
|
||||
xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
|
||||
xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2);
|
||||
xfree(options);
|
||||
|
||||
if (noddc || noddc2)
|
||||
return NULL;
|
||||
|
||||
if (!(dev = DDC2Init(scrnIndex, pBus)))
|
||||
return NULL;
|
||||
|
||||
EDID_block = xcalloc(1, EDID1_LEN);
|
||||
if (!EDID_block)
|
||||
return NULL;
|
||||
|
||||
if (DDC2Read(dev, 0, EDID_block)) {
|
||||
tmp = xf86InterpretEDID(scrnIndex, EDID_block);
|
||||
}
|
||||
|
||||
if (nblocks) {
|
||||
if (tmp)
|
||||
*nblocks = tmp->no_sections;
|
||||
else
|
||||
*nblocks = 0;
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are
|
||||
* unset. EDID information blocks are interpreted and the results returned in
|
||||
|
@ -130,42 +269,8 @@ xf86DoEDID_DDC1(
|
|||
xf86MonPtr
|
||||
xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
|
||||
unsigned char *EDID_block = NULL;
|
||||
xf86MonPtr tmp = NULL;
|
||||
/* Default DDC and DDC2 to enabled. */
|
||||
Bool noddc = FALSE, noddc2 = FALSE;
|
||||
OptionInfoPtr options;
|
||||
|
||||
options = xnfalloc(sizeof(DDCOptions));
|
||||
(void)memcpy(options, DDCOptions, sizeof(DDCOptions));
|
||||
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
|
||||
|
||||
xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
|
||||
xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2);
|
||||
xfree(options);
|
||||
|
||||
if (noddc || noddc2)
|
||||
return NULL;
|
||||
|
||||
EDID_block = EDID1Read_DDC2(scrnIndex,pBus);
|
||||
|
||||
if (EDID_block){
|
||||
tmp = xf86InterpretEDID(scrnIndex,EDID_block);
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
ErrorF("No EDID block returned\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (!tmp)
|
||||
ErrorF("Cannot interpret EDID block\n");
|
||||
else
|
||||
ErrorF("Sections to follow: %i\n",tmp->no_sections);
|
||||
#endif
|
||||
|
||||
return tmp;
|
||||
int nblocks = 1;
|
||||
return xf86DoEEDID(scrnIndex, pBus, &nblocks);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -234,68 +339,3 @@ FetchEDID_DDC1(register ScrnInfoPtr pScrn,
|
|||
} while(--count);
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
static unsigned char*
|
||||
EDID1Read_DDC2(int scrnIndex, I2CBusPtr pBus)
|
||||
{
|
||||
return DDCRead_DDC2(scrnIndex, pBus, 0, EDID1_LEN);
|
||||
}
|
||||
|
||||
static unsigned char *
|
||||
DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len)
|
||||
{
|
||||
I2CDevPtr dev;
|
||||
unsigned char W_Buffer[2];
|
||||
int w_bytes;
|
||||
unsigned char *R_Buffer;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Slow down the bus so that older monitors don't
|
||||
* miss things.
|
||||
*/
|
||||
pBus->RiseFallTime = 20;
|
||||
|
||||
if (!(dev = xf86I2CFindDev(pBus, 0x00A0))) {
|
||||
dev = xf86CreateI2CDevRec();
|
||||
dev->DevName = "ddc2";
|
||||
dev->SlaveAddr = 0xA0;
|
||||
dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
|
||||
dev->StartTimeout = 550;
|
||||
dev->BitTimeout = 40;
|
||||
dev->AcknTimeout = 40;
|
||||
|
||||
dev->pI2CBus = pBus;
|
||||
if (!xf86I2CDevInit(dev)) {
|
||||
xf86DrvMsg(scrnIndex, X_PROBED, "No DDC2 device\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (start < 0x100) {
|
||||
w_bytes = 1;
|
||||
W_Buffer[0] = start;
|
||||
} else {
|
||||
w_bytes = 2;
|
||||
W_Buffer[0] = start & 0xFF;
|
||||
W_Buffer[1] = (start & 0xFF00) >> 8;
|
||||
}
|
||||
R_Buffer = xcalloc(1,sizeof(unsigned char)
|
||||
* (len));
|
||||
for (i=0; i<RETRIES; i++) {
|
||||
if (xf86I2CWriteRead(dev, W_Buffer,w_bytes, R_Buffer,len)) {
|
||||
if (!DDC_checksum(R_Buffer,len))
|
||||
return R_Buffer;
|
||||
|
||||
#ifdef DEBUG
|
||||
else ErrorF("Checksum error in EDID block\n");
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else ErrorF("Error reading EDID block\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
xf86DestroyI2CDevRec(dev,TRUE);
|
||||
xfree(R_Buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ extern xf86MonPtr xf86DoEDID_DDC2(
|
|||
I2CBusPtr pBus
|
||||
);
|
||||
|
||||
extern xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks);
|
||||
|
||||
extern xf86MonPtr xf86PrintEDID(
|
||||
xf86MonPtr monPtr
|
||||
);
|
||||
|
|
|
@ -26,6 +26,10 @@ if MFB
|
|||
MFBMOD = libmfb.la
|
||||
endif
|
||||
|
||||
if RECORD
|
||||
RECORDMOD = librecord.la
|
||||
endif
|
||||
|
||||
module_LTLIBRARIES = $(AFBMOD) \
|
||||
$(CFBMOD) \
|
||||
libfb.la \
|
||||
|
@ -34,7 +38,7 @@ module_LTLIBRARIES = $(AFBMOD) \
|
|||
libshadow.la
|
||||
|
||||
extsmoduledir = $(moduledir)/extensions
|
||||
extsmodule_LTLIBRARIES = librecord.la \
|
||||
extsmodule_LTLIBRARIES = $(RECORDMOD) \
|
||||
$(DBEMOD) \
|
||||
$(GLXMODS) \
|
||||
$(XTRAPMOD)
|
||||
|
|
|
@ -42,7 +42,7 @@ static ExtensionModule extensionModules[] = {
|
|||
{
|
||||
SELinuxExtensionInit,
|
||||
SELINUX_EXTENSION_NAME,
|
||||
NULL,
|
||||
&noSELinuxExtension,
|
||||
NULL,
|
||||
NULL
|
||||
},
|
||||
|
@ -258,6 +258,27 @@ extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XSELINUX
|
||||
if (! strcmp(SELINUX_EXTENSION_NAME, extensionModules[i].name)) {
|
||||
pointer o;
|
||||
selinuxEnforcingState = SELINUX_MODE_DEFAULT;
|
||||
|
||||
if ((o = xf86FindOption(opts, "SELinux mode disabled"))) {
|
||||
xf86MarkOptionUsed(o);
|
||||
selinuxEnforcingState = SELINUX_MODE_DISABLED;
|
||||
}
|
||||
if ((o = xf86FindOption(opts, "SELinux mode permissive"))) {
|
||||
xf86MarkOptionUsed(o);
|
||||
selinuxEnforcingState = SELINUX_MODE_PERMISSIVE;
|
||||
}
|
||||
if ((o = xf86FindOption(opts, "SELinux mode enforcing"))) {
|
||||
xf86MarkOptionUsed(o);
|
||||
selinuxEnforcingState = SELINUX_MODE_ENFORCING;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LoadExtension(&extensionModules[i], FALSE);
|
||||
}
|
||||
/* Need a non-NULL return */
|
||||
|
|
|
@ -7,7 +7,7 @@ libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
|
|||
-I$(top_builddir)/GL/include \
|
||||
-I@MESA_SOURCE@/include \
|
||||
-DHAVE_XORG_CONFIG_H \
|
||||
@DIX_CFLAGS@ @DRIPROTO_CFLAGS@ \
|
||||
@DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \
|
||||
@LIBDRM_CFLAGS@ \
|
||||
@GL_CFLAGS@
|
||||
libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
|
||||
|
|
|
@ -2,7 +2,7 @@ libdri2_la_LTLIBRARIES = libdri2.la
|
|||
libdri2_la_CFLAGS = \
|
||||
-DHAVE_XORG_CONFIG_H \
|
||||
-I@MESA_SOURCE@/include \
|
||||
@DIX_CFLAGS@ @DRIPROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
|
||||
@DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
|
||||
-I$(top_srcdir)/hw/xfree86/common \
|
||||
-I$(top_srcdir)/hw/xfree86/os-support/bus
|
||||
|
||||
|
@ -10,6 +10,7 @@ libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
|
|||
libdri2_ladir = $(moduledir)/extensions
|
||||
libdri2_la_SOURCES = \
|
||||
dri2.c \
|
||||
dri2.h
|
||||
dri2.h \
|
||||
dri2ext.c
|
||||
|
||||
sdk_HEADERS = dri2.h
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#include "xf86Module.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "region.h"
|
||||
#include "damage.h"
|
||||
#include "dri2.h"
|
||||
#include <GL/internal/dri_sarea.h>
|
||||
|
||||
|
@ -48,8 +50,9 @@ static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKey;
|
|||
static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKey;
|
||||
|
||||
typedef struct _DRI2DrawablePriv {
|
||||
drm_drawable_t drawable;
|
||||
unsigned int handle;
|
||||
unsigned int refCount;
|
||||
unsigned int boHandle;
|
||||
unsigned int dri2Handle;
|
||||
} DRI2DrawablePrivRec, *DRI2DrawablePrivPtr;
|
||||
|
||||
typedef struct _DRI2Screen {
|
||||
|
@ -58,9 +61,7 @@ typedef struct _DRI2Screen {
|
|||
void *sarea;
|
||||
unsigned int sareaSize;
|
||||
const char *driverName;
|
||||
int ddxVersionMajor;
|
||||
int ddxVersionMinor;
|
||||
int ddxVersionPatch;
|
||||
unsigned int nextHandle;
|
||||
|
||||
__DRIEventBuffer *buffer;
|
||||
int locked;
|
||||
|
@ -150,7 +151,7 @@ DRI2PostDrawableConfig(DrawablePtr pDraw)
|
|||
|
||||
e = DRI2ScreenAllocEvent(ds, size);
|
||||
e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_DRAWABLE_CONFIG, size);
|
||||
e->drawable = pPriv->drawable;
|
||||
e->drawable = pPriv->dri2Handle;
|
||||
e->x = pDraw->x - pPixmap->screen_x;
|
||||
e->y = pDraw->y - pPixmap->screen_y;
|
||||
e->width = pDraw->width;
|
||||
|
@ -167,7 +168,7 @@ DRI2PostDrawableConfig(DrawablePtr pDraw)
|
|||
}
|
||||
|
||||
static void
|
||||
DRI2PostBufferAttach(DrawablePtr pDraw)
|
||||
DRI2PostBufferAttach(DrawablePtr pDraw, Bool force)
|
||||
{
|
||||
ScreenPtr pScreen = pDraw->pScreen;
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||
|
@ -176,7 +177,8 @@ DRI2PostBufferAttach(DrawablePtr pDraw)
|
|||
PixmapPtr pPixmap;
|
||||
__DRIBufferAttachEvent *e;
|
||||
size_t size;
|
||||
unsigned int handle, flags;
|
||||
unsigned int flags;
|
||||
unsigned int boHandle;
|
||||
|
||||
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||
pWin = (WindowPtr) pDraw;
|
||||
|
@ -190,22 +192,20 @@ DRI2PostBufferAttach(DrawablePtr pDraw)
|
|||
if (!pPriv)
|
||||
return;
|
||||
|
||||
size = sizeof *e;
|
||||
|
||||
handle = ds->getPixmapHandle(pPixmap, &flags);
|
||||
if (handle == 0 || handle == pPriv->handle)
|
||||
boHandle = ds->getPixmapHandle(pPixmap, &flags);
|
||||
if (boHandle == pPriv->boHandle && !force)
|
||||
return;
|
||||
|
||||
pPriv->boHandle = boHandle;
|
||||
size = sizeof *e;
|
||||
e = DRI2ScreenAllocEvent(ds, size);
|
||||
e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_BUFFER_ATTACH, size);
|
||||
e->drawable = pPriv->drawable;
|
||||
e->drawable = pPriv->dri2Handle;
|
||||
e->buffer.attachment = DRI_DRAWABLE_BUFFER_FRONT_LEFT;
|
||||
e->buffer.handle = handle;
|
||||
e->buffer.handle = pPriv->boHandle;
|
||||
e->buffer.pitch = pPixmap->devKind;
|
||||
e->buffer.cpp = pPixmap->drawable.bitsPerPixel / 8;
|
||||
e->buffer.flags = flags;
|
||||
|
||||
pPriv->handle = handle;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -226,7 +226,7 @@ DRI2ClipNotify(WindowPtr pWin, int dx, int dy)
|
|||
}
|
||||
|
||||
DRI2PostDrawableConfig(&pWin->drawable);
|
||||
DRI2PostBufferAttach(&pWin->drawable);
|
||||
DRI2PostBufferAttach(&pWin->drawable, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -265,10 +265,10 @@ DRI2CloseScreen(ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
Bool
|
||||
DRI2CreateDrawable(ScreenPtr pScreen,
|
||||
DrawablePtr pDraw, drm_drawable_t *pDrmDrawable)
|
||||
DRI2CreateDrawable(DrawablePtr pDraw,
|
||||
unsigned int *handle, unsigned int *head)
|
||||
{
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
|
||||
WindowPtr pWin;
|
||||
PixmapPtr pPixmap;
|
||||
DRI2DrawablePrivPtr pPriv;
|
||||
|
@ -286,51 +286,70 @@ DRI2CreateDrawable(ScreenPtr pScreen,
|
|||
}
|
||||
|
||||
pPriv = dixLookupPrivate(devPrivates, key);
|
||||
if (pPriv == NULL) {
|
||||
if (pPriv != NULL) {
|
||||
pPriv->refCount++;
|
||||
} else {
|
||||
pPriv = xalloc(sizeof *pPriv);
|
||||
if (drmCreateDrawable(ds->fd, &pPriv->drawable))
|
||||
return FALSE;
|
||||
|
||||
pPriv->refCount = 1;
|
||||
pPriv->boHandle = 0;
|
||||
pPriv->dri2Handle = ds->nextHandle++;
|
||||
dixSetPrivate(devPrivates, key, pPriv);
|
||||
}
|
||||
|
||||
*pDrmDrawable = pPriv->drawable;
|
||||
*handle = pPriv->dri2Handle;
|
||||
*head = ds->buffer->head;
|
||||
|
||||
DRI2PostDrawableConfig(pDraw);
|
||||
DRI2PostBufferAttach(pDraw);
|
||||
DRI2PostBufferAttach(pDraw, TRUE);
|
||||
DRI2ScreenCommitEvents(ds);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
DRI2DestroyDrawable(ScreenPtr pScreen, DrawablePtr pDraw)
|
||||
DRI2DestroyDrawable(DrawablePtr pDraw)
|
||||
{
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||
PixmapPtr pPixmap;
|
||||
WindowPtr pWin;
|
||||
DRI2DrawablePrivPtr pPriv;
|
||||
DevPrivateKey key;
|
||||
PrivateRec **devPrivates;
|
||||
|
||||
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||
pWin = (WindowPtr) pDraw;
|
||||
pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
|
||||
dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
|
||||
devPrivates = &pWin->devPrivates;
|
||||
key = dri2WindowPrivateKey;
|
||||
} else {
|
||||
pPixmap = (PixmapPtr) pDraw;
|
||||
pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
|
||||
dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
|
||||
devPrivates = &pPixmap->devPrivates;
|
||||
key = dri2PixmapPrivateKey;
|
||||
}
|
||||
|
||||
pPriv = dixLookupPrivate(devPrivates, key);
|
||||
if (pPriv == NULL)
|
||||
return;
|
||||
|
||||
drmDestroyDrawable(ds->fd, pPriv->drawable);
|
||||
pPriv->refCount--;
|
||||
if (pPriv->refCount == 0) {
|
||||
dixSetPrivate(devPrivates, key, NULL);
|
||||
xfree(pPriv);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DRI2ReemitDrawableInfo(DrawablePtr pDraw, unsigned int *head)
|
||||
{
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
|
||||
|
||||
*head = ds->buffer->head;
|
||||
|
||||
DRI2PostDrawableConfig(pDraw);
|
||||
DRI2PostBufferAttach(pDraw, TRUE);
|
||||
DRI2ScreenCommitEvents(ds);
|
||||
}
|
||||
|
||||
Bool
|
||||
DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
|
||||
int *ddxMajor, int *ddxMinor, int *ddxPatch,
|
||||
unsigned int *sareaHandle)
|
||||
{
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||
|
@ -340,14 +359,22 @@ DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
|
|||
|
||||
*fd = ds->fd;
|
||||
*driverName = ds->driverName;
|
||||
*ddxMajor = ds->ddxVersionMajor;
|
||||
*ddxMinor = ds->ddxVersionMinor;
|
||||
*ddxPatch = ds->ddxVersionPatch;
|
||||
*sareaHandle = ds->sareaBO.handle;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic)
|
||||
{
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||
|
||||
if (ds == NULL || drmAuthMagic(ds->fd, magic))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
DRI2GetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags)
|
||||
{
|
||||
|
@ -406,9 +433,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
|||
|
||||
ds->fd = info->fd;
|
||||
ds->driverName = info->driverName;
|
||||
ds->ddxVersionMajor = info->ddxVersionMajor;
|
||||
ds->ddxVersionMinor = info->ddxVersionMinor;
|
||||
ds->ddxVersionPatch = info->ddxVersionPatch;
|
||||
ds->nextHandle = 1;
|
||||
|
||||
ds->getPixmapHandle = info->getPixmapHandle;
|
||||
ds->beginClipNotify = info->beginClipNotify;
|
||||
|
@ -432,9 +457,21 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
|||
return p;
|
||||
}
|
||||
|
||||
extern ExtensionModule dri2ExtensionModule;
|
||||
|
||||
static pointer
|
||||
DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
|
||||
{
|
||||
static Bool setupDone = FALSE;
|
||||
|
||||
if (!setupDone) {
|
||||
setupDone = TRUE;
|
||||
LoadExtension(&dri2ExtensionModule, FALSE);
|
||||
} else {
|
||||
if (errmaj)
|
||||
*errmaj = LDR_ONCEONLY;
|
||||
}
|
||||
|
||||
return (pointer) 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ typedef struct {
|
|||
int fd;
|
||||
size_t driverSareaSize;
|
||||
const char *driverName;
|
||||
int ddxVersionMajor, ddxVersionMinor, ddxVersionPatch;
|
||||
DRI2GetPixmapHandleProcPtr getPixmapHandle;
|
||||
DRI2BeginClipNotifyProcPtr beginClipNotify;
|
||||
DRI2EndClipNotifyProcPtr endClipNotify;
|
||||
|
@ -57,24 +56,26 @@ void DRI2CloseScreen(ScreenPtr pScreen);
|
|||
Bool DRI2Connect(ScreenPtr pScreen,
|
||||
int *fd,
|
||||
const char **driverName,
|
||||
int *ddxMajor,
|
||||
int *ddxMinor,
|
||||
int *ddxPatch,
|
||||
unsigned int *sareaHandle);
|
||||
|
||||
Bool DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic);
|
||||
|
||||
unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap,
|
||||
unsigned int *flags);
|
||||
|
||||
void DRI2Lock(ScreenPtr pScreen);
|
||||
void DRI2Unlock(ScreenPtr pScreen);
|
||||
|
||||
Bool DRI2CreateDrawable(ScreenPtr pScreen,
|
||||
DrawablePtr pDraw,
|
||||
drm_drawable_t *pDrmDrawable);
|
||||
Bool DRI2CreateDrawable(DrawablePtr pDraw,
|
||||
unsigned int *handle,
|
||||
unsigned int *head);
|
||||
|
||||
void DRI2DestroyDrawable(ScreenPtr pScreen,
|
||||
DrawablePtr pDraw);
|
||||
void DRI2DestroyDrawable(DrawablePtr pDraw);
|
||||
|
||||
void DRI2ExtensionInit(void);
|
||||
void DRI2ReemitDrawableInfo(DrawablePtr pDraw,
|
||||
unsigned int *head);
|
||||
|
||||
Bool DRI2PostDamage(DrawablePtr pDrawable,
|
||||
struct drm_clip_rect *rects, int numRects);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,361 @@
|
|||
/*
|
||||
* Copyright © 2008 Red Hat, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Soft-
|
||||
* ware"), 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 Soft-
|
||||
* ware 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 MERCHANTABIL-
|
||||
* ITY, 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 CONSE-
|
||||
* QUENTIAL 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 PERFOR-
|
||||
* MANCE 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.
|
||||
*
|
||||
* Authors:
|
||||
* Kristian Høgsberg (krh@redhat.com)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#define NEED_REPLIES
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/extensions/dri2proto.h>
|
||||
#include "dixstruct.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "extnsionst.h"
|
||||
#include "xf86drm.h"
|
||||
#include "dri2.h"
|
||||
|
||||
/* The only xf86 include */
|
||||
#include "xf86Module.h"
|
||||
|
||||
static ExtensionEntry *dri2Extension;
|
||||
static RESTYPE dri2DrawableRes;
|
||||
|
||||
static Bool
|
||||
validScreen(ClientPtr client, int screen, ScreenPtr *pScreen)
|
||||
{
|
||||
if (screen >= screenInfo.numScreens) {
|
||||
client->errorValue = screen;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*pScreen = screenInfo.screens[screen];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
validDrawable(ClientPtr client, XID drawable,
|
||||
DrawablePtr *pDrawable, int *status)
|
||||
{
|
||||
*status = dixLookupDrawable(pDrawable, drawable, client, 0, DixReadAccess);
|
||||
if (*status != Success) {
|
||||
client->errorValue = drawable;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2QueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2QueryVersionReq);
|
||||
xDRI2QueryVersionReply rep;
|
||||
int n;
|
||||
|
||||
if (client->swapped)
|
||||
swaps(&stuff->length, n);
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2QueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.majorVersion = DRI2_MAJOR;
|
||||
rep.minorVersion = DRI2_MINOR;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.majorVersion, n);
|
||||
swapl(&rep.minorVersion, n);
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(xDRI2QueryVersionReply), &rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2Connect(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2ConnectReq);
|
||||
xDRI2ConnectReply rep;
|
||||
ScreenPtr pScreen;
|
||||
int fd;
|
||||
const char *driverName;
|
||||
char *busId = NULL;
|
||||
unsigned int sareaHandle;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2ConnectReq);
|
||||
if (!validScreen(client, stuff->screen, &pScreen))
|
||||
return BadValue;
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.driverNameLength = 0;
|
||||
rep.busIdLength = 0;
|
||||
rep.sareaHandle = 0;
|
||||
|
||||
if (!DRI2Connect(pScreen, &fd, &driverName, &sareaHandle))
|
||||
goto fail;
|
||||
|
||||
busId = drmGetBusid(fd);
|
||||
if (busId == NULL)
|
||||
goto fail;
|
||||
|
||||
rep.driverNameLength = strlen(driverName);
|
||||
rep.busIdLength = strlen(busId);
|
||||
rep.sareaHandle = sareaHandle;
|
||||
rep.length = (rep.driverNameLength + 3) / 4 + (rep.busIdLength + 3) / 4;
|
||||
|
||||
fail:
|
||||
WriteToClient(client, sizeof(xDRI2ConnectReply), &rep);
|
||||
WriteToClient(client, rep.driverNameLength, driverName);
|
||||
WriteToClient(client, rep.busIdLength, busId);
|
||||
drmFreeBusid(busId);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2AuthConnection(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2AuthConnectionReq);
|
||||
xDRI2AuthConnectionReply rep;
|
||||
ScreenPtr pScreen;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2AuthConnectionReq);
|
||||
if (!validScreen(client, stuff->screen, &pScreen))
|
||||
return BadValue;
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.authenticated = 1;
|
||||
|
||||
if (!DRI2AuthConnection(pScreen, stuff->magic)) {
|
||||
ErrorF("DRI2: Failed to authenticate %lu\n",
|
||||
(unsigned long) stuff->magic);
|
||||
rep.authenticated = 0;
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(xDRI2AuthConnectionReply), &rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2CreateDrawable(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2CreateDrawableReq);
|
||||
xDRI2CreateDrawableReply rep;
|
||||
DrawablePtr pDrawable;
|
||||
unsigned int handle, head;
|
||||
int status;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2CreateDrawableReq);
|
||||
|
||||
if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
|
||||
return status;
|
||||
|
||||
if (!DRI2CreateDrawable(pDrawable, &handle, &head))
|
||||
return BadMatch;
|
||||
|
||||
if (!AddResource(stuff->drawable, dri2DrawableRes, pDrawable)) {
|
||||
DRI2DestroyDrawable(pDrawable);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.handle = handle;
|
||||
rep.head = head;
|
||||
|
||||
WriteToClient(client, sizeof(xDRI2CreateDrawableReply), &rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2DestroyDrawable(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2DestroyDrawableReq);
|
||||
DrawablePtr pDrawable;
|
||||
int status;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2DestroyDrawableReq);
|
||||
if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
|
||||
return status;
|
||||
|
||||
FreeResourceByType(stuff->drawable, dri2DrawableRes, FALSE);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2ReemitDrawableInfo(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2ReemitDrawableInfoReq);
|
||||
xDRI2ReemitDrawableInfoReply rep;
|
||||
DrawablePtr pDrawable;
|
||||
unsigned int head;
|
||||
int status;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2ReemitDrawableInfoReq);
|
||||
if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
|
||||
return status;
|
||||
|
||||
DRI2ReemitDrawableInfo(pDrawable, &head);
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.head = head;
|
||||
|
||||
WriteToClient(client, sizeof(xDRI2ReemitDrawableInfoReply), &rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2Dispatch (ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
switch (stuff->data) {
|
||||
case X_DRI2QueryVersion:
|
||||
return ProcDRI2QueryVersion(client);
|
||||
}
|
||||
|
||||
if (!LocalClient(client))
|
||||
return BadRequest;
|
||||
|
||||
switch (stuff->data) {
|
||||
case X_DRI2Connect:
|
||||
return ProcDRI2Connect(client);
|
||||
case X_DRI2AuthConnection:
|
||||
return ProcDRI2AuthConnection(client);
|
||||
case X_DRI2CreateDrawable:
|
||||
return ProcDRI2CreateDrawable(client);
|
||||
case X_DRI2DestroyDrawable:
|
||||
return ProcDRI2DestroyDrawable(client);
|
||||
case X_DRI2ReemitDrawableInfo:
|
||||
return ProcDRI2ReemitDrawableInfo(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDRI2Connect(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2ConnectReq);
|
||||
xDRI2ConnectReply rep;
|
||||
int n;
|
||||
|
||||
/* If the client is swapped, it's not local. Talk to the hand. */
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
if (sizeof(*stuff) / 4 != client->req_len)
|
||||
return BadLength;
|
||||
|
||||
rep.sequenceNumber = client->sequence;
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
rep.length = 0;
|
||||
rep.driverNameLength = 0;
|
||||
rep.busIdLength = 0;
|
||||
rep.sareaHandle = 0;
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDRI2Dispatch (ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
/*
|
||||
* Only local clients are allowed DRI access, but remote clients
|
||||
* still need these requests to find out cleanly.
|
||||
*/
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_DRI2QueryVersion:
|
||||
return ProcDRI2QueryVersion(client);
|
||||
case X_DRI2Connect:
|
||||
return SProcDRI2Connect(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
DRI2ResetProc (ExtensionEntry *extEntry)
|
||||
{
|
||||
}
|
||||
|
||||
static int DRI2DrawableGone(pointer p, XID id)
|
||||
{
|
||||
DrawablePtr pDrawable = p;
|
||||
|
||||
DRI2DestroyDrawable(pDrawable);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static void
|
||||
DRI2ExtensionInit(void)
|
||||
{
|
||||
dri2Extension = AddExtension(DRI2_NAME,
|
||||
DRI2NumberEvents,
|
||||
DRI2NumberErrors,
|
||||
ProcDRI2Dispatch,
|
||||
SProcDRI2Dispatch,
|
||||
DRI2ResetProc,
|
||||
StandardMinorOpcode);
|
||||
|
||||
dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone);
|
||||
}
|
||||
|
||||
extern Bool noDRI2Extension;
|
||||
|
||||
_X_HIDDEN ExtensionModule dri2ExtensionModule = {
|
||||
DRI2ExtensionInit,
|
||||
DRI2_NAME,
|
||||
&noDRI2Extension,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
|
@ -148,22 +148,23 @@ exaDDXDriverInit(ScreenPtr pScreen)
|
|||
FALSE);
|
||||
}
|
||||
|
||||
if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_COMPOSITE)) {
|
||||
xf86DrvMsg(pScreen->myNum, X_INFO,
|
||||
if (xf86ReturnOptValBool(pScreenPriv->options,
|
||||
EXAOPT_NO_COMPOSITE, FALSE)) {
|
||||
xf86DrvMsg(pScreen->myNum, X_CONFIG,
|
||||
"EXA: Disabling Composite operation "
|
||||
"(RENDER acceleration)\n");
|
||||
pExaScr->info->CheckComposite = NULL;
|
||||
pExaScr->info->PrepareComposite = NULL;
|
||||
}
|
||||
|
||||
if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_UTS)) {
|
||||
xf86DrvMsg(pScreen->myNum, X_INFO,
|
||||
if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_UTS, FALSE)) {
|
||||
xf86DrvMsg(pScreen->myNum, X_CONFIG,
|
||||
"EXA: Disabling UploadToScreen\n");
|
||||
pExaScr->info->UploadToScreen = NULL;
|
||||
}
|
||||
|
||||
if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_DFS)) {
|
||||
xf86DrvMsg(pScreen->myNum, X_INFO,
|
||||
if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_DFS, FALSE)) {
|
||||
xf86DrvMsg(pScreen->myNum, X_CONFIG,
|
||||
"EXA: Disabling DownloadFromScreen\n");
|
||||
pExaScr->info->DownloadFromScreen = NULL;
|
||||
}
|
||||
|
|
|
@ -625,14 +625,11 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
|
|||
pScrn->virtualY = mode->VDisplay;
|
||||
|
||||
if (NULL == pScrn->modes) {
|
||||
pScrn->modes = xnfalloc(sizeof(DisplayModeRec));
|
||||
this = pScrn->modes;
|
||||
memcpy(this,mode,sizeof(DisplayModeRec));
|
||||
this = pScrn->modes = xf86DuplicateMode(mode);
|
||||
this->next = this;
|
||||
this->prev = this;
|
||||
} else {
|
||||
this = xnfalloc(sizeof(DisplayModeRec));
|
||||
memcpy(this,mode,sizeof(DisplayModeRec));
|
||||
this = xf86DuplicateMode(mode);
|
||||
this->next = pScrn->modes;
|
||||
this->prev = last;
|
||||
last->next = this;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#ifdef _X86EMU
|
||||
#include "x86emu/x86emui.h"
|
||||
#endif
|
||||
#include <pciaccess.h>
|
||||
|
||||
static int pciCfg1in(CARD16 addr, CARD32 *val);
|
||||
static int pciCfg1out(CARD16 addr, CARD32 val);
|
||||
|
@ -46,8 +47,6 @@ static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set);
|
|||
|
||||
#define REG pInt
|
||||
|
||||
static int pci_config_cycle = 0;
|
||||
|
||||
int
|
||||
setup_int(xf86Int10InfoPtr pInt)
|
||||
{
|
||||
|
@ -461,7 +460,43 @@ Mem_wl(CARD32 addr, CARD32 val)
|
|||
|
||||
static CARD32 PciCfg1Addr = 0;
|
||||
|
||||
#define OFFSET(Cfg1Addr) (Cfg1Addr & 0xff)
|
||||
#define PCI_OFFSET(x) ((x) & 0x000000ff)
|
||||
#define PCI_TAG(x) ((x) & 0x7fffff00)
|
||||
|
||||
static struct pci_device*
|
||||
pci_device_for_cfg_address (CARD32 addr)
|
||||
{
|
||||
struct pci_device *dev = NULL;
|
||||
PCITAG tag = PCI_TAG(addr);
|
||||
struct pci_slot_match slot_match = {
|
||||
.domain = PCI_DOM_FROM_TAG(tag),
|
||||
.bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)),
|
||||
.dev = PCI_DEV_FROM_TAG(tag),
|
||||
.func = PCI_FUNC_FROM_TAG(tag),
|
||||
.match_data = 0
|
||||
};
|
||||
|
||||
struct pci_device_iterator *iter =
|
||||
pci_slot_match_iterator_create (&slot_match);
|
||||
if (iter)
|
||||
dev = pci_device_next(iter);
|
||||
if (!dev) {
|
||||
char buf[128]; /* enough to store "%u@%u" */
|
||||
xf86FormatPciBusNumber(tag >> 16, buf);
|
||||
ErrorF("Failed to find device matching %s:%u:%u\n",
|
||||
buf, slot_match.dev, slot_match.func);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pci_device_next(iter)) {
|
||||
char buf[128]; /* enough to store "%u@%u" */
|
||||
xf86FormatPciBusNumber(tag >> 16, buf);
|
||||
ErrorF("Multiple devices matching %s:%u:%u\n",
|
||||
buf, slot_match.dev, slot_match.func);
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
static int
|
||||
pciCfg1in(CARD16 addr, CARD32 *val)
|
||||
|
@ -471,7 +506,8 @@ pciCfg1in(CARD16 addr, CARD32 *val)
|
|||
return 1;
|
||||
}
|
||||
if (addr == 0xCFC) {
|
||||
pci_device_cfg_read_u32(Int10Current->dev, val, OFFSET(PciCfg1Addr));
|
||||
pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
|
||||
val, PCI_OFFSET(PciCfg1Addr));
|
||||
if (PRINT_PORT && DEBUG_IO_TRACE())
|
||||
ErrorF(" cfg_inl(%#x) = %8.8x\n", PciCfg1Addr, *val);
|
||||
return 1;
|
||||
|
@ -489,7 +525,8 @@ pciCfg1out(CARD16 addr, CARD32 val)
|
|||
if (addr == 0xCFC) {
|
||||
if (PRINT_PORT && DEBUG_IO_TRACE())
|
||||
ErrorF(" cfg_outl(%#x, %8.8x)\n", PciCfg1Addr, val);
|
||||
pci_device_cfg_write_u32(Int10Current->dev, val, OFFSET(PciCfg1Addr));
|
||||
pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr),
|
||||
val, PCI_OFFSET(PciCfg1Addr));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -508,7 +545,8 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
|
|||
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
|
||||
const unsigned offset = addr - 0xCFC;
|
||||
|
||||
pci_device_cfg_read_u16(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
|
||||
pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr),
|
||||
val, PCI_OFFSET(PciCfg1Addr) + offset);
|
||||
if (PRINT_PORT && DEBUG_IO_TRACE())
|
||||
ErrorF(" cfg_inw(%#x) = %4.4x\n", PciCfg1Addr + offset, *val);
|
||||
return 1;
|
||||
|
@ -532,7 +570,8 @@ pciCfg1outw(CARD16 addr, CARD16 val)
|
|||
|
||||
if (PRINT_PORT && DEBUG_IO_TRACE())
|
||||
ErrorF(" cfg_outw(%#x, %4.4x)\n", PciCfg1Addr + offset, val);
|
||||
pci_device_cfg_write_u16(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
|
||||
pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr),
|
||||
val, PCI_OFFSET(PciCfg1Addr) + offset);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -551,7 +590,8 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
|
|||
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
|
||||
const unsigned offset = addr - 0xCFC;
|
||||
|
||||
pci_device_cfg_read_u8(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
|
||||
pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr),
|
||||
val, PCI_OFFSET(PciCfg1Addr) + offset);
|
||||
if (PRINT_PORT && DEBUG_IO_TRACE())
|
||||
ErrorF(" cfg_inb(%#x) = %2.2x\n", PciCfg1Addr + offset, *val);
|
||||
return 1;
|
||||
|
@ -575,7 +615,8 @@ pciCfg1outb(CARD16 addr, CARD8 val)
|
|||
|
||||
if (PRINT_PORT && DEBUG_IO_TRACE())
|
||||
ErrorF(" cfg_outb(%#x, %2.2x)\n", PciCfg1Addr + offset, val);
|
||||
pci_device_cfg_write_u8(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
|
||||
pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr),
|
||||
val, PCI_OFFSET(PciCfg1Addr) + offset);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -92,9 +92,6 @@
|
|||
extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval;
|
||||
#endif
|
||||
|
||||
extern Selection *CurrentSelections;
|
||||
extern int NumCurrentSelections;
|
||||
|
||||
/* DIX things */
|
||||
|
||||
_X_HIDDEN void *dixLookupTab[] = {
|
||||
|
@ -150,8 +147,6 @@ _X_HIDDEN void *dixLookupTab[] = {
|
|||
SYMVAR(isItTimeToYield)
|
||||
SYMVAR(ClientStateCallback)
|
||||
SYMVAR(ServerGrabCallback)
|
||||
SYMVAR(CurrentSelections)
|
||||
SYMVAR(NumCurrentSelections)
|
||||
/* dixfonts.c */
|
||||
SYMFUNC(CloseFont)
|
||||
SYMFUNC(FontToXError)
|
||||
|
@ -193,8 +188,12 @@ _X_HIDDEN void *dixLookupTab[] = {
|
|||
SYMFUNC(XineramaGetCursorScreen)
|
||||
#endif
|
||||
/* property.c */
|
||||
SYMFUNC(dixLookupProperty)
|
||||
SYMFUNC(ChangeWindowProperty)
|
||||
SYMFUNC(dixChangeWindowProperty)
|
||||
/* selection.c */
|
||||
SYMFUNC(dixLookupSelection)
|
||||
SYMVAR(CurrentSelections)
|
||||
/* extension.c */
|
||||
SYMFUNC(AddExtension)
|
||||
SYMFUNC(AddExtensionAlias)
|
||||
|
@ -441,6 +440,9 @@ _X_HIDDEN void *dixLookupTab[] = {
|
|||
#ifdef XIDLE
|
||||
SYMVAR(noXIdleExtension)
|
||||
#endif
|
||||
#ifdef XSELINUX
|
||||
SYMVAR(noSELinuxExtension)
|
||||
#endif
|
||||
#ifdef XV
|
||||
SYMVAR(noXvExtension)
|
||||
#endif
|
||||
|
|
|
@ -68,8 +68,10 @@
|
|||
# include "xf86Xinput.h"
|
||||
#endif
|
||||
#include "xf86OSmouse.h"
|
||||
#ifdef XV
|
||||
#include "xf86xv.h"
|
||||
#include "xf86xvmc.h"
|
||||
#endif
|
||||
#include "xf86cmap.h"
|
||||
#include "xf86fbman.h"
|
||||
#include "dgaproc.h"
|
||||
|
@ -351,9 +353,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
|||
SYMFUNC(xf86AllocateEntityPrivateIndex)
|
||||
SYMFUNC(xf86GetEntityPrivate)
|
||||
|
||||
/* xf86cvt.c */
|
||||
SYMFUNC(xf86CVTMode)
|
||||
|
||||
/* xf86Configure.c */
|
||||
SYMFUNC(xf86AddDeviceToConfigure)
|
||||
|
||||
|
@ -952,6 +951,7 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
|||
SYMFUNC(xf86CrtcSetSizeRange)
|
||||
SYMFUNC(xf86CrtcScreenInit)
|
||||
SYMFUNC(xf86CVTMode)
|
||||
SYMFUNC(xf86GTFMode)
|
||||
SYMFUNC(xf86DisableUnusedFunctions)
|
||||
SYMFUNC(xf86DPMSSet)
|
||||
SYMFUNC(xf86DuplicateMode)
|
||||
|
|
|
@ -5,6 +5,7 @@ libxf86modes_a_SOURCES = \
|
|||
xf86Crtc.h \
|
||||
xf86Cursors.c \
|
||||
xf86cvt.c \
|
||||
xf86gtf.c \
|
||||
xf86DiDGA.c \
|
||||
xf86EdidModes.c \
|
||||
xf86Modes.c \
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2006 Keith Packard
|
||||
* Copyright © 2008 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
|
@ -693,7 +694,12 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen)
|
|||
/*
|
||||
* Called at ScreenInit time to set up
|
||||
*/
|
||||
_X_EXPORT Bool
|
||||
_X_EXPORT
|
||||
#ifdef RANDR_13_INTERFACE
|
||||
int
|
||||
#else
|
||||
Bool
|
||||
#endif
|
||||
xf86CrtcScreenInit (ScreenPtr screen)
|
||||
{
|
||||
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
|
||||
|
@ -726,7 +732,11 @@ xf86CrtcScreenInit (ScreenPtr screen)
|
|||
config->CloseScreen = screen->CloseScreen;
|
||||
screen->CloseScreen = xf86CrtcCloseScreen;
|
||||
|
||||
#ifdef RANDR_13_INTERFACE
|
||||
return RANDR_INTERFACE_VERSION;
|
||||
#else
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static DisplayModePtr
|
||||
|
@ -808,7 +818,7 @@ xf86ClosestMode (xf86OutputPtr output,
|
|||
return target_mode;
|
||||
}
|
||||
|
||||
static Bool
|
||||
static DisplayModePtr
|
||||
xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
|
||||
{
|
||||
DisplayModePtr mode;
|
||||
|
@ -820,9 +830,21 @@ xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
|
|||
continue;
|
||||
|
||||
if (mode->type & M_T_PREFERRED)
|
||||
return TRUE;
|
||||
return mode;
|
||||
}
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static DisplayModePtr
|
||||
xf86OutputHasUserPreferredMode (xf86OutputPtr output)
|
||||
{
|
||||
DisplayModePtr mode, first = output->probed_modes;
|
||||
|
||||
for (mode = first; mode && mode->next != first; mode = mode->next)
|
||||
if (mode->type & M_T_USERPREF)
|
||||
return mode;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1261,6 +1283,23 @@ xf86SortModes (DisplayModePtr input)
|
|||
return output;
|
||||
}
|
||||
|
||||
static char *
|
||||
preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output)
|
||||
{
|
||||
char *preferred_mode = NULL;
|
||||
|
||||
/* Check for a configured preference for a particular mode */
|
||||
preferred_mode = xf86GetOptValString (output->options,
|
||||
OPTION_PREFERRED_MODE);
|
||||
if (preferred_mode)
|
||||
return preferred_mode;
|
||||
|
||||
if (pScrn->display->modes && *pScrn->display->modes)
|
||||
preferred_mode = *pScrn->display->modes;
|
||||
|
||||
return preferred_mode;
|
||||
}
|
||||
|
||||
_X_EXPORT void
|
||||
xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
|
||||
{
|
||||
|
@ -1445,8 +1484,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
|
|||
output->probed_modes = xf86SortModes (output->probed_modes);
|
||||
|
||||
/* Check for a configured preference for a particular mode */
|
||||
preferred_mode = xf86GetOptValString (output->options,
|
||||
OPTION_PREFERRED_MODE);
|
||||
preferred_mode = preferredMode(scrn, output);
|
||||
|
||||
if (preferred_mode)
|
||||
{
|
||||
|
@ -1561,6 +1599,271 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
|
|||
scrn->currentMode = scrn->modes;
|
||||
}
|
||||
|
||||
static void
|
||||
xf86EnableOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, Bool *enabled)
|
||||
{
|
||||
Bool any_enabled = FALSE;
|
||||
int o;
|
||||
|
||||
for (o = 0; o < config->num_output; o++)
|
||||
any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE);
|
||||
|
||||
if (!any_enabled) {
|
||||
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
|
||||
"No outputs definitely connected, trying again...\n");
|
||||
|
||||
for (o = 0; o < config->num_output; o++)
|
||||
enabled[o] = xf86OutputEnabled(config->output[o], FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static Bool
|
||||
nextEnabledOutput(xf86CrtcConfigPtr config, Bool *enabled, int *index)
|
||||
{
|
||||
int o = *index;
|
||||
|
||||
for (o++; o < config->num_output; o++) {
|
||||
if (enabled[o]) {
|
||||
*index = o;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86TargetExact(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
|
||||
DisplayModePtr *modes, Bool *enabled,
|
||||
int width, int height)
|
||||
{
|
||||
int o;
|
||||
int pref_width = 0, pref_height = 0;
|
||||
DisplayModePtr *preferred;
|
||||
Bool ret = FALSE;
|
||||
|
||||
preferred = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
|
||||
|
||||
/* Find all the preferred modes; fail if any outputs lack them */
|
||||
for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
|
||||
preferred[o] =
|
||||
xf86OutputHasPreferredMode(config->output[o], width, height);
|
||||
|
||||
if (!preferred[o])
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* check that they're all the same size */
|
||||
for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
|
||||
Rotation r = config->output[o]->initial_rotation;
|
||||
if (!pref_width) {
|
||||
pref_width = xf86ModeWidth(preferred[o], r);
|
||||
pref_height = xf86ModeHeight(preferred[o], r);
|
||||
} else {
|
||||
if (pref_width != xf86ModeWidth(preferred[o], r))
|
||||
goto out;
|
||||
if (pref_height != xf86ModeHeight(preferred[o], r))
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
/* oh good, they match. stash the selected modes and return. */
|
||||
memcpy(modes, preferred, config->num_output * sizeof(DisplayModePtr));
|
||||
ret = TRUE;
|
||||
|
||||
out:
|
||||
xfree(preferred);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Bool
|
||||
aspectMatch(float a, float b)
|
||||
{
|
||||
return fabs(1 - (a / b)) < 0.05;
|
||||
}
|
||||
|
||||
static DisplayModePtr
|
||||
nextAspectMode(xf86OutputPtr o, DisplayModePtr last, float aspect)
|
||||
{
|
||||
DisplayModePtr m = NULL;
|
||||
|
||||
if (!o)
|
||||
return NULL;
|
||||
|
||||
if (!last)
|
||||
m = o->probed_modes;
|
||||
else
|
||||
m = last->next;
|
||||
|
||||
for (; m; m = m->next)
|
||||
if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
|
||||
return m;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static DisplayModePtr
|
||||
bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
|
||||
{
|
||||
int o = -1, p;
|
||||
DisplayModePtr mode = NULL, test = NULL, match = NULL;
|
||||
|
||||
nextEnabledOutput(config, enabled, &o);
|
||||
while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
|
||||
for (p = o; nextEnabledOutput(config, enabled, &p); ) {
|
||||
test = xf86OutputFindClosestMode(config->output[p], mode);
|
||||
if (!test)
|
||||
break;
|
||||
if (test->HDisplay != mode->HDisplay ||
|
||||
test->VDisplay != mode->VDisplay) {
|
||||
test = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we didn't match it on all outputs, try the next one */
|
||||
if (!test)
|
||||
continue;
|
||||
|
||||
/* if it's bigger than the last one, save it */
|
||||
if (!match || (test->HDisplay > match->HDisplay))
|
||||
match = test;
|
||||
}
|
||||
|
||||
/* return the biggest one found */
|
||||
return match;
|
||||
}
|
||||
|
||||
static DisplayModePtr
|
||||
biggestMode(DisplayModePtr a, DisplayModePtr b)
|
||||
{
|
||||
int A, B;
|
||||
|
||||
if (!a)
|
||||
return b;
|
||||
if (!b)
|
||||
return a;
|
||||
|
||||
A = a->HDisplay * a->VDisplay;
|
||||
B = b->HDisplay * b->VDisplay;
|
||||
|
||||
if (A > B)
|
||||
return a;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86TargetAspect(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
|
||||
DisplayModePtr *modes, Bool *enabled,
|
||||
int width, int height)
|
||||
{
|
||||
int o;
|
||||
float aspect = 0.0, *aspects;
|
||||
xf86OutputPtr output;
|
||||
Bool ret = FALSE;
|
||||
DisplayModePtr guess = NULL, aspect_guess = NULL, base_guess = NULL;
|
||||
|
||||
aspects = xnfcalloc(config->num_output, sizeof(float));
|
||||
|
||||
/* collect the aspect ratios */
|
||||
for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
|
||||
output = config->output[o];
|
||||
if (output->mm_height)
|
||||
aspects[o] = (float)output->mm_width / (float)output->mm_height;
|
||||
else
|
||||
aspects[o] = 4.0 / 3.0;
|
||||
}
|
||||
|
||||
/* check that they're all the same */
|
||||
for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
|
||||
output = config->output[o];
|
||||
if (!aspect) {
|
||||
aspect = aspects[o];
|
||||
} else if (!aspectMatch(aspect, aspects[o])) {
|
||||
goto no_aspect_match;
|
||||
}
|
||||
}
|
||||
|
||||
/* if they're all 4:3, just skip ahead and save effort */
|
||||
if (!aspectMatch(aspect, 4.0/3.0))
|
||||
aspect_guess = bestModeForAspect(config, enabled, aspect);
|
||||
|
||||
no_aspect_match:
|
||||
base_guess = bestModeForAspect(config, enabled, 4.0/3.0);
|
||||
|
||||
guess = biggestMode(base_guess, aspect_guess);
|
||||
|
||||
if (!guess)
|
||||
goto out;
|
||||
|
||||
/* found a mode that works everywhere, now apply it */
|
||||
for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
|
||||
modes[o] = xf86OutputFindClosestMode(config->output[o], guess);
|
||||
}
|
||||
ret = TRUE;
|
||||
|
||||
out:
|
||||
xfree(aspects);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
|
||||
DisplayModePtr *modes, Bool *enabled,
|
||||
int width, int height)
|
||||
{
|
||||
DisplayModePtr target_mode = NULL;
|
||||
Rotation target_rotation = RR_Rotate_0;
|
||||
DisplayModePtr default_mode;
|
||||
int default_preferred, target_preferred = 0, o;
|
||||
|
||||
/* User preferred > preferred > other modes */
|
||||
for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
|
||||
default_mode = xf86DefaultMode (config->output[o], width, height);
|
||||
if (!default_mode)
|
||||
continue;
|
||||
|
||||
default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
|
||||
((default_mode->type & M_T_USERPREF) != 0));
|
||||
|
||||
if (default_preferred > target_preferred || !target_mode) {
|
||||
target_mode = default_mode;
|
||||
target_preferred = default_preferred;
|
||||
target_rotation = config->output[o]->initial_rotation;
|
||||
config->compat_output = o;
|
||||
}
|
||||
}
|
||||
|
||||
if (target_mode)
|
||||
modes[config->compat_output] = target_mode;
|
||||
|
||||
/* Fill in other output modes */
|
||||
for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
|
||||
if (!modes[o])
|
||||
modes[o] = xf86ClosestMode(config->output[o], target_mode,
|
||||
target_rotation, width, height);
|
||||
}
|
||||
|
||||
return (target_mode != NULL);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
|
||||
DisplayModePtr *modes, Bool *enabled,
|
||||
int width, int height)
|
||||
{
|
||||
int o;
|
||||
|
||||
for (o = -1; nextEnabledOutput(config, enabled, &o); )
|
||||
if (xf86OutputHasUserPreferredMode(config->output[o]))
|
||||
return
|
||||
xf86TargetFallback(scrn, config, modes, enabled, width, height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct default screen configuration
|
||||
*
|
||||
|
@ -1580,14 +1883,11 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
|||
{
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
int o, c;
|
||||
DisplayModePtr target_mode = NULL;
|
||||
int target_preferred = 0;
|
||||
Rotation target_rotation = RR_Rotate_0;
|
||||
xf86CrtcPtr *crtcs;
|
||||
DisplayModePtr *modes;
|
||||
Bool *enabled, any_enabled = FALSE;
|
||||
int width;
|
||||
int height;
|
||||
Bool *enabled;
|
||||
int width, height;
|
||||
int i = scrn->scrnIndex;
|
||||
|
||||
/* Set up the device options */
|
||||
config->options = xnfalloc (sizeof (xf86DeviceOptions));
|
||||
|
@ -1613,75 +1913,28 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
|||
modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
|
||||
enabled = xnfcalloc (config->num_output, sizeof (Bool));
|
||||
|
||||
for (o = 0; o < config->num_output; o++)
|
||||
{
|
||||
xf86OutputPtr output = config->output[o];
|
||||
xf86EnableOutputs(scrn, config, enabled);
|
||||
|
||||
modes[o] = NULL;
|
||||
any_enabled |= (enabled[o] = xf86OutputEnabled (output, TRUE));
|
||||
}
|
||||
if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
|
||||
xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
|
||||
else if (xf86TargetExact(scrn, config, modes, enabled, width, height))
|
||||
xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
|
||||
else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
|
||||
xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n");
|
||||
else if (xf86TargetFallback(scrn, config, modes, enabled, width, height))
|
||||
xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
|
||||
else
|
||||
xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
|
||||
|
||||
if (!any_enabled)
|
||||
{
|
||||
xf86DrvMsg (scrn->scrnIndex, X_WARNING,
|
||||
"No outputs definitely connected, trying again...\n");
|
||||
|
||||
for (o = 0; o < config->num_output; o++)
|
||||
{
|
||||
xf86OutputPtr output = config->output[o];
|
||||
|
||||
modes[o] = NULL;
|
||||
enabled[o] = xf86OutputEnabled (output, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* User preferred > preferred > other modes
|
||||
*/
|
||||
for (o = 0; o < config->num_output; o++)
|
||||
{
|
||||
xf86OutputPtr output = config->output[o];
|
||||
DisplayModePtr default_mode;
|
||||
int default_preferred;
|
||||
|
||||
if (!enabled[o])
|
||||
continue;
|
||||
default_mode = xf86DefaultMode (output, width, height);
|
||||
if (!default_mode)
|
||||
continue;
|
||||
default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
|
||||
((default_mode->type & M_T_USERPREF) != 0));
|
||||
if (default_preferred > target_preferred || !target_mode)
|
||||
{
|
||||
target_mode = default_mode;
|
||||
target_preferred = default_preferred;
|
||||
target_rotation = output->initial_rotation;
|
||||
config->compat_output = o;
|
||||
}
|
||||
}
|
||||
if (target_mode)
|
||||
modes[config->compat_output] = target_mode;
|
||||
/*
|
||||
* Fill in other output modes
|
||||
*/
|
||||
for (o = 0; o < config->num_output; o++)
|
||||
{
|
||||
xf86OutputPtr output = config->output[o];
|
||||
|
||||
if (enabled[o])
|
||||
{
|
||||
if (!modes[o])
|
||||
modes[o] = xf86ClosestMode (output, target_mode,
|
||||
target_rotation, width, height);
|
||||
for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
|
||||
if (!modes[o])
|
||||
xf86DrvMsg (scrn->scrnIndex, X_ERROR,
|
||||
"Output %s enabled but has no modes\n",
|
||||
output->name);
|
||||
config->output[o]->name);
|
||||
else
|
||||
xf86DrvMsg (scrn->scrnIndex, X_INFO,
|
||||
"Output %s using initial mode %s\n",
|
||||
output->name, modes[o]->name);
|
||||
}
|
||||
config->output[o]->name, modes[o]->name);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1780,6 +2033,68 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the CRTC we're going to map each output to vs. it's current
|
||||
* CRTC. If they don't match, we have to disable the output and the CRTC
|
||||
* since the driver will have to re-route things.
|
||||
*/
|
||||
static void
|
||||
xf86PrepareOutputs (ScrnInfoPtr scrn)
|
||||
{
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
int o;
|
||||
|
||||
for (o = 0; o < config->num_output; o++) {
|
||||
xf86OutputPtr output = config->output[o];
|
||||
#if RANDR_GET_CRTC_INTERFACE
|
||||
/* Disable outputs that are unused or will be re-routed */
|
||||
if (!output->funcs->get_crtc ||
|
||||
output->crtc != (*output->funcs->get_crtc)(output) ||
|
||||
output->crtc == NULL)
|
||||
#endif
|
||||
(*output->funcs->dpms)(output, DPMSModeOff);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xf86PrepareCrtcs (ScrnInfoPtr scrn)
|
||||
{
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
int c;
|
||||
|
||||
for (c = 0; c < config->num_crtc; c++) {
|
||||
#if RANDR_GET_CRTC_INTERFACE
|
||||
xf86CrtcPtr crtc = config->crtc[c];
|
||||
xf86OutputPtr output = NULL;
|
||||
uint32_t desired_outputs = 0, current_outputs = 0;
|
||||
int o;
|
||||
|
||||
for (o = 0; o < config->num_output; o++) {
|
||||
output = config->output[o];
|
||||
if (output->crtc == crtc)
|
||||
desired_outputs |= (1<<o);
|
||||
/* If we can't tell where it's mapped, force it off */
|
||||
if (!output->funcs->get_crtc) {
|
||||
desired_outputs = 0;
|
||||
break;
|
||||
}
|
||||
if ((*output->funcs->get_crtc)(output) == crtc)
|
||||
current_outputs |= (1<<o);
|
||||
}
|
||||
|
||||
/*
|
||||
* If mappings are different or the CRTC is unused,
|
||||
* we need to disable it
|
||||
*/
|
||||
if (desired_outputs != current_outputs ||
|
||||
!desired_outputs)
|
||||
(*crtc->funcs->dpms)(crtc, DPMSModeOff);
|
||||
#else
|
||||
(*crtc->funcs->dpms)(crtc, DPMSModeOff);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Using the desired mode information in each crtc, set
|
||||
* modes (used in EnterVT functions, or at server startup)
|
||||
|
@ -1789,25 +2104,10 @@ _X_EXPORT Bool
|
|||
xf86SetDesiredModes (ScrnInfoPtr scrn)
|
||||
{
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
int c, o;
|
||||
int c;
|
||||
|
||||
/*
|
||||
* Turn off everything so mode setting is done
|
||||
* with hardware in a consistent state
|
||||
*/
|
||||
for (o = 0; o < config->num_output; o++)
|
||||
{
|
||||
xf86OutputPtr output = config->output[o];
|
||||
(*output->funcs->dpms)(output, DPMSModeOff);
|
||||
}
|
||||
|
||||
for (c = 0; c < config->num_crtc; c++)
|
||||
{
|
||||
xf86CrtcPtr crtc = config->crtc[c];
|
||||
|
||||
crtc->funcs->dpms(crtc, DPMSModeOff);
|
||||
memset(&crtc->mode, 0, sizeof(crtc->mode));
|
||||
}
|
||||
xf86PrepareOutputs(scrn);
|
||||
xf86PrepareCrtcs(scrn);
|
||||
|
||||
for (c = 0; c < config->num_crtc; c++)
|
||||
{
|
||||
|
@ -1987,7 +2287,7 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
|
|||
}
|
||||
}
|
||||
xf86DisableUnusedFunctions(pScrn);
|
||||
#if RANDR_12_INTERFACE
|
||||
#ifdef RANDR_12_INTERFACE
|
||||
xf86RandR12TellChanged (pScrn->pScreen);
|
||||
#endif
|
||||
return ok;
|
||||
|
|
|
@ -215,7 +215,14 @@ typedef struct _xf86CrtcFuncs {
|
|||
Rotation rotation, int x, int y);
|
||||
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
|
||||
|
||||
#define XF86_CRTC_VERSION 1
|
||||
|
||||
struct _xf86Crtc {
|
||||
/**
|
||||
* ABI versioning
|
||||
*/
|
||||
int version;
|
||||
|
||||
/**
|
||||
* Associated ScrnInfo
|
||||
*/
|
||||
|
@ -409,6 +416,21 @@ typedef struct _xf86OutputFuncs {
|
|||
(*set_property)(xf86OutputPtr output,
|
||||
Atom property,
|
||||
RRPropertyValuePtr value);
|
||||
#endif
|
||||
#ifdef RANDR_13_INTERFACE
|
||||
/**
|
||||
* Callback to get an updated property value
|
||||
*/
|
||||
Bool
|
||||
(*get_property)(xf86OutputPtr output,
|
||||
Atom property);
|
||||
#endif
|
||||
#ifdef RANDR_GET_CRTC_INTERFACE
|
||||
/**
|
||||
* Callback to get current CRTC for a given output
|
||||
*/
|
||||
xf86CrtcPtr
|
||||
(*get_crtc)(xf86OutputPtr output);
|
||||
#endif
|
||||
/**
|
||||
* Clean up driver-specific bits of the output
|
||||
|
@ -417,7 +439,15 @@ typedef struct _xf86OutputFuncs {
|
|||
(*destroy) (xf86OutputPtr output);
|
||||
} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
|
||||
|
||||
|
||||
#define XF86_OUTPUT_VERSION 1
|
||||
|
||||
struct _xf86Output {
|
||||
/**
|
||||
* ABI versioning
|
||||
*/
|
||||
int version;
|
||||
|
||||
/**
|
||||
* Associated ScrnInfo
|
||||
*/
|
||||
|
@ -669,7 +699,11 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
|
|||
void
|
||||
xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
|
||||
|
||||
#ifdef RANDR_13_INTERFACE
|
||||
int
|
||||
#else
|
||||
Bool
|
||||
#endif
|
||||
xf86CrtcScreenInit (ScreenPtr pScreen);
|
||||
|
||||
Bool
|
||||
|
|
|
@ -138,7 +138,8 @@ cursor_bitpos (int flags, int x, Bool mask)
|
|||
mask = !mask;
|
||||
if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED)
|
||||
x = (x & ~3) | (3 - (x & 3));
|
||||
if (flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST)
|
||||
if (((flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) == 0) ==
|
||||
(X_BYTE_ORDER == X_BIG_ENDIAN))
|
||||
x = (x & ~7) | (7 - (x & 7));
|
||||
if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1)
|
||||
x = (x << 1) + mask;
|
||||
|
@ -227,8 +228,13 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
|
|||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||
CursorPtr cursor = xf86_config->cursor;
|
||||
int c;
|
||||
CARD8 *bits = cursor ? dixLookupPrivate(&cursor->devPrivates,
|
||||
screen) : NULL;
|
||||
CARD8 *bits = cursor ?
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
dixLookupPrivate(&cursor->devPrivates, screen)
|
||||
#else
|
||||
cursor->devPriv[screen->myNum]
|
||||
#endif
|
||||
: NULL;
|
||||
|
||||
/* Save ARGB versions of these colors */
|
||||
xf86_config->cursor_fg = (CARD32) fg | 0xff000000;
|
||||
|
@ -614,7 +620,12 @@ xf86_reload_cursors (ScreenPtr screen)
|
|||
else
|
||||
#endif
|
||||
(*cursor_info->LoadCursorImage)(cursor_info->pScrn,
|
||||
dixLookupPrivate(&cursor->devPrivates, screen));
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
dixLookupPrivate(&cursor->devPrivates, screen)
|
||||
#else
|
||||
cursor->devPriv[screen->myNum]
|
||||
#endif
|
||||
);
|
||||
|
||||
(*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y);
|
||||
(*cursor_info->ShowCursor)(cursor_info->pScrn);
|
||||
|
|
|
@ -108,13 +108,6 @@ static Bool quirk_prefer_large_75 (int scrnIndex, xf86MonPtr DDC)
|
|||
|
||||
static Bool quirk_detailed_h_in_cm (int scrnIndex, xf86MonPtr DDC)
|
||||
{
|
||||
/* Bug #10304: "LGPhilipsLCD LP154W01-A5" */
|
||||
/* Bug #12784: "LGPhilipsLCD LP154W01-TLA2" */
|
||||
/* Red Hat #435216 "LGPhilipsLCD LP154W01-TLAE" */
|
||||
if (memcmp (DDC->vendor.name, "LPL", 4) == 0 &&
|
||||
(DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00))
|
||||
return TRUE;
|
||||
|
||||
/* Bug #11603: Funai Electronics PM36B */
|
||||
if (memcmp (DDC->vendor.name, "FCM", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 13600)
|
||||
|
@ -137,7 +130,7 @@ static Bool quirk_detailed_use_maximum_size (int scrnIndex, xf86MonPtr DDC)
|
|||
{
|
||||
/* Bug #10304: LGPhilipsLCD LP154W01-A5 */
|
||||
if (memcmp (DDC->vendor.name, "LPL", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 0)
|
||||
(DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
@ -160,6 +153,16 @@ static Bool quirk_first_detailed_preferred (int scrnIndex, xf86MonPtr DDC)
|
|||
DDC->vendor.prod_id == 57364)
|
||||
return TRUE;
|
||||
|
||||
/* Proview AY765C 17" LCD. See bug #15160*/
|
||||
if (memcmp (DDC->vendor.name, "PTS", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 765)
|
||||
return TRUE;
|
||||
|
||||
/* ACR of some sort RH #284231 */
|
||||
if (memcmp (DDC->vendor.name, "ACR", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 2423)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -221,27 +224,27 @@ static const ddc_quirk_map_t ddc_quirks[] = {
|
|||
* TODO:
|
||||
* - for those with access to the VESA DMT standard; review please.
|
||||
*/
|
||||
#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DRIVER
|
||||
#define MODEPREFIX NULL, NULL, NULL, 0, M_T_DRIVER
|
||||
#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
|
||||
|
||||
static DisplayModeRec DDCEstablishedModes[17] = {
|
||||
{ MODEPREFIX("800x600"), 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
|
||||
{ MODEPREFIX("800x600"), 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
|
||||
{ MODEPREFIX("640x480"), 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
|
||||
{ MODEPREFIX("640x480"), 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
|
||||
{ MODEPREFIX("640x480"), 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
|
||||
{ MODEPREFIX("640x480"), 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
|
||||
{ MODEPREFIX("720x400"), 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
|
||||
{ MODEPREFIX("720x400"), 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
|
||||
{ MODEPREFIX("1280x1024"), 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
|
||||
{ MODEPREFIX("1024x768"), 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
|
||||
{ MODEPREFIX("1024x768"), 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
|
||||
{ MODEPREFIX("1024x768"), 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
|
||||
{ MODEPREFIX("1024x768"), 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
|
||||
{ MODEPREFIX("832x624"), 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
|
||||
{ MODEPREFIX("800x600"), 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
|
||||
{ MODEPREFIX("800x600"), 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
|
||||
{ MODEPREFIX("1152x864"), 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
|
||||
static const DisplayModeRec DDCEstablishedModes[17] = {
|
||||
{ MODEPREFIX, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
|
||||
{ MODEPREFIX, 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
|
||||
{ MODEPREFIX, 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
|
||||
{ MODEPREFIX, 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
|
||||
{ MODEPREFIX, 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
|
||||
{ MODEPREFIX, 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
|
||||
{ MODEPREFIX, 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
|
||||
{ MODEPREFIX, 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
|
||||
{ MODEPREFIX, 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
|
||||
{ MODEPREFIX, 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
|
||||
{ MODEPREFIX, 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
|
||||
{ MODEPREFIX, 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
|
||||
{ MODEPREFIX, 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
|
||||
{ MODEPREFIX, 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
|
||||
{ MODEPREFIX, 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
|
||||
{ MODEPREFIX, 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
|
||||
{ MODEPREFIX, 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
|
||||
};
|
||||
|
||||
static DisplayModePtr
|
||||
|
@ -263,20 +266,57 @@ DDCModesFromEstablished(int scrnIndex, struct established_timings *timing,
|
|||
return Modes;
|
||||
}
|
||||
|
||||
#define LEVEL_DMT 0
|
||||
#define LEVEL_GTF 1
|
||||
#define LEVEL_CVT 2
|
||||
|
||||
static int
|
||||
MonitorStandardTimingLevel(xf86MonPtr DDC)
|
||||
{
|
||||
if (DDC->ver.revision >= 2) {
|
||||
if (DDC->ver.revision >= 4 && CVT_SUPPORTED(DDC->features.msc)) {
|
||||
return LEVEL_CVT;
|
||||
}
|
||||
return LEVEL_GTF;
|
||||
}
|
||||
return LEVEL_DMT;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is not really correct. Appendix B of the EDID 1.4 spec defines
|
||||
* the right thing to do here. If the timing given here matches a mode
|
||||
* defined in the VESA DMT standard, we _must_ use that. If the device
|
||||
* supports CVT modes, then we should generate a CVT timing. If both
|
||||
* of the above fail, use GTF.
|
||||
*
|
||||
* There are some wrinkles here. EDID 1.1 and 1.0 sinks can't really
|
||||
* "support" GTF, since it wasn't a standard yet; so if they ask for a
|
||||
* timing in this section that isn't defined in DMT, returning a GTF mode
|
||||
* may not actually be valid. EDID 1.3 sinks often report support for
|
||||
* some CVT modes, but they are not required to support CVT timings for
|
||||
* modes in the standard timing descriptor, so we should _not_ treat them
|
||||
* as CVT-compliant (unless specified in an extension block I suppose).
|
||||
*
|
||||
* EDID 1.4 requires that all sink devices support both GTF and CVT timings
|
||||
* for modes in this section, but does say that CVT is preferred.
|
||||
*/
|
||||
static DisplayModePtr
|
||||
DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing,
|
||||
ddc_quirk_t quirks)
|
||||
DDCModesFromStandardTiming(struct std_timings *timing, ddc_quirk_t quirks,
|
||||
int timing_level)
|
||||
{
|
||||
DisplayModePtr Modes = NULL, Mode = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < STD_TIMINGS; i++) {
|
||||
if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
|
||||
/* XXX check for DMT first, else... */
|
||||
if (timing_level == LEVEL_CVT)
|
||||
Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
|
||||
timing[i].refresh, FALSE, FALSE);
|
||||
else
|
||||
Mode = xf86GTFMode(timing[i].hsize, timing[i].vsize,
|
||||
timing[i].refresh, FALSE, FALSE);
|
||||
|
||||
Mode->type = M_T_DRIVER;
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
}
|
||||
|
@ -321,8 +361,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
|
|||
" sync.\n", __func__, timing->h_active, timing->v_active);
|
||||
}
|
||||
|
||||
Mode = xnfalloc(sizeof(DisplayModeRec));
|
||||
memset(Mode, 0, sizeof(DisplayModeRec));
|
||||
Mode = xnfcalloc(1, sizeof(DisplayModeRec));
|
||||
|
||||
Mode->type = M_T_DRIVER;
|
||||
if (preferred)
|
||||
|
@ -374,6 +413,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
|
|||
return Mode;
|
||||
}
|
||||
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
static DisplayModePtr
|
||||
DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
|
||||
{
|
||||
|
@ -402,10 +442,15 @@ DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
|
|||
|
||||
return modes;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* This is only valid when the sink claims to be continuous-frequency
|
||||
* but does not supply a detailed range descriptor. Such sinks are
|
||||
* arguably broken. Currently the mode validation code isn't aware of
|
||||
* this; the non-RANDR code even punts the decision of optional sync
|
||||
* range checking to the driver. Loss.
|
||||
*/
|
||||
static void
|
||||
DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
|
||||
|
@ -547,6 +592,7 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
|
|||
DisplayModePtr Modes = NULL, Mode;
|
||||
ddc_quirk_t quirks;
|
||||
Bool preferred;
|
||||
int timing_level;
|
||||
|
||||
xf86DrvMsg (scrnIndex, X_INFO, "EDID vendor \"%s\", prod id %d\n",
|
||||
DDC->vendor.name, DDC->vendor.prod_id);
|
||||
|
@ -561,6 +607,8 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
|
|||
if (quirks & (DDC_QUIRK_PREFER_LARGE_60 | DDC_QUIRK_PREFER_LARGE_75))
|
||||
preferred = FALSE;
|
||||
|
||||
timing_level = MonitorStandardTimingLevel(DDC);
|
||||
|
||||
for (i = 0; i < DET_TIMINGS; i++) {
|
||||
struct detailed_monitor_section *det_mon = &DDC->det_mon[i];
|
||||
|
||||
|
@ -574,15 +622,16 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
|
|||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
break;
|
||||
case DS_STD_TIMINGS:
|
||||
Mode = DDCModesFromStandardTiming(scrnIndex,
|
||||
det_mon->section.std_t,
|
||||
quirks);
|
||||
Mode = DDCModesFromStandardTiming(det_mon->section.std_t,
|
||||
quirks, timing_level);
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
break;
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
case DS_CVT:
|
||||
Mode = DDCModesFromCVT(scrnIndex, det_mon->section.cvt);
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -593,7 +642,7 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
|
|||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
|
||||
/* Add standard timings */
|
||||
Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2, quirks);
|
||||
Mode = DDCModesFromStandardTiming(DDC->timings2, quirks, timing_level);
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
|
||||
if (quirks & DDC_QUIRK_PREFER_LARGE_60)
|
||||
|
@ -620,13 +669,17 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
|
|||
|
||||
Monitor->DDC = DDC;
|
||||
|
||||
if (Monitor->widthmm <= 0 && Monitor->heightmm <= 0) {
|
||||
Monitor->widthmm = 10 * DDC->features.hsize;
|
||||
Monitor->heightmm = 10 * DDC->features.vsize;
|
||||
}
|
||||
|
||||
/* If this is a digital display, then we can use reduced blanking */
|
||||
/*
|
||||
* If this is a digital display, then we can use reduced blanking.
|
||||
* XXX This is a 1.3 heuristic. 1.4 explicitly defines rb support.
|
||||
*/
|
||||
if (DDC->features.input_type)
|
||||
Monitor->reducedblanking = TRUE;
|
||||
/* Allow the user to also enable this through config */
|
||||
|
||||
Modes = xf86DDCGetModes(scrnIndex, DDC);
|
||||
|
||||
|
|
|
@ -214,9 +214,10 @@ xf86DuplicateMode(DisplayModePtr pMode)
|
|||
*pNew = *pMode;
|
||||
pNew->next = NULL;
|
||||
pNew->prev = NULL;
|
||||
if (pNew->name == NULL) {
|
||||
xf86SetModeDefaultName(pMode);
|
||||
}
|
||||
|
||||
if (pMode->name == NULL)
|
||||
xf86SetModeDefaultName(pNew);
|
||||
else
|
||||
pNew->name = xnfstrdup(pMode->name);
|
||||
|
||||
return pNew;
|
||||
|
@ -508,7 +509,12 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
|||
|
||||
for (mode = modeList; mode != NULL; mode = mode->next) {
|
||||
if (xf86ModeBandwidth(mode, depth) > bandwidth)
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
mode->status = MODE_BANDWIDTH;
|
||||
#else
|
||||
/* MODE_BANDWIDTH didn't exist in xserver 1.2 */
|
||||
mode->status = MODE_BAD;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -657,7 +663,7 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
|
|||
DisplayModePtr head = NULL, prev = NULL, mode;
|
||||
int i;
|
||||
|
||||
for (i = 0; xf86DefaultModes[i].name != NULL; i++)
|
||||
for (i = 0; i < xf86NumDefaultModes; i++)
|
||||
{
|
||||
DisplayModePtr defMode = &xf86DefaultModes[i];
|
||||
|
||||
|
@ -666,23 +672,9 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
|
|||
if (!doubleScanAllowed && (defMode->Flags & V_DBLSCAN))
|
||||
continue;
|
||||
|
||||
mode = xalloc(sizeof(DisplayModeRec));
|
||||
if (!mode)
|
||||
continue;
|
||||
memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec));
|
||||
mode->name = xstrdup(xf86DefaultModes[i].name);
|
||||
if (!mode->name)
|
||||
{
|
||||
xfree (mode);
|
||||
continue;
|
||||
}
|
||||
mode->prev = prev;
|
||||
mode->next = NULL;
|
||||
if (prev)
|
||||
prev->next = mode;
|
||||
else
|
||||
head = mode;
|
||||
prev = mode;
|
||||
mode = xf86DuplicateMode(defMode);
|
||||
|
||||
head = xf86ModesAdd(head, mode);
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
|
|||
DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
|
||||
DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
|
||||
Bool Reduced, Bool Interlaced);
|
||||
DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins);
|
||||
|
||||
void
|
||||
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||
|
|
|
@ -61,11 +61,21 @@ static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
|
|||
#endif
|
||||
|
||||
static int xf86RandR12Generation;
|
||||
static DevPrivateKey xf86RandR12Key;
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
|
||||
static DevPrivateKey xf86RandR12Key;
|
||||
#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
|
||||
dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key))
|
||||
|
||||
#else /* XORG_VERSION_CURRENT < 7.0 */
|
||||
|
||||
static int xf86RandR12Index;
|
||||
#define XF86RANDRINFO(p) \
|
||||
((XF86RandRInfoPtr)(p)->devPrivates[xf86RandR12Index].ptr)
|
||||
|
||||
#endif /* XORG_VERSION_CURRENT < 7.0 */
|
||||
|
||||
|
||||
static int
|
||||
xf86RandR12ModeRefresh (DisplayModePtr mode)
|
||||
{
|
||||
|
@ -136,23 +146,6 @@ xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
|
|||
randrp->maxY = maxY;
|
||||
}
|
||||
|
||||
if (scrp->currentMode->HDisplay != randrp->virtualX ||
|
||||
scrp->currentMode->VDisplay != randrp->virtualY)
|
||||
{
|
||||
pSize = RRRegisterSize (pScreen,
|
||||
randrp->virtualX, randrp->virtualY,
|
||||
randrp->mmWidth,
|
||||
randrp->mmHeight);
|
||||
if (!pSize)
|
||||
return FALSE;
|
||||
RRRegisterRate (pScreen, pSize, refresh0);
|
||||
if (scrp->virtualX == randrp->virtualX &&
|
||||
scrp->virtualY == randrp->virtualY)
|
||||
{
|
||||
RRSetCurrentConfig (pScreen, randrp->rotation, refresh0, pSize);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -341,13 +334,17 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
|
|||
PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
|
||||
Bool ret = FALSE;
|
||||
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
if (xf86RandR12Key) {
|
||||
#endif
|
||||
if (randrp->virtualX == -1 || randrp->virtualY == -1)
|
||||
{
|
||||
randrp->virtualX = pScrn->virtualX;
|
||||
randrp->virtualY = pScrn->virtualY;
|
||||
}
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
}
|
||||
#endif
|
||||
if (pRoot && pScrn->vtSema)
|
||||
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
|
||||
|
||||
|
@ -359,8 +356,8 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
|
|||
|
||||
pScreen->width = pScrnPix->drawable.width = width;
|
||||
pScreen->height = pScrnPix->drawable.height = height;
|
||||
pScreen->mmWidth = mmWidth;
|
||||
pScreen->mmHeight = mmHeight;
|
||||
randrp->mmWidth = pScreen->mmWidth = mmWidth;
|
||||
randrp->mmHeight = pScreen->mmHeight = mmHeight;
|
||||
|
||||
xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
|
||||
xf86SetViewport (pScreen, 0, 0);
|
||||
|
@ -469,8 +466,10 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
|
|||
mmHeight);
|
||||
}
|
||||
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
if (xf86RandR12Key == NULL)
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
if (randrp->virtualX == -1 || randrp->virtualY == -1)
|
||||
{
|
||||
|
@ -501,7 +500,11 @@ xf86RandR12Init (ScreenPtr pScreen)
|
|||
if (xf86RandR12Generation != serverGeneration)
|
||||
xf86RandR12Generation = serverGeneration;
|
||||
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
xf86RandR12Key = &xf86RandR12Key;
|
||||
#else
|
||||
xf86RandR12Index = AllocateScreenPrivateIndex();
|
||||
#endif
|
||||
|
||||
randrp = xalloc (sizeof (XF86RandRInfoRec));
|
||||
if (!randrp)
|
||||
|
@ -527,7 +530,11 @@ xf86RandR12Init (ScreenPtr pScreen)
|
|||
|
||||
randrp->maxX = randrp->maxY = 0;
|
||||
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
|
||||
#else
|
||||
pScreen->devPrivates[xf86RandR12Index].ptr = randrp;
|
||||
#endif
|
||||
|
||||
#if RANDR_12_INTERFACE
|
||||
if (!xf86RandR12Init12 (pScreen))
|
||||
|
@ -546,8 +553,10 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
|
|||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
#endif
|
||||
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
if (xf86RandR12Key == NULL)
|
||||
return;
|
||||
#endif
|
||||
|
||||
randrp = XF86RANDRINFO(pScreen);
|
||||
#if RANDR_12_INTERFACE
|
||||
|
@ -735,6 +744,9 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
|
|||
xf86CrtcPtr *save_crtcs;
|
||||
Bool save_enabled = crtc->enabled;
|
||||
|
||||
if (!crtc->scrn->vtSema)
|
||||
return FALSE;
|
||||
|
||||
save_crtcs = xalloc(config->num_output * sizeof (xf86CrtcPtr));
|
||||
if ((randr_mode != NULL) != crtc->enabled)
|
||||
changed = TRUE;
|
||||
|
@ -848,6 +860,20 @@ xf86RandR12OutputSetProperty (ScreenPtr pScreen,
|
|||
return output->funcs->set_property(output, property, value);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR13OutputGetProperty (ScreenPtr pScreen,
|
||||
RROutputPtr randr_output,
|
||||
Atom property)
|
||||
{
|
||||
xf86OutputPtr output = randr_output->devPrivate;
|
||||
|
||||
if (output->funcs->get_property == NULL)
|
||||
return TRUE;
|
||||
|
||||
/* Should be safe even w/o vtSema */
|
||||
return output->funcs->get_property(output, property);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR12OutputValidateMode (ScreenPtr pScreen,
|
||||
RROutputPtr randr_output,
|
||||
|
@ -1077,8 +1103,10 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
|
|||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
if (xf86RandR12Key == NULL)
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
for (c = 0; c < config->num_crtc; c++)
|
||||
xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
|
||||
|
@ -1100,8 +1128,13 @@ xf86RandR12TellChanged (ScreenPtr pScreen)
|
|||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
int c;
|
||||
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
|
||||
if (xf86RandR12Key == NULL)
|
||||
return;
|
||||
#else
|
||||
if (!XF86RANDRINFO(pScreen))
|
||||
return;
|
||||
#endif
|
||||
|
||||
xf86RandR12SetInfo12 (pScreen);
|
||||
for (c = 0; c < config->num_crtc; c++)
|
||||
|
@ -1127,6 +1160,9 @@ xf86RandR12Init12 (ScreenPtr pScreen)
|
|||
rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma;
|
||||
rp->rrOutputSetProperty = xf86RandR12OutputSetProperty;
|
||||
rp->rrOutputValidateMode = xf86RandR12OutputValidateMode;
|
||||
#if RANDR_13_INTERFACE
|
||||
rp->rrOutputGetProperty = xf86RandR13OutputGetProperty;
|
||||
#endif
|
||||
rp->rrModeDestroy = xf86RandR12ModeDestroy;
|
||||
rp->rrSetConfig = NULL;
|
||||
pScrn->PointerMoved = xf86RandR12PointerMoved;
|
||||
|
|
|
@ -20,11 +20,6 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file This is a copy of xf86cvt.c from the X Server, for compatibility with
|
||||
* old servers (pre-1.2).
|
||||
*/
|
||||
|
||||
/*
|
||||
* The reason for having this function in a file of its own is
|
||||
* so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
|
||||
|
@ -72,7 +67,7 @@ _X_EXPORT DisplayModePtr
|
|||
xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
||||
Bool Interlaced)
|
||||
{
|
||||
DisplayModeRec *Mode = xnfalloc(sizeof(DisplayModeRec));
|
||||
DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
|
||||
|
||||
/* 1) top/bottom margin size (% of height) - default: 1.8 */
|
||||
#define CVT_MARGIN_PERCENTAGE 1.8
|
||||
|
@ -95,8 +90,6 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
|||
int VDisplayRnd, VMargin, VSync;
|
||||
float Interlace; /* Please rename this */
|
||||
|
||||
memset(Mode, 0, sizeof(DisplayModeRec));
|
||||
|
||||
/* CVT default is 60.0Hz */
|
||||
if (!VRefresh)
|
||||
VRefresh = 60.0;
|
||||
|
|
|
@ -0,0 +1,388 @@
|
|||
/*
|
||||
* gtf.c Generate mode timings using the GTF Timing Standard
|
||||
*
|
||||
* gcc gtf.c -o gtf -lm -Wall
|
||||
*
|
||||
* Copyright (c) 2001, Andy Ritger aritger@nvidia.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* o Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* o Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* o Neither the name of NVIDIA nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This program is based on the Generalized Timing Formula(GTF TM)
|
||||
* Standard Version: 1.0, Revision: 1.0
|
||||
*
|
||||
* The GTF Document contains the following Copyright information:
|
||||
*
|
||||
* Copyright (c) 1994, 1995, 1996 - Video Electronics Standards
|
||||
* Association. Duplication of this document within VESA member
|
||||
* companies for review purposes is permitted. All other rights
|
||||
* reserved.
|
||||
*
|
||||
* While every precaution has been taken in the preparation
|
||||
* of this standard, the Video Electronics Standards Association and
|
||||
* its contributors assume no responsibility for errors or omissions,
|
||||
* and make no warranties, expressed or implied, of functionality
|
||||
* of suitability for any purpose. The sample code contained within
|
||||
* this standard may be used without restriction.
|
||||
*
|
||||
*
|
||||
*
|
||||
* The GTF EXCEL(TM) SPREADSHEET, a sample (and the definitive)
|
||||
* implementation of the GTF Timing Standard, is available at:
|
||||
*
|
||||
* ftp://ftp.vesa.org/pub/GTF/GTF_V1R1.xls
|
||||
*/
|
||||
|
||||
/* Ruthlessly converted to server code by Adam Jackson <ajax@redhat.com> */
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
# include <xorg-config.h>
|
||||
#else
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86Modes.h"
|
||||
#include <string.h>
|
||||
|
||||
#define MARGIN_PERCENT 1.8 /* % of active vertical image */
|
||||
#define CELL_GRAN 8.0 /* assumed character cell granularity */
|
||||
#define MIN_PORCH 1 /* minimum front porch */
|
||||
#define V_SYNC_RQD 3 /* width of vsync in lines */
|
||||
#define H_SYNC_PERCENT 8.0 /* width of hsync as % of total line */
|
||||
#define MIN_VSYNC_PLUS_BP 550.0 /* min time of vsync + back porch (microsec) */
|
||||
#define M 600.0 /* blanking formula gradient */
|
||||
#define C 40.0 /* blanking formula offset */
|
||||
#define K 128.0 /* blanking formula scaling factor */
|
||||
#define J 20.0 /* blanking formula scaling factor */
|
||||
|
||||
/* C' and M' are part of the Blanking Duty Cycle computation */
|
||||
|
||||
#define C_PRIME (((C - J) * K/256.0) + J)
|
||||
#define M_PRIME (K/256.0 * M)
|
||||
|
||||
|
||||
/*
|
||||
* xf86GTFMode() - as defined by the GTF Timing Standard, compute the
|
||||
* Stage 1 Parameters using the vertical refresh frequency. In other
|
||||
* words: input a desired resolution and desired refresh rate, and
|
||||
* output the GTF mode timings.
|
||||
*
|
||||
* XXX All the code is in place to compute interlaced modes, but I don't
|
||||
* feel like testing it right now.
|
||||
*
|
||||
* XXX margin computations are implemented but not tested (nor used by
|
||||
* XServer of fbset mode descriptions, from what I can tell).
|
||||
*/
|
||||
|
||||
_X_EXPORT DisplayModePtr
|
||||
xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
|
||||
{
|
||||
DisplayModeRec *mode = xnfcalloc(1, sizeof(DisplayModeRec));
|
||||
|
||||
float h_pixels_rnd;
|
||||
float v_lines_rnd;
|
||||
float v_field_rate_rqd;
|
||||
float top_margin;
|
||||
float bottom_margin;
|
||||
float interlace;
|
||||
float h_period_est;
|
||||
float vsync_plus_bp;
|
||||
float v_back_porch;
|
||||
float total_v_lines;
|
||||
float v_field_rate_est;
|
||||
float h_period;
|
||||
float v_field_rate;
|
||||
float v_frame_rate;
|
||||
float left_margin;
|
||||
float right_margin;
|
||||
float total_active_pixels;
|
||||
float ideal_duty_cycle;
|
||||
float h_blank;
|
||||
float total_pixels;
|
||||
float pixel_freq;
|
||||
float h_freq;
|
||||
|
||||
float h_sync;
|
||||
float h_front_porch;
|
||||
float v_odd_front_porch_lines;
|
||||
|
||||
/* 1. In order to give correct results, the number of horizontal
|
||||
* pixels requested is first processed to ensure that it is divisible
|
||||
* by the character size, by rounding it to the nearest character
|
||||
* cell boundary:
|
||||
*
|
||||
* [H PIXELS RND] = ((ROUND([H PIXELS]/[CELL GRAN RND],0))*[CELLGRAN RND])
|
||||
*/
|
||||
|
||||
h_pixels_rnd = rint((float) h_pixels / CELL_GRAN) * CELL_GRAN;
|
||||
|
||||
/* 2. If interlace is requested, the number of vertical lines assumed
|
||||
* by the calculation must be halved, as the computation calculates
|
||||
* the number of vertical lines per field. In either case, the
|
||||
* number of lines is rounded to the nearest integer.
|
||||
*
|
||||
* [V LINES RND] = IF([INT RQD?]="y", ROUND([V LINES]/2,0),
|
||||
* ROUND([V LINES],0))
|
||||
*/
|
||||
|
||||
v_lines_rnd = interlaced ?
|
||||
rint((float) v_lines) / 2.0 :
|
||||
rint((float) v_lines);
|
||||
|
||||
/* 3. Find the frame rate required:
|
||||
*
|
||||
* [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2,
|
||||
* [I/P FREQ RQD])
|
||||
*/
|
||||
|
||||
v_field_rate_rqd = interlaced ? (freq * 2.0) : (freq);
|
||||
|
||||
/* 4. Find number of lines in Top margin:
|
||||
*
|
||||
* [TOP MARGIN (LINES)] = IF([MARGINS RQD?]="Y",
|
||||
* ROUND(([MARGIN%]/100*[V LINES RND]),0),
|
||||
* 0)
|
||||
*/
|
||||
|
||||
top_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0);
|
||||
|
||||
/* 5. Find number of lines in Bottom margin:
|
||||
*
|
||||
* [BOT MARGIN (LINES)] = IF([MARGINS RQD?]="Y",
|
||||
* ROUND(([MARGIN%]/100*[V LINES RND]),0),
|
||||
* 0)
|
||||
*/
|
||||
|
||||
bottom_margin = margins ? rint(MARGIN_PERCENT/100.0 * v_lines_rnd) : (0.0);
|
||||
|
||||
/* 6. If interlace is required, then set variable [INTERLACE]=0.5:
|
||||
*
|
||||
* [INTERLACE]=(IF([INT RQD?]="y",0.5,0))
|
||||
*/
|
||||
|
||||
interlace = interlaced ? 0.5 : 0.0;
|
||||
|
||||
/* 7. Estimate the Horizontal period
|
||||
*
|
||||
* [H PERIOD EST] = ((1/[V FIELD RATE RQD]) - [MIN VSYNC+BP]/1000000) /
|
||||
* ([V LINES RND] + (2*[TOP MARGIN (LINES)]) +
|
||||
* [MIN PORCH RND]+[INTERLACE]) * 1000000
|
||||
*/
|
||||
|
||||
h_period_est = (((1.0/v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP/1000000.0))
|
||||
/ (v_lines_rnd + (2*top_margin) + MIN_PORCH + interlace)
|
||||
* 1000000.0);
|
||||
|
||||
/* 8. Find the number of lines in V sync + back porch:
|
||||
*
|
||||
* [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0)
|
||||
*/
|
||||
|
||||
vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP/h_period_est);
|
||||
|
||||
/* 9. Find the number of lines in V back porch alone:
|
||||
*
|
||||
* [V BACK PORCH] = [V SYNC+BP] - [V SYNC RND]
|
||||
*
|
||||
* XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]?
|
||||
*/
|
||||
|
||||
v_back_porch = vsync_plus_bp - V_SYNC_RQD;
|
||||
|
||||
/* 10. Find the total number of lines in Vertical field period:
|
||||
*
|
||||
* [TOTAL V LINES] = [V LINES RND] + [TOP MARGIN (LINES)] +
|
||||
* [BOT MARGIN (LINES)] + [V SYNC+BP] + [INTERLACE] +
|
||||
* [MIN PORCH RND]
|
||||
*/
|
||||
|
||||
total_v_lines = v_lines_rnd + top_margin + bottom_margin + vsync_plus_bp +
|
||||
interlace + MIN_PORCH;
|
||||
|
||||
/* 11. Estimate the Vertical field frequency:
|
||||
*
|
||||
* [V FIELD RATE EST] = 1 / [H PERIOD EST] / [TOTAL V LINES] * 1000000
|
||||
*/
|
||||
|
||||
v_field_rate_est = 1.0 / h_period_est / total_v_lines * 1000000.0;
|
||||
|
||||
/* 12. Find the actual horizontal period:
|
||||
*
|
||||
* [H PERIOD] = [H PERIOD EST] / ([V FIELD RATE RQD] / [V FIELD RATE EST])
|
||||
*/
|
||||
|
||||
h_period = h_period_est / (v_field_rate_rqd / v_field_rate_est);
|
||||
|
||||
/* 13. Find the actual Vertical field frequency:
|
||||
*
|
||||
* [V FIELD RATE] = 1 / [H PERIOD] / [TOTAL V LINES] * 1000000
|
||||
*/
|
||||
|
||||
v_field_rate = 1.0 / h_period / total_v_lines * 1000000.0;
|
||||
|
||||
/* 14. Find the Vertical frame frequency:
|
||||
*
|
||||
* [V FRAME RATE] = (IF([INT RQD?]="y", [V FIELD RATE]/2, [V FIELD RATE]))
|
||||
*/
|
||||
|
||||
v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate;
|
||||
|
||||
/* 15. Find number of pixels in left margin:
|
||||
*
|
||||
* [LEFT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y",
|
||||
* (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 /
|
||||
* [CELL GRAN RND]),0)) * [CELL GRAN RND],
|
||||
* 0))
|
||||
*/
|
||||
|
||||
left_margin = margins ?
|
||||
rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
|
||||
0.0;
|
||||
|
||||
/* 16. Find number of pixels in right margin:
|
||||
*
|
||||
* [RIGHT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y",
|
||||
* (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 /
|
||||
* [CELL GRAN RND]),0)) * [CELL GRAN RND],
|
||||
* 0))
|
||||
*/
|
||||
|
||||
right_margin = margins ?
|
||||
rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
|
||||
0.0;
|
||||
|
||||
/* 17. Find total number of active pixels in image and left and right
|
||||
* margins:
|
||||
*
|
||||
* [TOTAL ACTIVE PIXELS] = [H PIXELS RND] + [LEFT MARGIN (PIXELS)] +
|
||||
* [RIGHT MARGIN (PIXELS)]
|
||||
*/
|
||||
|
||||
total_active_pixels = h_pixels_rnd + left_margin + right_margin;
|
||||
|
||||
/* 18. Find the ideal blanking duty cycle from the blanking duty cycle
|
||||
* equation:
|
||||
*
|
||||
* [IDEAL DUTY CYCLE] = [C'] - ([M']*[H PERIOD]/1000)
|
||||
*/
|
||||
|
||||
ideal_duty_cycle = C_PRIME - (M_PRIME * h_period / 1000.0);
|
||||
|
||||
/* 19. Find the number of pixels in the blanking time to the nearest
|
||||
* double character cell:
|
||||
*
|
||||
* [H BLANK (PIXELS)] = (ROUND(([TOTAL ACTIVE PIXELS] *
|
||||
* [IDEAL DUTY CYCLE] /
|
||||
* (100-[IDEAL DUTY CYCLE]) /
|
||||
* (2*[CELL GRAN RND])), 0))
|
||||
* * (2*[CELL GRAN RND])
|
||||
*/
|
||||
|
||||
h_blank = rint(total_active_pixels *
|
||||
ideal_duty_cycle /
|
||||
(100.0 - ideal_duty_cycle) /
|
||||
(2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN);
|
||||
|
||||
/* 20. Find total number of pixels:
|
||||
*
|
||||
* [TOTAL PIXELS] = [TOTAL ACTIVE PIXELS] + [H BLANK (PIXELS)]
|
||||
*/
|
||||
|
||||
total_pixels = total_active_pixels + h_blank;
|
||||
|
||||
/* 21. Find pixel clock frequency:
|
||||
*
|
||||
* [PIXEL FREQ] = [TOTAL PIXELS] / [H PERIOD]
|
||||
*/
|
||||
|
||||
pixel_freq = total_pixels / h_period;
|
||||
|
||||
/* 22. Find horizontal frequency:
|
||||
*
|
||||
* [H FREQ] = 1000 / [H PERIOD]
|
||||
*/
|
||||
|
||||
h_freq = 1000.0 / h_period;
|
||||
|
||||
|
||||
/* Stage 1 computations are now complete; I should really pass
|
||||
the results to another function and do the Stage 2
|
||||
computations, but I only need a few more values so I'll just
|
||||
append the computations here for now */
|
||||
|
||||
|
||||
/* 17. Find the number of pixels in the horizontal sync period:
|
||||
*
|
||||
* [H SYNC (PIXELS)] =(ROUND(([H SYNC%] / 100 * [TOTAL PIXELS] /
|
||||
* [CELL GRAN RND]),0))*[CELL GRAN RND]
|
||||
*/
|
||||
|
||||
h_sync = rint(H_SYNC_PERCENT/100.0 * total_pixels / CELL_GRAN) * CELL_GRAN;
|
||||
|
||||
/* 18. Find the number of pixels in the horizontal front porch period:
|
||||
*
|
||||
* [H FRONT PORCH (PIXELS)] = ([H BLANK (PIXELS)]/2)-[H SYNC (PIXELS)]
|
||||
*/
|
||||
|
||||
h_front_porch = (h_blank / 2.0) - h_sync;
|
||||
|
||||
/* 36. Find the number of lines in the odd front porch period:
|
||||
*
|
||||
* [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE])
|
||||
*/
|
||||
|
||||
v_odd_front_porch_lines = MIN_PORCH + interlace;
|
||||
|
||||
/* finally, pack the results in the mode struct */
|
||||
|
||||
mode->HDisplay = (int) (h_pixels_rnd);
|
||||
mode->HSyncStart = (int) (h_pixels_rnd + h_front_porch);
|
||||
mode->HSyncEnd = (int) (h_pixels_rnd + h_front_porch + h_sync);
|
||||
mode->HTotal = (int) (total_pixels);
|
||||
mode->VDisplay = (int) (v_lines_rnd);
|
||||
mode->VSyncStart = (int) (v_lines_rnd + v_odd_front_porch_lines);
|
||||
mode->VSyncEnd = (int) (v_lines_rnd + v_odd_front_porch_lines + V_SYNC_RQD);
|
||||
mode->VTotal = (int) (total_v_lines);
|
||||
|
||||
mode->Clock = (int) (pixel_freq * 1000.0);
|
||||
mode->HSync = h_freq;
|
||||
mode->VRefresh = freq;
|
||||
|
||||
xf86SetModeDefaultName(mode);
|
||||
|
||||
mode->Flags = V_NHSYNC | V_PVSYNC;
|
||||
if (interlaced) {
|
||||
mode->VTotal *= 2;
|
||||
mode->Flags |= V_INTERLACE;
|
||||
}
|
||||
|
||||
return mode;
|
||||
}
|
|
@ -212,6 +212,11 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
|
|||
pVidMem->mapMem = mapVidMem;
|
||||
pVidMem->unmapMem = unmapVidMem;
|
||||
|
||||
#if HAVE_PCI_SYSTEM_INIT_DEV_MEM
|
||||
if (useDevMem)
|
||||
pci_system_init_dev_mem(devMemFd);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_MTRR_SUPPORT
|
||||
if (useDevMem) {
|
||||
if (cleanMTRR()) {
|
||||
|
|
|
@ -27,18 +27,6 @@ if LINUX_ALPHA
|
|||
PCI_SOURCES += axpPci.c
|
||||
endif
|
||||
|
||||
if LINUX_IA64
|
||||
PLATFORM_PCI_SOURCES = \
|
||||
460gxPCI.c \
|
||||
460gxPCI.h \
|
||||
altixPCI.c \
|
||||
altixPCI.h \
|
||||
e8870PCI.c \
|
||||
e8870PCI.h \
|
||||
zx1PCI.c \
|
||||
zx1PCI.h
|
||||
endif
|
||||
|
||||
if XORG_BUS_SPARC
|
||||
PLATFORM_SOURCES = Sbus.c
|
||||
sdk_HEADERS += xf86Sbus.h
|
||||
|
|
|
@ -207,9 +207,8 @@
|
|||
# endif
|
||||
#elif defined(__ia64__)
|
||||
# if defined(linux)
|
||||
# define ARCH_PCI_INIT ia64linuxPciInit
|
||||
# define ARCH_PCI_INIT linuxPciInit
|
||||
# endif
|
||||
# define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper
|
||||
#elif defined(__i386__) || defined(__i386)
|
||||
# if defined(linux)
|
||||
# define ARCH_PCI_INIT linuxPciInit
|
||||
|
|
|
@ -81,4 +81,6 @@ bsdPciInit(void)
|
|||
{
|
||||
pciNumBuses = 1;
|
||||
pciBusInfo[0] = &bsd_pci;
|
||||
|
||||
xf86InitVidMem();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
noinst_LTLIBRARIES = liblinux.la
|
||||
|
||||
if LINUX_IA64
|
||||
PLATFORM_PCI_SUPPORT = $(srcdir)/lnx_ia64.c $(srcdir)/../shared/ia64Pci.c
|
||||
PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c
|
||||
PLATFORM_DEFINES = -DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset
|
||||
PLATFORM_INCLUDES = -I$(srcdir)/../shared
|
||||
endif
|
||||
|
|
|
@ -42,12 +42,7 @@
|
|||
#include <linux/pci.h>
|
||||
|
||||
#include "compiler.h"
|
||||
#include "460gxPCI.h"
|
||||
#include "e8870PCI.h"
|
||||
#include "zx1PCI.h"
|
||||
#include "altixPCI.h"
|
||||
#include "Pci.h"
|
||||
#include "ia64Pci.h"
|
||||
|
||||
/*
|
||||
* We use special in/out routines here since Altix platforms require the
|
||||
|
@ -191,53 +186,3 @@ _X_EXPORT unsigned int inl(unsigned long port)
|
|||
return val;
|
||||
}
|
||||
|
||||
void
|
||||
ia64ScanPCIWrapper(scanpciWrapperOpt flags)
|
||||
{
|
||||
static IA64Chipset chipset = NONE_CHIPSET;
|
||||
|
||||
if (flags == SCANPCI_INIT) {
|
||||
|
||||
/* PCI configuration space probes should be done first */
|
||||
if (xorgProbe460GX(flags)) {
|
||||
chipset = I460GX_CHIPSET;
|
||||
xf86PreScan460GX();
|
||||
return;
|
||||
} else if (xorgProbeE8870(flags)) {
|
||||
chipset = E8870_CHIPSET;
|
||||
xf86PreScanE8870();
|
||||
return;
|
||||
}
|
||||
#ifdef OS_PROBE_PCI_CHIPSET
|
||||
chipset = OS_PROBE_PCI_CHIPSET(flags);
|
||||
switch (chipset) {
|
||||
case ZX1_CHIPSET:
|
||||
xf86PreScanZX1();
|
||||
return;
|
||||
case ALTIX_CHIPSET:
|
||||
xf86PreScanAltix();
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
} else /* if (flags == SCANPCI_TERM) */ {
|
||||
|
||||
switch (chipset) {
|
||||
case I460GX_CHIPSET:
|
||||
xf86PostScan460GX();
|
||||
return;
|
||||
case E8870_CHIPSET:
|
||||
xf86PostScanE8870();
|
||||
return;
|
||||
case ZX1_CHIPSET:
|
||||
xf86PostScanZX1();
|
||||
return;
|
||||
case ALTIX_CHIPSET:
|
||||
xf86PostScanAltix();
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue