From ffcad53d15733b0b97a3ca4ef63aa0a3ac52e435 Mon Sep 17 00:00:00 2001 From: Windsome Zeng Date: Tue, 16 Aug 2022 16:58:52 +0800 Subject: [PATCH] [libdrm] Sync patch files with DDK 1.17 --- ...ync-add-support-for-pre-v4.7-kernels.patch | 92 +++++++++++++++++++ ...Add-sync_fence_info-and-sync_pt_info.patch | 10 +- ...nc_file_info-and-sync_get_fence_info.patch | 10 +- package/libdrm/libdrm.hash | 6 +- package/libdrm/libdrm.mk | 2 +- 5 files changed, 106 insertions(+), 14 deletions(-) create mode 100644 package/libdrm/0001-libsync-add-support-for-pre-v4.7-kernels.patch diff --git a/package/libdrm/0001-libsync-add-support-for-pre-v4.7-kernels.patch b/package/libdrm/0001-libsync-add-support-for-pre-v4.7-kernels.patch new file mode 100644 index 00000000..8e65e239 --- /dev/null +++ b/package/libdrm/0001-libsync-add-support-for-pre-v4.7-kernels.patch @@ -0,0 +1,92 @@ +From 2e634ba4191594394d9b378eed7850b2242d9cb4 Mon Sep 17 00:00:00 2001 +From: Brendan King +Date: Tue, 13 Jun 2017 15:52:44 +0100 +Subject: [PATCH 1/3] libsync: add support for pre-v4.7 kernels + +Add support for the the sync merge ioctl supported by older kernels. +--- + libsync.h | 44 +++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 41 insertions(+), 3 deletions(-) + +diff --git a/libsync.h b/libsync.h +index f1a2f96d..c3b8a385 100644 +--- a/libsync.h ++++ b/libsync.h +@@ -40,6 +40,10 @@ + extern "C" { + #endif + ++#ifndef SYNC_IOC_MAGIC ++#define SYNC_IOC_MAGIC '>' ++#endif ++ + #ifndef SYNC_IOC_MERGE + /* duplicated from linux/sync_file.h to avoid build-time dependency + * on new (v4.7) kernel headers. Once distro's are mostly using +@@ -53,10 +57,22 @@ struct sync_merge_data { + uint32_t flags; + uint32_t pad; + }; +-#define SYNC_IOC_MAGIC '>' + #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data) + #endif + ++#ifndef SYNC_IOC_LEGACY_MERGE ++/* the legacy definitions are based on the contents of ++ * drivers/staging/android/uapi/sync.h in the v4.4 kernel. ++ */ ++struct sync_legacy_merge_data { ++ int32_t fd2; ++ char name[32]; ++ int32_t fence; ++}; ++ ++#define SYNC_IOC_LEGACY_MERGE _IOWR(SYNC_IOC_MAGIC, 1, \ ++ struct sync_legacy_merge_data) ++#endif + + static inline int sync_wait(int fd, int timeout) + { +@@ -83,6 +99,24 @@ static inline int sync_wait(int fd, int timeout) + return ret; + } + ++static inline int sync_legacy_merge(const char *name, int fd1, int fd2) ++{ ++ struct sync_legacy_merge_data data; ++ int ret; ++ ++ data.fd2 = fd2; ++ strncpy(data.name, name, sizeof(data.name)); ++ ++ do { ++ ret = ioctl(fd1, SYNC_IOC_LEGACY_MERGE, &data); ++ } while (ret == -1 && (errno == EINTR || errno == EAGAIN)); ++ ++ if (ret < 0) ++ return ret; ++ ++ return data.fence; ++} ++ + static inline int sync_merge(const char *name, int fd1, int fd2) + { + struct sync_merge_data data = {0}; +@@ -95,8 +129,12 @@ static inline int sync_merge(const char *name, int fd1, int fd2) + ret = ioctl(fd1, SYNC_IOC_MERGE, &data); + } while (ret == -1 && (errno == EINTR || errno == EAGAIN)); + +- if (ret < 0) +- return ret; ++ if (ret < 0) { ++ if (errno == ENOTTY) ++ return sync_legacy_merge(name, fd1, fd2); ++ else ++ return ret; ++ } + + return data.fence; + } +-- +2.25.1 + diff --git a/package/libdrm/0002-Add-sync_fence_info-and-sync_pt_info.patch b/package/libdrm/0002-Add-sync_fence_info-and-sync_pt_info.patch index 5a17f323..225328a4 100644 --- a/package/libdrm/0002-Add-sync_fence_info-and-sync_pt_info.patch +++ b/package/libdrm/0002-Add-sync_fence_info-and-sync_pt_info.patch @@ -1,17 +1,17 @@ -From fef264e0844cfd49be3fdc19a6cea3f2d0f273a8 Mon Sep 17 00:00:00 2001 +From d6acf1fccc903ffe2cbd82c9976e1ad0e500322c Mon Sep 17 00:00:00 2001 From: Brendan King Date: Thu, 24 Aug 2017 13:28:38 +0100 -Subject: [PATCH 4/6] Add sync_fence_info and sync_pt_info +Subject: [PATCH 2/3] Add sync_fence_info and sync_pt_info For pre-4.7 kernels, sync_fence_info returns the data from the SYNC_IOC_FENCE_INFO ioctl. For newer kernels, the SYNC_IOC_FILE_INFO ioctl is called, and the data converted to SYNC_IOC_FENCE_INFO form. --- - libsync.h | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + libsync.h | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) diff --git a/libsync.h b/libsync.h -index c3b8a38..44f7330 100644 +index c3b8a385..44f7330d 100644 --- a/libsync.h +++ b/libsync.h @@ -31,6 +31,7 @@ @@ -208,5 +208,5 @@ index c3b8a38..44f7330 100644 } #endif -- -2.7.4 +2.25.1 diff --git a/package/libdrm/0003-Add-sync_file_info-and-sync_get_fence_info.patch b/package/libdrm/0003-Add-sync_file_info-and-sync_get_fence_info.patch index c2e857cd..c523fb6f 100644 --- a/package/libdrm/0003-Add-sync_file_info-and-sync_get_fence_info.patch +++ b/package/libdrm/0003-Add-sync_file_info-and-sync_get_fence_info.patch @@ -1,7 +1,7 @@ -From a12e3b4490c182ed506f59eda01f1bd0919720f1 Mon Sep 17 00:00:00 2001 +From 5a7d3c0c8d59cf4e9bb70f8d498bbe1fe2dbc69d Mon Sep 17 00:00:00 2001 From: Brendan King Date: Mon, 9 Mar 2020 14:52:17 +0000 -Subject: [PATCH 6/6] Add sync_file_info and sync_get_fence_info +Subject: [PATCH 3/3] Add sync_file_info and sync_get_fence_info For pre-4.7 kernels, sync_file_info calls the SYNC_IOC_FENCE_INFO ioctl, and converts the data to SYNC_IOC_FILE_INFO form. For newer kernels, @@ -12,11 +12,11 @@ which added legacy sync info support, using the structure and ioctl definitions at the top of the patch, as well as the sync_pt_info function. --- - libsync.h | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + libsync.h | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/libsync.h b/libsync.h -index 44f7330..54acb6f 100644 +index 44f7330d..54acb6fa 100644 --- a/libsync.h +++ b/libsync.h @@ -351,6 +351,123 @@ static inline void sync_fence_info_free(struct sync_fence_info_data *info) @@ -144,5 +144,5 @@ index 44f7330..54acb6f 100644 } #endif -- -2.7.4 +2.25.1 diff --git a/package/libdrm/libdrm.hash b/package/libdrm/libdrm.hash index d3f35b3d..4571c270 100644 --- a/package/libdrm/libdrm.hash +++ b/package/libdrm/libdrm.hash @@ -1,6 +1,6 @@ -# From https://lists.freedesktop.org/archives/dri-devel/2021-July/313594.html -sha256 c554cef03b033636a975543eab363cc19081cb464595d3da1ec129f87370f888 libdrm-2.4.107.tar.xz -sha512 c7542ba15c4c934519a6a1f3cb1ec21effa820a805a030d0175313bb1cc796cd311f39596ead883f9f251679d701e262894c5a297d5cf45093c80a6cd818def0 libdrm-2.4.107.tar.xz +# From https://lists.freedesktop.org/archives/dri-devel/2021-November/330279.html +sha256 a1d7948cbc536763fde14b4beb5e4da7867607966d4cf46301087e8b8fe3d6a0 libdrm-2.4.108.tar.xz +sha512 6a841dc3eb8eae7d75e1d35d23a14d51aff758e5a251dbcf6fc8c28d973d935a4a2f6751b405e956b2777d93c651721199ac80c3cd14b87d021668120d6bc974 libdrm-2.4.108.tar.xz # Hash for license file sha256 7e952c6666ed17c99f91ee7af13c688b8769b0feaf6f4558bf6ad3e07512e1e6 xf86drm.c diff --git a/package/libdrm/libdrm.mk b/package/libdrm/libdrm.mk index c15be3e6..0e4029fe 100644 --- a/package/libdrm/libdrm.mk +++ b/package/libdrm/libdrm.mk @@ -4,7 +4,7 @@ # ################################################################################ -LIBDRM_VERSION = 2.4.107 +LIBDRM_VERSION = 2.4.108 LIBDRM_SOURCE = libdrm-$(LIBDRM_VERSION).tar.xz LIBDRM_SITE = https://dri.freedesktop.org/libdrm LIBDRM_LICENSE = MIT