From 67d930d64bb27944f4ad02068720a832c503ab1f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michel=20D=C3=A4nzer?= Date: Wed, 18 Sep 2019 20:18:39 -0400 Subject: [PATCH] radeonsi: fix VAAPI segfault due to various bugs Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111236 --- src/gallium/drivers/radeon/radeon_video.c | 1 + src/gallium/drivers/radeonsi/si_texture.c | 1 + src/gallium/drivers/radeonsi/si_uvd.c | 1 + 3 files changed, 3 insertions(+) diff --git a/src/gallium/drivers/radeon/radeon_video.c b/src/gallium/drivers/radeon/radeon_video.c index 7777f888b05..31b28f76d3a 100644 --- a/src/gallium/drivers/radeon/radeon_video.c +++ b/src/gallium/drivers/radeon/radeon_video.c @@ -178,6 +178,7 @@ void si_vid_join_surfaces(struct si_context *sctx, surfaces[i]->u.gfx9.offset[j] += off; } + surfaces[i]->flags |= RADEON_SURF_IMPORTED; off += surfaces[i]->surf_size; } diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c index a8504f4e90c..3d35fb41cf0 100644 --- a/src/gallium/drivers/radeonsi/si_texture.c +++ b/src/gallium/drivers/radeonsi/si_texture.c @@ -1863,6 +1863,7 @@ static bool si_can_invalidate_texture(struct si_screen *sscreen, const struct pipe_box *box) { return !tex->buffer.b.is_shared && + !(tex->surface.flags & RADEON_SURF_IMPORTED) && !(transfer_usage & PIPE_TRANSFER_READ) && tex->buffer.b.b.last_level == 0 && util_texrange_covers_whole_level(&tex->buffer.b.b, 0, diff --git a/src/gallium/drivers/radeonsi/si_uvd.c b/src/gallium/drivers/radeonsi/si_uvd.c index 94d81a4ab6c..19d1b09f1c1 100644 --- a/src/gallium/drivers/radeonsi/si_uvd.c +++ b/src/gallium/drivers/radeonsi/si_uvd.c @@ -96,6 +96,7 @@ struct pipe_video_buffer *si_video_buffer_create(struct pipe_context *pipe, /* reset the address */ resources[i]->buffer.gpu_address = ctx->ws->buffer_get_virtual_address( resources[i]->buffer.buf); + resources[i]->buffer.bo_size = resources[i]->buffer.buf->size; } vidtemplate.height *= array_size; -- 2.30.2