Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.11.0-rc1 Building #249

Closed
sickcodes opened this issue Jan 3, 2021 · 89 comments
Closed

5.11.0-rc1 Building #249

sickcodes opened this issue Jan 3, 2021 · 89 comments

Comments

@sickcodes
Copy link
Contributor

Ready and able to test!

origin/devel

[user@hostname evdi]$ make
CFLAGS="-Werror -Wextra -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-error=missing-field-initializers " make -C module 
make[1]: Entering directory './evdi/module'
make -C /lib/modules/5.11.0-rc1-1-git-00073-g3516bd729358/build M=$PWD
make[2]: Entering directory '/usr/lib/modules/5.11.0-rc1-1-git-00073-g3516bd729358/build'
  CC [M]  ./evdi/module/evdi_modeset.o
./evdi/module/evdi_modeset.c:163:20: error: initialization of ‘void (*)(struct drm_crtc *, struct drm_atomic_state *)’ from incompatible pointer type ‘void (*)(struct drm_crtc *, struct drm_crtc_state *)’ [-Werror=incompatible-pointer-types]
  163 |  .atomic_flush   = evdi_crtc_atomic_flush,
      |                    ^~~~~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_modeset.c:163:20: note: (near initialization for ‘evdi_helper_funcs.atomic_flush’)
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:279: ./evdi/module/evdi_modeset.o] Error 1
make[2]: *** [Makefile:1805: ./evdi/module] Error 2
make[2]: Leaving directory '/usr/lib/modules/5.11.0-rc1-1-git-00073-g3516bd729358/build'
make[1]: *** [Makefile:77: module] Error 2
make[1]: Leaving directory './evdi/module'
make: *** [Makefile:8: all] Error 2

origin/v1.7.x

[user@hostname evdi]$ make
CFLAGS="-Werror -Wextra -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-error=missing-field-initializers" make -C module 
make[1]: Entering directory './evdi/module'
cat: /etc/redhat-release: No such file or directory
make -C /lib/modules/5.11.0-rc1-1-git-00073-g3516bd729358/build M=$PWD
make[2]: Entering directory '/usr/lib/modules/5.11.0-rc1-1-git-00073-g3516bd729358/build'
cat: /etc/redhat-release: No such file or directory
  CC [M]  ./evdi/module/evdi_drv.o
./evdi/module/evdi_drv.c:90:3: error: ‘struct drm_driver’ has no member named ‘preclose’; did you mean ‘postclose’?
   90 |  .preclose = evdi_driver_preclose,
      |   ^~~~~~~~
      |   postclose
./evdi/module/evdi_drv.c:90:14: error: initialization of ‘void (*)(struct drm_device *)’ from incompatible pointer type ‘void (*)(struct drm_device *, struct drm_file *)’ [-Werror=incompatible-pointer-types]
   90 |  .preclose = evdi_driver_preclose,
      |              ^~~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:90:14: note: (near initialization for ‘driver.release’)
./evdi/module/evdi_drv.c:96:3: error: ‘struct drm_driver’ has no member named ‘gem_free_object_unlocked’
   96 |  .gem_free_object_unlocked = evdi_gem_free_object,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:96:30: error: initialization of ‘void (*)(struct drm_device *)’ from incompatible pointer type ‘void (*)(struct drm_gem_object *)’ [-Werror=incompatible-pointer-types]
   96 |  .gem_free_object_unlocked = evdi_gem_free_object,
      |                              ^~~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:96:30: note: (near initialization for ‘driver.lastclose’)
./evdi/module/evdi_drv.c:100:3: error: ‘struct drm_driver’ has no member named ‘gem_vm_ops’
  100 |  .gem_vm_ops = &evdi_gem_vm_ops,
      |   ^~~~~~~~~~
./evdi/module/evdi_drv.c:100:16: error: initialization of ‘void (*)(struct drm_device *)’ from incompatible pointer type ‘const struct vm_operations_struct *’ [-Werror=incompatible-pointer-types]
  100 |  .gem_vm_ops = &evdi_gem_vm_ops,
      |                ^
./evdi/module/evdi_drv.c:100:16: note: (near initialization for ‘driver.unload’)
./evdi/module/evdi_drv.c:100:16: error: initialized field overwritten [-Werror=override-init]
./evdi/module/evdi_drv.c:100:16: note: (near initialization for ‘driver.unload’)
./evdi/module/evdi_drv.c:114:3: error: ‘struct drm_driver’ has no member named ‘gem_prime_export’; did you mean ‘gem_prime_import’?
  114 |  .gem_prime_export = drm_gem_prime_export,
      |   ^~~~~~~~~~~~~~~~
      |   gem_prime_import
./evdi/module/evdi_drv.c:114:22: 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 ‘struct dma_buf * (*)(struct drm_gem_object *, int)’ [-Werror=incompatible-pointer-types]
  114 |  .gem_prime_export = drm_gem_prime_export,
      |                      ^~~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:114:22: note: (near initialization for ‘driver.prime_fd_to_handle’)
./evdi/module/evdi_drv.c:114:22: error: initialized field overwritten [-Werror=override-init]
./evdi/module/evdi_drv.c:114:22: note: (near initialization for ‘driver.prime_fd_to_handle’)
./evdi/module/evdi_drv.c:115:3: error: ‘struct drm_driver’ has no member named ‘gem_prime_get_sg_table’; did you mean ‘gem_prime_import_sg_table’?
  115 |  .gem_prime_get_sg_table = evdi_prime_get_sg_table,
      |   ^~~~~~~~~~~~~~~~~~~~~~
      |   gem_prime_import_sg_table
./evdi/module/evdi_drv.c:115: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]
  115 |  .gem_prime_get_sg_table = evdi_prime_get_sg_table,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:115:28: note: (near initialization for ‘driver.gem_prime_import’)
./evdi/module/evdi_drv.c:115:28: error: initialized field overwritten [-Werror=override-init]
./evdi/module/evdi_drv.c:115:28: note: (near initialization for ‘driver.gem_prime_import’)
./evdi/module/evdi_drv.c:118:3: error: ‘struct drm_driver’ has no member named ‘enable_vblank’
  118 |  .enable_vblank = evdi_enable_vblank,
      |   ^~~~~~~~~~~~~
./evdi/module/evdi_drv.c:118:19: error: initialization of ‘int (*)(struct drm_gem_object *, struct vm_area_struct *)’ from incompatible pointer type ‘int (*)(struct drm_device *, unsigned int)’ [-Werror=incompatible-pointer-types]
  118 |  .enable_vblank = evdi_enable_vblank,
      |                   ^~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:118:19: note: (near initialization for ‘driver.gem_prime_mmap’)
./evdi/module/evdi_drv.c:119:3: error: ‘struct drm_driver’ has no member named ‘disable_vblank’
  119 |  .disable_vblank = evdi_disable_vblank,
      |   ^~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:119:20: error: initialization of ‘int (*)(struct drm_file *, struct drm_device *, struct drm_mode_create_dumb *)’ from incompatible pointer type ‘void (*)(struct drm_device *, unsigned int)’ [-Werror=incompatible-pointer-types]
  119 |  .disable_vblank = evdi_disable_vblank,
      |                    ^~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:119:20: note: (near initialization for ‘driver.dumb_create’)
./evdi/module/evdi_drv.c:119:20: error: initialized field overwritten [-Werror=override-init]
./evdi/module/evdi_drv.c:119:20: note: (near initialization for ‘driver.dumb_create’)
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:279: ./evdi/module/evdi_drv.o] Error 1
make[2]: *** [Makefile:1805: ./evdi/module] Error 2
make[2]: Leaving directory '/usr/lib/modules/5.11.0-rc1-1-git-00073-g3516bd729358/build'
make[1]: *** [Makefile:77: module] Error 2
make[1]: Leaving directory './evdi/module'
make: *** [Makefile:8: all] Error 2


