From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6621C433EF for ; Tue, 21 Sep 2021 23:21:04 +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 B927560FDA for ; Tue, 21 Sep 2021 23:21:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B927560FDA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B36F26E925; Tue, 21 Sep 2021 23:20:56 +0000 (UTC) Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by gabe.freedesktop.org (Postfix) with ESMTPS id B875B6E8FE for ; Tue, 21 Sep 2021 23:20:34 +0000 (UTC) Received: by mail-pl1-x630.google.com with SMTP id t11so476502plq.11 for ; Tue, 21 Sep 2021 16:20:34 -0700 (PDT) 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=Ey9lhaUgZA+8S1H5osVr7f8kYi5n5xZ93mrqVA17Ee0=; b=k8twYXpv6ameMFzizIPP6OBL2uNRxQL+B0/aJol4RWwZwQWFp3ROaknSSPir5MvjeS z7/lx3D36rnvht2G4HfM1zn2ezN0gsRuJa0E8UMyWGyukDdLjL7NIBtDRHs0+FDFCsKQ DvlYJBtoWEojgk0C1QRYis2B2kHVGqtOBa6xY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ey9lhaUgZA+8S1H5osVr7f8kYi5n5xZ93mrqVA17Ee0=; b=ouKQ6QkpJNVdd4NxcvxT6+hMkggtDVscJ2hGejf3UG6TJ0BpsOd9ji4LfpClAysLsQ NfCOGPjKawfcWzeZ+ctFDqZ5iConJi1n3jGw1mrADa1YGaDf6DqrbKBN0wT+8uQmxdcc bZp9s4GvS99yoeBZRiBfVLuCIqAJB4EubLWTYWCvg1z+XTpxv3myPgZFvpBI5tfCNNFt eQDQLF0KUXjbuMx1CaOORvx/DtHa4k7l6EEpsc9HXX8wMQEsP6ABZr0Rm0JoNx4QMWaV 2zt+bqoPkEPlvODFz3/J/jmZPCHXZPtiK312G24ILCLuxfKgJR4wID1C1/MIfANBEMLi wcDg== X-Gm-Message-State: AOAM533fpQXWcxlQlsB9vd+pQWI1Ehb9aBN1p6TFZWx2Q35LfMWHahN6 sKz1cGgUb09rR3boRPMzV5VtsxqJyosbJg== X-Google-Smtp-Source: ABdhPJx6SKVBSXEbZ+qguJW2bwKJhQTFmfeLf7t+8MMtniOkymGGIH2c3C1rO/7mjeCyPojbmZEfKA== X-Received: by 2002:a17:902:b789:b0:13b:90bc:f184 with SMTP id e9-20020a170902b78900b0013b90bcf184mr29875499pls.31.1632266434065; Tue, 21 Sep 2021 16:20:34 -0700 (PDT) Received: from gurchetansingh0.mtv.corp.google.com ([2620:15c:202:201:a5ff:11c:6401:fce]) by smtp.gmail.com with ESMTPSA id e2sm201906pfn.141.2021.09.21.16.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Sep 2021 16:20:33 -0700 (PDT) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org, virtio-dev@lists.oasis-open.org Cc: kraxel@redhat.com Subject: [PATCH v3 07/12] drm/virtio: implement context init: plumb {base_fence_ctx, ring_idx} to virtio_gpu_fence_alloc Date: Tue, 21 Sep 2021 16:20:19 -0700 Message-Id: <20210921232024.817-8-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210921232024.817-1-gurchetansingh@chromium.org> References: <20210921232024.817-1-gurchetansingh@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" These were defined in the previous commit. We'll need these parameters when allocating a dma_fence. The use case for this is multiple synchronizations timelines. The maximum number of timelines per 3D instance will be 32. Usually, only 2 are needed -- one for CPU commands, and another for GPU commands. As such, we'll need to specify these parameters when allocating a dma_fence. vgdev->fence_drv.context is the "default" fence context for 2D mode and old userspace. Signed-off-by: Gurchetan Singh Acked-by: Lingfeng Yang --- drivers/gpu/drm/virtio/virtgpu_drv.h | 5 +++-- drivers/gpu/drm/virtio/virtgpu_fence.c | 4 +++- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 9 +++++---- drivers/gpu/drm/virtio/virtgpu_plane.c | 3 ++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 401aec1a5efb..a5142d60c2fa 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -426,8 +426,9 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev, int index); /* virtgpu_fence.c */ -struct virtio_gpu_fence *virtio_gpu_fence_alloc( - struct virtio_gpu_device *vgdev); +struct virtio_gpu_fence *virtio_gpu_fence_alloc(struct virtio_gpu_device *vgdev, + uint64_t base_fence_ctx, + uint32_t ring_idx); void virtio_gpu_fence_emit(struct virtio_gpu_device *vgdev, struct virtio_gpu_ctrl_hdr *cmd_hdr, struct virtio_gpu_fence *fence); diff --git a/drivers/gpu/drm/virtio/virtgpu_fence.c b/drivers/gpu/drm/virtio/virtgpu_fence.c index d28e25e8409b..24c728b65d21 100644 --- a/drivers/gpu/drm/virtio/virtgpu_fence.c +++ b/drivers/gpu/drm/virtio/virtgpu_fence.c @@ -71,7 +71,9 @@ static const struct dma_fence_ops virtio_gpu_fence_ops = { .timeline_value_str = virtio_gpu_timeline_value_str, }; -struct virtio_gpu_fence *virtio_gpu_fence_alloc(struct virtio_gpu_device *vgdev) +struct virtio_gpu_fence *virtio_gpu_fence_alloc(struct virtio_gpu_device *vgdev, + uint64_t base_fence_ctx, + uint32_t ring_idx) { struct virtio_gpu_fence_driver *drv = &vgdev->fence_drv; struct virtio_gpu_fence *fence = kzalloc(sizeof(struct virtio_gpu_fence), diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index f5281d1e30e1..f51f3393a194 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -173,7 +173,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, goto out_memdup; } - out_fence = virtio_gpu_fence_alloc(vgdev); + out_fence = virtio_gpu_fence_alloc(vgdev, vgdev->fence_drv.context, 0); if(!out_fence) { ret = -ENOMEM; goto out_unresv; @@ -288,7 +288,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data, if (params.size == 0) params.size = PAGE_SIZE; - fence = virtio_gpu_fence_alloc(vgdev); + fence = virtio_gpu_fence_alloc(vgdev, vgdev->fence_drv.context, 0); if (!fence) return -ENOMEM; ret = virtio_gpu_object_create(vgdev, ¶ms, &qobj, fence); @@ -367,7 +367,7 @@ static int virtio_gpu_transfer_from_host_ioctl(struct drm_device *dev, if (ret != 0) goto err_put_free; - fence = virtio_gpu_fence_alloc(vgdev); + fence = virtio_gpu_fence_alloc(vgdev, vgdev->fence_drv.context, 0); if (!fence) { ret = -ENOMEM; goto err_unlock; @@ -427,7 +427,8 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data, goto err_put_free; ret = -ENOMEM; - fence = virtio_gpu_fence_alloc(vgdev); + fence = virtio_gpu_fence_alloc(vgdev, vgdev->fence_drv.context, + 0); if (!fence) goto err_unlock; diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index a49fd9480381..6d3cc9e238a4 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -256,7 +256,8 @@ static int virtio_gpu_plane_prepare_fb(struct drm_plane *plane, return 0; if (bo->dumb && (plane->state->fb != new_state->fb)) { - vgfb->fence = virtio_gpu_fence_alloc(vgdev); + vgfb->fence = virtio_gpu_fence_alloc(vgdev, vgdev->fence_drv.context, + 0); if (!vgfb->fence) return -ENOMEM; } -- 2.33.0.464.g1972c5931b-goog From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Sender: List-Post: List-Help: List-Unsubscribe: List-Subscribe: Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id D1DCB98636B for ; Tue, 21 Sep 2021 23:20:57 +0000 (UTC) From: Gurchetan Singh Date: Tue, 21 Sep 2021 16:20:19 -0700 Message-Id: <20210921232024.817-8-gurchetansingh@chromium.org> In-Reply-To: <20210921232024.817-1-gurchetansingh@chromium.org> References: <20210921232024.817-1-gurchetansingh@chromium.org> MIME-Version: 1.0 Subject: [virtio-dev] [PATCH v3 07/12] drm/virtio: implement context init: plumb {base_fence_ctx, ring_idx} to virtio_gpu_fence_alloc Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="US-ASCII" To: dri-devel@lists.freedesktop.org, virtio-dev@lists.oasis-open.org Cc: kraxel@redhat.com List-ID: These were defined in the previous commit. We'll need these parameters when allocating a dma_fence. The use case for this is multiple synchronizations timelines. The maximum number of timelines per 3D instance will be 32. Usually, only 2 are needed -- one for CPU commands, and another for GPU commands. As such, we'll need to specify these parameters when allocating a dma_fence. vgdev->fence_drv.context is the "default" fence context for 2D mode and old userspace. Signed-off-by: Gurchetan Singh Acked-by: Lingfeng Yang --- drivers/gpu/drm/virtio/virtgpu_drv.h | 5 +++-- drivers/gpu/drm/virtio/virtgpu_fence.c | 4 +++- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 9 +++++---- drivers/gpu/drm/virtio/virtgpu_plane.c | 3 ++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/= virtgpu_drv.h index 401aec1a5efb..a5142d60c2fa 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -426,8 +426,9 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_g= pu_device *vgdev, =09=09=09=09=09int index); =20 /* virtgpu_fence.c */ -struct virtio_gpu_fence *virtio_gpu_fence_alloc( -=09struct virtio_gpu_device *vgdev); +struct virtio_gpu_fence *virtio_gpu_fence_alloc(struct virtio_gpu_device *= vgdev, +=09=09=09=09=09=09uint64_t base_fence_ctx, +=09=09=09=09=09=09uint32_t ring_idx); void virtio_gpu_fence_emit(struct virtio_gpu_device *vgdev, =09=09=09 struct virtio_gpu_ctrl_hdr *cmd_hdr, =09=09=09 struct virtio_gpu_fence *fence); diff --git a/drivers/gpu/drm/virtio/virtgpu_fence.c b/drivers/gpu/drm/virti= o/virtgpu_fence.c index d28e25e8409b..24c728b65d21 100644 --- a/drivers/gpu/drm/virtio/virtgpu_fence.c +++ b/drivers/gpu/drm/virtio/virtgpu_fence.c @@ -71,7 +71,9 @@ static const struct dma_fence_ops virtio_gpu_fence_ops = =3D { =09.timeline_value_str =3D virtio_gpu_timeline_value_str, }; =20 -struct virtio_gpu_fence *virtio_gpu_fence_alloc(struct virtio_gpu_device *= vgdev) +struct virtio_gpu_fence *virtio_gpu_fence_alloc(struct virtio_gpu_device *= vgdev, +=09=09=09=09=09=09uint64_t base_fence_ctx, +=09=09=09=09=09=09uint32_t ring_idx) { =09struct virtio_gpu_fence_driver *drv =3D &vgdev->fence_drv; =09struct virtio_gpu_fence *fence =3D kzalloc(sizeof(struct virtio_gpu_fen= ce), diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virti= o/virtgpu_ioctl.c index f5281d1e30e1..f51f3393a194 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -173,7 +173,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_devic= e *dev, void *data, =09=09=09goto out_memdup; =09} =20 -=09out_fence =3D virtio_gpu_fence_alloc(vgdev); +=09out_fence =3D virtio_gpu_fence_alloc(vgdev, vgdev->fence_drv.context, 0= ); =09if(!out_fence) { =09=09ret =3D -ENOMEM; =09=09goto out_unresv; @@ -288,7 +288,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_= device *dev, void *data, =09if (params.size =3D=3D 0) =09=09params.size =3D PAGE_SIZE; =20 -=09fence =3D virtio_gpu_fence_alloc(vgdev); +=09fence =3D virtio_gpu_fence_alloc(vgdev, vgdev->fence_drv.context, 0); =09if (!fence) =09=09return -ENOMEM; =09ret =3D virtio_gpu_object_create(vgdev, ¶ms, &qobj, fence); @@ -367,7 +367,7 @@ static int virtio_gpu_transfer_from_host_ioctl(struct d= rm_device *dev, =09if (ret !=3D 0) =09=09goto err_put_free; =20 -=09fence =3D virtio_gpu_fence_alloc(vgdev); +=09fence =3D virtio_gpu_fence_alloc(vgdev, vgdev->fence_drv.context, 0); =09if (!fence) { =09=09ret =3D -ENOMEM; =09=09goto err_unlock; @@ -427,7 +427,8 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm= _device *dev, void *data, =09=09=09goto err_put_free; =20 =09=09ret =3D -ENOMEM; -=09=09fence =3D virtio_gpu_fence_alloc(vgdev); +=09=09fence =3D virtio_gpu_fence_alloc(vgdev, vgdev->fence_drv.context, +=09=09=09=09=09 0); =09=09if (!fence) =09=09=09goto err_unlock; =20 diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virti= o/virtgpu_plane.c index a49fd9480381..6d3cc9e238a4 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -256,7 +256,8 @@ static int virtio_gpu_plane_prepare_fb(struct drm_plane= *plane, =09=09return 0; =20 =09if (bo->dumb && (plane->state->fb !=3D new_state->fb)) { -=09=09vgfb->fence =3D virtio_gpu_fence_alloc(vgdev); +=09=09vgfb->fence =3D virtio_gpu_fence_alloc(vgdev, vgdev->fence_drv.conte= xt, +=09=09=09=09=09=09 0); =09=09if (!vgfb->fence) =09=09=09return -ENOMEM; =09} --=20 2.33.0.464.g1972c5931b-goog --------------------------------------------------------------------- To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org