From 9433dcaf8c0f78ca7b4c78f918f65d8e5ab5a14d Mon Sep 17 00:00:00 2001 From: Windsome Zeng Date: Tue, 16 Aug 2022 16:53:21 +0800 Subject: [PATCH] [libdrm] Delete and rename path file with DDK 1.17 --- ...d-disable-nouveau-tests-for-static-b.patch | 43 ----- ...c_file_info-and-sync_get_fence_info.patch} | 0 ...d-support-for-populating-drm-formats.patch | 171 ------------------ 3 files changed, 214 deletions(-) delete mode 100644 package/libdrm/0001-tests-meson.build-disable-nouveau-tests-for-static-b.patch rename package/libdrm/{0004-Add-sync_file_info-and-sync_get_fence_info.patch => 0003-Add-sync_file_info-and-sync_get_fence_info.patch} (100%) delete mode 100644 package/libdrm/0003-xf86drm-add-support-for-populating-drm-formats.patch diff --git a/package/libdrm/0001-tests-meson.build-disable-nouveau-tests-for-static-b.patch b/package/libdrm/0001-tests-meson.build-disable-nouveau-tests-for-static-b.patch deleted file mode 100644 index e2e18e12..00000000 --- a/package/libdrm/0001-tests-meson.build-disable-nouveau-tests-for-static-b.patch +++ /dev/null @@ -1,43 +0,0 @@ -From c9036706b9f724f09ac6288f82b53f2e76264ec7 Mon Sep 17 00:00:00 2001 -From: Peter Seiderer -Date: Mon, 25 Nov 2019 15:59:15 +0100 -Subject: [PATCH] tests/meson.build: disable nouveau tests for static build - -Signed-off-by: Peter Seiderer ---- -Notes: - - - the existing test/check for static build in meson.build does not - catch this case because e.g. the buildroot toolchain - br-arm-full-static-2019.05.1 provides an empty libdl.a - - 169 # Among others FreeBSD does not have a separate dl library. - 170 if not cc.has_function('dlsym') - 171 dep_dl = cc.find_library('dl', required : with_nouveau) - 172 else - 173 dep_dl = [] - 174 endif ---- - tests/meson.build | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/tests/meson.build b/tests/meson.build -index 6c8ddd9..f7cb5f0 100644 ---- a/tests/meson.build -+++ b/tests/meson.build -@@ -44,8 +44,11 @@ endif - if with_etnaviv - subdir('etnaviv') - endif -+lib_type = get_option('default_library') - if with_nouveau -- subdir('nouveau') -+ if lib_type != 'static' -+ subdir('nouveau') -+ endif - endif - - drmsl = executable( --- -2.24.0 - diff --git a/package/libdrm/0004-Add-sync_file_info-and-sync_get_fence_info.patch b/package/libdrm/0003-Add-sync_file_info-and-sync_get_fence_info.patch similarity index 100% rename from package/libdrm/0004-Add-sync_file_info-and-sync_get_fence_info.patch rename to package/libdrm/0003-Add-sync_file_info-and-sync_get_fence_info.patch diff --git a/package/libdrm/0003-xf86drm-add-support-for-populating-drm-formats.patch b/package/libdrm/0003-xf86drm-add-support-for-populating-drm-formats.patch deleted file mode 100644 index 37969118..00000000 --- a/package/libdrm/0003-xf86drm-add-support-for-populating-drm-formats.patch +++ /dev/null @@ -1,171 +0,0 @@ -From 001ef51239541dd91f854ea5a5f569f2b338ad82 Mon Sep 17 00:00:00 2001 -From: Luigi Santivetti -Date: Tue, 24 Sep 2019 13:09:31 +0100 -Subject: [PATCH 5/6] xf86drm: add support for populating drm formats - -This change lets libdrm take care of allocation and deallocation of -the drmModePlane formats on behalf of clients. Weston, xserver and -others can use this functionaly instead of querying and parsing the -drm blob. - -NOTE: this change is based on weston/kms.c - -Change-Id: Id318322ee6b8f02442a37797669edd0363a58d88 -Signed-off-by: Luigi Santivetti ---- - xf86drmMode.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - xf86drmMode.h | 12 +++++++ - 2 files changed, 120 insertions(+) - -diff --git a/xf86drmMode.c b/xf86drmMode.c -index 2399e8e..3a099b2 100644 ---- a/xf86drmMode.c -+++ b/xf86drmMode.c -@@ -718,6 +718,114 @@ err_allocs: - return r; - } - -+static inline uint32_t * -+formats_ptr(struct drm_format_modifier_blob *blob) -+{ -+ return (uint32_t *)(((uint8_t *)blob) + blob->formats_offset); -+} -+ -+static inline struct drm_format_modifier * -+modifiers_ptr(struct drm_format_modifier_blob *blob) -+{ -+ return (struct drm_format_modifier *)(((uint8_t *)blob) + -+ blob->modifiers_offset); -+} -+ -+drm_public void -+drmModeFreeFormats(drmModeFormatsPtr drm_mode_fmt) -+{ -+ uint32_t i; -+ -+ if (!drm_mode_fmt) -+ return; -+ -+ for (i = 0; i < drm_mode_fmt->count; i++) -+ drmFree(drm_mode_fmt->formats[i].modifiers); -+ -+ drmFree(drm_mode_fmt); -+} -+ -+drm_public int -+drmModePopulateFormats(drmModePropertyBlobPtr blob, drmModeFormatsPtr *out_formats) -+{ -+ struct drm_format_modifier_blob *fmt_mod_blob; -+ struct drm_format_modifier *blob_modifiers; -+ drmModeFormatsPtr drm_mode_fmt; -+ uint32_t *blob_formats; -+ uint32_t count_formats; -+ uint32_t i; -+ -+ if (!blob || !out_formats) -+ return -EINVAL; -+ -+ fmt_mod_blob = blob->data; -+ blob_formats = formats_ptr(fmt_mod_blob); -+ blob_modifiers = modifiers_ptr(fmt_mod_blob); -+ -+ if (!fmt_mod_blob->count_formats) -+ return -EINVAL; -+ -+ /* The drmModeFormats type supports C versions earlier than C99 -+ * by explicitly defining an array of length 1. Thus, 1 must be -+ * deducted from the runtime value of fmt_mod_blob->count_formats. -+ */ -+ count_formats = fmt_mod_blob->count_formats - 1; -+ drm_mode_fmt = drmMalloc(sizeof(*drm_mode_fmt) + -+ sizeof(drm_mode_fmt->formats[0]) * count_formats); -+ if (!drm_mode_fmt) -+ return -errno; -+ -+ drm_mode_fmt->count = 0; -+ -+ for (i = 0; i < fmt_mod_blob->count_formats; i++) { -+ uint32_t count_valid_modifiers = 0; -+ uint64_t *modifiers = NULL; -+ unsigned j; -+ -+ for (j = 0; j < fmt_mod_blob->count_modifiers; j++) { -+ struct drm_format_modifier *mod = &blob_modifiers[j]; -+ -+ if ((i < mod->offset) || (i > mod->offset + 63)) -+ continue; -+ if (!(mod->formats & (1 << (i - mod->offset)))) -+ continue; -+ -+ modifiers = realloc(modifiers, -+ (count_valid_modifiers + 1) * -+ sizeof(*modifiers)); -+ if (!modifiers) -+ goto err_allocs; -+ -+ modifiers[count_valid_modifiers++] = mod->modifier; -+ } -+ -+ /* Couldn't find valid modifiers, fallback to use linear */ -+ if (count_valid_modifiers == 0) { -+ modifiers = drmMalloc(sizeof(*modifiers)); -+ if (!modifiers) -+ goto err_allocs; -+ -+ *modifiers = 0; /* as DRM_FORMAT_MOD_LINEAR */ -+ count_valid_modifiers = 1; -+ } -+ -+ /* If realloc fails, in order to free all previoulsy allocated -+ * modifiers, always update drm_mode_fmt->count. -+ */ -+ drm_mode_fmt->count++; -+ drm_mode_fmt->formats[i].format = blob_formats[i]; -+ drm_mode_fmt->formats[i].modifiers = modifiers; -+ drm_mode_fmt->formats[i].count_modifiers = count_valid_modifiers; -+ } -+ -+ *out_formats = drm_mode_fmt; -+ return 0; -+ -+err_allocs: -+ drmModeFreeFormats(drm_mode_fmt); -+ return -errno; -+} -+ - drm_public void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr) - { - if (!ptr) -diff --git a/xf86drmMode.h b/xf86drmMode.h -index 5449320..76e77df 100644 ---- a/xf86drmMode.h -+++ b/xf86drmMode.h -@@ -334,6 +334,15 @@ typedef struct _drmModeObjectProperties { - uint64_t *prop_values; - } drmModeObjectProperties, *drmModeObjectPropertiesPtr; - -+typedef struct _drmModeFormats { -+ uint32_t count; -+ struct { -+ uint32_t format; -+ uint32_t count_modifiers; -+ uint64_t *modifiers; -+ } formats[1]; -+} drmModeFormats, *drmModeFormatsPtr; -+ - typedef struct _drmModePlane { - uint32_t count_formats; - uint32_t *formats; -@@ -484,6 +493,9 @@ extern drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId); - extern void drmModeFreeProperty(drmModePropertyPtr ptr); - - extern drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id); -+extern int drmModePopulateFormats(drmModePropertyBlobPtr ptr, -+ drmModeFormatsPtr *out_formats); -+extern void drmModeFreeFormats(drmModeFormatsPtr ptr); - extern void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr); - extern int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property_id, - uint64_t value); --- -2.7.4 -