Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5828830imd; Wed, 31 Oct 2018 02:41:54 -0700 (PDT) X-Google-Smtp-Source: AJdET5faz8gUfAsuy6TMLWLnMptWLdjEjGKBZt2tSsoGJo2f0h/5oMeICmSYVoEw0y2gd8lwKzyW X-Received: by 2002:a17:902:54d:: with SMTP id 71-v6mr2642895plf.80.1540978914159; Wed, 31 Oct 2018 02:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540978914; cv=none; d=google.com; s=arc-20160816; b=PsJWtdpoW46MlNgFPJv2jSzA9aI6/O9UCpCSLwVGa1px9pC/mG1prTioee3Dnw4vSl RDQtFF90CaVuadGJ90q0KzgSajsxrQ/OtFsrK/AoESyuNb6LKQ3OKPXFxmD8+/ETWn/i z7bUIRmgxw+xfnt3/cwK+8Nda4FcsVEG+dSNWiUlkDAffYz2Turrhc6azYOcFMgDYNqL de9L+L/g+1DQO2Id6fLyLqq5OVSzbydJWxBZaGMCpFabzrlbcHFJHwNE7bL4+yJUQevA Y5vOtlyu529jZqy3SJ3yZ36Pclj7wAXB8cR7neJpsDx97txMhO2a9/7SYO92sYgt+X9G Ub9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=koEaX2WE3ZBls9EXsPoMftPSIHHrvv/SRUgkNf2FbOU=; b=SgHGV0ur9mBvYHlzb33B0/CJOr0KbzmKB6MQCA20KWLBYuShFHM0ixkQ+wvBP3ENu1 shpKbTTS0gIDAsIG6c/bE2OZ4CJYa0G03cE8dVVqrD6LEvX5FJGBEIT/QqWLUfA9MRvq WaCJvhg7q1iiYMkt2leo2XFPLjsxWy9yACdCzsAx8wjnA56MplaSD9tyWJ8Bt9Unvlt/ CQmarCCMYuhIIg/5XMekwAFTRD2mCzlqs+n1KOXkrbt55SQXHGZ5K90dn1P5rv4wXxXy PaNlO1S0a9g+P781Pfuv7TPg5Gx2h2RZRY3AelJIkIYBEJSymVR3VJFWdWLDRDeghl92 F3Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="mC2aQ/55"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q13-v6si25401791pgq.526.2018.10.31.02.41.39; Wed, 31 Oct 2018 02:41:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="mC2aQ/55"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728155AbeJaSiM (ORCPT + 99 others); Wed, 31 Oct 2018 14:38:12 -0400 Received: from mail-vs1-f66.google.com ([209.85.217.66]:39423 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727436AbeJaSiM (ORCPT ); Wed, 31 Oct 2018 14:38:12 -0400 Received: by mail-vs1-f66.google.com with SMTP id h78so8518229vsi.6 for ; Wed, 31 Oct 2018 02:40:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=koEaX2WE3ZBls9EXsPoMftPSIHHrvv/SRUgkNf2FbOU=; b=mC2aQ/55/kNbVcXO7H+OVooLBG3SzRPkH8yq1FphKRHeBqwUIofYETrh+gN4GvZ7tO wHSjiaWQ8aouKOrkaRsqThDqRASksKAf+oFveUEo336/9UYNyP0XQmnjgWwu7jFvFO4N /IkCjfKaeK+0GNZCy4X+yHDuG3Pg3Hx7wRAQmyz5f6mhJ3lU7wBtkoA4clEDScOIGrr2 yFtZTM9O6H9kJedkHEvgxWP6Fg8xK+dh+8YWGMkopR9/E9dRi1firRSCMoTsGd3OBy/c NWlX4T90HDlilEE+aVeYfNUvxBJVPLLmTBkQ8hkbXTUhEPUHO1YmP5nS90J8Y136oB5a tErw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=koEaX2WE3ZBls9EXsPoMftPSIHHrvv/SRUgkNf2FbOU=; b=sW0KhmgFZBahmuM3IFqILYxiIgyp11qCJaZQqg5NA76rHtrBi4vECFnYv8n2sSIKdT jVyECyHvvQ2KHJZRjXOqFNb29oKm+zi6PMkfg/+St2Ot3Jevp882ALOBCo7wMeKUbDkq f8d4Svx0eLJ9vJMAbzklYzOC8GwWAnm4FTlEy0na4A86Y/+t3QVn3nVcjNRZ3rGcKT65 Gt+hp4cXIkTdveSqlRxAx6AEepWTEF7rAfmVSxiHoZgfArjTNj7hR7wOwhO7CnBLCkRC CLlV4WHCrxbJorV5d0BDpoVZavteX2t6v8aomptyDMgpqXxq02UhCDtYvDPfA4bn5yba hWpg== X-Gm-Message-State: AGRZ1gJo4bqqmg7LXGVc2rPZKvYVj4M0gkpumBDOyhb/4kBCLnjoQkGt BHZrpdqSbv8zhbeS/Y3XNrJUls/k9aWiJrdzi6k= X-Received: by 2002:a67:3144:: with SMTP id x65mr953819vsx.186.1540978849675; Wed, 31 Oct 2018 02:40:49 -0700 (PDT) MIME-Version: 1.0 References: <20181025183739.9375-1-robert.foss@collabora.com> <20181025183739.9375-5-robert.foss@collabora.com> In-Reply-To: <20181025183739.9375-5-robert.foss@collabora.com> From: Emil Velikov Date: Wed, 31 Oct 2018 09:39:31 +0000 Message-ID: Subject: Re: [PATCH 4/5] drm/virtio: add out-fences support for explicit synchronization To: Robert Foss Cc: David Airlie , Gerd Hoffmann , ML dri-devel , "open list:VIRTIO GPU DRIVER" , "Linux-Kernel@Vger. Kernel. Org" , Rob Herring , Gustavo Padovan , Emil Velikov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rob, On Thu, 25 Oct 2018 at 19:38, Robert Foss wrote: > > From: Gustavo Padovan > > On the out-fence side we get fence returned by the submitted draw call > and attach it to a sync_file and send the sync_file fd to userspace. On > error -1 is returned to userspace. > Can we have both an IN and OUT fence at the same time? Either way, please mention that in the commit message. > Signed-off-by: Gustavo Padovan > Signed-off-by: Robert Foss > Suggested-by: Rob Herring > --- > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 50 +++++++++++++++++++------- > 1 file changed, 38 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c > index 0368195966aa..32e714a1c753 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c > +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c > @@ -106,7 +106,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, > struct virtio_gpu_device *vgdev = dev->dev_private; > struct virtio_gpu_fpriv *vfpriv = drm_file->driver_priv; > struct drm_gem_object *gobj; > - struct virtio_gpu_fence *fence; > + struct virtio_gpu_fence *out_fence; > struct virtio_gpu_object *qobj; > int ret; > uint32_t *bo_handles = NULL; > @@ -116,7 +116,9 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, > int i; > struct ww_acquire_ctx ticket; > struct dma_fence *in_fence = NULL; > + struct sync_file *sync_file; > int in_fence_fd = exbuf->fence_fd; > + int out_fence_fd = -1; > void *buf; > > exbuf->fence_fd = -1; > @@ -143,6 +145,14 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, > } > } > > + if (exbuf->flags & VIRTGPU_EXECBUF_FENCE_FD_OUT) { > + out_fence_fd = get_unused_fd_flags(O_CLOEXEC); > + if (out_fence_fd < 0) { > + ret = out_fence_fd; > + goto out_in_fence; > + } > + } > + If the answer to the above is "no" we want a check around here. With that the patch is Reviewed-by: Emil Velikov -Emil