nouveau: bring back legacy mmap handler
Subsystems (3)
Dave Airlie
maintainerPATCH 1/1 nouveau: bring back legacy mmap handler
From: Dave Airlie <[email protected]>
nouveau userspace back at 1.0.1 used to call the X server DRIOpenDRMMaster interface even for DRI2 (doh!), this attempts to map the sarea and fails if it can't.
Since 884c6dabb0eafe7227f099c9e78e514191efaf13 from Daniel, this fails, but only ancient drivers would see it.
Revert the nouveau bits of that fix, and hope it works.
--- drivers/gpu/drm/nouveau/nouveau_ttm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_ttm.c +2 -1
@@ -28,6 +28,7 @@#include "nouveau_ttm.h" #include "nouveau_gem.h" +#include "drm_legacy.h" static int nouveau_vram_manager_init (struct ttm_mem_type_manager *man,unsigned long psize) {
@@ -281,7 +282,7 @@ nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma)struct nouveau_drm *drm =nouveau_drm (file_priv->minor->dev);if (unlikely (vma->vm_pgoff <DRM_FILE_PAGE_OFFSET )) -return -EINVAL ; +return drm_legacy_mmap (filp, vma);return ttm_bo_mmap (filp, vma, &drm->ttm.bdev); }
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Dave Airlie
From: Dave Airlie <[email protected]>
nouveau userspace back at 1.0.1 used to call the X server DRIOpenDRMMaster interface even for DRI2 (doh!), this attempts to map the sarea and fails if it can't.
Quoted 6 lines
Since
884c6dabb0eafe7227f099c9e78e514191efaf13from Daniel, this fails, but only ancient drivers would see it.Revert the nouveau bits of that fix, and hope it works.
Signed-off-by Dave Airlie <[email protected]>
Argh, sorry for missing that in my git history digging.
Now curious question: Would return 0 also work? As long as userspace only cares about the errno of the ioctl call and doesn't actually look at the sarea itself we could keep the cake and eat it, too. I've used a similar trick in legacy context code, again because old nouveau had copypasta from dri1, but only cared about the errno and not whether the contexts actually did anything useful.
I'd really prefer the return 0; patch if possible.
Cheers, Daniel
Quoted 32 lines
--- drivers/gpu/drm/nouveau/nouveau_ttm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/nouveau/nouveau_ttm.c +2
-1@@ -28,6 +28,7 @@#include "nouveau_ttm.h" #include "nouveau_gem.h" +#include "drm_legacy.h" static int nouveau_vram_manager_init (struct ttm_mem_type_manager *man,unsigned long psize) {@@ -281,7 +282,7 @@ nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma)struct nouveau_drm *drm =nouveau_drm (file_priv->minor->dev);if (unlikely (vma->vm_pgoff <DRM_FILE_PAGE_OFFSET )) -return -EINVAL ; +return drm_legacy_mmap (filp, vma);return ttm_bo_mmap (filp, vma, &drm->ttm.bdev); }Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerQuoted 16 lines · Daniel Vetter
Quoted 6 lines · Dave Airlie
From: Dave Airlie <[email protected]>
nouveau userspace back at 1.0.1 used to call the X server DRIOpenDRMMaster interface even for DRI2 (doh!), this attempts to map the sarea and fails if it can't.
Quoted 6 lines
Since
884c6dabb0eafe7227f099c9e78e514191efaf13from Daniel, this fails, but only ancient drivers would see it.Revert the nouveau bits of that fix, and hope it works.
Signed-off-by Dave Airlie <[email protected]>Argh, sorry for missing that in my git history digging.
Quoted 8 lines
Acked-by Daniel Vetter <[email protected]>Now curious question: Would return 0 also work? As long as userspace only cares about the errno of the ioctl call and doesn't actually look at the sarea itself we could keep the cake and eat it, too. I've used a similar trick in legacy context code, again because old nouveau had copypasta from dri1, but only cared about the errno and not whether the contexts actually did anything useful.
if (drmMap(tmp.drmFD, tmp.hLSAREA, sAreaSize,
(drmAddressPtr) (&tmp.pLSAREA)) < 0) {
DRIDrvMsg(-1, X_INFO, "[drm] Mapping SAREA for DRM lock failed.\n");
tmp.pLSAREA = NULL;
goto out_err;
}
memset(tmp.pLSAREA, 0, sAreaSize);seems unlikely return 0 will work!
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel