Skip to content

Commit

Permalink
Fix evdi build error on EL8 distros (displaylink-rpm#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
elguero committed Dec 30, 2021
1 parent 8085cbe commit bb7f71b
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 2 deletions.
203 changes: 203 additions & 0 deletions 0001-Fix-compiling-on-EL8-distros-due-to-backports-presen.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
From 92b02abe0e9effbfb6fb0fb3701e5f16438b4eed Mon Sep 17 00:00:00 2001
From: "Michael L. Young" <[email protected]>
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 <drm/drm_crtc_helper.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_atomic.h>
-#if KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE
+#if KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE || defined(EL8)
#include <drm/drm_damage_helper.h>
#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 <drm/drm_cache.h>


-#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

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion displaylink.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%endif

%if 0%{!?_release}
%global _release 2
%global _release 3
%endif

# Disable RPATH since DisplayLinkManager contains this.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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 <[email protected]> 1.9.1-3
- Add patch to fix compile error on EL8

* Mon Dec 27 2021 Michael L. Young <[email protected]> 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.
Expand Down

0 comments on commit bb7f71b

Please sign in to comment.