klogg / fl2000_drm

Linux kernel FL2000DX/IT66121FN dongle DRM driver
GNU General Public License v2.0
113 stars 30 forks source link

Compilation fails at fl2000_gem_prime_vunmap/fl2000_gem_prime_vmap: Missing dma_buf_map (kernel 5.11.0) #44

Open MarcelWaldvogel opened 3 years ago

MarcelWaldvogel commented 3 years ago

Compiling on Ubuntu 21.04 (Kernel 5.11.0-18), I get the following errors:

  CC [M]  /tmp/fl2000_drm/fl2000_gem.o
/tmp/fl2000_drm/fl2000_gem.c:270:10: error: initialization of ‘int (*)(struct drm_gem_object *, struct dma_buf_map *)’ from incompatible pointer type ‘void * (*)(struct drm_gem_object *)’ [-Werror=incompatible-pointer-types]
  270 |  .vmap = fl2000_gem_prime_vmap,
      |          ^~~~~~~~~~~~~~~~~~~~~
/tmp/fl2000_drm/fl2000_gem.c:270:10: note: (near initialization for ‘fl2000_gem_default_funcs.vmap’)
/tmp/fl2000_drm/fl2000_gem.c:271:12: error: initialization of ‘void (*)(struct drm_gem_object *, struct dma_buf_map *)’ from incompatible pointer type ‘void (*)(struct drm_gem_object *, void *)’ [-Werror=incompatible-pointer-types]
  271 |  .vunmap = fl2000_gem_prime_vunmap,
      |            ^~~~~~~~~~~~~~~~~~~~~~~
/tmp/fl2000_drm/fl2000_gem.c:271:12: note: (near initialization for ‘fl2000_gem_default_funcs.vunmap’)
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:287: /tmp/fl2000_drm/fl2000_gem.o] Error 1

It seems that an additional dma_buf_map parameter is required.

pedrobritobr commented 3 years ago

Same error here, mint 20.2 kernel 5.11

m-anwr commented 3 years ago

@MarcelWaldvogel Any updates on this issue?

davidnilo commented 3 years ago

Same issue with:

mmarjano commented 3 years ago

Same issue with:

derco0n commented 2 years ago

Seems like there has been a change in the linux-kernel from version 5.10.x to 5.11.x:

5.10.x: void (vmap)(struct drm_gem_object obj); void (vunmap)(struct drm_gem_object obj, void vaddr);

5.11.x: int (vmap)(struct drm_gem_object obj, struct dma_buf_map map); void (vunmap)(struct drm_gem_object obj, struct dma_buf_map map);

it looks like from 5.11 on there is a pointer to an dma_buf_map-struct instead of a pointer to an address (assumingly integer) required...

https://elixir.bootlin.com/linux/v5.10.82/source/include/drm/drm_gem.h https://elixir.bootlin.com/linux/v5.11.14/source/include/drm/drm_gem.h

Looks like at least, this commit is involved: https://patchwork.kernel.org/project/linux-media/patch/20201028193521.2489-9-tzimmermann@suse.de/

dim6003 commented 2 years ago

Tried to fix these errors in files fl2000_gem.c and fl2000.h, but then more errors arise in fl2000_drm.c. Not an expert at this, and I don't know this code, so stopping there, but interested in solution either.

ubuntu@ubuntu:~/Documents/klogg/fl2000_drm$ make
make CHECK="/usr/bin/sparse" -C /lib/modules/5.11.0-27-generic/build M=/home/ubuntu/Documents/klogg/fl2000_drm modules
make[1] : on entre dans le répertoire « /usr/src/linux-headers-5.11.0-27-generic »
  CC [M]  /home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drv.o
  CC [M]  /home/ubuntu/Documents/klogg/fl2000_drm/fl2000_registers.o
  CC [M]  /home/ubuntu/Documents/klogg/fl2000_drm/fl2000_interrupt.o
  CC [M]  /home/ubuntu/Documents/klogg/fl2000_drm/fl2000_streaming.o
  CC [M]  /home/ubuntu/Documents/klogg/fl2000_drm/fl2000_i2c.o
  CC [M]  /home/ubuntu/Documents/klogg/fl2000_drm/fl2000_gem.o
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_gem.c: In function ‘fl2000_gem_prime_vmap’:
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_gem.c:259:12: warning: returning ‘void *’ from a function with return type ‘int’ makes integer from pointer without a cast [-Wint-conversion]
  259 |  return obj->vaddr;
      |         ~~~^~~~~~~
  CC [M]  /home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.o
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:129:3: error: ‘struct drm_driver’ has no member named ‘gem_free_object_unlocked’
  129 |  .gem_free_object_unlocked = fl2000_gem_free,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:129:30: error: initialization of ‘int (*)(struct drm_device *, struct drm_file *, uint32_t,  uint32_t,  int *)’ {aka ‘int (*)(struct drm_device *, struct drm_file *, unsigned int,  unsigned int,  int *)’} from incompatible pointer type ‘void (*)(struct drm_gem_object *)’ [-Werror=incompatible-pointer-types]
  129 |  .gem_free_object_unlocked = fl2000_gem_free,
      |                              ^~~~~~~~~~~~~~~
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:129:30: note: (near initialization for ‘fl2000_drm_driver.prime_handle_to_fd’)
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:130:3: error: ‘struct drm_driver’ has no member named ‘gem_vm_ops’
  130 |  .gem_vm_ops = &fl2000_gem_vm_ops,
      |   ^~~~~~~~~~
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:130:16: error: initialization of ‘int (*)(struct drm_device *, struct drm_file *, int,  uint32_t *)’ {aka ‘int (*)(struct drm_device *, struct drm_file *, int,  unsigned int *)’} from incompatible pointer type ‘const struct vm_operations_struct *’ [-Werror=incompatible-pointer-types]
  130 |  .gem_vm_ops = &fl2000_gem_vm_ops,
      |                ^
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:130:16: note: (near initialization for ‘fl2000_drm_driver.prime_fd_to_handle’)
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:131:3: error: ‘struct drm_driver’ has no member named ‘gem_prime_get_sg_table’; did you mean ‘gem_prime_import_sg_table’?
  131 |  .gem_prime_get_sg_table = fl2000_gem_prime_get_sg_table,
      |   ^~~~~~~~~~~~~~~~~~~~~~
      |   gem_prime_import_sg_table
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:131:28: error: initialization of ‘struct drm_gem_object * (*)(struct drm_device *, struct dma_buf *)’ from incompatible pointer type ‘struct sg_table * (*)(struct drm_gem_object *)’ [-Werror=incompatible-pointer-types]
  131 |  .gem_prime_get_sg_table = fl2000_gem_prime_get_sg_table,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:131:28: note: (near initialization for ‘fl2000_drm_driver.gem_prime_import’)
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:132:3: error: ‘struct drm_driver’ has no member named ‘gem_prime_vmap’; did you mean ‘gem_prime_mmap’?
  132 |  .gem_prime_vmap = fl2000_gem_prime_vmap,
      |   ^~~~~~~~~~~~~~
      |   gem_prime_mmap
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:132:20: error: initialization of ‘struct drm_gem_object * (*)(struct drm_device *, struct dma_buf_attachment *, struct sg_table *)’ from incompatible pointer type ‘int (*)(struct drm_gem_object *, struct dma_buf_map *)’ [-Werror=incompatible-pointer-types]
  132 |  .gem_prime_vmap = fl2000_gem_prime_vmap,
      |                    ^~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:132:20: note: (near initialization for ‘fl2000_drm_driver.gem_prime_import_sg_table’)
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:133:3: error: ‘struct drm_driver’ has no member named ‘gem_prime_vunmap’; did you mean ‘gem_prime_mmap’?
  133 |  .gem_prime_vunmap = fl2000_gem_prime_vunmap,
      |   ^~~~~~~~~~~~~~~~
      |   gem_prime_mmap
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:133:22: error: initialization of ‘int (*)(struct drm_gem_object *, struct vm_area_struct *)’ from incompatible pointer type ‘void (*)(struct drm_gem_object *, struct dma_buf_map *)’ [-Werror=incompatible-pointer-types]
  133 |  .gem_prime_vunmap = fl2000_gem_prime_vunmap,
      |                      ^~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.c:133:22: note: (near initialization for ‘fl2000_drm_driver.gem_prime_mmap’)
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:287 : /home/ubuntu/Documents/klogg/fl2000_drm/fl2000_drm.o] Erreur 1
make[1]: *** [Makefile:1848 : /home/ubuntu/Documents/klogg/fl2000_drm] Erreur 2
make[1] : on quitte le répertoire « /usr/src/linux-headers-5.11.0-27-generic »
make: *** [Makefile:21 : modules] Erreur 2

by the way, in case someone is interested in my changes in the 1st two files, they're attached as zip : just cosmetics so that it compiles fl2000_dm.zip !