origin/master

[user@hostname evdi]$ make
CFLAGS="-Werror -Wextra -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-error=missing-field-initializers" make -C module 
make[1]: Entering directory './evdi/module'
make -C /lib/modules/5.11.0-rc1-1-git-00073-g3516bd729358/build M=$PWD
make[2]: Entering directory '/usr/lib/modules/5.11.0-rc1-1-git-00073-g3516bd729358/build'
  CC [M]  ./evdi/module/evdi_drv.o
./evdi/module/evdi_drv.c:87:3: error: ‘struct drm_driver’ has no member named ‘preclose’; did you mean ‘postclose’?
   87 |  .preclose = evdi_driver_preclose,
      |   ^~~~~~~~
      |   postclose
./evdi/module/evdi_drv.c:87:14: error: initialization of ‘void (*)(struct drm_device *)’ from incompatible pointer type ‘void (*)(struct drm_device *, struct drm_file *)’ [-Werror=incompatible-pointer-types]
   87 |  .preclose = evdi_driver_preclose,
      |              ^~~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:87:14: note: (near initialization for ‘driver.release’)
./evdi/module/evdi_drv.c:92:3: error: ‘struct drm_driver’ has no member named ‘gem_free_object’; did you mean ‘gem_create_object’?
   92 |  .gem_free_object = evdi_gem_free_object,
      |   ^~~~~~~~~~~~~~~
      |   gem_create_object
./evdi/module/evdi_drv.c:92:21: error: initialization of ‘void (*)(struct drm_device *)’ from incompatible pointer type ‘void (*)(struct drm_gem_object *)’ [-Werror=incompatible-pointer-types]
   92 |  .gem_free_object = evdi_gem_free_object,
      |                     ^~~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:92:21: note: (near initialization for ‘driver.lastclose’)
./evdi/module/evdi_drv.c:93:3: error: ‘struct drm_driver’ has no member named ‘gem_vm_ops’
   93 |  .gem_vm_ops = &evdi_gem_vm_ops,
      |   ^~~~~~~~~~
./evdi/module/evdi_drv.c:93:16: error: initialization of ‘void (*)(struct drm_device *)’ from incompatible pointer type ‘const struct vm_operations_struct *’ [-Werror=incompatible-pointer-types]
   93 |  .gem_vm_ops = &evdi_gem_vm_ops,
      |                ^
./evdi/module/evdi_drv.c:93:16: note: (near initialization for ‘driver.unload’)
./evdi/module/evdi_drv.c:93:16: error: initialized field overwritten [-Werror=override-init]
./evdi/module/evdi_drv.c:93:16: note: (near initialization for ‘driver.unload’)
./evdi/module/evdi_drv.c:107:3: error: ‘struct drm_driver’ has no member named ‘gem_prime_export’; did you mean ‘gem_prime_import’?
  107 |  .gem_prime_export = drm_gem_prime_export,
      |   ^~~~~~~~~~~~~~~~
      |   gem_prime_import
./evdi/module/evdi_drv.c:107:22: 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 ‘struct dma_buf * (*)(struct drm_gem_object *, int)’ [-Werror=incompatible-pointer-types]
  107 |  .gem_prime_export = drm_gem_prime_export,
      |                      ^~~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:107:22: note: (near initialization for ‘driver.prime_fd_to_handle’)
./evdi/module/evdi_drv.c:107:22: error: initialized field overwritten [-Werror=override-init]
./evdi/module/evdi_drv.c:107:22: note: (near initialization for ‘driver.prime_fd_to_handle’)
./evdi/module/evdi_drv.c:108:3: error: ‘struct drm_driver’ has no member named ‘gem_prime_get_sg_table’; did you mean ‘gem_prime_import_sg_table’?
  108 |  .gem_prime_get_sg_table = evdi_prime_get_sg_table,
      |   ^~~~~~~~~~~~~~~~~~~~~~
      |   gem_prime_import_sg_table
./evdi/module/evdi_drv.c:108: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]
  108 |  .gem_prime_get_sg_table = evdi_prime_get_sg_table,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:108:28: note: (near initialization for ‘driver.gem_prime_import’)
./evdi/module/evdi_drv.c:108:28: error: initialized field overwritten [-Werror=override-init]
./evdi/module/evdi_drv.c:108:28: note: (near initialization for ‘driver.gem_prime_import’)
./evdi/module/evdi_drv.c:111:3: error: ‘struct drm_driver’ has no member named ‘enable_vblank’
  111 |  .enable_vblank = evdi_enable_vblank,
      |   ^~~~~~~~~~~~~
./evdi/module/evdi_drv.c:111:19: error: initialization of ‘int (*)(struct drm_gem_object *, struct vm_area_struct *)’ from incompatible pointer type ‘int (*)(struct drm_device *, unsigned int)’ [-Werror=incompatible-pointer-types]
  111 |  .enable_vblank = evdi_enable_vblank,
      |                   ^~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:111:19: note: (near initialization for ‘driver.gem_prime_mmap’)
./evdi/module/evdi_drv.c:112:3: error: ‘struct drm_driver’ has no member named ‘disable_vblank’
  112 |  .disable_vblank = evdi_disable_vblank,
      |   ^~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:112:20: error: initialization of ‘int (*)(struct drm_file *, struct drm_device *, struct drm_mode_create_dumb *)’ from incompatible pointer type ‘void (*)(struct drm_device *, unsigned int)’ [-Werror=incompatible-pointer-types]
  112 |  .disable_vblank = evdi_disable_vblank,
      |                    ^~~~~~~~~~~~~~~~~~~
./evdi/module/evdi_drv.c:112:20: note: (near initialization for ‘driver.dumb_create’)
./evdi/module/evdi_drv.c:112:20: error: initialized field overwritten [-Werror=override-init]
./evdi/module/evdi_drv.c:112:20: note: (near initialization for ‘driver.dumb_create’)
./evdi/module/evdi_drv.c: In function ‘evdi_platform_probe’:
./evdi/module/evdi_drv.c:173:20: error: ‘struct dev_archdata’ has no member named ‘iommu’
  173 |  pdev->dev.archdata.iommu = INTEL_IOMMU_DUMMY_DOMAIN;
      |                    ^
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:279: ./evdi/module/evdi_drv.o] Error 1
make[2]: *** [Makefile:1805: ./evdi/module] Error 2
make[2]: Leaving directory '/usr/lib/modules/5.11.0-rc1-1-git-00073-g3516bd729358/build'
make[1]: *** [Makefile:71: module] Error 2
make[1]: Leaving directory './evdi/module'
make: *** [Makefile:8: all] Error 2
@rockorequin
Copy link

Re the compile error listed above in evdi_modeset.c for the origin/devel branch, what's happened is that the atomic_flush has changed to pass struct drm_atomic_state *state instead of struct drm_crtc_state *old_state, so I think evdi_modeset.c just needs changing to something like this:

static void evdi_crtc_atomic_flush(
	struct drm_crtc *crtc
#if KERNEL_VERSION(5, 11, 0) >= LINUX_VERSION_CODE
	, __always_unused struct drm_atomic_state *old_state
#else
	, __always_unused struct drm_crtc_state *old_state
#endif
	)

butt when I try to compile 5.11-rc2, I still get all the other errors listed above for the origin/1.7.x branch.

@sickcodes
Copy link
Contributor Author

