1From 55f7577ea99188047b89a37720b0e68a6f404c7e Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Tue, 23 Jun 2020 17:17:13 +0800
4Subject: [PATCH 05/93] HACK: backend-drm: Disable DRM_CLIENT_CAP_ASPECT_RATIO
5 for kernel < 4.19
6
7This conflicts with custom cap in Rockchip BSP 4.4 kernel.
8
9Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
10---
11 libweston/backend-drm/kms.c | 5 +++++
12 1 file changed, 5 insertions(+)
13
14diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c
15index 0118efa..735196b 100644
16--- a/libweston/backend-drm/kms.c
17+++ b/libweston/backend-drm/kms.c
18@@ -29,6 +29,8 @@
19
20 #include "config.h"
21
22+#include <linux/version.h>
23+
24 #include <stdint.h>
25
26 #include <xf86drm.h>
27@@ -1530,10 +1532,13 @@ init_kms_caps(struct drm_device *device)
28 	if (!device->atomic_modeset || getenv("WESTON_FORCE_RENDERER"))
29 		device->sprites_are_broken = true;
30
31+	/* HACK: This conflicts with custom cap in Rockchip BSP 4.4 kernel */
32+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)
33 	ret = drmSetClientCap(device->drm.fd, DRM_CLIENT_CAP_ASPECT_RATIO, 1);
34 	device->aspect_ratio_supported = (ret == 0);
35 	weston_log("DRM: %s picture aspect ratio\n",
36 		   device->aspect_ratio_supported ? "supports" : "does not support");
37+#endif
38
39 	return 0;
40 }
41--
422.20.1
43
44