From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Anholt Subject: Re: [PATCH 2/4] drm/vc4: Syncobj import support Date: Mon, 23 Apr 2018 11:59:37 -0700 Message-ID: <87d0yp4uli.fsf@anholt.net> References: <20180421225022.7592-1-stschake@gmail.com> <20180421225022.7592-3-stschake@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1941985636==" Return-path: Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id AF5D96E2D6 for ; Mon, 23 Apr 2018 18:59:40 +0000 (UTC) In-Reply-To: <20180421225022.7592-3-stschake@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Cc: airlied@linux.ie, linux-rpi-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Stefan Schake List-Id: dri-devel@lists.freedesktop.org --===============1941985636== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Stefan Schake writes: > Allow userland to specify a syncobj that is waited on before a render job > starts processing. > > Signed-off-by: Stefan Schake > --- > drivers/gpu/drm/vc4/vc4_drv.h | 2 ++ > drivers/gpu/drm/vc4/vc4_gem.c | 33 +++++++++++++++++++++++++++------ > include/uapi/drm/vc4_drm.h | 9 +++++---- > 3 files changed, 34 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h > index 4288615b66a2..3105df99cb12 100644 > --- a/drivers/gpu/drm/vc4/vc4_drv.h > +++ b/drivers/gpu/drm/vc4/vc4_drv.h > @@ -10,6 +10,8 @@ > #include > #include > #include > +#include > + Drop the extra \n? > #include "uapi/drm/vc4_drm.h" >=20=20 > diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c > index 2107b0daf8ef..232363488125 100644 > --- a/drivers/gpu/drm/vc4/vc4_gem.c > +++ b/drivers/gpu/drm/vc4/vc4_gem.c > @@ -27,6 +27,7 @@ > #include > #include > #include > +#include >=20=20 > #include "uapi/drm/vc4_drm.h" > #include "vc4_drv.h" > @@ -1115,21 +1116,18 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void = *data, > struct drm_vc4_submit_cl *args =3D data; > struct vc4_exec_info *exec; > struct ww_acquire_ctx acquire_ctx; > + struct dma_fence *in_fence; > int ret =3D 0; >=20=20 > if ((args->flags & ~(VC4_SUBMIT_CL_USE_CLEAR_COLOR | > VC4_SUBMIT_CL_FIXED_RCL_ORDER | > VC4_SUBMIT_CL_RCL_ORDER_INCREASING_X | > - VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y)) !=3D 0) { > + VC4_SUBMIT_CL_RCL_ORDER_INCREASING_Y | > + VC4_SUBMIT_CL_IMPORT_SYNCOBJ)) !=3D 0) { > DRM_DEBUG("Unknown flags: 0x%02x\n", args->flags); > return -EINVAL; > } >=20=20 > - if (args->pad2 !=3D 0) { > - DRM_DEBUG("->pad2 must be set to zero\n"); > - return -EINVAL; > - } > - > exec =3D kcalloc(1, sizeof(*exec), GFP_KERNEL); > if (!exec) { > DRM_ERROR("malloc failure on exec struct\n"); > @@ -1164,6 +1162,29 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *= data, > } > } >=20=20 > + if (args->flags & VC4_SUBMIT_CL_IMPORT_SYNCOBJ) { > + ret =3D drm_syncobj_find_fence(file_priv, args->in_sync, > + &in_fence); > + if (ret) > + goto fail; > + > + /* When the fence (or fence array) is exclusively from our > + * context we can skip the wait since jobs are executed in > + * order of their submission through this ioctl and this can > + * only have fences from a prior job. > + */ > + if (!dma_fence_match_context(in_fence, > + vc4->dma_fence_context)) { > + ret =3D dma_fence_wait(in_fence, true); > + if (ret) { > + dma_fence_put(in_fence); > + goto fail; > + } > + } > + > + dma_fence_put(in_fence); > + } I don't think we need an extra flag here. 0 is an invalid syncobj handle, so that could be the indication that there's no input syncobj. Long term, we should probably only block once we're ready to exec the job, not at submit time. However, I think we can wait on fixing that until we start using the GPU scheduler. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlreLRoACgkQtdYpNtH8 nuhB3g//Wh4+9t3LSM1xF09pt6pDhJFwwqOiucOmh3k/VeY/aa7bFbi1q+3nePz0 FWM8WTiWMrsDJyAawHhzYymgb3WQDwcC8ZR5SZG13aBui/+t73g2cE3Z2gB5fIWH 6ABlWmTqVM7LnBBa1NOIiFeEkIAnAZ7xJgc1jAduFccYYFLvF8Z9itVBkj74d7sN iUhPEyTFIyHAqNcEHrxPn359PSv1QhBTmArLcMvi38WK6q13cc4zak94L7dtWrTN pXozjCW+2CjCL6fJxvXDpQSIYCgBzywYaJ3fVOOvQ9RrvN9zBlDH6DniNvfDiaA9 54fYR7FaMLol914IlsC4SvlBv254aT+H42fLUJpfK+EZ9dV47S79LuzQNzDqRQ2I P8NxgQOig/TNg6hozSKytcYAt5g8tJmJIENQeG15yh2JjtdpkLwLsBoOG/9WggHv XLyoeAktbygxl5PA/ov4WpbboRJ8nK0XVtkXehBH7gx166ladfgJdwdDJtJWb74M yoYlJrCQK7lo6d2AQrBNNZ3ynTsGwsDhgnbE7Qu9dqJFJcWF/rpfe8M/ezVNq/wv y3sn0CXYYqUefOuHnPfCTHJwvwlNeHQuwi1ty5Ulsi/rfhU18xbxqnOf5tKTfeEh njgFxZ4joq4WPJY1jlyb4i3j1BU4CK/7Zb14x4BKYZhm+BCvkIc= =1Aja -----END PGP SIGNATURE----- --=-=-=-- --===============1941985636== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1941985636==--