Thank you @rockorequin I will your snippet shortly!

@rockorequin
Copy link

@sickcodes No problems!

For the other errors, it looks like the last two commits to drm_drv.h are what broke things:

commit 57bb1ee6034046be70aed33fd6d447bb2b7261fa
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Nov 4 11:04:21 2020 +0100

    drm: Compile out legacy chunks from struct drm_device

You can get around this by enabling CONFIG_DRM_LEGACY in the Makefile ccflags:

ccflags-y := -Iinclude/drm -DCONFIG_DRM_LEGACY

With the above change, the errors about preclose and enable_vblank/disable_vblank disappear for me. But I still get errors about the GEM and PRIME callbacks due to this commit:

commit d693def4fd1c23f1ca5aed1afb9993b3a2069ad2
Author: Thomas Zimmermann <tzimmermann@suse.de>
Date:   Wed Sep 23 12:21:59 2020 +0200

    drm: Remove obsolete GEM and PRIME callbacks from struct drm_driver
    
    Several GEM and PRIME callbacks have been deprecated in favor of
    per-instance GEM object functions. Remove the callbacks as they are
    now unused. The only exception is .gem_prime_mmap, which is still
    in use by several drivers.
    
    What is also gone is gem_vm_ops in struct drm_driver. All drivers now
    use struct drm_gem_object_funcs.vm_ops instead.
 

and that looks like a more complicated fix.

@rockorequin
Copy link

I got evdi to build with 5.11-rc2 using the patch at https://gist.github.com/rockorequin/f3047e748bcba9be9d1fff06f472dbda, but I haven't got a DisplayLink monitor atm to test it with.

The patch cheats by using the CONFIG_DRM_LEGACY define in the Makefile so that I didn't have to remap the vblank etc function callbacks.

@sickcodes
Copy link
Contributor Author

Thanks @rockorequin, builds perfect on devel branch!

git clone https://github.com/DisplayLink/evdi.git && cd evdi
git checkout -f devel
curl "https://gist.githubusercontent.com/rockorequin/f3047e748bcba9be9d1fff06f472dbda/raw/93b4792bb11ffe0a77973a6335d3e5c751dcf053/evdi-devel-5.11-rc2.patch"
git apply --verbose --ignore-whitespace evdi-devel-5.11-rc2.patch
make # && sudo make install

Did you want to write the PR?

I also had to add -DCONFIG_DRM_LEGACY to line 44 for kbuild, in addition to the dkms build which your patch fixed.
e.g.
ccflags-y := -isystem include/drm $(CFLAGS) $(EL8FLAG)
ccflags-y := -isystem include/drm $(CFLAGS) $(EL8FLAG) -DCONFIG_DRM_LEGACY

Even though I have two displaylink things, I also cannot test 1.9 as we're still on 1.7.x.

I think we will also need to cherry-pick the fix to 1.7.x, I will attempt that now with your fix!

@sickcodes
Copy link
Contributor Author

Not sure if it works yet tho, no screen activity on 1.7.x with 5.11rc2 but I'll poke around with starting/stopping the service, maybe @abucodonosor might know something.

@sickcodes
Copy link
Contributor Author

sickcodes commented Jan 5, 2021

@elguero
Copy link
Contributor

elguero commented Jan 5, 2021

@sickcodes Thanks for your help, contribution and enthusiasm. Did @rockorequin give the go ahead to submit his patch as a PR? I think I missed that somewhere. Just trying to put myself in his place, unless he said to go for it.

The current kernel 5.11 release candidate is only the second one. It would be nice if someone could test this on actual hardware since all that appears to have been done are compile tests.

Just my 2 cents. It is great to see the contributions from the community to hopefully help keep us from falling behind again with new kernel releases.

@abucodonosor
Copy link
Contributor

@rockorequin

the accepted syntax for this module is:

#if KERNEL_VERSION(X, Y, Z) <= LINUX_VERSION_CODE

so the logic is swapped :).

I didn't looked what changed bc a big batch of DRM stuff will hit rc3++, but those defines lin your patch look wrong to me.

@abucodonosor
Copy link
Contributor

Not sure if it works yet tho, no screen activity on 1.7.x with 5.11rc2 but I'll poke around with starting/stopping the service, maybe @abucodonosor might know something.

Unfortunately, I don't have any time to look at this right now. I may have some time next week.

@sickcodes
Copy link
Contributor Author

Sorry ya'll, I already committed it locally and was only 1 click away from a PR so I pushed it anyway.

Can confirm 1.7.x doesn't run yet with the changes above on two DisplayLink hardware devices. I will triple check if I have made an error and I think I have.

How can I check why it won't run?

@microhobby
Copy link

I tried the patch from @rockorequin with your instructions @sickcodes, but no success yet. I'm getting this on dmesg:

[    3.195586] evdi: loading out-of-tree module taints kernel.
[    3.197004] evdi: module verification failed: signature and/or required key missing - tainting kernel
[    3.197519] evdi: [I] Initialising logging on level 5
[    3.197521] evdi: [I] Atomic driver: yes
[    3.197558] evdi: [D] evdi_platform_add_devices:145 Increasing device count to 4
[    3.197642] evdi: [D] evdi_crtc_init:394 drm_crtc_init: 0 p00000000cb1b80e7
[    3.197652] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[    3.197658] evdi evdi.0: [drm] Cannot find any crtc or sizes
[    3.197668] evdi: [W] evdi_painter_send_update_ready_if_needed:706 Painter does not exist!
[    3.198780] [drm] Initialized evdi 1.9.0 20201210 for evdi.0 on minor 0
[    3.198800] evdi: [I] Evdi platform_device create
[    3.254690] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[    3.254716] evdi: [D] evdi_driver_postclose:234 (dev=0) Process tries to close us, postclose
[    3.254718] evdi: [I] Task 396 (plymouthd) of process 396 (plymouthd)
[    3.354205] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[    3.354227] evdi: [D] evdi_driver_postclose:234 (dev=0) Process tries to close us, postclose
[    3.354230] evdi: [I] Task 396 (plymouthd) of process 396 (plymouthd)
[    4.856145] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[    4.856164] evdi: [D] evdi_driver_postclose:234 (dev=0) Process tries to close us, postclose
[    4.856167] evdi: [I] Task 396 (plymouthd) of process 396 (plymouthd)
[    5.402913] evdi: [D] evdi_driver_postclose:234 (dev=0) Process tries to close us, postclose
[    5.402917] evdi: [I] Task 641 (gpu-manager) of process 641 (gpu-manager)
[    5.402953] evdi: [D] evdi_driver_postclose:234 (dev=0) Process tries to close us, postclose
[    5.402955] evdi: [I] Task 641 (gpu-manager) of process 641 (gpu-manager)
[    5.403008] evdi: [D] evdi_driver_postclose:234 (dev=0) Process tries to close us, postclose
[    5.403010] evdi: [I] Task 641 (gpu-manager) of process 641 (gpu-manager)
[    6.471511] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[    7.926715] Modules linked in: uvcvideo(+) rtsx_usb videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 uas ecdh_generic videobuf2_common videodev ecc usb_storage snd_hda_codec_hdmi snd_seq_dummy snd_hrtimer snd_usb_audio snd_usbmidi_lib usbhid mc intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio coretemp ath10k_pci snd_hda_intel ath10k_core snd_intel_dspcfg snd_hda_codec snd_hda_core kvm_intel snd_hwdep overlay kvm ath snd_pcm snd_seq_midi joydev snd_seq_midi_event crct10dif_pclmul nouveau binfmt_misc mac80211 mei_hdcp snd_rawmidi ghash_clmulni_intel aesni_intel snd_seq nls_iso8859_1 crypto_simd input_leds cryptd glue_helper snd_seq_device snd_timer drm_ttm_helper rapl i915 cfg80211 intel_cstate snd serio_raw ttm efi_pstore soundcore mei_me mxm_wmi ee1004 mei libarc4 hid_multitouch intel_pch_thermal i2c_algo_bit acpi_tad mac_hid acpi_pad sch_fq_codel evdi(OE) drm_kms_helper cec rc_core drm fb_sys_fops
[    8.259156] evdi: [D] evdi_painter_dpms_notify:715 (dev=0) Notifying dpms mode: 3
[    8.259161] evdi: [W] evdi_painter_send_event:321 Painter is not connected!
[   29.691976] evdi: [D] evdi_driver_postclose:234 (dev=0) Process tries to close us, postclose
[   29.691980] evdi: [I] Task 1939 (Xorg.wrap) of process 1939 (Xorg.wrap)
[   29.872282] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   29.872342] evdi: [D] evdi_painter_framebuffer_size:594 Scanout buffer not set.
[   29.872344] evdi: [D] evdi_painter_mark_dirty:621 (dev=0) Skip clip rect. Scanout buffer not set.
[   29.872352] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   30.131851] evdi: [D] evdi_painter_dpms_notify:715 (dev=0) Notifying dpms mode: 3
[   30.131855] evdi: [W] evdi_painter_send_event:321 Painter is not connected!
[   30.352443] evdi: [D] evdi_painter_dpms_notify:715 (dev=0) Notifying dpms mode: 3
[   30.352447] evdi: [W] evdi_painter_send_event:321 Painter is not connected!
[   30.921058] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   32.213576] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   33.732400] evdi: [D] evdi_driver_postclose:234 (dev=0) Process tries to close us, postclose
[   33.732404] evdi: [I] Task 1 (systemd) of process 1 (systemd)
[   76.206256] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[  127.881311] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected

Something new about this?

@microhobby
Copy link

microhobby commented Feb 2, 2021

Ok, I figure out that the DisplayLinkManager was not running.
Now I have the screen receiving signal, but no image all black.

@microhobby
Copy link

Yeah, we are having some null pointer deference when connecting the device:

[ 3298.507373] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3298.507384] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3298.507416] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3298.507420] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3298.507441] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3298.507444] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3298.507473] evdi: [D] evdi_detect:90 (dev=0) painter is connected
[ 3298.507476] evdi: [D] evdi_detect:92 (dev=0) poll connector state: connected
[ 3298.507481] evdi: [D] evdi_painter_get_edid_copy:228 (dev=0) EDID valid
[ 3316.038136] evdi: [D] evdi_painter_dpms_notify:654 (dev=0) Notifying dpms mode: 0
[ 3316.038149] evdi: [D] evdi_painter_mode_changed_notify:701 (dev=0) Notifying mode changed: 1920x1080@60; bpp 32; 
[ 3316.038152] evdi: [D] evdi_log_pixel_format:680 pixel format XR24 little-endian (0x34325258)
[ 3316.038155] evdi: [D] evdi_painter_dpms_notify:654 (dev=0) Notifying dpms mode: 0
[ 3316.047829] BUG: kernel NULL pointer dereference, address: 0000000000000008
[ 3316.047833] #PF: supervisor read access in kernel mode
[ 3316.047834] #PF: error_code(0x0000) - not-present page
[ 3316.047836] PGD 800000014b017067 P4D 800000014b017067 PUD 14b28c067 PMD 0 
[ 3316.047840] Oops: 0000 [#3] SMP PTI
[ 3316.047843] CPU: 5 PID: 11217 Comm: ThreadedDevice_ Tainted: G      D W  O      5.11.0-rc5-MicroHobby+ #5
[ 3316.047845] Hardware name: SAMSUNG ELECTRONICS CO., LTD. 800G5M/800G5W/NP800G5M-XG2BR, BIOS P11RDV.075.170829.XJ 08/29/2017
[ 3316.047846] RIP: 0010:dma_buf_vmap+0x2a/0x120
[ 3316.047850] Code: 0f 1f 44 00 00 55 48 89 e5 41 56 41 55 41 54 49 89 f4 53 48 89 fb 48 83 ec 18 65 48 8b 04 25 28 00 00 00 48 89 44 24 10 31 c0 <80> 7e 08 00 48 c7 06 00 00 00 00 74 04 c6 46 08 00 48 85 db 0f 84
[ 3316.047852] RSP: 0018:ffff9eca4209fc48 EFLAGS: 00010246
[ 3316.047854] RAX: 0000000000000000 RBX: ffff90dbcb2ed000 RCX: 0000000000000000
[ 3316.047856] RDX: ffff90dbb5a70000 RSI: 0000000000000000 RDI: ffff90dbcb2ed000
[ 3316.047857] RBP: ffff9eca4209fc80 R08: 0000000000000000 R09: 0000000000000000
[ 3316.047858] R10: ffff90db9abee040 R11: 0000000000000438 R12: 0000000000000000
[ 3316.047860] R13: ffff9eca4209fd00 R14: ffff90db9abee000 R15: ffff90db8a019200
[ 3316.047861] FS:  00007f9b1b7fe640(0000) GS:ffff90e29ed40000(0000) knlGS:0000000000000000
[ 3316.047863] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 3316.047864] CR2: 0000000000000008 CR3: 0000000128274001 CR4: 00000000003706e0
[ 3316.047866] Call Trace:
[ 3316.047867]  ? __ext4_journal_stop+0x3c/0xb0
[ 3316.047873]  evdi_gem_vmap+0x2a/0xd0 [evdi]
[ 3316.047879]  evdi_painter_grabpix_ioctl+0x42c/0x520 [evdi]
[ 3316.047883]  ? generic_perform_write+0x133/0x1c0
[ 3316.047887]  ? __check_object_size+0x4d/0x150
[ 3316.047891]  ? atime_needs_update+0x73/0xd0
[ 3316.047894]  ? touch_atime+0x33/0x140
[ 3316.047896]  ? _cond_resched+0x1a/0x50
[ 3316.047898]  ? mutex_lock+0x13/0x40
[ 3316.047900]  ? evdi_painter_connect_ioctl+0x250/0x250 [evdi]
[ 3316.047905]  drm_ioctl_kernel+0xae/0xf0 [drm]
[ 3316.047929]  drm_ioctl+0x245/0x400 [drm]
[ 3316.047956]  ? evdi_painter_connect_ioctl+0x250/0x250 [evdi]
[ 3316.047960]  ? vfs_read+0x188/0x1c0
[ 3316.047963]  __x64_sys_ioctl+0x91/0xc0
[ 3316.047967]  do_syscall_64+0x38/0x90
[ 3316.047970]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 3316.047973] RIP: 0033:0x7f9b65a1331b
[ 3316.047975] Code: 89 d8 49 8d 3c 1c 48 f7 d8 49 39 c4 72 b5 e8 1c ff ff ff 85 c0 78 ba 4c 89 e0 5b 5d 41 5c c3 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1d 3b 0d 00 f7 d8 64 89 01 48
[ 3316.047977] RSP: 002b:00007f9b1b7fd2a8 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
[ 3316.047979] RAX: ffffffffffffffda RBX: 0000000002aa8d20 RCX: 00007f9b65a1331b
[ 3316.047980] RDX: 00007f9b1b7fd380 RSI: 00000000c0286442 RDI: 00000000000000ad
[ 3316.047982] RBP: 00007f9b1b7fd2e0 R08: 00007f9ae8001fd0 R09: 0000000000000000
[ 3316.047983] R10: 0000000000000000 R11: 0000000000000202 R12: 00007f9b1b7fd470
[ 3316.047984] R13: 00007f9b40002100 R14: 00007f9b40001840 R15: 00007f9b1b7fd760
[ 3316.047986] Modules linked in: xt_conntrack xt_MASQUERADE nf_conntrack_netlink xfrm_user xfrm_algo nft_counter xt_addrtype nft_compat nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables libcrc32c nfnetlink br_netfilter bridge stp llc ccm rfcomm cmac algif_hash algif_skcipher af_alg bnep rtsx_usb_ms btusb rtsx_usb_sdmmc memstick btrtl btbcm btintel uas bluetooth hid_corsair uvcvideo usb_storage videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 rtsx_usb videobuf2_common videodev ecdh_generic ecc snd_seq_dummy snd_hrtimer overlay binfmt_misc nls_iso8859_1 snd_usb_audio snd_usbmidi_lib usbhid mc snd_hda_codec_hdmi ath10k_pci intel_rapl_msr intel_rapl_common ath10k_core mei_hdcp x86_pkg_temp_thermal intel_powerclamp coretemp ath kvm_intel snd_hda_codec_realtek kvm snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_intel_dspcfg joydev snd_hda_codec snd_hda_core snd_hwdep crct10dif_pclmul ghash_clmulni_intel mac80211 aesni_intel snd_pcm crypto_simd cryptd glue_helper
[ 3316.048033]  snd_seq_midi snd_seq_midi_event rapl nouveau i915 snd_rawmidi cfg80211 snd_seq snd_seq_device snd_timer intel_cstate snd input_leds drm_ttm_helper serio_raw ttm efi_pstore mxm_wmi mei_me ee1004 mei hid_multitouch libarc4 soundcore intel_pch_thermal i2c_algo_bit sch_fq_codel evdi(O) acpi_tad mac_hid acpi_pad drm_kms_helper cec rc_core drm fb_sys_fops syscopyarea sysfillrect sysimgblt parport_pc ppdev lp parport ip_tables x_tables autofs4 hid_generic nvme nvme_core r8169 crc32_pclmul ahci intel_lpss_pci libahci intel_lpss i2c_hid idma64 i2c_i801 hid xhci_pci i2c_smbus realtek xhci_pci_renesas virt_dma pinctrl_sunrisepoint video wmi
[ 3316.048070] CR2: 0000000000000008
[ 3316.048072] ---[ end trace 494a1fa7abaeffe4 ]---
[ 3316.102393] RIP: 0010:dma_buf_vmap+0x2a/0x120
[ 3316.102397] Code: 0f 1f 44 00 00 55 48 89 e5 41 56 41 55 41 54 49 89 f4 53 48 89 fb 48 83 ec 18 65 48 8b 04 25 28 00 00 00 48 89 44 24 10 31 c0 <80> 7e 08 00 48 c7 06 00 00 00 00 74 04 c6 46 08 00 48 85 db 0f 84
[ 3316.102399] RSP: 0018:ffff9eca43ea7c48 EFLAGS: 00010246
[ 3316.102401] RAX: 0000000000000000 RBX: ffff90db8bcd1400 RCX: 0000000000000000
[ 3316.102402] RDX: ffff90db8eb218c0 RSI: 0000000000000000 RDI: ffff90db8bcd1400
[ 3316.102404] RBP: ffff9eca43ea7c80 R08: 0000000000000000 R09: 0000000000000001
[ 3316.102406] R10: 0000000000000002 R11: 0000000000000000 R12: 0000000000000000
[ 3316.102411] R13: ffff9eca43ea7d00 R14: ffff90db9abee000 R15: ffff90dbb0145e00
[ 3316.102412] FS:  00007f9b1b7fe640(0000) GS:ffff90e29ed40000(0000) knlGS:0000000000000000
[ 3316.102414] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 3316.102416] CR2: 0000000000000008 CR3: 0000000128274001 CR4: 00000000003706e0
[ 3316.530472] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3316.530477] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3316.530491] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3316.530493] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3316.530504] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3316.530505] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3316.530520] evdi: [D] evdi_detect:90 (dev=0) painter is connected
[ 3316.530521] evdi: [D] evdi_detect:92 (dev=0) poll connector state: connected
[ 3316.530523] evdi: [D] evdi_painter_get_edid_copy:228 (dev=0) EDID valid
[ 3316.690871] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3316.690878] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3316.690895] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3316.690897] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3316.690927] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3316.690929] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3316.690949] evdi: [D] evdi_detect:90 (dev=0) painter is connected
[ 3316.690951] evdi: [D] evdi_detect:92 (dev=0) poll connector state: connected
[ 3316.690954] evdi: [D] evdi_painter_get_edid_copy:228 (dev=0) EDID valid
[ 3336.780649] evdi: [D] evdi_painter_dpms_notify:654 (dev=0) Notifying dpms mode: 3
[ 3336.780787] evdi: [D] evdi_painter_dpms_notify:654 (dev=0) Notifying dpms mode: 3
[ 3336.981947] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3336.981950] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3336.981963] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3336.981965] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3336.981974] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3336.981975] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3336.981988] evdi: [D] evdi_detect:90 (dev=0) painter is connected
[ 3336.981990] evdi: [D] evdi_detect:92 (dev=0) poll connector state: connected
[ 3336.981991] evdi: [D] evdi_painter_get_edid_copy:228 (dev=0) EDID valid
[ 3337.142897] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3337.142900] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3337.142912] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3337.142913] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3337.142921] evdi: [D] evdi_detect:97 (dev=0) painter is disconnected
[ 3337.142922] evdi: [D] evdi_detect:99 (dev=0) poll connector state: disconnected
[ 3337.142934] evdi: [D] evdi_detect:90 (dev=0) painter is connected
[ 3337.142935] evdi: [D] evdi_detect:92 (dev=0) poll connector state: connected
[ 3337.142937] evdi: [D] evdi_painter_get_edid_copy:228 (dev=0) EDID valid

@elguero
Copy link
Contributor

elguero commented Feb 2, 2021

@microhobby You need to use evdi 1.7.2 --> #245

@microhobby
Copy link

microhobby commented Feb 2, 2021

@elguero yes I figure out this also, cause when I try to use from devel even running the DisplayLinkManager I did not have the device state changed to connected. Now I'm using the https://github.com/sickcodes/evdi/tree/v1.7.x

I'm getting the null pointer deference running the 1.7.2

@microhobby
Copy link

microhobby commented Feb 2, 2021

ok, so I think I found the root cause:

dma_buf_vmap(obj->base.import_attach->dmabuf, obj->vmapping);

I change it and tested and now works for v5.11-rc6. I'm right now writing this on my Displaylink screen 😎.

@sickcodes I sent you a PR, sickcodes#1, so if you are going to continue and send a PR to this repository you already have my contribution to your work. Thanks, also to @rockorequin to the great work.

@sickcodes
Copy link
Contributor Author

ok, so I think I found the root cause:

dma_buf_vmap(obj->base.import_attach->dmabuf, obj->vmapping);

I change it and tested and now works for v5.11-rc6. I'm right now writing this on my Displaylink screen sunglasses.

@sickcodes I sent you a PR, sickcodes#1, so if you are going to continue and send a PR to this repository you already have my contribution to your work. Thanks, also to @rockorequin to the great work.

Thanks for that!

Hey @rockorequin are you still here? :)

@rockorequin

the accepted syntax for this module is:

#if KERNEL_VERSION(X, Y, Z) <= LINUX_VERSION_CODE

