diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-11 15:29:59 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-11 15:43:01 +0100 |
commit | c9003c6d9602dba682e577ea7ce39990ea378db3 (patch) | |
tree | 41dd876ff93bf6e5acb2945696722f9e0eadbbe1 | |
parent | 5705e66a329273c478f6ecd8f41b8f5633095581 (diff) |
sna: Fix scanout creation routine for old kernels <= 3.11
With an old kernel, we would fail to actually mark the display as part
of the scanout domain, but proceed to assign it a fb id. This caused our
asserts to report our bookkeeping error.
Reported-by: Pavel Ondračka <pavel.ondracka@email.cz>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79909
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index f29f8fd1..7582e075 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -4373,18 +4373,23 @@ static void __kgem_bo_make_scanout(struct kgem *kgem, arg.depth = scrn->depth; arg.handle = bo->handle; - if (gem_set_caching(kgem->fd, bo->handle, DISPLAY)) { - bo->scanout = true; + /* First move the scanout out of cached memory */ + if (kgem->has_llc) { + if (!gem_set_caching(kgem->fd, bo->handle, DISPLAY) && + !gem_set_caching(kgem->fd, bo->handle, UNCACHED)) + return; + } - /* Pre-emptively move the object into the mappable - * portion to avoid rebinding later when busy. - */ - if (bo->map__gtt == NULL) - bo->map__gtt = __kgem_bo_map__gtt(kgem, bo); - if (bo->map__gtt) { - *(uint32_t *)bo->map__gtt = 0; - bo->domain = DOMAIN_GTT; - } + bo->scanout = true; + + /* Then pre-emptively move the object into the mappable + * portion to avoid rebinding later when busy. + */ + if (bo->map__gtt == NULL) + bo->map__gtt = __kgem_bo_map__gtt(kgem, bo); + if (bo->map__gtt) { + *(uint32_t *)bo->map__gtt = 0; + bo->domain = DOMAIN_GTT; } if (do_ioctl(kgem->fd, DRM_IOCTL_MODE_ADDFB, &arg) == 0) { |