[PATCH 06/20] drm/gem: inline drm_gem_object_handle_reference

Rob Clark robdclark at gmail.com
Tue Jul 23 05:07:47 PDT 2013


On Tue, Jul 16, 2013 at 3:11 AM, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> Only one callsite and since ->handle_count is not a simple reference
> count (it can resurrect) it's imo better to be explicit about things
> than hide the refcount dance.

I'm not really sure I like this one.. I guess it could be that I'm
just used to the handle-ref stuff, so it doesn't seem odd not-inlined.
 And it does seem kinda odd / unsymmetric to have an unref w/out a
ref.  I guess I kinda like the bikeshed's current color in this case.

BR,
-R

> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  drivers/gpu/drm/drm_gem.c | 3 ++-
>  include/drm/drmP.h        | 7 -------
>  2 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 603f256..7bcd851 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -280,7 +280,8 @@ drm_gem_handle_create(struct drm_file *file_priv,
>                 return ret;
>         *handlep = ret;
>
> -       drm_gem_object_handle_reference(obj);
> +       drm_gem_object_reference(obj);
> +       atomic_inc(&obj->handle_count);
>
>         if (dev->driver->gem_open_object) {
>                 ret = dev->driver->gem_open_object(obj, file_priv);
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index f949cb2..114db57 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -1664,13 +1664,6 @@ int drm_gem_handle_create(struct drm_file *file_priv,
>  int drm_gem_handle_delete(struct drm_file *filp, u32 handle);
>
>  static inline void
> -drm_gem_object_handle_reference(struct drm_gem_object *obj)
> -{
> -       drm_gem_object_reference(obj);
> -       atomic_inc(&obj->handle_count);
> -}
> -
> -static inline void
>  drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
>  {
>         if (obj == NULL)
> --
> 1.8.3.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list