Commit 7b8d1d88 authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Lipeng Sang
Browse files

drm/virtio: Use appropriate atomic state in virtio_gpu_plane_cleanup_fb()

stable inclusion
from stable-v5.10.152
commit 1414e9bf3c307759347e6c91ed1143065ee86402
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I73HJ0

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=1414e9bf3c307759347e6c91ed1143065ee86402



--------------------------------

[ Upstream commit 4656b3a2 ]

Make virtio_gpu_plane_cleanup_fb() to clean the state which DRM core
wants to clean up and not the current plane's state. Normally the older
atomic state is cleaned up, but the newer state could also be cleaned up
in case of aborted commits.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarDmitry Osipenko <dmitry.osipenko@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-6-dmitry.osipenko@collabora.com


Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarLipeng Sang <sanglipeng1@jd.com>
parent be43a5c8
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -213,14 +213,14 @@ static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane,
}
}


static void virtio_gpu_cursor_cleanup_fb(struct drm_plane *plane,
static void virtio_gpu_cursor_cleanup_fb(struct drm_plane *plane,
					 struct drm_plane_state *old_state)
					struct drm_plane_state *state)
{
{
	struct virtio_gpu_framebuffer *vgfb;
	struct virtio_gpu_framebuffer *vgfb;


	if (!plane->state->fb)
	if (!state->fb)
		return;
		return;


	vgfb = to_virtio_gpu_framebuffer(plane->state->fb);
	vgfb = to_virtio_gpu_framebuffer(state->fb);
	if (vgfb->fence) {
	if (vgfb->fence) {
		dma_fence_put(&vgfb->fence->f);
		dma_fence_put(&vgfb->fence->f);
		vgfb->fence = NULL;
		vgfb->fence = NULL;