summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-09-11 17:06:07 -0700
committerKeith Packard <keithp@keithp.com>2008-09-11 17:06:07 -0700
commitb84acf64101d4fd4c40e2f619cc4c5f3bd82fd01 (patch)
treede39ac6ada380127a3dd3b10ce4eaa5a51ed484c
parent40b3d2972dbafefae38759666ed49c66cc797889 (diff)
fix stale dri2 buildtransform-proposal
-rw-r--r--glx/glxdri2.c6
-rw-r--r--hw/xfree86/dri2/dri2.c28
-rw-r--r--hw/xfree86/dri2/dri2.h3
-rw-r--r--hw/xfree86/dri2/dri2ext.c9
-rw-r--r--randr/rrmode.c3
5 files changed, 28 insertions, 21 deletions
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 9a3bc1fdb..441a42313 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -471,7 +471,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
char filename[128];
size_t buffer_size;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- unsigned int sareaHandle;
+ drm_handle_t sareaHandle;
+ unsigned int sareaSize;
const __DRIextension **extensions;
const __DRIconfig **driConfigs;
int i;
@@ -482,7 +483,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
memset(screen, 0, sizeof *screen);
if (!xf86LoaderCheckSymbol("DRI2Connect") ||
- !DRI2Connect(pScreen, &screen->fd, &driverName, &sareaHandle)) {
+ !DRI2Connect(pScreen, &screen->fd, &driverName, &sareaHandle, &sareaSize)) {
LogMessage(X_INFO,
"AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
return NULL;
@@ -530,6 +531,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
(*screen->core->createNewScreen)(pScreen->myNum,
screen->fd,
sareaHandle,
+ sareaSize,
loader_extensions,
&driConfigs,
screen);
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 74aef7196..cf895bc2d 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -57,8 +57,8 @@ typedef struct _DRI2DrawablePriv {
typedef struct _DRI2Screen {
int fd;
- drmBO sareaBO;
void *sarea;
+ drm_handle_t sareaHandle;
unsigned int sareaSize;
const char *driverName;
unsigned int nextHandle;
@@ -257,8 +257,7 @@ DRI2CloseScreen(ScreenPtr pScreen)
pScreen->ClipNotify = ds->ClipNotify;
pScreen->HandleExposures = ds->HandleExposures;
- drmBOUnmap(ds->fd, &ds->sareaBO);
- drmBOUnreference(ds->fd, &ds->sareaBO);
+ drmRmMap(ds->fd, ds->sareaHandle);
xfree(ds);
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
@@ -350,7 +349,8 @@ DRI2ReemitDrawableInfo(DrawablePtr pDraw, unsigned int *head)
Bool
DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
- unsigned int *sareaHandle)
+ drm_handle_t *sareaHandle,
+ drmSize *sareaSize)
{
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
@@ -359,7 +359,8 @@ DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
*fd = ds->fd;
*driverName = ds->driverName;
- *sareaHandle = ds->sareaBO.handle;
+ *sareaHandle = ds->sareaHandle;
+ *sareaSize = ds->sareaSize;
return TRUE;
}
@@ -387,7 +388,7 @@ static void *
DRI2SetupSAREA(ScreenPtr pScreen, size_t driverSareaSize)
{
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
- unsigned long mask;
+
const size_t event_buffer_size = 32 * 1024;
ds->sareaSize =
@@ -395,21 +396,18 @@ DRI2SetupSAREA(ScreenPtr pScreen, size_t driverSareaSize)
driverSareaSize +
sizeof (unsigned int);
- mask = DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE |
- DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_SHAREABLE;
-
- if (drmBOCreate(ds->fd, ds->sareaSize, 1, NULL, mask, 0, &ds->sareaBO))
+ if (drmAddMap(ds->fd, 1, ds->sareaSize, DRM_SHM,
+ DRM_CONTAINS_LOCK, &ds->sareaHandle) != 0)
return NULL;
- if (drmBOMap(ds->fd, &ds->sareaBO,
- DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0, &ds->sarea)) {
- drmBOUnreference(ds->fd, &ds->sareaBO);
+ if (drmMap(ds->fd, ds->sareaHandle, ds->sareaSize, &ds->sarea)) {
+ drmRmMap (ds->fd, ds->sareaHandle);
return NULL;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
- "[DRI2] Allocated %d byte SAREA, BO handle 0x%08x\n",
- ds->sareaSize, ds->sareaBO.handle);
+ "[DRI2] Allocated %d byte SAREA, handle 0x%08x\n",
+ ds->sareaSize, ds->sareaHandle);
memset(ds->sarea, 0, ds->sareaSize);
ds->buffer = ds->sarea;
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index 85b3da41c..f49d7466c 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -56,7 +56,8 @@ void DRI2CloseScreen(ScreenPtr pScreen);
Bool DRI2Connect(ScreenPtr pScreen,
int *fd,
const char **driverName,
- unsigned int *sareaHandle);
+ drm_handle_t *sareaHandle,
+ drmSize *sareaSize);
Bool DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic);
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 4ae0fda3a..d3c4a6aa7 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -115,7 +115,8 @@ ProcDRI2Connect(ClientPtr client)
int fd;
const char *driverName;
char *busId = NULL;
- unsigned int sareaHandle;
+ drm_handle_t sareaHandle;
+ unsigned int sareaSize;
REQUEST_SIZE_MATCH(xDRI2ConnectReq);
if (!validScreen(client, stuff->screen, &pScreen))
@@ -127,8 +128,9 @@ ProcDRI2Connect(ClientPtr client)
rep.driverNameLength = 0;
rep.busIdLength = 0;
rep.sareaHandle = 0;
+ rep.sareaSize = 0;
- if (!DRI2Connect(pScreen, &fd, &driverName, &sareaHandle))
+ if (!DRI2Connect(pScreen, &fd, &driverName, &sareaHandle, &sareaSize))
goto fail;
busId = drmGetBusid(fd);
@@ -137,7 +139,8 @@ ProcDRI2Connect(ClientPtr client)
rep.driverNameLength = strlen(driverName);
rep.busIdLength = strlen(busId);
- rep.sareaHandle = sareaHandle;
+ rep.sareaHandle = (CARD32) sareaHandle;
+ rep.sareaSize = (CARD32) sareaSize;
rep.length = (rep.driverNameLength + 3) / 4 + (rep.busIdLength + 3) / 4;
fail:
diff --git a/randr/rrmode.c b/randr/rrmode.c
index d5072084a..712103628 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -320,6 +320,9 @@ ProcRRCreateMode (ClientPtr client)
swapl(&rep.mode, n);
}
WriteToClient(client, sizeof(xRRCreateModeReply), (char *)&rep);
+
+ /* Drop our reference to this mode */
+ RRModeDestroy (mode);
return client->noClientException;
}