[RFC][PATCH 0/8] Support I/O memory in generic fbdev emulation

Daniel Vetter daniel at ffwll.ch
Wed Nov 6 10:05:12 UTC 2019


On Wed, Nov 06, 2019 at 10:31:13AM +0100, Thomas Zimmermann wrote:
> We recently had a discussion if/how fbdev emulation could support
> framebuffers in I/O memory on all platform. [1]
> 
> I typed up a patchset that passes information about the memory area
> from memory manager to client (e.g., fbdev emulation). The client can
> take this into consideration when accessing the framebuffer.
> 
> The alternative proposal is to introduce a separate vmap() call that
> only returns I/O memorym or NULL if the framebuffer is not in I/O
> memory. AFAICS the benefit of this idea is the cleaner interface and
> the ability to modify drivers one by one. The drawback is some additional
> boilerplate code in drivers and clients.

Imo we need the correct types, to let sparse check this stuff for us.
Otherwise this is just going to be whack-a-mole, since on x86 (and I think
also on arm) there's not really a difference between iomem and system
memory.

One idea I had is to do a new opaque pointer struct, and _lots_ of new
functions to handle it. Unfortunately that means no more pointer
arithmetic on that pointer (this isn't C++):

	struct opaque_dev_ptr {
		union { void * __iomem; void * smem; };
		bool is_iomem;
	};

So really it's a _lot_ of work.

The other issue is that we also need to fix the dma-buf interfaces. Which
is going to be even more work.

All that for gain I'm not really sure is worth it - I don't even know
which platforms we're fixing with this.
-Daniel

> 
> [1] https://lists.freedesktop.org/archives/dri-devel/2019-November/242464.html
> 
> Thomas Zimmermann (8):
>   drm/vram-helper: Tell caller if vmap() returned I/O memory
>   drm/qxl: Tell caller if kmap() returned I/O memory
>   drm: Add is_iomem return parameter to struct drm_gem_object_funcs.vmap
>   drm/gem: Return I/O-memory flag from drm_gem_vram()
>   drm/client: Return I/O memory flag from drm_client_buffer_vmap()
>   fbdev: Export default read and write operations as
>     fb_cfb_{read,write}()
>   drm/fb-helper: Select between fb_{sys,cfb}_read() and _write()
>   drm/fb-helper: Handle I/O memory correctly when flushing shadow fb
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c |   6 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h |   2 +-
>  drivers/gpu/drm/ast/ast_mode.c              |   6 +-
>  drivers/gpu/drm/cirrus/cirrus.c             |   2 +-
>  drivers/gpu/drm/drm_client.c                |  15 ++-
>  drivers/gpu/drm/drm_fb_helper.c             | 118 ++++++++++++++++++--
>  drivers/gpu/drm/drm_gem.c                   |   9 +-
>  drivers/gpu/drm/drm_gem_cma_helper.c        |   7 +-
>  drivers/gpu/drm/drm_gem_shmem_helper.c      |  12 +-
>  drivers/gpu/drm/drm_gem_vram_helper.c       |  13 ++-
>  drivers/gpu/drm/drm_internal.h              |   2 +-
>  drivers/gpu/drm/drm_prime.c                 |   2 +-
>  drivers/gpu/drm/etnaviv/etnaviv_drv.h       |   2 +-
>  drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c |   4 +-
>  drivers/gpu/drm/mgag200/mgag200_cursor.c    |   4 +-
>  drivers/gpu/drm/nouveau/nouveau_gem.h       |   2 +-
>  drivers/gpu/drm/nouveau/nouveau_prime.c     |   4 +-
>  drivers/gpu/drm/panfrost/panfrost_perfcnt.c |   2 +-
>  drivers/gpu/drm/qxl/qxl_display.c           |   6 +-
>  drivers/gpu/drm/qxl/qxl_draw.c              |   4 +-
>  drivers/gpu/drm/qxl/qxl_drv.h               |   4 +-
>  drivers/gpu/drm/qxl/qxl_object.c            |   7 +-
>  drivers/gpu/drm/qxl/qxl_object.h            |   2 +-
>  drivers/gpu/drm/qxl/qxl_prime.c             |   4 +-
>  drivers/gpu/drm/radeon/radeon_drv.c         |   2 +-
>  drivers/gpu/drm/radeon/radeon_prime.c       |   4 +-
>  drivers/gpu/drm/tiny/gm12u320.c             |   2 +-
>  drivers/gpu/drm/vc4/vc4_bo.c                |   4 +-
>  drivers/gpu/drm/vc4/vc4_drv.h               |   2 +-
>  drivers/gpu/drm/vgem/vgem_drv.c             |   5 +-
>  drivers/gpu/drm/xen/xen_drm_front_gem.c     |   6 +-
>  drivers/gpu/drm/xen/xen_drm_front_gem.h     |   3 +-
>  drivers/video/fbdev/core/fbmem.c            |  53 +++++++--
>  include/drm/drm_client.h                    |   7 +-
>  include/drm/drm_drv.h                       |   2 +-
>  include/drm/drm_fb_helper.h                 |  14 +++
>  include/drm/drm_gem.h                       |   2 +-
>  include/drm/drm_gem_cma_helper.h            |   2 +-
>  include/drm/drm_gem_shmem_helper.h          |   2 +-
>  include/drm/drm_gem_vram_helper.h           |   2 +-
>  include/linux/fb.h                          |   5 +
>  41 files changed, 278 insertions(+), 78 deletions(-)
> 
> -- 
> 2.23.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list