From patchwork Wed Aug 31 16:26:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9307523 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 EF29260487 for ; Wed, 31 Aug 2016 16:27:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0C7428FB0 for ; Wed, 31 Aug 2016 16:27:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D511B28FB2; Wed, 31 Aug 2016 16:27:02 +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]) (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 92D4F28FB0 for ; Wed, 31 Aug 2016 16:27:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE9F26E7C3; Wed, 31 Aug 2016 16:27:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-f196.google.com (mail-qk0-f196.google.com [209.85.220.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 827BF6E1D4 for ; Wed, 31 Aug 2016 16:26:57 +0000 (UTC) Received: by mail-qk0-f196.google.com with SMTP id v123so3829832qkh.3 for ; Wed, 31 Aug 2016 09:26:57 -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:in-reply-to :references; bh=16ncoip11gpBZui/54o/2YJ4LG2z/qZGGUpYUkMOCvE=; b=ecsbmQW5+nF0tmI9KmMRBzRS+0WTh4QMBdAe8p3zeDlw8uirwZEGRPZRkxmmkkf+cE KUTTLbKL3JRdhqF5S2q8Kr5AatEiaYw+z4e8h7Rsl8BAcx1CJ6iDbUdNFbJkW0gO73Zu uca/p6cL4b0WwRVIvaaVsGvkcAgY3WWOBccZ0UW4NHlnZAvJosTwy4BObpYEcfxycYFE X2QgWlkHYPKMorTyg+hJDM2iUR+nM07MwIX98lW8P/Hd4BWbR1On8bOFAm5cGokvBjdY 1qizg7cH6d1eahLFuBQSTI15n6ZNWAjBoI2iYI7iiBEpk4WcISosxkw+cDbGu6iNsRxf lGHw== X-Gm-Message-State: AE9vXwN9jv3wuBLicsLVOeh4hC9eyVCpQYxqYNRaF9McqKiV3jEnOvGMVGfITVGWl3TytQ== X-Received: by 10.55.175.134 with SMTP id y128mr12358229qke.134.1472660816754; Wed, 31 Aug 2016 09:26:56 -0700 (PDT) Received: from jade.localdomain (modemcable154.55-37-24.static.videotron.ca. [24.37.55.154]) by smtp.gmail.com with ESMTPSA id e33sm334771qta.47.2016.08.31.09.26.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Aug 2016 09:26:56 -0700 (PDT) From: Gustavo Padovan To: David Airlie Subject: [PATCH 2/2] drm/virtio: add real fence context and seqno Date: Wed, 31 Aug 2016 12:26:53 -0400 Message-Id: <1472660813-28219-2-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1472660813-28219-1-git-send-email-gustavo@padovan.org> References: <1472660813-28219-1-git-send-email-gustavo@padovan.org> Cc: open list , Gustavo Padovan , Gerd Hoffmann , "open list:VIRTIO GPU DRIVER" , "open list:VIRTIO GPU DRIVER" 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 virtio fences were created with no fence context, which would make then clash with an allocated fence context. Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_fence.c | 2 +- drivers/gpu/drm/virtio/virtgpu_kms.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index b18ef31..06ad923 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -75,6 +75,7 @@ typedef void (*virtio_gpu_resp_cb)(struct virtio_gpu_device *vgdev, struct virtio_gpu_fence_driver { atomic64_t last_seq; uint64_t sync_seq; + uint64_t context; struct list_head fences; spinlock_t lock; }; diff --git a/drivers/gpu/drm/virtio/virtgpu_fence.c b/drivers/gpu/drm/virtio/virtgpu_fence.c index cf44187..f3f70fa 100644 --- a/drivers/gpu/drm/virtio/virtgpu_fence.c +++ b/drivers/gpu/drm/virtio/virtgpu_fence.c @@ -89,7 +89,7 @@ int virtio_gpu_fence_emit(struct virtio_gpu_device *vgdev, (*fence)->drv = drv; (*fence)->seq = ++drv->sync_seq; fence_init(&(*fence)->f, &virtio_fence_ops, &drv->lock, - 0, (*fence)->seq); + drv->context, (*fence)->seq); fence_get(&(*fence)->f); list_add_tail(&(*fence)->node, &drv->fences); spin_unlock_irqrestore(&drv->lock, irq_flags); diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c index 4150873..036b0fb 100644 --- a/drivers/gpu/drm/virtio/virtgpu_kms.c +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c @@ -159,6 +159,7 @@ int virtio_gpu_driver_load(struct drm_device *dev, unsigned long flags) virtio_gpu_init_vq(&vgdev->ctrlq, virtio_gpu_dequeue_ctrl_func); virtio_gpu_init_vq(&vgdev->cursorq, virtio_gpu_dequeue_cursor_func); + vgdev->fence_drv.context = fence_context_alloc(1); spin_lock_init(&vgdev->fence_drv.lock); INIT_LIST_HEAD(&vgdev->fence_drv.fences); INIT_LIST_HEAD(&vgdev->cap_cache);