bcm27xx: add kernel 5.10 support
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.10 / 950-0716-drm-gud-Add-async_flush-module-parameter.patch
1 From e0eb7ca2dd07ca8878b67cc20e75f9d7e46d80f4 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
3 Date: Sat, 3 Jul 2021 16:13:21 +0200
4 Subject: [PATCH] drm/gud: Add async_flush module parameter
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 [ drm-misc commit a0356899ebe8ecde0da9c5685cc47154db973a5e ]
10
11 Provide a way for userspace to choose synchronous flushing/pageflips.
12 This helps save CPU and power.
13
14 It is also useful for test scripts since userspace can know when a flush
15 has happended and wait before doing the next visual test.
16
17 Cc: Linus Walleij <linus.walleij@linaro.org>
18 Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
19 Reviewed-by: Peter Stuge <peter@stuge.se>
20 Link: https://patchwork.freedesktop.org/patch/msgid/20210703141321.35494-2-noralf@tronnes.org
21 ---
22 drivers/gpu/drm/gud/gud_pipe.c | 15 +++++++++++++++
23 1 file changed, 15 insertions(+)
24
25 --- a/drivers/gpu/drm/gud/gud_pipe.c
26 +++ b/drivers/gpu/drm/gud/gud_pipe.c
27 @@ -24,6 +24,19 @@
28 #include "gud_internal.h"
29
30 /*
31 + * Some userspace rendering loops runs all displays in the same loop.
32 + * This means that a fast display will have to wait for a slow one.
33 + * For this reason gud does flushing asynchronous by default.
34 + * The down side is that in e.g. a single display setup userspace thinks
35 + * the display is insanely fast since the driver reports back immediately
36 + * that the flush/pageflip is done. This wastes CPU and power.
37 + * Such users might want to set this module parameter to false.
38 + */
39 +static bool gud_async_flush = true;
40 +module_param_named(async_flush, gud_async_flush, bool, 0644);
41 +MODULE_PARM_DESC(async_flush, "Enable asynchronous flushing [default=true]");
42 +
43 +/*
44 * FIXME: The driver is probably broken on Big Endian machines.
45 * See discussion:
46 * https://lore.kernel.org/dri-devel/CAKb7UvihLX0hgBOP3VBG7O+atwZcUVCPVuBdfmDMpg0NjXe-cQ@mail.gmail.com/
47 @@ -577,6 +590,8 @@ void gud_pipe_update(struct drm_simple_d
48 if (gdrm->flags & GUD_DISPLAY_FLAG_FULL_UPDATE)
49 drm_rect_init(&damage, 0, 0, fb->width, fb->height);
50 gud_fb_queue_damage(gdrm, fb, &damage);
51 + if (!gud_async_flush)
52 + flush_work(&gdrm->work);
53 }
54
55 if (!crtc->state->enable)