0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2024-12-15 20:20:30 +00:00
Lakka-LibreELEC/packages/x11/xserver/xorg-server/patches/xorg-server-100.04-modesetting-dont-pass-a-big-struct-by-value.patch
David Lawson ff0aec0f57
WIP: Build fixes for Odin (and others) (#1742)
* vulkan-loader: require xrandr when using x11

* vulkan-loader: USE_GAS=OFF for Odin

Might be needed for all aarch64 until https://github.com/KhronosGroup/Vulkan-Loader/issues/881 is fixed

* mergerfs: downgrade to fix build

* xf86-input-libinput: require xorg-server

* Odin: WINDOWMANAGER 'none' -> 'no'

* xorg-server: add patch for drmmode_display.c build error

* Odin: delete a bunch of custom packages

* mesa: couple of bits from v4.x
2023-01-21 17:08:07 +01:00

60 lines
2.4 KiB
Diff

From 0011f4ad173deb284d3001929439c67ad45aa6f2 Mon Sep 17 00:00:00 2001
From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Date: Sun, 24 Mar 2019 02:22:46 +0300
Subject: [PATCH] modesetting: don't pass a big struct by value
Fixes LGTM warning "This parameter of type drmModeModeInfo is 68 bytes -
consider passing a const pointer/reference instead."
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
---
hw/xfree86/drivers/modesetting/drmmode_display.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 21c9222e1e..65e8e63353 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -519,13 +519,13 @@ connector_add_prop(drmModeAtomicReq *req, drmmode_output_private_ptr drmmode_out
}
static int
-drmmode_CompareKModes(drmModeModeInfo * kmode, drmModeModeInfo * other)
+drmmode_CompareKModes(const drmModeModeInfo * kmode, const drmModeModeInfo * other)
{
return memcmp(kmode, other, sizeof(*kmode));
}
static int
-drm_mode_ensure_blob(xf86CrtcPtr crtc, drmModeModeInfo mode_info)
+drm_mode_ensure_blob(xf86CrtcPtr crtc, const drmModeModeInfo* mode_info)
{
modesettingPtr ms = modesettingPTR(crtc->scrn);
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
@@ -533,14 +533,14 @@ drm_mode_ensure_blob(xf86CrtcPtr crtc, drmModeModeInfo mode_info)
int ret;
if (drmmode_crtc->current_mode &&
- drmmode_CompareKModes(&drmmode_crtc->current_mode->mode_info, &mode_info) == 0)
+ drmmode_CompareKModes(&drmmode_crtc->current_mode->mode_info, mode_info) == 0)
return 0;
mode = calloc(sizeof(drmmode_mode_rec), 1);
if (!mode)
return -1;
- mode->mode_info = mode_info;
+ mode->mode_info = *mode_info;
ret = drmModeCreatePropertyBlob(ms->fd,
&mode->mode_info,
sizeof(mode->mode_info),
@@ -589,7 +589,7 @@ crtc_add_dpms_props(drmModeAtomicReq *req, xf86CrtcPtr crtc,
drmModeModeInfo kmode;
drmmode_ConvertToKMode(crtc->scrn, &kmode, &crtc->mode);
- ret |= drm_mode_ensure_blob(crtc, kmode);
+ ret |= drm_mode_ensure_blob(crtc, &kmode);
ret |= crtc_add_prop(req, drmmode_crtc,
DRMMODE_CRTC_ACTIVE, 1);