kernel: bump 4.14 to 4.14.93
[openwrt/staging/chunkeey.git] / target / linux / brcm2708 / patches-4.14 / 950-0345-drm-vc4-Check-if-plane-requires-background-fill.patch
1 From 7771310ee7e9b7291e549e36771de6176d57e24b Mon Sep 17 00:00:00 2001
2 From: Stefan Schake <stschake@gmail.com>
3 Date: Fri, 9 Mar 2018 01:53:35 +0100
4 Subject: [PATCH 345/454] drm/vc4: Check if plane requires background fill
5
6 commit 3d67b68a6a3c2deb689c29759a20150c668c286e upstream.
7
8 Considering a single plane only, we have to enable background color
9 when the plane has an alpha format and could be blending from the
10 background or when it doesn't cover the entire screen.
11
12 Changes from v1:
13 - Drop unrelated change
14 - Move needs_bg_fill to plane state
15
16 Signed-off-by: Stefan Schake <stschake@gmail.com>
17 Signed-off-by: Eric Anholt <eric@anholt.net>
18 Reviewed-by: Eric Anholt <eric@anholt.net>
19 Link: https://patchwork.freedesktop.org/patch/msgid/1520556817-97297-3-git-send-email-stschake@gmail.com
20 ---
21 drivers/gpu/drm/vc4/vc4_plane.c | 17 +++++++++++++++++
22 1 file changed, 17 insertions(+)
23
24 --- a/drivers/gpu/drm/vc4/vc4_plane.c
25 +++ b/drivers/gpu/drm/vc4/vc4_plane.c
26 @@ -73,6 +73,12 @@ struct vc4_plane_state {
27
28 /* Our allocation in LBM for temporary storage during scaling. */
29 struct drm_mm_node lbm;
30 +
31 + /* Set when the plane has per-pixel alpha content or does not cover
32 + * the entire screen. This is a hint to the CRTC that it might need
33 + * to enable background color fill.
34 + */
35 + bool needs_bg_fill;
36 };
37
38 static inline struct vc4_plane_state *
39 @@ -522,6 +528,7 @@ static int vc4_plane_mode_set(struct drm
40 u32 ctl0_offset = vc4_state->dlist_count;
41 const struct hvs_format *format = vc4_get_hvs_format(fb->format->format);
42 int num_planes = drm_format_num_planes(format->drm);
43 + bool covers_screen;
44 u32 scl0, scl1, pitch0;
45 u32 lbm_size, tiling;
46 unsigned long irqflags;
47 @@ -705,6 +712,16 @@ static int vc4_plane_mode_set(struct drm
48 vc4_state->dlist[ctl0_offset] |=
49 VC4_SET_FIELD(vc4_state->dlist_count, SCALER_CTL0_SIZE);
50
51 + /* crtc_* are already clipped coordinates. */
52 + covers_screen = vc4_state->crtc_x == 0 && vc4_state->crtc_y == 0 &&
53 + vc4_state->crtc_w == state->crtc->mode.hdisplay &&
54 + vc4_state->crtc_h == state->crtc->mode.vdisplay;
55 + /* Background fill might be necessary when the plane has per-pixel
56 + * alpha content and blends from the background or does not cover
57 + * the entire screen.
58 + */
59 + vc4_state->needs_bg_fill = format->has_alpha || !covers_screen;
60 +
61 return 0;
62 }
63