From bb7f71be19b24261e03bac4f350f69f956a96918 Mon Sep 17 00:00:00 2001 From: "Michael L. Young" Date: Wed, 29 Dec 2021 21:04:29 -0500 Subject: [PATCH] Fix evdi build error on EL8 distros (#189) Fixes #188 --- ...-EL8-distros-due-to-backports-presen.patch | 203 ++++++++++++++++++ Makefile | 2 +- displaylink.spec | 14 +- 3 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 0001-Fix-compiling-on-EL8-distros-due-to-backports-presen.patch diff --git a/0001-Fix-compiling-on-EL8-distros-due-to-backports-presen.patch b/0001-Fix-compiling-on-EL8-distros-due-to-backports-presen.patch new file mode 100644 index 0000000..d20ce39 --- /dev/null +++ b/0001-Fix-compiling-on-EL8-distros-due-to-backports-presen.patch @@ -0,0 +1,203 @@ +From 92b02abe0e9effbfb6fb0fb3701e5f16438b4eed Mon Sep 17 00:00:00 2001 +From: "Michael L. Young" +Date: Wed, 29 Dec 2021 14:32:46 -0500 +Subject: [PATCH] Fix compiling on EL8 distros due to backports present in + current kernel + +--- + module/evdi_drm_drv.c | 14 +++++++------- + module/evdi_fb.c | 10 +++++----- + module/evdi_gem.c | 10 +++++----- + module/evdi_modeset.c | 8 ++++---- + 4 files changed, 21 insertions(+), 21 deletions(-) + +diff --git a/module/evdi_drm_drv.c b/module/evdi_drm_drv.c +index 8d2afcd..f6912f4 100644 +--- a/module/evdi_drm_drv.c ++++ b/module/evdi_drm_drv.c +@@ -41,7 +41,7 @@ struct drm_ioctl_desc evdi_painter_ioctls[] = { + DRM_UNLOCKED), + }; + +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + #else + static const struct vm_operations_struct evdi_gem_vm_ops = { + .fault = evdi_gem_fault, +@@ -64,7 +64,7 @@ static const struct file_operations evdi_driver_fops = { + .llseek = noop_llseek, + }; + +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + #else + static int evdi_enable_vblank(__always_unused struct drm_device *dev, + __always_unused unsigned int pipe) +@@ -91,21 +91,21 @@ static struct drm_driver driver = { + .postclose = evdi_driver_postclose, + + /* gem hooks */ +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE +-#elif KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE || defined(EL8) ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) ++#elif KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE + .gem_free_object_unlocked = evdi_gem_free_object, + #else + .gem_free_object = evdi_gem_free_object, + #endif + +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + #else + .gem_vm_ops = &evdi_gem_vm_ops, + #endif + + .dumb_create = evdi_dumb_create, + .dumb_map_offset = evdi_gem_mmap, +-#if KERNEL_VERSION(5, 12, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 12, 0) <= LINUX_VERSION_CODE || defined(EL8) + #else + .dumb_destroy = drm_gem_dumb_destroy, + #endif +@@ -118,7 +118,7 @@ static struct drm_driver driver = { + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, + .gem_prime_import = drm_gem_prime_import, + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + #else + .preclose = evdi_driver_preclose, + .gem_prime_export = drm_gem_prime_export, +diff --git a/module/evdi_fb.c b/module/evdi_fb.c +index 2e37ca3..e610b1e 100644 +--- a/module/evdi_fb.c ++++ b/module/evdi_fb.c +@@ -25,7 +25,7 @@ + #include + #include + #include +-#if KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE || defined(EL8) + #include + #endif + #include "evdi_drm_drv.h" +@@ -221,7 +221,7 @@ static struct fb_ops evdifb_ops = { + }; + #endif /* CONFIG_FB */ + +-#if KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE || defined(EL8) + #else + /* + * Function taken from +@@ -331,7 +331,7 @@ static void evdi_user_framebuffer_destroy(struct drm_framebuffer *fb) + static const struct drm_framebuffer_funcs evdifb_funcs = { + .create_handle = evdi_user_framebuffer_create_handle, + .destroy = evdi_user_framebuffer_destroy, +-#if KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE || defined(EL8) + .dirty = drm_atomic_helper_dirtyfb, + #else + .dirty = evdi_user_framebuffer_dirty, +@@ -540,8 +540,8 @@ void evdi_fbdev_unplug(struct drm_device *dev) + if (efbdev->helper.fbdev) { + struct fb_info *info; + +- info = efbdev->helper.fbdev; +-#if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE ++ info = efbdev->helper.fbdev; ++#if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE || defined(EL8) + unregister_framebuffer(info); + #else + unlink_framebuffer(info); +diff --git a/module/evdi_gem.c b/module/evdi_gem.c +index d29c677..ed2ceef 100644 +--- a/module/evdi_gem.c ++++ b/module/evdi_gem.c +@@ -21,7 +21,7 @@ + #include + + +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + static const struct vm_operations_struct evdi_gem_vm_ops = { + .fault = evdi_gem_fault, + .open = drm_gem_vm_open, +@@ -76,7 +76,7 @@ struct evdi_gem_object *evdi_gem_alloc_object(struct drm_device *dev, + #endif + obj->resv = &obj->_resv; + +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + obj->base.funcs = &gem_obj_funcs; + #endif + +@@ -232,7 +232,7 @@ int evdi_gem_vmap(struct evdi_gem_object *obj) + int ret; + + if (obj->base.import_attach) { +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + struct dma_buf_map map; + + ret = dma_buf_vmap(obj->base.import_attach->dmabuf, &map); +@@ -260,7 +260,7 @@ int evdi_gem_vmap(struct evdi_gem_object *obj) + void evdi_gem_vunmap(struct evdi_gem_object *obj) + { + if (obj->base.import_attach) { +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(obj->vmapping); + + dma_buf_vunmap(obj->base.import_attach->dmabuf, &map); +@@ -370,7 +370,7 @@ evdi_prime_import_sg_table(struct drm_device *dev, + return ERR_PTR(-ENOMEM); + } + +-#if KERNEL_VERSION(5, 12, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 12, 0) <= LINUX_VERSION_CODE || defined(EL8) + drm_prime_sg_to_page_array(sg, obj->pages, npages); + #else + drm_prime_sg_to_page_addr_arrays(sg, obj->pages, NULL, npages); +diff --git a/module/evdi_modeset.c b/module/evdi_modeset.c +index 8b91ccf..37b1857 100644 +--- a/module/evdi_modeset.c ++++ b/module/evdi_modeset.c +@@ -62,14 +62,14 @@ static void evdi_crtc_set_nofb(__always_unused struct drm_crtc *crtc) + + static void evdi_crtc_atomic_flush( + struct drm_crtc *crtc +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + , struct drm_atomic_state *state + #else + , __always_unused struct drm_crtc_state *old_state + #endif + ) + { +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); + #else + struct drm_crtc_state *crtc_state = crtc->state; +@@ -181,7 +181,7 @@ static struct drm_crtc_helper_funcs evdi_helper_funcs = { + .disable = evdi_crtc_disable + }; + +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + static int evdi_enable_vblank(__always_unused struct drm_crtc *crtc) + { + return 1; +@@ -202,7 +202,7 @@ static const struct drm_crtc_funcs evdi_crtc_funcs = { + + .cursor_set2 = evdi_crtc_cursor_set, + .cursor_move = evdi_crtc_cursor_move, +-#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE ++#if KERNEL_VERSION(5, 11, 0) <= LINUX_VERSION_CODE || defined(EL8) + .enable_vblank = evdi_enable_vblank, + .disable_vblank = evdi_disable_vblank, + #endif +-- +2.27.0 + diff --git a/Makefile b/Makefile index f52a2f8..1b1d118 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ DAEMON_VERSION := 5.4.1-55.174 DOWNLOAD_ID := 3751 # This id number comes off the link on the displaylink website VERSION := 1.9.1 -RELEASE := 2 +RELEASE := 3 # # Dependencies diff --git a/displaylink.spec b/displaylink.spec index 22547f2..f1c64b9 100644 --- a/displaylink.spec +++ b/displaylink.spec @@ -7,7 +7,7 @@ %endif %if 0%{!?_release} -%global _release 2 +%global _release 3 %endif # Disable RPATH since DisplayLinkManager contains this. @@ -45,6 +45,10 @@ Source5: 20-displaylink.conf Source6: 95-displaylink.preset Source7: %{name}.logrotate +%if 0%{?rhel} && 0%{?rhel} >= 8 +Patch1: 0001-Fix-compiling-on-EL8-distros-due-to-backports-presen.patch +%endif + BuildRequires: gcc-c++ BuildRequires: libdrm-devel BuildRequires: make @@ -88,6 +92,11 @@ mkdir -p evdi-%{version} mv displaylink-driver-%{_daemon_version}/evdi.tar.gz evdi-%{version} cd evdi-%{version} gzip -dc evdi.tar.gz | tar -xvvf - + +%if 0%{?rhel} && 0%{?rhel} >= 8 +%patch1 -p1 +%endif + %else %setup -q -T -D -a 0 cd evdi-%{version} @@ -219,6 +228,9 @@ chmod +x %{buildroot}%{_prefix}/lib/systemd/system-sleep/displaylink.sh %systemd_postun_with_restart displaylink.service %changelog +* Wed Dec 29 2021 Michael L. Young 1.9.1-3 +- Add patch to fix compile error on EL8 + * Mon Dec 27 2021 Michael L. Young 1.9.1-2 - Change 'unbundled' to 'github' as part of attempt to clarify which evdi driver is being used in the RPM that is produced.