so the logic is swapped :).

I didn't looked what changed bc a big batch of DRM stuff will hit rc3++, but those defines lin your patch look wrong to me.

@microhobby do you think we can fix the style, as per @abucodonosor's request? :)

@microhobby
Copy link

@sickcodes yeah for sure, check my MR I used what I think is the expected way:

#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE
	struct dma_buf_map map;
#endif

@sickcodes
Copy link
Contributor Author

Merged on https://github.com/sickcodes/evdi/tree/v1.7.x

@sickcodes yeah for sure, check my MR I used what I think is the expected way:

#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE
	struct dma_buf_map map;
#endif

@sickcodes
Copy link
Contributor Author

sickcodes commented Feb 2, 2021

Great work @rockorequin @microhobby!

Working for me on 5.11-rc6 using branch https://github.com/sickcodes/evdi/tree/v1.7.x

CC: @bnavigator if you wanna test

sudo pacman -R evdi || sudo pacman -R evdi-git
yay --getpkgbuild evdi
cd evdi
sed -i -e s/DisplayLink/sickcodes/g PKGBUILD
sed -i -e s/^pkgver\=/pkgver\=1.7.x\ \#/g PKGBUILD

sed -i -e s/^md5sums/old_md5sums/g PKGBUILD
perl -i -p -e s/^old_md5sums/md5sums\=\(\'SKIP\'\)\\nold_md5sums/g PKGBUILD

makepkg --nodeps -si 

sudo modprobe evdi
sudo systemctl disable displaylink.service

reboot

# no reboot froze

sudo systemctl start displaylink

@sickcodes
Copy link
Contributor Author

Forgot to mention, the external display is working now on 5.11 so if you want to get this into 7.1.x it's good to go functionally @displaylink-dkurek thanks to @rockorequin & @microhobby!

@brian-a-mulrooney
Copy link

@sickcodes trying to reproduce your results here, but I get a dependency error with DisplayLink.

==> Finished making: evdi 1.7.x-1 (Sat 06 Feb 2021 08:30:31 PM EST)
==> Installing package evdi with pacman -U...
loading packages...
warning: downgrading package evdi (1.7.2-1 => 1.7.x-1)
resolving dependencies...
looking for conflicting packages...
error: failed to prepare transaction (could not satisfy dependencies)
:: installing evdi (1.7.x-1) breaks dependency 'evdi>=1.7.0' required by displaylink
==> WARNING: Failed to install built package(s).

@sickcodes
Copy link
Contributor Author

sickcodes commented Feb 7, 2021

Open ./PKGBUILD and delete DisplayLink from the dependencies before this command

makepkg --nodeps -si

@bnavigator
Copy link

No, use a proper version string for evdi. "1.7.x" does not work with the resolver.

@sickcodes
Copy link
Contributor Author

1.7.x is the named branch from DisplayLink https://github.com/DisplayLink/evdi/tree/v1.7.x

Should I change my branch name or just submit this as a PR so people can test?

@bnavigator
Copy link

You have to change how you generate your version number (The pkgver sed command in your post above, maybe?).

@rockorequin
Copy link

Is it the #elsif statement?

Should that be #elif?

https://gist.github.com/rockorequin/f3047e748bcba9be9d1fff06f472dbda#file-evdi-devel-5-11-rc2-patch-L49

Hey @sickcodes good spot, that line needs to be changed to #elif or this branch doesn't compile with earlier kernels like 5.8.

Great to see you've got it working! I don't have a monitor to test it on but this branch installs for me on both kernels 5.8 (with the #elif fix) and 5.11-rc7.

@microhobby
Copy link

Yeah, same here. Freezes. So what's the best solution as of now? Boot Arch with the Linux 5.10 LTS kernel?

Yeah I'm using linux-lts I'm sick of rebooting and being unable to shutdown properly.

A good point was made about data loss too, it's honestly pretty dangerous to use

ok, I had no system freezes (maybe I need to test with the new changes from @rockorequin), but the issue with the shutdown did. If you have any logs to share it will be of great help. I'll see if at the weekend I can do some analysis on the shutdown issue.

@rockorequin
Copy link

Fwiw, Ubuntu 21.04 has now moved to the 5.11 kernel. 5.10 seems to be available for now luckily.

I installed the driver for Ubuntu's 5.11.0-11-generic kernel with these lines modified in evdi_gem_free_object
(I think the test for LINUX_VERSION_CODE was < instead of <= previously):

#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE // We allocated this in evdi_gem_alloc_object if (obj->base.funcs != NULL) { kfree(obj->base.funcs); obj->base.funcs = NULL; } #endif
and I was able to change the monitor layout without it crashing, but when I unplugged the monitor I just got a frozen blank laptop screen.

@ghost
Copy link

ghost commented Mar 11, 2021

I switched to the LTS kernel and everything -- evdi (but not evdi-git), udl, displaylink -- seemed to be working properly. However, no matter what I reconfigured, I still couldn't get the USB monitor to work. Xrandr would occasionally recognize the monitor, but whenever I tried to initialize it, nothing would show up on the screen. The working screens would flash black, turn back on, but the USB monitor remained black. Xrandr would display error 4 in the terminal. At other times, Xrandr simply doesn't recognize the monitor, while dmesg always recognizes the displaylink/USB device. I've pretty much tried everything following the Arch Wiki page!!

I'm starting to think it's my hardware that's incompatible. I'm using Plugable USB 2.0 HDMI/VGA adapter. Am I just out of luck as it pertains to the current hardware?

https://plugable.com/products/uga-165

@rockorequin
Copy link

rockorequin commented Mar 16, 2021

There seem to be at least two separate things happening related to the freezes. I checked journalctl after one freeze (when I tried changing the layout) and it It indicated the bug was at drivers/dma-buf/dma-buf.c:1269. (Unfortunately there was no further info.) But based on the generic 5.11.0 kernel is in dma_buf_vunmap() at the line BUG_ON(!dma_buf_map_is_equal(&dmabuf->vmap_ptr, map));

I also tried ssh'ing into the laptop when I tried to recreate the same freeze, but this time there was no kernel bug. The ssh session continued operating normally, but the laptop screen was blank except for a frozen mouse cursor. Killing the session via loginctl didn't fix anything, so it was as if the graphics drivers had locked up.

@sickcodes
Copy link
Contributor Author

Yeah, same here. Freezes. So what's the best solution as of now? Boot Arch with the Linux 5.10 LTS kernel?

Yeah I'm using linux-lts I'm sick of rebooting and being unable to shutdown properly.

A good point was made about data loss too, it's honestly pretty dangerous to use

ok, I had no system freezes (maybe I need to test with the new changes from @rockorequin), but the issue with the shutdown did. If you have any logs to share it will be of great help. I'll see if at the weekend I can do some analysis on the shutdown issue.

Anyone reading, this PR no longer works. How does one debug this properly?

@microhobby have you tried 5.11.6? I can't activate displays at all anymore, early 5.11 was working though!

Have two blank screens on my desk, like many others on 5.11 😬

@sickcodes
Copy link
Contributor Author

I switched to the LTS kernel and everything -- evdi (but not evdi-git), udl, displaylink -- seemed to be working properly. However, no matter what I reconfigured, I still couldn't get the USB monitor to work. Xrandr would occasionally recognize the monitor, but whenever I tried to initialize it, nothing would show up on the screen. The working screens would flash black, turn back on, but the USB monitor remained black. Xrandr would display error 4 in the terminal. At other times, Xrandr simply doesn't recognize the monitor, while dmesg always recognizes the displaylink/USB device. I've pretty much tried everything following the Arch Wiki page!!

I'm starting to think it's my hardware that's incompatible. I'm using Plugable USB 2.0 HDMI/VGA adapter. Am I just out of luck as it pertains to the current hardware?

https://plugable.com/products/uga-165

I have a USB2 and USB3 one let me check tomrorow but you are correct my 5.10.23 USB2 displaylink doesn't work on LTS anymore and I wasn't sure why!

Perhaps I have old files around but I will test the USB3 part as, like many DisplayLink paying customers, we need our screens and hardware to work.

So in terms of debugging, @displaylink-mlukaszek can you give us the decryption codes for the displaylink driver logs? -logging and -debugging are not helpful at all, whatsoever 😂

@sickcodes
Copy link
Contributor Author

I emailed PSIRT @ Synaptics about disgraceful logging: https://cwe.mitre.org/data/definitions/778.html

@ghost
Copy link

ghost commented Mar 19, 2021

I have a USB2 and USB3 one let me check tomrorow but you are correct my 5.10.23 USB2 displaylink doesn't work on LTS anymore and I wasn't sure why!

Perhaps I have old files around but I will test the USB3 part as, like many DisplayLink paying customers, we need our screens and hardware to work.

Thanks for trying to help!! It magically started working yesterday on the LTS kernel. I had left the USB plugged in from a Windows session; when I logged in (to Linux), the USB screen just turned on lol. Before that, I had spent some more effort trying to fix it by installing additional Intel drivers and changing one of the xorg config documents contrary to the Arch Wiki.

Anyway, unfortunately, it still wasn't usable, because everything became incredibly slow and laggy. Journalctl showed that some bytes of the EDID -- different ones at varying times -- weren't being read. Installing a package called read_edid didn't fix it. I ended up breaking the kernel while trying to fix the problem lol. I'm going to try again on the LTS at a later time (have to reconfigure everything ugh), but any ideas would be greatly appreciated.

@TOSHIAKI1331
Copy link

TOSHIAKI1331 commented Mar 20, 2021 via email

@arif-ali
Copy link

Just updated my system to the dev release of ubuntu (hirsute), which has kernel 5.11.0-11, neither of 1.7.2 or 1.9.0 would compile by default. Added both patches in this thread, and was able to get 1.9.0 up and running, with both screens attached to my dock now up and running. If there is anything you need, then happy to provide

@sickcodes
Copy link
Contributor Author

Just updated my system to the dev release of ubuntu (hirsute), which has kernel 5.11.0-11, neither of 1.7.2 or 1.9.0 would compile by default. Added both patches in this thread, and was able to get 1.9.0 up and running, with both screens attached to my dock now up and running. If there is anything you need, then happy to provide

Good to know, did you uninstall 1.9 first? I also fell for this the first time I installed both. Unless 1.9 is ready?

@rockorequin
Copy link

I've got this driver working for me in Linux 5.11 (Wayland only - see below) using the rockorequin-sickcodes-microhobby-patch-1.7.x branch and the patch at https://gist.github.com/rockorequin/9f16d3dd2a3278c3d19d7871a72a4092 (I tried pushing to the branch but I don't have access).

ie I fetched the branch with this command:

git clone \
    --branch rockorequin-sickcodes-microhobby-patch-1.7.x  \
    https://github.com/sickcodes/evdi

and then I applied the patch in the gist and built it for kernels 5.10 and 5.11 using dkms (I have symlinked /usr/bin/evdi-1.7.2 to the evdi/module folder and then I can use "sudo dkms install -m evdi -v 1.7.2 -k " to build and install the module).

In the patch, I removed CONFIG_DRM_LEGACY from the Makefile and removed the vblank functions for linux 5.11+. The other changes are mostly cosmetic (comments) but I did add a check to the return value from dma_buf_vmap and now it sets obj->vmapping to NULL on error. I wouldn't have thought this was happening often, but it is possible that on error obj->vmapping was being set to some random value instead of NULL and causing chaos.

I'm running Ubuntu 21.04, Linux 5.11.0-11-generic and evdi in a Wayland session. I haven't tried suspend/resume yet but logging out and back in, rebooting, and removing the monitor are all working without crashing.

However, isn't working under X11 in either Linux 5.11.0-11-generic or 5.10.0-14-generic. The good news is that it doesn't crash the kernel any more. gnome-settings recognises that there is a monitor attached, but it only allows me to have chose "Single Display" - when I try to change it, it reverts back to a single display.

@rockorequin
Copy link

@arif-ali: are you using a Wayland or an X11 session?

@rockorequin
Copy link

Fwiw, I also got evdi working (in Wayland) for kernel 5.12-rc4 using the patch at https://gist.github.com/rockorequin/f61fcb0217194997a2a3e8c4da260e4c. It's a bit hacky because I just copied in the functions that have been removed or made internal.

@sickcodes
Copy link
Contributor Author

Fwiw, I also got evdi working (in Wayland) for kernel 5.12-rc4 using the patch at https://gist.github.com/rockorequin/f61fcb0217194997a2a3e8c4da260e4c. It's a bit hacky because I just copied in the functions that have been removed or made internal.

@rockorequin you have to add my branch as a remote, you can cherry pick it, and then push to your own fork, then submit PR across to mine, or just fork it, and I'll PR everything over to yours

I guess we are skipping 5.11 😂 I'll give your gist a go today on 5.12!

@sickcodes
Copy link
Contributor Author

Testing 5.12 rc6

Can you fork evdi @rockorequin I'll PR all the code to my your repo

@arif-ali
Copy link

@rockorequin Although hirsute defaults to wayland, I have stuck with X11, as there were issues with Google Meet, and other stuff or work related stuff. So, my default was X11, and as I did a do-release-upgrade -d, it kept my original default :)

