From patchwork Mon Apr 10 00:24:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9671837 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 5775D601EA for ; Mon, 10 Apr 2017 00:24:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 478EE27EED for ; Mon, 10 Apr 2017 00:24:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AA5527FA8; Mon, 10 Apr 2017 00:24:58 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E9F0C27EED for ; Mon, 10 Apr 2017 00:24:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CEAA6E0C7; Mon, 10 Apr 2017 00:24:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 946646E0CA for ; Mon, 10 Apr 2017 00:24:54 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id x75so7008914wma.1 for ; Sun, 09 Apr 2017 17:24:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=l1R5SRWjnOT6FNMiGK4cRB7PLh/umwWqeIc3WDpWWE4=; b=Dqx+/oXfv5N8o8e+Z+LZLPsj+avZKAkoq/NdUW06f54iNXXswIs/HzyZe7R9ca2vmR Qk4ZFYBkgEMpzqN0B6vwuCzZLTiD/w0jNuJuHOI5noyatCBzfj1vEjgbWnEUivIUmTRo CeRySOtyu65R1DdS81ESxvCWaf4SaGppKgxY1r/m65G/8NzBfJdVjq63N6Hv6Kumza1m 1dNHPEJ3+hS742zvVagEEX1z911AcZyFFR0dHZXXWmGX85+6RfzW5Fd2vioEQLoMgNJZ mCxEQWBdCc0OlKwBTyjMKJNmU2jwaL0QxiLjRgRrnczNivN0UdttHSC0P2mPrDD0QOo3 j8PQ== X-Gm-Message-State: AN3rC/6ahHmY8uT7ClRUULn1lmIBVBKCf234ZdIhBDjXQlJxMqk8zM9BInqJXxBmyaAplg== X-Received: by 10.28.188.84 with SMTP id m81mr7833168wmf.119.1491783893098; Sun, 09 Apr 2017 17:24:53 -0700 (PDT) Received: from localhost.localdomain ([79.143.138.42]) by smtp.gmail.com with ESMTPSA id w10sm8015818wmw.14.2017.04.09.17.24.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Apr 2017 17:24:52 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [RFC 2/7] drm/virtio: support async cursor updates Date: Mon, 10 Apr 2017 02:24:43 +0200 Message-Id: <20170410002448.12460-3-gustavo@padovan.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170410002448.12460-1-gustavo@padovan.org> References: <20170410002448.12460-1-gustavo@padovan.org> Cc: 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 Short circuit the update path for cursors and use the drm async update infrastructure. Signed-off-by: Gustavo Padovan --- I wrote this mostly for testing purposes, not sure if its something that we actually for virtio. --- drivers/gpu/drm/virtio/virtgpu_plane.c | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 76d5fed..4d6e40b 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -260,6 +260,46 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane, virtio_gpu_cursor_ping(vgdev, output); } +static int virtio_gpu_cursor_plane_async_check(struct drm_plane *plane, + struct drm_plane_state *new_state) +{ + struct virtio_gpu_output *output; + + if (!plane->state->crtc) + return -EINVAL; + + output = drm_crtc_to_virtio_gpu_output(plane->state->crtc); + if (!output) + return -EINVAL; + + if (plane->state->fb != new_state->fb) + return -EINVAL; + + return 0; +} + +static void virtio_gpu_cursor_plane_async_update(struct drm_plane *plane, + struct drm_plane_state *new_state) +{ + struct drm_device *dev = plane->dev; + struct virtio_gpu_device *vgdev = dev->dev_private; + struct virtio_gpu_output *output = NULL; + + output = drm_crtc_to_virtio_gpu_output(plane->state->crtc); + if (WARN_ON(!output)) + return; + + if (plane->state->fb != new_state->fb) + return; + + DRM_DEBUG("move +%d+%d\n", plane->state->crtc_x, plane->state->crtc_y); + + output->cursor.hdr.type = cpu_to_le32(VIRTIO_GPU_CMD_MOVE_CURSOR); + output->cursor.pos.x = cpu_to_le32(plane->state->crtc_x); + output->cursor.pos.y = cpu_to_le32(plane->state->crtc_y); + virtio_gpu_cursor_ping(vgdev, output); +} + static const struct drm_plane_helper_funcs virtio_gpu_primary_helper_funcs = { .atomic_check = virtio_gpu_plane_atomic_check, .atomic_update = virtio_gpu_primary_plane_update, @@ -268,6 +308,8 @@ static const struct drm_plane_helper_funcs virtio_gpu_primary_helper_funcs = { static const struct drm_plane_helper_funcs virtio_gpu_cursor_helper_funcs = { .atomic_check = virtio_gpu_plane_atomic_check, .atomic_update = virtio_gpu_cursor_plane_update, + .atomic_async_check = virtio_gpu_cursor_plane_async_check, + .atomic_async_update = virtio_gpu_cursor_plane_async_update, }; struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev,