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>
This commit is contained in:
Chris Wilson 2014-06-11 15:29:59 +01:00
parent 5705e66a32
commit c9003c6d96
1 changed files with 16 additions and 11 deletions

View File

@ -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) {