From patchwork Mon May 30 23:57:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9143035 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C2C460754 for ; Mon, 30 May 2016 23:57:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6B7027C05 for ; Mon, 30 May 2016 23:57:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAE4F27E15; Mon, 30 May 2016 23:57:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29F6D27C05 for ; Mon, 30 May 2016 23:57:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 57C5A6E012; Mon, 30 May 2016 23:57:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw0-f193.google.com (mail-yw0-f193.google.com [209.85.161.193]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0374C6E012 for ; Mon, 30 May 2016 23:57:38 +0000 (UTC) Received: by mail-yw0-f193.google.com with SMTP id y6so16662233ywe.0 for ; Mon, 30 May 2016 16:57:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=TgIi+f0O1x6eF+h5mCBqKyvfqiDS44m1qeegYk7WUok=; b=Ti6bku0019aXygWo7XsVAq95PUobIWj5h+9MN9KAndpQjTXnea+oZ6kgf9+FGTrMGw 7CNR6QbXfnB+RCphrL10xDEr7S6ugiCWjvHoDs9PNzqD13WjqSMTSieJb/1rJXKAANw2 qbdxqYTyRiEmLnMnO86nq5KHiqv6odTCAjtxHtlHJSgrflBOSr4WG2QYtZaim1GO8uil jT0DTFDfyLAaCG+eqO080VE7HRdEXTPiU54Vii+9Y1aEHzsdYWSjrqPMw8Atjx886Yrb FcpTmJmpIpVBnBO3mVV3dyVqDGuN9cO/F8A2LqivDlP9ZCZgKiP92kluESdkgHqLmHXy 2YQA== X-Gm-Message-State: ALyK8tLxbM0iHyulmqKpoQhY4JX1rUKykRaU56l4ep4WX4lS65TpuqieyEHqs6PtUI58EQ== X-Received: by 10.13.237.130 with SMTP id w124mr18721677ywe.248.1464652656796; Mon, 30 May 2016 16:57:36 -0700 (PDT) Received: from jade.localdomain ([201.82.24.203]) by smtp.gmail.com with ESMTPSA id l185sm14878064ywb.24.2016.05.30.16.57.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 May 2016 16:57:35 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/virtio: use old_state when disabling a plane Date: Mon, 30 May 2016 20:57:29 -0300 Message-Id: <1464652649-18990-1-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 Cc: Daniel Vetter , Gustavo Padovan X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan When disabling a plane it current plane->state->crtc is NULL and thus can't be used to to retrieve the crtc index. In this case we should get the old_state->crtc and disable the plane on it. Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 70b44a2..ba1b679 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -63,7 +63,7 @@ static void virtio_gpu_plane_atomic_update(struct drm_plane *plane, { struct drm_device *dev = plane->dev; struct virtio_gpu_device *vgdev = dev->dev_private; - struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(plane->crtc); + struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc; struct virtio_gpu_framebuffer *vgfb; struct virtio_gpu_object *bo; uint32_t handle; @@ -86,7 +86,7 @@ static void virtio_gpu_plane_atomic_update(struct drm_plane *plane, DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d\n", handle, plane->state->crtc_w, plane->state->crtc_h, plane->state->crtc_x, plane->state->crtc_y); - virtio_gpu_cmd_set_scanout(vgdev, output->index, handle, + virtio_gpu_cmd_set_scanout(vgdev, drm_crtc_index(crtc), handle, plane->state->crtc_w, plane->state->crtc_h, plane->state->crtc_x,