@sickcodes I had 1.7.2 installed before, but the kernel I was using had already been removed, and hence the evdi driver was no longer there anymore. So, I've just straight to 1.9.0, with the 2 patches in this thread

@sickcodes
Copy link
Contributor Author

[user@hostname ~]$ uname -a
Linux hostname 5.11.8-arch1-1 

I think this PR stopped working around 5.11.5 or 5.11.6 but I'm going straight to 5.12 instead, will report back with @rockorequin's patch!

@sickcodes
Copy link
Contributor Author

Fwiw, I also got evdi working (in Wayland) for kernel 5.12-rc4 using the patch at https://gist.github.com/rockorequin/f61fcb0217194997a2a3e8c4da260e4c. It's a bit hacky because I just copied in the functions that have been removed or made internal.

git clone \
    --branch rockorequin-sickcodes-microhobby-patch-1.7.x  \
    https://github.com/sickcodes/evdi
cd evdi
wget -O rockorequin.5.12.patch https://gist.githubusercontent.com/rockorequin/f61fcb0217194997a2a3e8c4da260e4c/raw/1b3fd7f686e93b7c410b7d212174b53a5f5f8019/gistfile1.txt
patch -p1 < rockorequin.5.12.patch
make
sudo make install

@rockorequin Thanks for this! I got the following on 5.12.0-rc4:

[user@hostname evdi]$ make
CFLAGS="-Werror -Wextra -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-error=missing-field-initializers" make -C module 
make[1]: Entering directory './evdi/module'
cat: /etc/redhat-release: No such file or directory
make -C /lib/modules/5.12.0-rc4-1-git-00004-g84196390620a/build M=$PWD
make[2]: Entering directory '/usr/lib/modules/5.12.0-rc4-1-git-00004-g84196390620a/build'
cat: /etc/redhat-release: No such file or directory
  CC [M]  ./evdi/module/evdi_drv.o
