diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-06-15 15:29:00 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-07-27 09:55:27 -0700 |
commit | 50cb6c7e4419e067c1f080d1de940811d21fc725 (patch) | |
tree | 7ad76dd3976c1b7cd7cf26f4419bf110111d3060 /hw | |
parent | cec793ef7a6dac9fa2a6538683e363a72672cde9 (diff) |
Don't map the front buffer in libdri if the ddx driver doesn't set the size.
This lets drivers map the front buffer themselves
by setting dontMapFramebuffer.
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/dri/dri.c | 70 | ||||
-rw-r--r-- | hw/xfree86/dri/dri.h | 8 | ||||
-rw-r--r-- | hw/xfree86/dri/dristruct.h | 1 |
3 files changed, 47 insertions, 32 deletions
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index 6c640d806..80e07c583 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -311,6 +311,8 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) Bool xineramaInCore = FALSE; DRIEntPrivPtr pDRIEntPriv; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + DRIContextFlags flags = 0; + DRIContextPrivPtr pDRIContextPriv; /* If the DRI extension is disabled, do not initialize the DRI */ if (noXFree86DRIExtension) { @@ -416,23 +418,29 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIPriv->hLSAREA = pDRIEntPriv->hLSAREA; pDRIPriv->pLSAREA = pDRIEntPriv->pLSAREA; - if (drmAddMap( pDRIPriv->drmFD, - (drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, - pDRIPriv->pDriverInfo->frameBufferSize, - DRM_FRAME_BUFFER, - 0, - &pDRIPriv->hFrameBuffer) < 0) + if (!pDRIPriv->pDriverInfo->dontMapFrameBuffer) { - pDRIPriv->directRenderingSupport = FALSE; - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize); - drmClose(pDRIPriv->drmFD); - DRIDrvMsg(pScreen->myNum, X_INFO, - "[drm] drmAddMap failed\n"); - return FALSE; + if (drmAddMap( pDRIPriv->drmFD, + (drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, + pDRIPriv->pDriverInfo->frameBufferSize, + DRM_FRAME_BUFFER, + 0, + &pDRIPriv->pDriverInfo->hFrameBuffer) < 0) + { + pDRIPriv->directRenderingSupport = FALSE; + pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; + drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize); + drmClose(pDRIPriv->drmFD); + DRIDrvMsg(pScreen->myNum, X_INFO, + "[drm] drmAddMap failed\n"); + return FALSE; + } + DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n", + pDRIPriv->pDriverInfo->hFrameBuffer); + } else { + DRIDrvMsg(pScreen->myNum, X_INFO, + "[drm] framebuffer mapped by ddx driver\n"); } - DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n", - pDRIPriv->hFrameBuffer); if (pDRIEntPriv->resOwner == NULL) { pDRIEntPriv->resOwner = pScreen; @@ -479,21 +487,14 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIEntPriv->refCount++; - return TRUE; -} - -Bool -DRIFinishScreenInit(ScreenPtr pScreen) -{ - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - DRIContextFlags flags = 0; - DRIContextPrivPtr pDRIContextPriv; - - /* Set up flags for DRICreateContextPriv */ + /* Set up flags for DRICreateContextPriv */ switch (pDRIInfo->driverSwapMethod) { - case DRI_KERNEL_SWAP: flags = DRI_CONTEXT_2DONLY; break; - case DRI_HIDE_X_CONTEXT: flags = DRI_CONTEXT_PRESERVED; break; + case DRI_KERNEL_SWAP: + flags = DRI_CONTEXT_2DONLY; + break; + case DRI_HIDE_X_CONTEXT: + flags = DRI_CONTEXT_PRESERVED; + break; } if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, @@ -580,6 +581,15 @@ DRIFinishScreenInit(ScreenPtr pScreen) break; } + return TRUE; +} + +Bool +DRIFinishScreenInit(ScreenPtr pScreen) +{ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; + /* Wrap DRI support */ if (pDRIInfo->wrap.ValidateTree) { pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree; @@ -1592,7 +1602,7 @@ DRIGetDeviceInfo(ScreenPtr pScreen, { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - *hFrameBuffer = pDRIPriv->hFrameBuffer; + *hFrameBuffer = pDRIPriv->pDriverInfo->hFrameBuffer; *fbOrigin = 0; *fbSize = pDRIPriv->pDriverInfo->frameBufferSize; *fbStride = pDRIPriv->pDriverInfo->frameBufferStride; diff --git a/hw/xfree86/dri/dri.h b/hw/xfree86/dri/dri.h index c0da7001e..98e8b75be 100644 --- a/hw/xfree86/dri/dri.h +++ b/hw/xfree86/dri/dri.h @@ -107,7 +107,7 @@ typedef struct { */ #define DRIINFO_MAJOR_VERSION 5 -#define DRIINFO_MINOR_VERSION 3 +#define DRIINFO_MINOR_VERSION 4 #define DRIINFO_PATCH_VERSION 0 typedef unsigned long long (*DRITexOffsetStartProcPtr)(PixmapPtr pPix); @@ -187,6 +187,12 @@ typedef struct { /* New with DRI version 5.3.0 */ DRITexOffsetStartProcPtr texOffsetStart; DRITexOffsetFinishProcPtr texOffsetFinish; + + /* New with DRI version 5.4.0 */ + int dontMapFrameBuffer; + drm_handle_t hFrameBuffer; /* Handle to framebuffer, either + * mapped by DDX driver or DRI */ + } DRIInfoRec, *DRIInfoPtr; diff --git a/hw/xfree86/dri/dristruct.h b/hw/xfree86/dri/dristruct.h index 5d981b820..c3b0aeede 100644 --- a/hw/xfree86/dri/dristruct.h +++ b/hw/xfree86/dri/dristruct.h @@ -85,7 +85,6 @@ typedef struct _DRIScreenPrivRec int drmFD; /* File descriptor for /dev/video/? */ drm_handle_t hSAREA; /* Handle to SAREA, for mapping */ XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */ - drm_handle_t hFrameBuffer; /* Handle to framebuffer, for mapping */ drm_context_t myContext; /* DDX Driver's context */ DRIContextPrivPtr myContextPriv;/* Pointer to server's private area */ DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */ |