[PATCH v3 1/3] drm: add prime helpers

Daniel Vetter daniel at ffwll.ch
Fri Apr 12 11:53:51 PDT 2013


On Fri, Apr 12, 2013 at 5:13 PM, Aaron Plattner <aplattner at nvidia.com> wrote:
>>> @@ -117,6 +249,58 @@ int drm_gem_prime_handle_to_fd(struct drm_device
>>> *dev,
>>>   }
>>>   EXPORT_SYMBOL(drm_gem_prime_handle_to_fd);
>>>
>>> +struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
>>> +                                         struct dma_buf *dma_buf)
>>> +{
>>> +     struct dma_buf_attachment *attach;
>>> +     struct sg_table *sgt;
>>> +     struct drm_gem_object *obj;
>>> +     int ret;
>>> +
>>> +     if (!dev->driver->gem_prime_import_sg_table)
>>> +             return ERR_PTR(-EINVAL);
>>> +
>>> +     if (dma_buf->ops == &drm_gem_prime_dmabuf_ops) {
>>
>>
>> This here breaks self-import checks since it smashes all buffers from all
>> drivers using these helpers into one set. Which means e.g. nouveau will
>> happily import a buffer from radoen as it's own. The only reason afaics
>> that shit didn't completely hit the fan is that i915 still has it's own
>> buffer ops, and everyone seems to only care about sharing with i915.
>
>
> Doesn't the (obj->dev == dev) check below guard against that?

Oh dear did I just make a big idiot out of myself ;-) Sorry for the
fuss, you're right.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list