diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c index be33480a..3611270c 100644 --- a/src/sna/sna_dri2.c +++ b/src/sna/sna_dri2.c @@ -400,6 +400,9 @@ static uint32_t color_tiling(struct sna *sna, DrawablePtr draw) { uint32_t tiling; + if (!sna->kgem.can_fence) + return I915_TILING_NONE; + if (COLOR_PREFER_TILING_Y && (draw->width != sna->front->drawable.width || draw->height != sna->front->drawable.height)) @@ -427,7 +430,6 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna, PixmapPtr pixmap) { struct sna_pixmap *priv; - int tiling; DBG(("%s: attaching DRI client to pixmap=%ld\n", __FUNCTION__, pixmap->drawable.serialNumber)); @@ -451,11 +453,18 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna, assert(priv->gpu_bo->proxy == NULL); assert(priv->gpu_bo->flush == false); - tiling = color_tiling(sna, &pixmap->drawable); - if (tiling < 0) - tiling = -tiling; - if (priv->gpu_bo->tiling < tiling && !priv->gpu_bo->scanout) - sna_pixmap_change_tiling(pixmap, tiling); + if (!sna->kgem.can_fence) { + if (!sna_pixmap_change_tiling(pixmap, I915_TILING_NONE)) { + DBG(("%s: failed to discard tiling (%d) for DRI2 protocol\n", __FUNCTION__, priv->gpu_bo->tiling)); + return NULL; + } + } else { + int tiling = color_tiling(sna, &pixmap->drawable); + if (tiling < 0) + tiling = -tiling; + if (priv->gpu_bo->tiling < tiling && !priv->gpu_bo->scanout) + sna_pixmap_change_tiling(pixmap, tiling); + } return priv->gpu_bo; } diff --git a/src/sna/sna_dri3.c b/src/sna/sna_dri3.c index ecfb6f30..1a2ba5dd 100644 --- a/src/sna/sna_dri3.c +++ b/src/sna/sna_dri3.c @@ -327,6 +327,15 @@ static int sna_dri3_fd_from_pixmap(ScreenPtr screen, return -1; } + if (bo->tiling && !sna->kgem.can_fence) { + if (!sna_pixmap_change_tiling(pixmap, I915_TILING_NONE)) { + DBG(("%s: unable to discard GPU tiling (%d) for DRI3 protocol\n", + __FUNCTION__, bo->tiling)); + return -1; + } + bo = priv->gpu_bo; + } + fd = kgem_bo_export_to_prime(&sna->kgem, bo); if (fd == -1) { DBG(("%s: exporting handle=%d to fd failed\n", __FUNCTION__, bo->handle));