Package: xserver-xorg-video-nouveau Version: 1:1.0.7-1 Severity: normal Tags: patch
--- Please enter the report below this line. --- Dear Maintainer, After upgrading to the 1.0.7 nouveau package, my configuration stopped working. Downgrading back to 1.0.1 fixed the problem. I discussed the issue with some of the nouveau devs on irc. They suggesting doing a git bisect. After that, Dave Airlie made a patch, which I tested. He has since added that fix in recent commits. I have tested that and submit here a patch that would bring the 1.0.7 release up to nouveau.git and fixes the problem for me. Thank You, John Vogel --- System information. --- Architecture: amd64 Kernel: Linux 3.8.12 Debian Release: jessie/sid 900 unstable debian.cs.binghamton.edu 800 testing security.debian.org 800 testing debian.cs.binghamton.edu 500 experimental mozilla.debian.net 500 experimental debian.cs.binghamton.edu --- Package information. --- Depends (Version) | Installed =======================================-+-================== libc6 (>= 2.15) | 2.17-2 libdrm-nouveau2 (>= 2.4.34) | 2.4.40-1 libudev0 (>= 146) | 175-7.2 xorg-video-abi-12 | xserver-xorg-core (>= 2:1.12.3.901) | 2:1.12.4-6 Recommends (Version) | Installed ===============================-+-============ libgl1-mesa-dri (>= 7.11.1) | 8.0.5-4+b1 Package's Suggests field is empty. -8<---8<---8<---8<---8<---8<---8<---8<---8<-- Please attach the file: /tmp/reportbug-ng-xserver-xorg-video-nouveau-idV6Hs.txt to the mail. I'd do it myself if the output wasn't too long to handle. Thank you! ->8--->8--->8--->8--->8--->8--->8--->8--->8--
diff --git a/src/nouveau_xv.c b/src/nouveau_xv.c index f7dc2bc..8eafcf0 100644 --- a/src/nouveau_xv.c +++ b/src/nouveau_xv.c @@ -1095,7 +1095,7 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, NVCopyNV12ColorPlanes(buf + s2offset, buf + s3offset, dst, line_len, srcPitch2, - nlines, line_len); + nlines, npixels); } } else { for (i = 0; i < nlines; i++) { @@ -1161,7 +1161,7 @@ CPU_copy: NVCopyNV12ColorPlanes(buf + s2offset, buf + s3offset, map, dstPitch, srcPitch2, - nlines, line_len); + nlines, npixels); } } else { /* YUY2 and RGB */ diff --git a/src/nv_accel_common.c b/src/nv_accel_common.c index b06fe0c..18e6a2f 100644 --- a/src/nv_accel_common.c +++ b/src/nv_accel_common.c @@ -649,8 +649,10 @@ NVAccelCommonInit(ScrnInfoPtr pScrn) else if (pNv->Architecture < NV_ARCH_E0) INIT_CONTEXT_OBJECT(M2MF_NVC0); - else + else { INIT_CONTEXT_OBJECT(P2MF_NVE0); + INIT_CONTEXT_OBJECT(COPY_NVE0); + } /* 3D init */ switch (pNv->Architecture) { @@ -702,6 +704,7 @@ void NVAccelFree(ScrnInfoPtr pScrn) nouveau_object_del(&pNv->NvMemFormat); nouveau_object_del(&pNv->NvSW); nouveau_object_del(&pNv->Nv3D); + nouveau_object_del(&pNv->NvCOPY); nouveau_bo_ref(NULL, &pNv->scratch); } diff --git a/src/nv_driver.c b/src/nv_driver.c index 2b74fc6..8a112db 100644 --- a/src/nv_driver.c +++ b/src/nv_driver.c @@ -60,7 +60,7 @@ static Bool NVUnmapMem(ScrnInfoPtr pScrn); #define NOUVEAU_PCI_DEVICE(_vendor_id, _device_id) \ { (_vendor_id), (_device_id), PCI_MATCH_ANY, PCI_MATCH_ANY, \ - 0x00030000, 0x00ffffff, 0 } + 0x00030000, 0x00ff0000, 0 } static const struct pci_id_match nouveau_device_match[] = { NOUVEAU_PCI_DEVICE(0x12d2, PCI_MATCH_ANY), @@ -80,6 +80,13 @@ static Bool NVPlatformProbe(DriverPtr driver, intptr_t dev_match_data); #endif +_X_EXPORT int NVEntityIndex = -1; + +static int getNVEntityIndex(void) +{ + return NVEntityIndex; +} + /* * This contains the functions needed by the server after loading the * driver module. It must be supplied, and gets added the driver list by @@ -228,6 +235,8 @@ NVDriverFunc(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data) static void NVInitScrn(ScrnInfoPtr pScrn, int entity_num) { + DevUnion *pPriv; + pScrn->driverVersion = NV_VERSION; pScrn->driverName = NV_DRIVER_NAME; pScrn->name = NV_NAME; @@ -242,6 +251,15 @@ NVInitScrn(ScrnInfoPtr pScrn, int entity_num) pScrn->FreeScreen = NVFreeScreen; xf86SetEntitySharable(entity_num); + if (NVEntityIndex == -1) + NVEntityIndex = xf86AllocateEntityPrivateIndex(); + + pPriv = xf86GetEntityPrivate(entity_num, + NVEntityIndex); + if (!pPriv->ptr) { + pPriv->ptr = xnfcalloc(sizeof(NVEntRec), 1); + } + xf86SetEntityInstanceForScreen(pScrn, entity_num, xf86GetNumEntityInstances(entity_num) - 1); } @@ -303,6 +321,7 @@ NVHasKMS(struct pci_device *pci_dev) case 0xc0: case 0xd0: case 0xe0: + case 0xf0: break; default: xf86DrvMsg(-1, X_ERROR, "Unknown chipset: NV%02x\n", chipset); @@ -682,15 +701,37 @@ nouveau_setup_capabilities(ScrnInfoPtr pScrn) #endif } +NVEntPtr NVEntPriv(ScrnInfoPtr pScrn) +{ + DevUnion *pPriv; + NVPtr pNv = NVPTR(pScrn); + pPriv = xf86GetEntityPrivate(pNv->pEnt->index, + getNVEntityIndex()); + return pPriv->ptr; +} + static Bool NVOpenDRMMaster(ScrnInfoPtr pScrn) { NVPtr pNv = NVPTR(pScrn); + NVEntPtr pNVEnt = NVEntPriv(pScrn); struct pci_device *dev = pNv->PciInfo; char *busid; drmSetVersion sv; int err; int ret; + if (pNVEnt->fd) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + " reusing fd for second head\n"); + ret = nouveau_device_wrap(pNVEnt->fd, 0, &pNv->dev); + if (ret) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[drm] error creating device\n"); + return FALSE; + } + return TRUE; + } + #if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,9,99,901,0) XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus, dev->dev, dev->func); @@ -720,6 +761,7 @@ static Bool NVOpenDRMMaster(ScrnInfoPtr pScrn) nouveau_device_del(&pNv->dev); return FALSE; } + pNVEnt->fd = pNv->dev->fd; return TRUE; } @@ -854,6 +896,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) pNv->Architecture = NV_ARCH_C0; break; case 0xe0: + case 0xf0: pNv->Architecture = NV_ARCH_E0; break; default: diff --git a/src/nv_proto.h b/src/nv_proto.h index bcf927d..a573269 100644 --- a/src/nv_proto.h +++ b/src/nv_proto.h @@ -153,6 +153,7 @@ void NVC0SyncToVBlank(PixmapPtr ppix, BoxPtr box); Bool NVAccelInitM2MF_NVC0(ScrnInfoPtr pScrn); Bool NVAccelInitCopy_NVC0(ScrnInfoPtr pScrn); Bool NVAccelInitP2MF_NVE0(ScrnInfoPtr pScrn); +Bool NVAccelInitCOPY_NVE0(ScrnInfoPtr pScrn); Bool NVAccelInit2D_NVC0(ScrnInfoPtr pScrn); Bool NVAccelInit3D_NVC0(ScrnInfoPtr pScrn); diff --git a/src/nv_type.h b/src/nv_type.h index ed21c6d..9c403b5 100644 --- a/src/nv_type.h +++ b/src/nv_type.h @@ -31,6 +31,11 @@ /* NV50 */ typedef struct _NVRec *NVPtr; + +typedef struct { + int fd; +} NVEntRec, *NVEntPtr; + typedef struct _NVRec { uint32_t Architecture; EntityInfoPtr pEnt; @@ -103,6 +108,7 @@ typedef struct _NVRec { struct nouveau_object *Nv2D; struct nouveau_object *Nv3D; struct nouveau_object *NvSW; + struct nouveau_object *NvCOPY; struct nouveau_bo *scratch; Bool ce_enabled; diff --git a/src/nvc0_accel.c b/src/nvc0_accel.c index 406bc59..4b3745f 100644 --- a/src/nvc0_accel.c +++ b/src/nvc0_accel.c @@ -121,8 +121,23 @@ NVAccelInitP2MF_NVE0(ScrnInfoPtr pScrn) BEGIN_NVC0(push, NV01_SUBC(P2MF, OBJECT), 1); PUSH_DATA (push, pNv->NvMemFormat->handle); + return TRUE; +} + +Bool +NVAccelInitCOPY_NVE0(ScrnInfoPtr pScrn) +{ + NVPtr pNv = NVPTR(pScrn); + struct nouveau_pushbuf *push = pNv->pushbuf; + int ret; + + ret = nouveau_object_new(pNv->channel, 0x0000a0b5, 0xa0b5, + NULL, 0, &pNv->NvCOPY); + if (ret) + return FALSE; + BEGIN_NVC0(push, NV01_SUBC(COPY, OBJECT), 1); - PUSH_DATA (push, 0x0000a0b5); + PUSH_DATA (push, pNv->NvCOPY->handle); return TRUE; }