2008-02-04 17:58:24 +01:00
|
|
|
/*
|
2008-08-11 22:59:17 +02:00
|
|
|
* Copyright © 2007, 2008 Red Hat, Inc.
|
2008-02-04 17:58:24 +01:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
|
#include <xf86drm.h>
|
|
|
|
#include "xf86Module.h"
|
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "windowstr.h"
|
|
|
|
#include "dri2.h"
|
|
|
|
|
|
|
|
#include "xf86.h"
|
|
|
|
|
2008-08-29 00:05:40 +02:00
|
|
|
static int dri2ScreenPrivateKeyIndex;
|
|
|
|
static DevPrivateKey dri2ScreenPrivateKey = &dri2ScreenPrivateKeyIndex;
|
|
|
|
static int dri2WindowPrivateKeyIndex;
|
|
|
|
static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKeyIndex;
|
|
|
|
static int dri2PixmapPrivateKeyIndex;
|
|
|
|
static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKeyIndex;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
typedef struct _DRI2Drawable {
|
|
|
|
unsigned int refCount;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
DRI2BufferPtr buffers;
|
|
|
|
int bufferCount;
|
2008-10-07 19:49:28 +02:00
|
|
|
unsigned int pendingSequence;
|
2008-08-11 22:59:17 +02:00
|
|
|
} DRI2DrawableRec, *DRI2DrawablePtr;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
|
|
|
typedef struct _DRI2Screen {
|
|
|
|
const char *driverName;
|
2008-10-07 19:49:28 +02:00
|
|
|
const char *deviceName;
|
2008-08-11 22:59:17 +02:00
|
|
|
int fd;
|
2008-10-07 19:49:28 +02:00
|
|
|
unsigned int lastSequence;
|
2008-08-11 22:59:17 +02:00
|
|
|
DRI2CreateBuffersProcPtr CreateBuffers;
|
|
|
|
DRI2DestroyBuffersProcPtr DestroyBuffers;
|
2008-10-07 19:49:28 +02:00
|
|
|
DRI2CopyRegionProcPtr CopyRegion;
|
|
|
|
|
|
|
|
HandleExposuresProcPtr HandleExposures;
|
2008-02-04 17:58:24 +01:00
|
|
|
} DRI2ScreenRec, *DRI2ScreenPtr;
|
|
|
|
|
|
|
|
static DRI2ScreenPtr
|
|
|
|
DRI2GetScreen(ScreenPtr pScreen)
|
|
|
|
{
|
|
|
|
return dixLookupPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey);
|
|
|
|
}
|
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
static DRI2DrawablePtr
|
|
|
|
DRI2GetDrawable(DrawablePtr pDraw)
|
2008-02-04 17:58:24 +01:00
|
|
|
{
|
2008-08-11 22:59:17 +02:00
|
|
|
WindowPtr pWin;
|
|
|
|
PixmapPtr pPixmap;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
if (pDraw->type == DRAWABLE_WINDOW)
|
|
|
|
{
|
2008-02-04 17:58:24 +01:00
|
|
|
pWin = (WindowPtr) pDraw;
|
2008-08-11 22:59:17 +02:00
|
|
|
return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
|
2008-02-04 17:58:24 +01:00
|
|
|
}
|
2008-08-11 22:59:17 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
pPixmap = (PixmapPtr) pDraw;
|
|
|
|
return dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
|
2008-02-04 17:58:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2008-08-11 22:59:17 +02:00
|
|
|
DRI2CreateDrawable(DrawablePtr pDraw)
|
2008-02-04 17:58:24 +01:00
|
|
|
{
|
2008-08-11 22:59:17 +02:00
|
|
|
WindowPtr pWin;
|
|
|
|
PixmapPtr pPixmap;
|
|
|
|
DRI2DrawablePtr pPriv;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
pPriv = DRI2GetDrawable(pDraw);
|
|
|
|
if (pPriv != NULL)
|
|
|
|
{
|
|
|
|
pPriv->refCount++;
|
|
|
|
return Success;
|
|
|
|
}
|
2008-02-04 17:58:24 +01:00
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
pPriv = xalloc(sizeof *pPriv);
|
|
|
|
if (pPriv == NULL)
|
|
|
|
return BadAlloc;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
pPriv->refCount = 1;
|
|
|
|
pPriv->width = pDraw->width;
|
|
|
|
pPriv->height = pDraw->height;
|
|
|
|
pPriv->buffers = NULL;
|
|
|
|
pPriv->bufferCount = 0;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
if (pDraw->type == DRAWABLE_WINDOW)
|
|
|
|
{
|
|
|
|
pWin = (WindowPtr) pDraw;
|
|
|
|
dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv);
|
2008-02-04 17:58:24 +01:00
|
|
|
}
|
2008-08-11 22:59:17 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
pPixmap = (PixmapPtr) pDraw;
|
|
|
|
dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, pPriv);
|
2008-02-04 17:58:24 +01:00
|
|
|
}
|
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
return Success;
|
2008-02-04 17:58:24 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
DRI2BufferPtr
|
2008-08-11 22:59:17 +02:00
|
|
|
DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
|
|
|
|
unsigned int *attachments, int count, int *out_count)
|
2008-02-04 17:58:24 +01:00
|
|
|
{
|
2008-08-11 22:59:17 +02:00
|
|
|
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
|
|
|
|
DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
|
|
|
|
DRI2BufferPtr buffers;
|
2009-04-09 00:44:34 +02:00
|
|
|
unsigned int temp_buf[32];
|
|
|
|
unsigned int *temp = temp_buf;
|
2009-04-09 23:38:24 +02:00
|
|
|
int have_fake_front = 0;
|
2009-04-09 00:44:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* If the drawable is a window and the front-buffer is requested, silently
|
|
|
|
* add the fake front-buffer to the list of requested attachments. The
|
|
|
|
* counting logic in the loop accounts for the case where the client
|
|
|
|
* requests both the fake and real front-buffer.
|
|
|
|
*/
|
|
|
|
if (pDraw->type == DRAWABLE_WINDOW) {
|
|
|
|
int need_fake_front = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if ((count + 1) > 32) {
|
|
|
|
temp = xalloc((count + 1) * sizeof(temp[0]));
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
if (attachments[i] == DRI2BufferFrontLeft) {
|
|
|
|
need_fake_front++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (attachments[i] == DRI2BufferFakeFrontLeft) {
|
|
|
|
need_fake_front--;
|
2009-04-09 23:38:24 +02:00
|
|
|
have_fake_front = 1;
|
2009-04-09 00:44:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
temp[i] = attachments[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (need_fake_front > 0) {
|
|
|
|
temp[i] = DRI2BufferFakeFrontLeft;
|
|
|
|
count++;
|
2009-04-09 23:38:24 +02:00
|
|
|
have_fake_front = 1;
|
2009-04-09 00:44:34 +02:00
|
|
|
attachments = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
|
|
|
|
if (pPriv->buffers == NULL ||
|
|
|
|
pDraw->width != pPriv->width || pDraw->height != pPriv->height)
|
|
|
|
{
|
|
|
|
buffers = (*ds->CreateBuffers)(pDraw, attachments, count);
|
|
|
|
(*ds->DestroyBuffers)(pDraw, pPriv->buffers, pPriv->bufferCount);
|
|
|
|
pPriv->buffers = buffers;
|
|
|
|
pPriv->bufferCount = count;
|
|
|
|
pPriv->width = pDraw->width;
|
|
|
|
pPriv->height = pDraw->height;
|
2008-02-04 17:58:24 +01:00
|
|
|
}
|
|
|
|
|
2009-04-09 00:44:34 +02:00
|
|
|
if (temp != temp_buf) {
|
|
|
|
xfree(temp);
|
|
|
|
}
|
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
*width = pPriv->width;
|
|
|
|
*height = pPriv->height;
|
|
|
|
*out_count = pPriv->bufferCount;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
2009-04-09 23:38:24 +02:00
|
|
|
|
|
|
|
/* If the client is getting a fake front-buffer, pre-fill it with the
|
|
|
|
* contents of the real front-buffer. This ensures correct operation of
|
|
|
|
* applications that call glXWaitX before calling glDrawBuffer.
|
|
|
|
*/
|
|
|
|
if (have_fake_front) {
|
|
|
|
BoxRec box;
|
|
|
|
RegionRec region;
|
|
|
|
|
|
|
|
box.x1 = 0;
|
|
|
|
box.y1 = 0;
|
|
|
|
box.x2 = pPriv->width;
|
|
|
|
box.y2 = pPriv->height;
|
|
|
|
REGION_INIT(pDraw->pScreen, ®ion, &box, 0);
|
|
|
|
|
|
|
|
DRI2CopyRegion(pDraw, ®ion, DRI2BufferFakeFrontLeft,
|
|
|
|
DRI2BufferFrontLeft);
|
|
|
|
}
|
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
return pPriv->buffers;
|
2008-02-04 17:58:24 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2008-10-07 19:49:28 +02:00
|
|
|
DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
|
|
|
|
unsigned int dest, unsigned int src)
|
2008-02-04 17:58:24 +01:00
|
|
|
{
|
2008-08-11 22:59:17 +02:00
|
|
|
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
|
|
|
|
DRI2DrawablePtr pPriv;
|
2008-10-07 19:49:28 +02:00
|
|
|
DRI2BufferPtr pDestBuffer, pSrcBuffer;
|
2008-08-11 22:59:17 +02:00
|
|
|
int i;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
pPriv = DRI2GetDrawable(pDraw);
|
|
|
|
if (pPriv == NULL)
|
2008-10-07 19:49:28 +02:00
|
|
|
return BadDrawable;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
2008-10-07 19:49:28 +02:00
|
|
|
pDestBuffer = NULL;
|
2008-08-11 22:59:17 +02:00
|
|
|
pSrcBuffer = NULL;
|
|
|
|
for (i = 0; i < pPriv->bufferCount; i++)
|
|
|
|
{
|
2008-10-07 19:49:28 +02:00
|
|
|
if (pPriv->buffers[i].attachment == dest)
|
|
|
|
pDestBuffer = &pPriv->buffers[i];
|
|
|
|
if (pPriv->buffers[i].attachment == src)
|
2008-08-11 22:59:17 +02:00
|
|
|
pSrcBuffer = &pPriv->buffers[i];
|
2008-02-04 17:58:24 +01:00
|
|
|
}
|
2008-10-07 19:49:28 +02:00
|
|
|
if (pSrcBuffer == NULL || pDestBuffer == NULL)
|
|
|
|
return BadValue;
|
2008-08-11 22:59:17 +02:00
|
|
|
|
2008-10-07 19:49:28 +02:00
|
|
|
(*ds->CopyRegion)(pDraw, pRegion, pDestBuffer, pSrcBuffer);
|
|
|
|
|
|
|
|
return Success;
|
2008-02-04 17:58:24 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2008-03-27 00:28:09 +01:00
|
|
|
DRI2DestroyDrawable(DrawablePtr pDraw)
|
2008-02-04 17:58:24 +01:00
|
|
|
{
|
2008-08-11 22:59:17 +02:00
|
|
|
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
|
|
|
|
DRI2DrawablePtr pPriv;
|
|
|
|
WindowPtr pWin;
|
|
|
|
PixmapPtr pPixmap;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
pPriv = DRI2GetDrawable(pDraw);
|
2008-02-04 17:58:24 +01:00
|
|
|
if (pPriv == NULL)
|
|
|
|
return;
|
|
|
|
|
2008-03-27 00:28:09 +01:00
|
|
|
pPriv->refCount--;
|
2008-08-11 22:59:17 +02:00
|
|
|
if (pPriv->refCount > 0)
|
|
|
|
return;
|
2008-03-27 00:28:09 +01:00
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
(*ds->DestroyBuffers)(pDraw, pPriv->buffers, pPriv->bufferCount);
|
|
|
|
xfree(pPriv);
|
2008-03-27 00:28:09 +01:00
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
if (pDraw->type == DRAWABLE_WINDOW)
|
|
|
|
{
|
|
|
|
pWin = (WindowPtr) pDraw;
|
|
|
|
dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pPixmap = (PixmapPtr) pDraw;
|
|
|
|
dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
|
|
|
|
}
|
2008-02-04 17:58:24 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2008-10-07 19:49:28 +02:00
|
|
|
DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd,
|
|
|
|
const char **driverName, const char **deviceName)
|
2008-02-04 17:58:24 +01:00
|
|
|
{
|
|
|
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
|
|
|
|
|
|
|
if (ds == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
2008-10-07 19:49:28 +02:00
|
|
|
if (driverType != DRI2DriverDRI)
|
|
|
|
return BadValue;
|
|
|
|
|
2008-02-04 17:58:24 +01:00
|
|
|
*fd = ds->fd;
|
|
|
|
*driverName = ds->driverName;
|
2008-10-07 19:49:28 +02:00
|
|
|
*deviceName = ds->deviceName;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2008-10-07 19:49:28 +02:00
|
|
|
DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic)
|
2008-03-11 05:35:31 +01:00
|
|
|
{
|
|
|
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
|
|
|
|
|
|
|
if (ds == NULL || drmAuthMagic(ds->fd, magic))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2008-02-04 17:58:24 +01:00
|
|
|
DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
|
|
|
{
|
|
|
|
DRI2ScreenPtr ds;
|
|
|
|
|
|
|
|
ds = xalloc(sizeof *ds);
|
|
|
|
if (!ds)
|
2008-08-11 22:59:17 +02:00
|
|
|
return FALSE;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
ds->fd = info->fd;
|
|
|
|
ds->driverName = info->driverName;
|
2008-10-07 19:49:28 +02:00
|
|
|
ds->deviceName = info->deviceName;
|
2008-08-11 22:59:17 +02:00
|
|
|
ds->CreateBuffers = info->CreateBuffers;
|
|
|
|
ds->DestroyBuffers = info->DestroyBuffers;
|
2008-10-07 19:49:28 +02:00
|
|
|
ds->CopyRegion = info->CopyRegion;
|
2008-02-04 17:58:24 +01:00
|
|
|
|
|
|
|
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds);
|
|
|
|
|
|
|
|
xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n");
|
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2008-08-11 22:59:17 +02:00
|
|
|
DRI2CloseScreen(ScreenPtr pScreen)
|
|
|
|
{
|
|
|
|
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
|
|
|
|
|
|
|
xfree(ds);
|
|
|
|
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
|
2008-02-04 17:58:24 +01:00
|
|
|
}
|
|
|
|
|
2008-03-27 00:28:09 +01:00
|
|
|
extern ExtensionModule dri2ExtensionModule;
|
|
|
|
|
2008-02-04 17:58:24 +01:00
|
|
|
static pointer
|
|
|
|
DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
|
|
|
|
{
|
2008-03-27 00:28:09 +01:00
|
|
|
static Bool setupDone = FALSE;
|
|
|
|
|
2008-08-11 22:59:17 +02:00
|
|
|
if (!setupDone)
|
|
|
|
{
|
2008-03-27 00:28:09 +01:00
|
|
|
setupDone = TRUE;
|
|
|
|
LoadExtension(&dri2ExtensionModule, FALSE);
|
2008-08-11 22:59:17 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-27 00:28:09 +01:00
|
|
|
if (errmaj)
|
|
|
|
*errmaj = LDR_ONCEONLY;
|
|
|
|
}
|
|
|
|
|
2008-02-04 17:58:24 +01:00
|
|
|
return (pointer) 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static XF86ModuleVersionInfo DRI2VersRec =
|
|
|
|
{
|
|
|
|
"dri2",
|
|
|
|
MODULEVENDORSTRING,
|
|
|
|
MODINFOSTRING1,
|
|
|
|
MODINFOSTRING2,
|
|
|
|
XORG_VERSION_CURRENT,
|
|
|
|
1, 0, 0,
|
|
|
|
ABI_CLASS_EXTENSION,
|
|
|
|
ABI_EXTENSION_VERSION,
|
|
|
|
MOD_CLASS_NONE,
|
|
|
|
{ 0, 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
_X_EXPORT XF86ModuleData dri2ModuleData = { &DRI2VersRec, DRI2Setup, NULL };
|
|
|
|
|
2009-04-24 21:09:21 +02:00
|
|
|
void
|
|
|
|
DRI2Version(int *major, int *minor)
|
|
|
|
{
|
|
|
|
if (major != NULL)
|
|
|
|
*major = DRI2VersRec.majorversion;
|
|
|
|
|
|
|
|
if (minor != NULL)
|
|
|
|
*minor = DRI2VersRec.minorversion;
|
|
|
|
}
|