Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm For gem and ttm objects backe...



details:   https://anonhg.NetBSD.org/src/rev/e652f6fb1896
branches:  trunk
changeset: 331640:e652f6fb1896
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 18 01:21:03 2014 +0000

description:
For gem and ttm objects backed by uvm_aobjs, share the vmobjlock.

XXX pullup to 7

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_gem.c    |   7 +++++++
 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c |  16 ++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diffs (57 lines):

diff -r 71ff18f6d952 -r e652f6fb1896 sys/external/bsd/drm2/dist/drm/drm_gem.c
--- a/sys/external/bsd/drm2/dist/drm/drm_gem.c  Mon Aug 18 01:17:34 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_gem.c  Mon Aug 18 01:21:03 2014 +0000
@@ -155,6 +155,13 @@
 
 #ifdef __NetBSD__
        obj->gemo_shm_uao = uao_create(size, 0);
+       /*
+        * XXX This is gross.  We ought to do it the other way around:
+        * set the uao to have the main uvm object's lock.  However,
+        * uvm_obj_setlock is not safe on uvm_aobjs.
+        */
+       mutex_obj_hold(obj->gemo_shm_uao->vmobjlock);
+       uvm_obj_setlock(&obj->gemo_uvmobj, obj->gemo_shm_uao->vmobjlock);
 #else
        filp = shmem_file_setup("drm mm object", size, VM_NORESERVE);
        if (IS_ERR(filp))
diff -r 71ff18f6d952 -r e652f6fb1896 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c       Mon Aug 18 01:17:34 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c       Mon Aug 18 01:21:03 2014 +0000
@@ -33,6 +33,7 @@
 #ifdef __NetBSD__
 #include <sys/types.h>
 #include <uvm/uvm_extern.h>
+#include <uvm/uvm_object.h>
 #endif
 
 #include <drm/ttm/ttm_module.h>
@@ -269,6 +270,16 @@
                                                      page_flags, glob->dummy_read_page);
                if (unlikely(bo->ttm == NULL))
                        ret = -ENOMEM;
+#ifdef __NetBSD__
+               /*
+                * XXX This is gross.  We ought to do it the other way
+                * around: set the uao to have the main uvm object's
+                * lock.  However, uvm_obj_setlock is not safe on
+                * uvm_aobjs.
+                */
+               mutex_obj_hold(bo->ttm->swap_storage->vmobjlock);
+               uvm_obj_setlock(&bo->uvmobj, bo->ttm->swap_storage->vmobjlock);
+#endif
                break;
        case ttm_bo_type_sg:
                bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << PAGE_SHIFT,
@@ -279,6 +290,11 @@
                        break;
                }
                bo->ttm->sg = bo->sg;
+#ifdef __NetBSD__
+               /* XXX This is gross too -- see above.  */
+               mutex_obj_hold(bo->ttm->swap_storage->vmobjlock);
+               uvm_obj_setlock(&bo->uvmobj, bo->ttm->swap_storage->vmobjlock);
+#endif
                break;
        default:
                pr_err("Illegal buffer object type\n");



Home | Main Index | Thread Index | Old Index