From: Simon Farnsworth Subject: Re: [PATCH] drm/radeon: Add support for userspace fence waits Date: Tue, 31 Jan 2012 14:49:01 +0000 Message-ID: <201201311449.05721.simon.farnsworth@onelan.co.uk> References: <201201311316.46745.simon.farnsworth@onelan.co.uk> <1328015882-14139-1-git-send-email-simon.farnsworth@onelan.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1491486731==" Return-path: Received: from claranet-outbound-smtp04.uk.clara.net (claranet-outbound-smtp04.uk.clara.net [195.8.89.37]) by gabe.freedesktop.org (Postfix) with ESMTP id E944A9E864 for ; Tue, 31 Jan 2012 06:49:07 -0800 (PST) In-Reply-To: <1328015882-14139-1-git-send-email-simon.farnsworth@onelan.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1491486731== Content-Type: multipart/signed; boundary="nextPart2175598.fMhaQt8KBi"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart2175598.fMhaQt8KBi Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Alex Deucher pointed out an error on IRC; I'm not using radeon_irq_kms_sw_irq_get and put to manage the IRQ enablement. I've fixed this up (as per the partial hunk below), and my bug goes away. I will be cleaning these patches up for proper submission. Simon On Tuesday 31 January 2012, Simon Farnsworth wrote: > +int radeon_gem_wait_user_fence_ioctl(struct drm_device *dev, void *data, > + struct drm_file *filp) > +{ > + struct drm_radeon_gem_wait_user_fence *args =3D data; > + struct radeon_device *rdev =3D dev->dev_private; > + struct drm_gem_object *gobj; > + struct radeon_bo *robj; > + void *buffer_data; > + uint32_t *fence_data; > + int r =3D 0; > + long timeout; > + > + printk( KERN_INFO "wait_user_fence offset %lld value %d timeout %lld\n"= , args->offset, args->value, args->timeout_usec ); > + > + gobj =3D drm_gem_object_lookup(dev, filp, args->handle); > + if (gobj =3D=3D NULL) { > + return -ENOENT; > + } > + robj =3D gem_to_radeon_bo(gobj); > + > + if (gobj->size < args->offset) { > + printk( KERN_INFO "Offset too large\n" ); > + r =3D -EINVAL; > + goto unreference; > + } > + > + r =3D radeon_bo_reserve(robj, true); > + if (r) { > + printk( KERN_INFO "Reserve fail\n" ); > + goto unreference; > + } > + > + r =3D radeon_bo_pin(robj, RADEON_GEM_DOMAIN_GTT, NULL); > + if (r) { > + printk( KERN_INFO "Pin fail\n" ); > + goto unreserve; > + } > + > + r =3D radeon_bo_kmap(robj, &buffer_data); > + if (r) { > + printk( KERN_INFO "kmap fail\n" ); > + goto unpin; > + } > + Missing radeon_irq_kms_sw_irq_get(rdev, RADEON_RING_TYPE_GFX_INDEX); here > + fence_data =3D (uint32_t*)buffer_data; > + > + printk( KERN_INFO "Current data value %d\n", fence_data[args->offset >>= 2] ); > + > + timeout =3D wait_event_interruptible_timeout(rdev->userspace_fence_wait= _queue, > + fence_data[args->offset >> 2] !=3D args->value, > + usecs_to_jiffies(args->timeout_usec)); And missing radeon_irq_kms_sw_irq_put(rdev, RADEON_RING_TYPE_GFX_INDEX); he= re. > + if (timeout =3D=3D 0) > + r =3D -ETIMEDOUT; > + else if (timeout < 0) > + r =3D timeout; > + > + printk( KERN_INFO "wait_user_fence offset %lld value %d timeout %lld\n"= , args->offset, args->value, args->timeout_usec ); > + printk( KERN_INFO "Finished data value %d\n", fence_data[args->offset >= > 2] ); > + > + radeon_bo_kunmap(robj); > +unpin: > + radeon_bo_unpin(robj); > +unreserve: > + radeon_bo_unreserve(robj); > +unreference: > + drm_gem_object_unreference_unlocked(gobj); > + > + return r; > +} =2D-=20 Simon Farnsworth Software Engineer ONELAN Limited http://www.onelan.com/ --nextPart2175598.fMhaQt8KBi Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iQEcBAABAgAGBQJPJ/9hAAoJEIKsye9/dtRWnKsIAITpCEnc/91/b3S78jQeOFqA UU/xc/Y+PfCGDC/Ph/RjXA0iM+3j8E8E/W+GCOwMC3O9KT2UGqqRz3CubBs8bczp tJ/2vsuCuF8w/faZiK39rdlpq0hFiaTeuIbVQiz+HC29XYPVtHSpkuUL5D/iy2Tr 548UB6bXKD9hS7b5e2UBNfP9mpNavxQ/3jxCzGV2bddFLvjQw4ihfp1l4IxHshwd rBu9H3uh4A2uP3GMeS2NfhMTnZ0AWQ6Plba0sRO0LLsx6ZepUDOyXn6JY/9kufhw RauD6lFTCXmR18GhcMftuwpUQaaJknA2QWF+eG7AWq3bsgQYfZSWVeGBZ1LIJNk= =lvAW -----END PGP SIGNATURE----- --nextPart2175598.fMhaQt8KBi-- --===============1491486731== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1491486731==--