xref: /OK3568_Linux_fs/buildroot/package/frecon/0001-HACK-Fix-compile-errors.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 468e457e57a46d2e5dd7d7831826992ab31f68d2 Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Thu, 9 Jun 2022 16:15:07 +0800
4Subject: [PATCH 1/9] HACK: Fix compile errors
5
6Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
7---
8 common.mk |  1 -
9 drm.c     |  2 +-
10 fb.c      | 13 +++++++++----
11 3 files changed, 10 insertions(+), 6 deletions(-)
12
13diff --git a/common.mk b/common.mk
14index c699152..055e75e 100644
15--- a/common.mk
16+++ b/common.mk
17@@ -314,7 +314,6 @@ COMMON_CFLAGS-clang := -fvisibility=hidden -ggdb
18 COMMON_CFLAGS := -Wall -Werror -fno-strict-aliasing $(SSP_CFLAGS) -O1 -Wformat=2
19 CXXFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CXXDRIVER))
20 CFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CDRIVER))
21-CPPFLAGS += -D_FORTIFY_SOURCE=2
22
23 # Enable large file support.
24 CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
25diff --git a/drm.c b/drm.c
26index 34d4b78..037a820 100644
27--- a/drm.c
28+++ b/drm.c
29@@ -821,7 +821,7 @@ static int remove_gamma_properties(drm_t* drm, uint32_t crtc_id) {
30 int32_t drm_setmode(drm_t* drm, uint32_t fb_id)
31 {
32 	int conn;
33-	int32_t ret;
34+	int32_t ret = 0;
35 	uint32_t existing_console_crtc_id = 0;
36
37 	if (drm->atomic)
38diff --git a/fb.c b/fb.c
39index 77219c2..9bb2599 100644
40--- a/fb.c
41+++ b/fb.c
42@@ -51,10 +51,15 @@ static int fb_buffer_create(fb_t* fb,
43
44 	fb->lock.map_offset = map_dumb.offset;
45
46-	uint32_t offset = 0;
47+	uint32_t handles[4] = {0};
48+	uint32_t pitches[4] = {0};
49+	uint32_t offsets[4] = {0};
50+	handles[0] = create_dumb.handle;
51+	pitches[0] = create_dumb.pitch;
52+
53 	ret = drmModeAddFB2(fb->drm->fd, fb->drm->console_mode_info.hdisplay, fb->drm->console_mode_info.vdisplay,
54-			    DRM_FORMAT_XRGB8888, &create_dumb.handle,
55-			    &create_dumb.pitch, &offset, &fb->fb_id, 0);
56+			    DRM_FORMAT_XRGB8888, handles,
57+			    pitches, offsets, &fb->fb_id, 0);
58 	if (ret) {
59 		LOG(ERROR, "drmModeAddFB2 failed");
60 		goto destroy_buffer;
61@@ -161,7 +166,7 @@ static bool parse_edid_dtd_display_size(drm_t* drm, int32_t* hsize_mm, int32_t*
62
63 int fb_buffer_init(fb_t* fb)
64 {
65-	int32_t width, height, pitch;
66+	int32_t width, height, pitch = 0;
67 	int32_t hsize_mm, vsize_mm;
68 	int r;
69
70--
712.20.1
72
73