./evdi/module/evdi_drv.c: In function ‘drm_gem_dumb_destroy’:
./evdi/module/evdi_drv.c:87:24: error: unused parameter ‘dev’ [-Werror=unused-parameter]
   87 |     struct drm_device *dev,
      |     ~~~~~~~~~~~~~~~~~~~^~~
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:271: ./evdi/module/evdi_drv.o] Error 1
make[2]: *** [Makefile:1851: ./evdi/module] Error 2
make[2]: Leaving directory '/usr/lib/modules/5.12.0-rc4-1-git-00004-g84196390620a/build'
make[1]: *** [Makefile:77: module] Error 2
make[1]: Leaving directory './evdi/module'
make: *** [Makefile:8: all] Error 2

@rockorequin
Copy link

@sickcodes: I also recommend the patch at https://gist.github.com/rockorequin/9f16d3dd2a3278c3d19d7871a72a4092 as it ensures a failed alloc doesn't try to continue with random memory (that's the one I need to get around to pushing to you).

Re your warning, it looks like we should define the function drm_gem_dumb_destroy with __always_unused:

static int drm_gem_dumb_destroy(struct drm_file *file,
			 __always_unused struct drm_device *dev,
			 u32 handle)
{
	return drm_gem_handle_delete(file, handle);
}

When you say that it stopped working around 5.11.5, what are the symptoms? It's not working for me in X11 at all (in 5.10, 5.11, 5.12), but under Wayland it works in both 5.11 (the latest Ubuntu 21.04 kernel, which must be at least 5.11.5) and 5.12-rc4. By it doesn't work I mean that although X recognises there is a monitor, it won't allow me to turn it on.

@sickcodes
Copy link
Contributor Author

@sickcodes: I also recommend the patch at https://gist.github.com/rockorequin/9f16d3dd2a3278c3d19d7871a72a4092 as it ensures a failed alloc doesn't try to continue with random memory (that's the one I need to get around to pushing to you).

Re your warning, it looks like we should define the function drm_gem_dumb_destroy with __always_unused:


static int drm_gem_dumb_destroy(struct drm_file *file,

			 __always_unused struct drm_device *dev,

			 u32 handle)

{

	return drm_gem_handle_delete(file, handle);

}



When you say that it stopped working around 5.11.5, what are the symptoms? It's not working for me in X11 at all (in 5.10, 5.11, 5.12), but under Wayland it works in both 5.11 (the latest Ubuntu 21.04 kernel, which must be at least 5.11.5) and 5.12-rc4. By it doesn't work I mean that although X recognises there is a monitor, it won't allow me to turn it on.

Will try both patches now

Same error in 5.11.6: unable to turn it on. Not sure exactly when it started however.

Unable to debug encrypted displaylink logs.

I'm gonna dump the firmware on the device and see if I can enable decrypted logging.

@arif-ali
Copy link

@rockorequin Although hirsute defaults to wayland, I have stuck with X11, as there were issues with Google Meet, and other stuff or work related stuff. So, my default was X11, and as I did a do-release-upgrade -d, it kept my original default :)

I've just logged out, and logged back in again, and realised I was now using Wayland and not xorg. So those patches worked for me in Wayland :)

Distro: Ubuntu 21.04 (devel)
Kernel: 5.11.0-11-generic
evdi: 1.9.0

patched using these 2 patches

  1. https://gist.github.com/rockorequin/f3047e748bcba9be9d1fff06f472dbda
  2. https://gist.github.com/rockorequin/a5dcbcad9289c4754b4312faf35dbf4f

@sickcodes
Copy link
Contributor Author

@rockorequin very close!

I forked your gist and added + __always_unused struct drm_device *dev,

git clone \
    --branch rockorequin-sickcodes-microhobby-patch-1.7.x  \
    https://github.com/sickcodes/evdi
cd evdi
wget -O rockorequin.5.12.patch https://gist.githubusercontent.com/sickcodes/2c62b829fdb2d9f98f547e27dd1c85f5/raw/1543ab1d9891c7181bf57df3d08ff2555b514b36/gistfile1.txt
wget -O rockorequin2.5.12.patch https://gist.githubusercontent.com/rockorequin/9f16d3dd2a3278c3d19d7871a72a4092/raw/c746cacd365116366886beb1092a7dd78bd6d16b/gistfile1.txt
patch -p1 < rockorequin.5.12.patch
patch -p1 < rockorequin2.5.12.patch

make
# sudo make install
[user@hostname evdi]$ make
CFLAGS="-Werror -Wextra -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-error=missing-field-initializers" make -C module 
make[1]: Entering directory './evdi/module'
cat: /etc/redhat-release: No such file or directory
make -C /lib/modules/5.12.0-rc4-1-git-00004-g84196390620a/build M=$PWD
make[2]: Entering directory '/usr/lib/modules/5.12.0-rc4-1-git-00004-g84196390620a/build'
cat: /etc/redhat-release: No such file or directory
  CC [M]  ./evdi/module/evdi_drv.o
  CC [M]  ./evdi/module/evdi_modeset.o
  CC [M]  ./evdi/module/evdi_connector.o
  CC [M]  ./evdi/module/evdi_encoder.o
  CC [M]  ./evdi/module/evdi_main.o
  CC [M]  ./evdi/module/evdi_fb.o
  CC [M]  ./evdi/module/evdi_gem.o
./evdi/module/evdi_gem.c:47:5: error: no previous prototype for ‘drm_prime_sg_to_page_addr_arrays’ [-Werror=missing-prototypes]
   47 | int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:271: ./evdi/module/evdi_gem.o] Error 1
make[2]: *** [Makefile:1851: ./evdi/module] Error 2
make[2]: Leaving directory '/usr/lib/modules/5.12.0-rc4-1-git-00004-g84196390620a/build'
make[1]: *** [Makefile:77: module] Error 2
make[1]: Leaving directory './evdi/module'
make: *** [Makefile:8: all] Error 2

@sickcodes
Copy link
Contributor Author

sickcodes commented Mar 24, 2021

I removed the CFLAG warnings and installed, rebooting

FLAGS=-Werror -Wextra -Wall #-Wmissing-prototypes -Wstrict-prototypes -Wno-error=missing-field-initializers

Edit: 🥺🤣 no good

Lemme try Wayland...

@arif-ali
Copy link

btw, tried on Xorg just now, and nope, it doesn't work. It detects the monitors, but when applying the setting, it hangs for ~10 seconds, and back to main screen. So, its only wayland for me

@rockorequin
Copy link

@sickcodes: does it stop your error if you make drm_prime_sg_to_page_addr_arrays a static function? I've updated the 5.12 patch at https://gist.github.com/rockorequin/f61fcb0217194997a2a3e8c4da260e4c to include the __always_unused and also to make drm_prime_sg_to_page_addr_arrays static.

@sickcodes
Copy link
Contributor Author

@sickcodes: does it stop your error if you make drm_prime_sg_to_page_addr_arrays a static function? I've updated the 5.12 patch at https://gist.github.com/rockorequin/f61fcb0217194997a2a3e8c4da260e4c to include the __always_unused and also to make drm_prime_sg_to_page_addr_arrays static.

Haven't had much time recently to test, I will try shortly.

@sickcodes
Copy link
Contributor Author

Fixed in related issue: #275

FWIW arch users:

In used downgrader-git to downgrade mesa to 20.3.4-3 which is tracked in #274

@sickcodes
Copy link
Contributor Author

FWIW latest testing verison:

2 testing/mesa 21.0.2-1 (17.2 MiB 90.7 MiB) (Installed)
    An open-source implementation of the OpenGL specification

seems to be working...!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests