sna/dri2+: The DRI2/DRI3 protocol requires fenced tiling
If we export a surface over DRI2/DRI3, we have to use explicit tiling via the kernel. :( Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
085efe6817
commit
b792b2c0b8
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue