On Wed, Jun 08, 2016 at 11:14:23AM +0200, Daniel Vetter wrote:
> On Fri, Jun 03, 2016 at 05:36:38PM +0100, Chris Wilson wrote:
> >  static inline struct drm_i915_gem_request *
> > +to_request(struct fence *fence)
> > +{
> > +   /* We assume that NULL fence/request are interoperable */
> > +   BUILD_BUG_ON(offsetof(struct drm_i915_gem_request, fence) != 0);
> > +   return container_of(fence, struct drm_i915_gem_request, fence);
> 
> For future-proofing to make sure we don't accidentally call this on a
> foreign fence:
> 
>       BUG_ON(fence->ops != i915_fence_ops);
> 
> BUG_ON since I don't want to splatter all callers with handlers for this.
> And if we ever get this wrong debugging it with just some randomy
> corruption would be serious pain, so I think the overhead is justified.

How about I just remove the function? It is only used on known requests
today, or call it __to_request_from_fence() ?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to