[Intel-gfx] [PATCH 40/59] drm/vram-helper: Drop drm_gem_prime_export/import

Thomas Zimmermann tzimmermann at suse.de
Thu Jun 27 08:27:32 UTC 2019


Hi

Am 17.06.19 um 15:59 schrieb Daniel Vetter:
> On Mon, Jun 17, 2019 at 10:24:38AM +0200, Gerd Hoffmann wrote:
>>   Hi,
>>
>>> Aside: Would be really nice to switch the others over to
>>> drm_gem_object_funcs.
>>
>> While most callbacks are pretty straight forward (just hook the same
>> callbacks into the drm_gem_object_funcs. struct) the mmap bits are a
>> bit more obscure.
>>
>> First, there seem to be two ways to mmap a gem buffer:
>>
>>   (1) drm_driver->fops->mmap, and
>>   (2) drm_driver->gem_prime_mmap.
>>
>> drm_gem_object_funcs has just a single vm_ops ...
>>
>> Also it is not obvious how one would convert something which basically
>> calls ttm_bo_mmap() in drm_driver->fops->mmap to the new interface.
> 
> Yeah the mmap side is still a mess, but my series here was getting a bit
> too long already. There's a bunch of problems here:
> 
> drm_driver->gem_prime_mmap could be nuked and instead we use
> drm_gem_prime_mmap everywhere. Especially the various versions in helpers
> really don't add much.
> 
> The trouble is that removing the hook outright isn't quite right, because
> it also signals "is mmap allowed on this dma-buf". I'm kinda tempted to
> just make that a hard requirement, and force people who can't support mmap
> on the dma-buf (or who need begin/end_cpu_access hooks) to supply their
> own set of dma_buf_ops.
> 
> Second one is drm_driver->fops->mmap. That one we need to keep, but this
> isn't mmap on a buffer, but mmap on the entire drm_device. The one which
> should be replaced by drm_gem_object_funcs.vm_ops is
> drm_driver->gem_vm_ops.

From what I've seen in fbdev drivers, it's an mmap of the framebuffer
memory, which typically is the same as the device's memory but doesn't
have to. And it's only valid for/while the current display mode (e.g.,
mgafb doesn't set fixes.smem_length until you configure a mode).

I guess it should be legal to just mmap the shadow FB from the fbcon
emulation.

Best regards
Thomas

> Hope that explains a bit better what's going on here. Step one here for
> mmap is definitely to roll out drm_gem_prime_mmap as far as possible, so
> it's easier to understand where the exceptions are.
> 
> Cheers, Daniel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20190627/e26f68c0/attachment.sig>


More information about the Intel-gfx mailing list