[RFC PATCH] drm/gem: Warn on illegal use of the dumb buffer interface

Daniel Vetter daniel at ffwll.ch
Wed Nov 12 06:29:55 PST 2014


On Wed, Nov 12, 2014 at 12:55:32PM +0100, Thomas Hellstrom wrote:
> It happens on occasion that developers of generic user-space applications
> abuse the dumb buffer API to get hold of drm buffers that they can both
> mmap() and use for GPU acceleration, using the assumptions that dumb buffers
> and buffers available for GPU are
> a) The same type and can be aribtrarily type-casted.
> b) fully coherent.
> 
> This patch makes the most widely used drivers warn nicely when that happens,
> the next step will be to fail.

Yeah, makes sense to enforce a bit of sanity here. Not sure whether the
armsoc folks have already terminally screwed this up though :(

> Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
> ---
> Patch is only compile-tested.
> FWIW vmware should typically fail on these errors.

At first I wanted to drop a bikeshed about the new bool arguments (since
they tend to make the code harder to read). But looking closer we can't
remove it from create because that would cause races (by setting it
afterwards) and for the mmap offset handling the code would end up rather
more ugly I think.

So Acked-by: Daniel Vetter <daniel.vetter at ffwll.ch> on the patch and i915
parts.
-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