diff options
author | Rob Clark <robdclark@gmail.com> | 2013-11-30 14:58:23 -0500 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2014-01-09 14:43:58 -0500 |
commit | 10a02eb64656e96579e136ae914d30093ca59e48 (patch) | |
tree | e65d153ce74300a1b2ef02315ae4dfabc441c2a6 /drivers/gpu/drm/msm | |
parent | facb4f4e7fae93ddfcfc2a5f2d0417185a7029ed (diff) |
drm/msm: mdp4_format -> mdp_format
This can be shared between mdp4 and mdp5. Both use the same set of
parameters to describe the format to the hw.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm')
-rw-r--r-- | drivers/gpu/drm/msm/Makefile | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp_format.c (renamed from drivers/gpu/drm/msm/mdp/mdp4/mdp4_format.c) | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp_kms.h | 42 |
7 files changed, 64 insertions, 31 deletions
diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile index 6df111821e2e..9481736eb2dd 100644 --- a/drivers/gpu/drm/msm/Makefile +++ b/drivers/gpu/drm/msm/Makefile | |||
@@ -12,9 +12,9 @@ msm-y := \ | |||
12 | hdmi/hdmi_i2c.o \ | 12 | hdmi/hdmi_i2c.o \ |
13 | hdmi/hdmi_phy_8960.o \ | 13 | hdmi/hdmi_phy_8960.o \ |
14 | hdmi/hdmi_phy_8x60.o \ | 14 | hdmi/hdmi_phy_8x60.o \ |
15 | mdp/mdp_format.o \ | ||
15 | mdp/mdp4/mdp4_crtc.o \ | 16 | mdp/mdp4/mdp4_crtc.o \ |
16 | mdp/mdp4/mdp4_dtv_encoder.o \ | 17 | mdp/mdp4/mdp4_dtv_encoder.o \ |
17 | mdp/mdp4/mdp4_format.o \ | ||
18 | mdp/mdp4/mdp4_irq.o \ | 18 | mdp/mdp4/mdp4_irq.o \ |
19 | mdp/mdp4/mdp4_kms.o \ | 19 | mdp/mdp4/mdp4_kms.o \ |
20 | mdp/mdp4/mdp4_plane.o \ | 20 | mdp/mdp4/mdp4_plane.o \ |
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c index d0ff3901bf5a..c11400a1c603 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | |||
@@ -262,8 +262,8 @@ static void blend_setup(struct drm_crtc *crtc) | |||
262 | enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); | 262 | enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); |
263 | int idx = idxs[pipe_id]; | 263 | int idx = idxs[pipe_id]; |
264 | if (idx > 0) { | 264 | if (idx > 0) { |
265 | const struct mdp4_format *format = | 265 | const struct mdp_format *format = |
266 | to_mdp4_format(msm_framebuffer_format(plane->fb)); | 266 | to_mdp_format(msm_framebuffer_format(plane->fb)); |
267 | alpha[idx-1] = format->alpha_enable; | 267 | alpha[idx-1] = format->alpha_enable; |
268 | } | 268 | } |
269 | mixer_cfg |= mixercfg(mdp4_crtc->mixer, pipe_id, stages[idx]); | 269 | mixer_cfg |= mixercfg(mdp4_crtc->mixer, pipe_id, stages[idx]); |
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c index 2e2ae16f334e..ee4b27eded98 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | |||
@@ -155,7 +155,7 @@ static const struct msm_kms_funcs kms_funcs = { | |||
155 | .irq = mdp4_irq, | 155 | .irq = mdp4_irq, |
156 | .enable_vblank = mdp4_enable_vblank, | 156 | .enable_vblank = mdp4_enable_vblank, |
157 | .disable_vblank = mdp4_disable_vblank, | 157 | .disable_vblank = mdp4_disable_vblank, |
158 | .get_format = mdp4_get_format, | 158 | .get_format = mdp_get_format, |
159 | .round_pixclk = mdp4_round_pixclk, | 159 | .round_pixclk = mdp4_round_pixclk, |
160 | .preclose = mdp4_preclose, | 160 | .preclose = mdp4_preclose, |
161 | .destroy = mdp4_destroy, | 161 | .destroy = mdp4_destroy, |
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h index 5da111f372cd..ede026698cdd 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h | |||
@@ -18,12 +18,8 @@ | |||
18 | #ifndef __MDP4_KMS_H__ | 18 | #ifndef __MDP4_KMS_H__ |
19 | #define __MDP4_KMS_H__ | 19 | #define __MDP4_KMS_H__ |
20 | 20 | ||
21 | #include <linux/clk.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/regulator/consumer.h> | ||
24 | |||
25 | #include "msm_drv.h" | 21 | #include "msm_drv.h" |
26 | #include "mdp/mdp_common.xml.h" | 22 | #include "mdp/mdp_kms.h" |
27 | #include "mdp4.xml.h" | 23 | #include "mdp4.xml.h" |
28 | 24 | ||
29 | 25 | ||
@@ -74,16 +70,6 @@ struct mdp4_platform_config { | |||
74 | uint32_t max_clk; | 70 | uint32_t max_clk; |
75 | }; | 71 | }; |
76 | 72 | ||
77 | struct mdp4_format { | ||
78 | struct msm_format base; | ||
79 | enum mdp_bpc bpc_r, bpc_g, bpc_b; | ||
80 | enum mdp_bpc_alpha bpc_a; | ||
81 | uint8_t unpack[4]; | ||
82 | bool alpha_enable, unpack_tight; | ||
83 | uint8_t cpp, unpack_count; | ||
84 | }; | ||
85 | #define to_mdp4_format(x) container_of(x, struct mdp4_format, base) | ||
86 | |||
87 | static inline void mdp4_write(struct mdp4_kms *mdp4_kms, u32 reg, u32 data) | 73 | static inline void mdp4_write(struct mdp4_kms *mdp4_kms, u32 reg, u32 data) |
88 | { | 74 | { |
89 | msm_writel(data, mdp4_kms->mmio + reg); | 75 | msm_writel(data, mdp4_kms->mmio + reg); |
@@ -189,9 +175,15 @@ void mdp4_irq_unregister(struct mdp4_kms *mdp4_kms, struct mdp4_irq *irq); | |||
189 | int mdp4_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); | 175 | int mdp4_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); |
190 | void mdp4_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); | 176 | void mdp4_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); |
191 | 177 | ||
192 | uint32_t mdp4_get_formats(enum mdp4_pipe pipe_id, uint32_t *formats, | 178 | static inline |
193 | uint32_t max_formats); | 179 | uint32_t mdp4_get_formats(enum mdp4_pipe pipe_id, uint32_t *pixel_formats, |
194 | const struct msm_format *mdp4_get_format(struct msm_kms *kms, uint32_t format); | 180 | uint32_t max_formats) |
181 | { | ||
182 | /* TODO when we have YUV, we need to filter supported formats | ||
183 | * based on pipe_id.. | ||
184 | */ | ||
185 | return mdp_get_formats(pixel_formats, max_formats); | ||
186 | } | ||
195 | 187 | ||
196 | void mdp4_plane_install_properties(struct drm_plane *plane, | 188 | void mdp4_plane_install_properties(struct drm_plane *plane, |
197 | struct drm_mode_object *obj); | 189 | struct drm_mode_object *obj); |
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c index 0f0af243f6fc..d2edf2b2a816 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | |||
@@ -132,7 +132,7 @@ int mdp4_plane_mode_set(struct drm_plane *plane, | |||
132 | struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane); | 132 | struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane); |
133 | struct mdp4_kms *mdp4_kms = get_kms(plane); | 133 | struct mdp4_kms *mdp4_kms = get_kms(plane); |
134 | enum mdp4_pipe pipe = mdp4_plane->pipe; | 134 | enum mdp4_pipe pipe = mdp4_plane->pipe; |
135 | const struct mdp4_format *format; | 135 | const struct mdp_format *format; |
136 | uint32_t op_mode = 0; | 136 | uint32_t op_mode = 0; |
137 | uint32_t phasex_step = MDP4_VG_PHASE_STEP_DEFAULT; | 137 | uint32_t phasex_step = MDP4_VG_PHASE_STEP_DEFAULT; |
138 | uint32_t phasey_step = MDP4_VG_PHASE_STEP_DEFAULT; | 138 | uint32_t phasey_step = MDP4_VG_PHASE_STEP_DEFAULT; |
@@ -175,7 +175,7 @@ int mdp4_plane_mode_set(struct drm_plane *plane, | |||
175 | 175 | ||
176 | mdp4_plane_set_scanout(plane, fb); | 176 | mdp4_plane_set_scanout(plane, fb); |
177 | 177 | ||
178 | format = to_mdp4_format(msm_framebuffer_format(fb)); | 178 | format = to_mdp_format(msm_framebuffer_format(fb)); |
179 | 179 | ||
180 | mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_FORMAT(pipe), | 180 | mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_FORMAT(pipe), |
181 | MDP4_PIPE_SRC_FORMAT_A_BPC(format->bpc_a) | | 181 | MDP4_PIPE_SRC_FORMAT_A_BPC(format->bpc_a) | |
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_format.c b/drivers/gpu/drm/msm/mdp/mdp_format.c index 17330b0927b2..e0a6ffbe6ab4 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_format.c +++ b/drivers/gpu/drm/msm/mdp/mdp_format.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | 18 | ||
19 | #include "msm_drv.h" | 19 | #include "msm_drv.h" |
20 | #include "mdp4_kms.h" | 20 | #include "mdp_kms.h" |
21 | 21 | ||
22 | #define FMT(name, a, r, g, b, e0, e1, e2, e3, alpha, tight, c, cnt) { \ | 22 | #define FMT(name, a, r, g, b, e0, e1, e2, e3, alpha, tight, c, cnt) { \ |
23 | .base = { .pixel_format = DRM_FORMAT_ ## name }, \ | 23 | .base = { .pixel_format = DRM_FORMAT_ ## name }, \ |
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | #define BPC0A 0 | 35 | #define BPC0A 0 |
36 | 36 | ||
37 | static const struct mdp4_format formats[] = { | 37 | static const struct mdp_format formats[] = { |
38 | /* name a r g b e0 e1 e2 e3 alpha tight cpp cnt */ | 38 | /* name a r g b e0 e1 e2 e3 alpha tight cpp cnt */ |
39 | FMT(ARGB8888, 8, 8, 8, 8, 1, 0, 2, 3, true, true, 4, 4), | 39 | FMT(ARGB8888, 8, 8, 8, 8, 1, 0, 2, 3, true, true, 4, 4), |
40 | FMT(XRGB8888, 8, 8, 8, 8, 1, 0, 2, 3, false, true, 4, 4), | 40 | FMT(XRGB8888, 8, 8, 8, 8, 1, 0, 2, 3, false, true, 4, 4), |
@@ -44,12 +44,11 @@ static const struct mdp4_format formats[] = { | |||
44 | FMT(BGR565, 0, 5, 6, 5, 2, 0, 1, 0, false, true, 2, 3), | 44 | FMT(BGR565, 0, 5, 6, 5, 2, 0, 1, 0, false, true, 2, 3), |
45 | }; | 45 | }; |
46 | 46 | ||
47 | uint32_t mdp4_get_formats(enum mdp4_pipe pipe_id, uint32_t *pixel_formats, | 47 | uint32_t mdp_get_formats(uint32_t *pixel_formats, uint32_t max_formats) |
48 | uint32_t max_formats) | ||
49 | { | 48 | { |
50 | uint32_t i; | 49 | uint32_t i; |
51 | for (i = 0; i < ARRAY_SIZE(formats); i++) { | 50 | for (i = 0; i < ARRAY_SIZE(formats); i++) { |
52 | const struct mdp4_format *f = &formats[i]; | 51 | const struct mdp_format *f = &formats[i]; |
53 | 52 | ||
54 | if (i == max_formats) | 53 | if (i == max_formats) |
55 | break; | 54 | break; |
@@ -60,11 +59,11 @@ uint32_t mdp4_get_formats(enum mdp4_pipe pipe_id, uint32_t *pixel_formats, | |||
60 | return i; | 59 | return i; |
61 | } | 60 | } |
62 | 61 | ||
63 | const struct msm_format *mdp4_get_format(struct msm_kms *kms, uint32_t format) | 62 | const struct msm_format *mdp_get_format(struct msm_kms *kms, uint32_t format) |
64 | { | 63 | { |
65 | int i; | 64 | int i; |
66 | for (i = 0; i < ARRAY_SIZE(formats); i++) { | 65 | for (i = 0; i < ARRAY_SIZE(formats); i++) { |
67 | const struct mdp4_format *f = &formats[i]; | 66 | const struct mdp_format *f = &formats[i]; |
68 | if (f->base.pixel_format == format) | 67 | if (f->base.pixel_format == format) |
69 | return &f->base; | 68 | return &f->base; |
70 | } | 69 | } |
diff --git a/drivers/gpu/drm/msm/mdp/mdp_kms.h b/drivers/gpu/drm/msm/mdp/mdp_kms.h new file mode 100644 index 000000000000..710edf7e19d1 --- /dev/null +++ b/drivers/gpu/drm/msm/mdp/mdp_kms.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Red Hat | ||
3 | * Author: Rob Clark <robdclark@gmail.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef __MDP_KMS_H__ | ||
19 | #define __MDP_KMS_H__ | ||
20 | |||
21 | #include <linux/clk.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/regulator/consumer.h> | ||
24 | |||
25 | #include "msm_drv.h" | ||
26 | #include "mdp_common.xml.h" | ||
27 | |||
28 | struct mdp_format { | ||
29 | struct msm_format base; | ||
30 | enum mdp_bpc bpc_r, bpc_g, bpc_b; | ||
31 | enum mdp_bpc_alpha bpc_a; | ||
32 | uint8_t unpack[4]; | ||
33 | bool alpha_enable, unpack_tight; | ||
34 | uint8_t cpp, unpack_count; | ||
35 | }; | ||
36 | #define to_mdp_format(x) container_of(x, struct mdp_format, base) | ||
37 | |||
38 | |||
39 | uint32_t mdp_get_formats(uint32_t *formats, uint32_t max_formats); | ||
40 | const struct msm_format *mdp_get_format(struct msm_kms *kms, uint32_t format); | ||
41 | |||
42 | #endif /* __MDP_KMS_H__ */ | ||