[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <21d7e9970912031610s26055089o30a4c2824f50dbf3@mail.gmail.com>
Date: Fri, 4 Dec 2009 10:10:23 +1000
From: Dave Airlie <airlied@...il.com>
To: Jerome Glisse <jglisse@...hat.com>
Cc: dri-devel@...ts.sf.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] drm/radeon/kms: Rework radeon object handling
On Fri, Nov 20, 2009 at 11:29 PM, Jerome Glisse <jglisse@...hat.com> wrote:
> The locking & protection of radeon object was somewhat messy.
> This patch completely rework it to now use ttm reserve as a
> protection for the radeon object structure member. It also
> shrink down the various radeon object structure by removing
> field which were redondant with the ttm information. Last it
> converts few simple functions to inline which should with
> performances.
>
> Signed-off-by: Jerome Glisse <jglisse@...hat.com>
>
> int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
> @@ -264,7 +261,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
> {
> struct drm_radeon_gem_busy *args = data;
> struct drm_gem_object *gobj;
> - struct radeon_object *robj;
> + struct radeon_bo *robj;
> int r;
> uint32_t cur_placement;
>
> @@ -273,7 +270,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
> return -EINVAL;
> }
> robj = gobj->driver_private;
> - r = radeon_object_busy_domain(robj, &cur_placement);
> + r = radeon_bo_wait(robj, &cur_placement, true);
Here we pass an uninitialised cur_placement to busy ioctl.
> +static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
> + bool no_wait)
> +{
> + int r;
> +
> +retry:
> + r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
> + if (unlikely(r != 0)) {
> + if (r == -ERESTART)
> + goto retry;
> + dev_err(bo->rdev->dev, "%p reserve failed for wait\n", bo);
> + return r;
> + }
> + spin_lock(&bo->tbo.lock);
> + if (mem_type)
> + *mem_type = bo->tbo.mem.mem_type;
> + if (bo->tbo.sync_obj)
> + r = ttm_bo_wait(&bo->tbo, true, true, no_wait);
> + spin_unlock(&bo->tbo.lock);
> + ttm_bo_unreserve(&bo->tbo);
> + if (unlikely(r == -ERESTART))
> + goto retry;
> + return r;
> +}
If this return early mem_type never gets set to anything useful.
The compiler warns on this here.
Can you send a fix up patch as I've merged this to drm-radeon-next already.
Dave.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists