sna: Ensure that DRI2 buffers are created with a fence
We use the fence as a backchannel to commuicated the tiling mode to the DRI2 client, so in such cases we cannot tolerate a failure to set the tiling mode. References: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c114 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
2050d03f52
commit
ad20fd401b
|
|
@ -5108,6 +5108,7 @@ static void __kgem_bo_make_scanout(struct kgem *kgem,
|
|||
|
||||
static void set_gpu_tiling(struct kgem_bo *bo, int tiling, int pitch)
|
||||
{
|
||||
assert(!kgem->can_fence);
|
||||
bo->tiling = tiling;
|
||||
bo->pitch = pitch;
|
||||
if (tiling && bo->map__gtt) {
|
||||
|
|
@ -5294,10 +5295,9 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem,
|
|||
if (num_pages(bo) < size)
|
||||
continue;
|
||||
|
||||
if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
|
||||
assert(!kgem->can_fence);
|
||||
if (!kgem_set_tiling(kgem, bo, tiling, pitch) &&
|
||||
!exact)
|
||||
set_gpu_tiling(bo, tiling, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
kgem_bo_remove_from_active(kgem, bo);
|
||||
|
|
@ -5324,10 +5324,9 @@ large_inactive:
|
|||
continue;
|
||||
|
||||
if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
|
||||
if (kgem->gen >= 040) {
|
||||
assert(!kgem->can_fence);
|
||||
if (kgem->gen >= 040 && !exact)
|
||||
set_gpu_tiling(bo, tiling, pitch);
|
||||
} else
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -5472,10 +5471,9 @@ search_active:
|
|||
if (num_pages(bo) < size)
|
||||
continue;
|
||||
|
||||
if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
|
||||
assert(!kgem->can_fence);
|
||||
if (!kgem_set_tiling(kgem, bo, tiling, pitch) &&
|
||||
!exact)
|
||||
set_gpu_tiling(bo, tiling, pitch);
|
||||
}
|
||||
}
|
||||
assert(bo->tiling == tiling);
|
||||
assert(bo->pitch >= pitch);
|
||||
|
|
@ -5534,8 +5532,7 @@ search_active:
|
|||
continue;
|
||||
|
||||
if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
|
||||
if (kgem->gen >= 040) {
|
||||
assert(!kgem->can_fence);
|
||||
if (kgem->gen >= 040 && !exact) {
|
||||
set_gpu_tiling(bo, tiling, pitch);
|
||||
} else {
|
||||
kgem_bo_free(kgem, bo);
|
||||
|
|
@ -5626,8 +5623,7 @@ search_inactive:
|
|||
}
|
||||
|
||||
if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
|
||||
if (kgem->gen >= 040) {
|
||||
assert(!kgem->can_fence);
|
||||
if (kgem->gen >= 040 && !exact) {
|
||||
set_gpu_tiling(bo, tiling, pitch);
|
||||
} else {
|
||||
kgem_bo_free(kgem, bo);
|
||||
|
|
@ -5693,8 +5689,7 @@ search_inactive:
|
|||
__kgem_bo_clear_busy(bo);
|
||||
|
||||
if (!kgem_set_tiling(kgem, bo, tiling, pitch)) {
|
||||
if (kgem->gen >= 040) {
|
||||
assert(!kgem->can_fence);
|
||||
if (kgem->gen >= 040 && !exact) {
|
||||
set_gpu_tiling(bo, tiling, pitch);
|
||||
} else {
|
||||
kgem_bo_free(kgem, bo);
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ sna_dri2_get_back(struct sna *sna,
|
|||
bo = kgem_create_2d(&sna->kgem,
|
||||
draw->width, draw->height, draw->bitsPerPixel,
|
||||
get_private(back)->bo->tiling,
|
||||
get_private(back)->bo->scanout ? CREATE_SCANOUT : 0);
|
||||
get_private(back)->bo->scanout ? CREATE_SCANOUT | CREATE_EXACT : CREATE_EXACT);
|
||||
if (bo == NULL)
|
||||
return;
|
||||
|
||||
|
|
@ -613,7 +613,7 @@ sna_dri2_create_buffer(DrawablePtr draw,
|
|||
PixmapPtr pixmap;
|
||||
struct kgem_bo *bo;
|
||||
unsigned bpp = format ?: draw->bitsPerPixel;
|
||||
unsigned flags = 0;
|
||||
unsigned flags = CREATE_EXACT;
|
||||
uint32_t size;
|
||||
|
||||
DBG(("%s pixmap=%ld, (attachment=%d, format=%d, drawable=%dx%d), window?=%d\n",
|
||||
|
|
@ -2263,7 +2263,7 @@ static void sna_dri2_xchg_crtc(struct sna *sna, DrawablePtr draw, xf86CrtcPtr cr
|
|||
bo = kgem_create_2d(&sna->kgem,
|
||||
draw->width, draw->height, draw->bitsPerPixel,
|
||||
get_private(back)->bo->tiling,
|
||||
CREATE_SCANOUT);
|
||||
CREATE_SCANOUT | CREATE_EXACT);
|
||||
if (bo != NULL) {
|
||||
get_private(back)->bo = bo;
|
||||
back->pitch = bo->pitch;
|
||||
|
|
|
|||
Loading…
Reference in New Issue