layerscape: add patches-5.4
[openwrt/staging/mkresin.git] / target / linux / layerscape / patches-5.4 / 805-display-0044-drm-imx-Extract-IPUv3-specific-KMS-functions-to-ipuv.patch
1 From 6b1bc8ad2bdcfa0cbda91a0963aed746c424465d Mon Sep 17 00:00:00 2001
2 From: Liu Ying <victor.liu@nxp.com>
3 Date: Thu, 24 Jan 2019 17:06:30 +0800
4 Subject: [PATCH] drm/imx: Extract IPUv3 specific KMS functions to ipuv3-kms.c
5 (part 1)
6
7 Since we want to add i.MX DPU support into imx-drm, the imx-drm core
8 driver should be no more IPUv3 specific. Let's make imx-drm more generic
9 and extract IPUv3 specific KMS functions to ipuv3-kms.c.
10
11 Signed-off-by: Liu Ying <victor.liu@nxp.com>
12 [ Aisheng: update to new kernel version accordingly ]
13 [ Aisheng: split IPU changes out of imx-drm-core change ]
14 Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
15 ---
16 drivers/gpu/drm/imx/imx-drm-core.c | 81 --------------------------------------
17 drivers/gpu/drm/imx/imx-drm.h | 5 +--
18 2 files changed, 2 insertions(+), 84 deletions(-)
19
20 --- a/drivers/gpu/drm/imx/imx-drm-core.c
21 +++ b/drivers/gpu/drm/imx/imx-drm-core.c
22 @@ -26,9 +26,6 @@
23 #include <drm/drm_vblank.h>
24
25 #include "imx-drm.h"
26 -#include "ipuv3-plane.h"
27 -
28 -#define MAX_CRTC 4
29
30 static int legacyfb_depth = 16;
31 module_param(legacyfb_depth, int, 0444);
32 @@ -48,81 +45,6 @@ void imx_drm_encoder_destroy(struct drm_
33 }
34 EXPORT_SYMBOL_GPL(imx_drm_encoder_destroy);
35
36 -static int imx_drm_atomic_check(struct drm_device *dev,
37 - struct drm_atomic_state *state)
38 -{
39 - int ret;
40 -
41 - ret = drm_atomic_helper_check(dev, state);
42 - if (ret)
43 - return ret;
44 -
45 - /*
46 - * Check modeset again in case crtc_state->mode_changed is
47 - * updated in plane's ->atomic_check callback.
48 - */
49 - ret = drm_atomic_helper_check_modeset(dev, state);
50 - if (ret)
51 - return ret;
52 -
53 - /* Assign PRG/PRE channels and check if all constrains are satisfied. */
54 - ret = ipu_planes_assign_pre(dev, state);
55 - if (ret)
56 - return ret;
57 -
58 - return ret;
59 -}
60 -
61 -static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = {
62 - .fb_create = drm_gem_fb_create,
63 - .atomic_check = imx_drm_atomic_check,
64 - .atomic_commit = drm_atomic_helper_commit,
65 -};
66 -
67 -static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
68 -{
69 - struct drm_device *dev = state->dev;
70 - struct drm_plane *plane;
71 - struct drm_plane_state *old_plane_state, *new_plane_state;
72 - bool plane_disabling = false;
73 - int i;
74 -
75 - drm_atomic_helper_commit_modeset_disables(dev, state);
76 -
77 - drm_atomic_helper_commit_planes(dev, state,
78 - DRM_PLANE_COMMIT_ACTIVE_ONLY |
79 - DRM_PLANE_COMMIT_NO_DISABLE_AFTER_MODESET);
80 -
81 - drm_atomic_helper_commit_modeset_enables(dev, state);
82 -
83 - for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
84 - if (drm_atomic_plane_disabling(old_plane_state, new_plane_state))
85 - plane_disabling = true;
86 - }
87 -
88 - /*
89 - * The flip done wait is only strictly required by imx-drm if a deferred
90 - * plane disable is in-flight. As the core requires blocking commits
91 - * to wait for the flip it is done here unconditionally. This keeps the
92 - * workitem around a bit longer than required for the majority of
93 - * non-blocking commits, but we accept that for the sake of simplicity.
94 - */
95 - drm_atomic_helper_wait_for_flip_done(dev, state);
96 -
97 - if (plane_disabling) {
98 - for_each_old_plane_in_state(state, plane, old_plane_state, i)
99 - ipu_plane_disable_deferred(plane);
100 -
101 - }
102 -
103 - drm_atomic_helper_commit_hw_done(state);
104 -}
105 -
106 -static const struct drm_mode_config_helper_funcs imx_drm_mode_config_helpers = {
107 - .atomic_commit_tail = imx_drm_atomic_commit_tail,
108 -};
109 -
110 -
111 int imx_drm_encoder_parse_of(struct drm_device *drm,
112 struct drm_encoder *encoder, struct device_node *np)
113 {
114 @@ -223,9 +145,6 @@ static int imx_drm_bind(struct device *d
115 drm->mode_config.min_height = 1;
116 drm->mode_config.max_width = 4096;
117 drm->mode_config.max_height = 4096;
118 - drm->mode_config.funcs = &imx_drm_mode_config_funcs;
119 - drm->mode_config.helper_private = &imx_drm_mode_config_helpers;
120 - drm->mode_config.allow_fb_modifiers = true;
121 drm->mode_config.normalize_zpos = true;
122
123 drm_mode_config_init(drm);
124 --- a/drivers/gpu/drm/imx/imx-drm.h
125 +++ b/drivers/gpu/drm/imx/imx-drm.h
126 @@ -2,6 +2,8 @@
127 #ifndef _IMX_DRM_H_
128 #define _IMX_DRM_H_
129
130 +#define MAX_CRTC 4
131 +
132 struct device_node;
133 struct drm_crtc;
134 struct drm_connector;
135 @@ -38,7 +40,4 @@ int imx_drm_encoder_parse_of(struct drm_
136 void imx_drm_connector_destroy(struct drm_connector *connector);
137 void imx_drm_encoder_destroy(struct drm_encoder *encoder);
138
139 -int ipu_planes_assign_pre(struct drm_device *dev,
140 - struct drm_atomic_state *state);
141 -
142 #endif /* _IMX_DRM_H_ */