From patchwork Tue Sep 10 20:06:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Riley X-Patchwork-Id: 11140065 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A297E112B for ; Tue, 10 Sep 2019 20:07:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 89CF721019 for ; Tue, 10 Sep 2019 20:07:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 89CF721019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 718436E141; Tue, 10 Sep 2019 20:07:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 669656E141 for ; Tue, 10 Sep 2019 20:06:59 +0000 (UTC) Received: by mail-pf1-x443.google.com with SMTP id q21so12166678pfn.11 for ; Tue, 10 Sep 2019 13:06:59 -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:mime-version:content-transfer-encoding; bh=0QByh7nMUE4DnF1EZmnVCO0LesBewegKmGWKg2jdIyE=; b=rAPGzzWV5FHVxGwihyRn5Iwhy/NMcxGI7GHHTtMFmU4fR87M/oupij16Lg6HUgJfso oSn0lrPTCgI07DP6bBuqzqg675De30UCQFkkFnKougzDFdfLUq6K2nlTLZDLYCoKTHNo T+1UErPlIRf/g+IqDl/VjhYCtAFkVFOl7PNn0dNudwHeV2O4dDYzvFlUUv4up9mdZk72 JltOyq8/hoTSkwfFk0OZy1qg4MccIeu48R9i6vEx/O32GZDhnQIQdRLjcv73oWmJlR/H DAO2MGjunxhig+oMFr1vym/PKPvq+Ufarg4edU8Wj7XVpriOkGNse3VPnRMyGUQUxp0u IcXg== X-Gm-Message-State: APjAAAXBhFfk1IqZnCDtHWclaDTmwSqMz3jvqUPXKS7HEf/Emr9SIEhy yskow6vFJ+IpPzwOV2bmeTJpqmDPwlM= X-Google-Smtp-Source: APXvYqwY8ZIVNVGdt/gxFNSdRhnyOwo46cUOwbhh5f13J3xXT4X/se8iTQ5/XLLxoCcy8JMm8lWmtg== X-Received: by 2002:a63:1:: with SMTP id 1mr29256800pga.162.1568146018680; Tue, 10 Sep 2019 13:06:58 -0700 (PDT) Received: from localhost ([2620:15c:202:1:e9ae:bd45:1bd9:e60d]) by smtp.gmail.com with ESMTPSA id q20sm35751990pfg.85.2019.09.10.13.06.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Sep 2019 13:06:58 -0700 (PDT) From: David Riley To: dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org Subject: [PATCH v3 1/2] drm/virtio: Rewrite virtio_gpu_queue_ctrl_buffer using fenced version. Date: Tue, 10 Sep 2019 13:06:50 -0700 Message-Id: <20190910200651.118628-1-davidriley@chromium.org> X-Mailer: git-send-email 2.23.0.162.g0b9fbb3734-goog In-Reply-To: <20190829212417.257397-1-davidriley@chromium.org> References: <20190829212417.257397-1-davidriley@chromium.org> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0QByh7nMUE4DnF1EZmnVCO0LesBewegKmGWKg2jdIyE=; b=nTUelCMWT/OF5pwZR9T+jGu510zTnmwud9l5EN0tgRovfWW3EYCEcVjRSwfD8F+hPw yAIdumgV1m7JRyUG7aabeXsBuJzUH71TonbwfImsqF5M8kj+jUqR8e83DIwTd/uGBLma /lCZB6Hq4zwK53E1k9KIQDRF0+VKGvwzIwlyM= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-kernel@vger.kernel.org, Gurchetan Singh , Gerd Hoffmann , =?utf-8?q?St=C3=A9phane_Marchesin?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Factor function in preparation to generating scatterlist prior to locking. Signed-off-by: David Riley --- drivers/gpu/drm/virtio/virtgpu_vq.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index 981ee16e3ee9..bf5a4a50b002 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -299,17 +299,6 @@ static int virtio_gpu_queue_ctrl_buffer_locked(struct virtio_gpu_device *vgdev, return ret; } -static int virtio_gpu_queue_ctrl_buffer(struct virtio_gpu_device *vgdev, - struct virtio_gpu_vbuffer *vbuf) -{ - int rc; - - spin_lock(&vgdev->ctrlq.qlock); - rc = virtio_gpu_queue_ctrl_buffer_locked(vgdev, vbuf); - spin_unlock(&vgdev->ctrlq.qlock); - return rc; -} - static int virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev, struct virtio_gpu_vbuffer *vbuf, struct virtio_gpu_ctrl_hdr *hdr, @@ -335,13 +324,19 @@ static int virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev, goto again; } - if (fence) + if (hdr && fence) virtio_gpu_fence_emit(vgdev, hdr, fence); rc = virtio_gpu_queue_ctrl_buffer_locked(vgdev, vbuf); spin_unlock(&vgdev->ctrlq.qlock); return rc; } +static int virtio_gpu_queue_ctrl_buffer(struct virtio_gpu_device *vgdev, + struct virtio_gpu_vbuffer *vbuf) +{ + return virtio_gpu_queue_fenced_ctrl_buffer(vgdev, vbuf, NULL, NULL); +} + static int virtio_gpu_queue_cursor(struct virtio_gpu_device *vgdev, struct virtio_gpu_vbuffer *vbuf) {