Adapt to DRM Lockfree and setStatus changes.

This commit is contained in:
Thomas Hellstrom 2007-10-24 19:34:12 +02:00
parent 78aaec0ffc
commit d2c78f82c2
2 changed files with 35 additions and 7 deletions

View File

@ -3004,8 +3004,8 @@ I830LeaveVT(int scrnIndex, int flags)
*/
#ifdef XF86DRI_MM
if (pI830->directRenderingOpen) {
if (pI830->memory_manager != NULL) {
drmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT);
if (pI830->memory_manager != NULL && pScrn->vtSema) {
drmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT, 1, 0);
}
}
#endif /* XF86DRI_MM */
@ -3043,8 +3043,8 @@ I830EnterVT(int scrnIndex, int flags)
/* Unlock the memory manager first of all so that we can pin our
* buffer objects
*/
if (pI830->memory_manager != NULL) {
drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT);
if (pI830->memory_manager != NULL && pScrn->vtSema) {
drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT, 1);
}
}
#endif /* XF86DRI_MM */
@ -3157,6 +3157,14 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
if (pScrn->vtSema == TRUE) {
I830LeaveVT(scrnIndex, 0);
#ifdef XF86DRI_MM
if (pI830->directRenderingEnabled) {
if (pI830->memory_manager != NULL) {
drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT, 1);
}
}
#endif /* XF86DRI_MM */
}
if (pI830->devicesTimer)

View File

@ -165,7 +165,17 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
I830Ptr pI830 = I830PTR(pScrn);
int ret;
ret = drmBOSetPin(pI830->drmSubFD, &mem->bo, 1);
ret = drmBOSetStatus(pI830->drmSubFD, &mem->bo,
DRM_BO_FLAG_MEM_VRAM |
DRM_BO_FLAG_MEM_TT |
DRM_BO_FLAG_READ |
DRM_BO_FLAG_WRITE |
DRM_BO_FLAG_NO_EVICT,
DRM_BO_MASK_MEM |
DRM_BO_FLAG_READ |
DRM_BO_FLAG_WRITE |
DRM_BO_FLAG_NO_EVICT,
0, 0, 0);
if (ret != 0)
return FALSE;
@ -226,7 +236,10 @@ i830_unbind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
I830Ptr pI830 = I830PTR(pScrn);
int ret;
ret = drmBOSetPin(pI830->drmSubFD, &mem->bo, 0);
ret = drmBOSetStatus(pI830->drmSubFD, &mem->bo,
0, DRM_BO_FLAG_NO_EVICT,
0, 0, 0);
if (ret == 0) {
mem->bound = FALSE;
/* Give buffer obviously wrong offset/end until it's re-pinned. */
@ -739,8 +752,15 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
return NULL;
}
/*
* Create buffers in local memory to avoid having the creation order
* determine the TT offset. Driver acceleration
* cannot handle changed front buffer TT offsets yet ,
* so let's keep our fingers crossed.
*/
mask = DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE |
DRM_BO_FLAG_MEM_TT;
DRM_BO_FLAG_MEM_LOCAL;
if (flags & ALLOW_SHARING)
mask |= DRM_BO_FLAG_SHAREABLE;