Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

Rob Clark 10a02eb6 facb4f4e

+64 -31
+1 -1
drivers/gpu/drm/msm/Makefile
··· 12 12 hdmi/hdmi_i2c.o \ 13 13 hdmi/hdmi_phy_8960.o \ 14 14 hdmi/hdmi_phy_8x60.o \ 15 + mdp/mdp_format.o \ 15 16 mdp/mdp4/mdp4_crtc.o \ 16 17 mdp/mdp4/mdp4_dtv_encoder.o \ 17 - mdp/mdp4/mdp4_format.o \ 18 18 mdp/mdp4/mdp4_irq.o \ 19 19 mdp/mdp4/mdp4_kms.o \ 20 20 mdp/mdp4/mdp4_plane.o \
+2 -2
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
··· 262 262 enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); 263 263 int idx = idxs[pipe_id]; 264 264 if (idx > 0) { 265 - const struct mdp4_format *format = 266 - to_mdp4_format(msm_framebuffer_format(plane->fb)); 265 + const struct mdp_format *format = 266 + to_mdp_format(msm_framebuffer_format(plane->fb)); 267 267 alpha[idx-1] = format->alpha_enable; 268 268 } 269 269 mixer_cfg |= mixercfg(mdp4_crtc->mixer, pipe_id, stages[idx]);
+6 -7
drivers/gpu/drm/msm/mdp/mdp4/mdp4_format.c drivers/gpu/drm/msm/mdp/mdp_format.c
··· 17 17 18 18 19 19 #include "msm_drv.h" 20 - #include "mdp4_kms.h" 20 + #include "mdp_kms.h" 21 21 22 22 #define FMT(name, a, r, g, b, e0, e1, e2, e3, alpha, tight, c, cnt) { \ 23 23 .base = { .pixel_format = DRM_FORMAT_ ## name }, \ ··· 34 34 35 35 #define BPC0A 0 36 36 37 - static const struct mdp4_format formats[] = { 37 + static const struct mdp_format formats[] = { 38 38 /* name a r g b e0 e1 e2 e3 alpha tight cpp cnt */ 39 39 FMT(ARGB8888, 8, 8, 8, 8, 1, 0, 2, 3, true, true, 4, 4), 40 40 FMT(XRGB8888, 8, 8, 8, 8, 1, 0, 2, 3, false, true, 4, 4), ··· 44 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, 48 - uint32_t max_formats) 47 + uint32_t mdp_get_formats(uint32_t *pixel_formats, uint32_t max_formats) 49 48 { 50 49 uint32_t i; 51 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 53 if (i == max_formats) 55 54 break; ··· 59 60 return i; 60 61 } 61 62 62 - const struct msm_format *mdp4_get_format(struct msm_kms *kms, uint32_t format) 63 + const struct msm_format *mdp_get_format(struct msm_kms *kms, uint32_t format) 63 64 { 64 65 int i; 65 66 for (i = 0; i < ARRAY_SIZE(formats); i++) { 66 - const struct mdp4_format *f = &formats[i]; 67 + const struct mdp_format *f = &formats[i]; 67 68 if (f->base.pixel_format == format) 68 69 return &f->base; 69 70 }
+1 -1
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
··· 155 155 .irq = mdp4_irq, 156 156 .enable_vblank = mdp4_enable_vblank, 157 157 .disable_vblank = mdp4_disable_vblank, 158 - .get_format = mdp4_get_format, 158 + .get_format = mdp_get_format, 159 159 .round_pixclk = mdp4_round_pixclk, 160 160 .preclose = mdp4_preclose, 161 161 .destroy = mdp4_destroy,
+10 -18
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h
··· 18 18 #ifndef __MDP4_KMS_H__ 19 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 21 #include "msm_drv.h" 26 - #include "mdp/mdp_common.xml.h" 22 + #include "mdp/mdp_kms.h" 27 23 #include "mdp4.xml.h" 28 24 29 25 ··· 69 73 struct iommu_domain *iommu; 70 74 uint32_t max_clk; 71 75 }; 72 - 73 - struct mdp4_format { 74 - struct msm_format base; 75 - enum mdp_bpc bpc_r, bpc_g, bpc_b; 76 - enum mdp_bpc_alpha bpc_a; 77 - uint8_t unpack[4]; 78 - bool alpha_enable, unpack_tight; 79 - uint8_t cpp, unpack_count; 80 - }; 81 - #define to_mdp4_format(x) container_of(x, struct mdp4_format, base) 82 76 83 77 static inline void mdp4_write(struct mdp4_kms *mdp4_kms, u32 reg, u32 data) 84 78 { ··· 175 189 int mdp4_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); 176 190 void mdp4_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); 177 191 178 - uint32_t mdp4_get_formats(enum mdp4_pipe pipe_id, uint32_t *formats, 179 - uint32_t max_formats); 180 - const struct msm_format *mdp4_get_format(struct msm_kms *kms, uint32_t format); 192 + static inline 193 + uint32_t mdp4_get_formats(enum mdp4_pipe pipe_id, uint32_t *pixel_formats, 194 + uint32_t max_formats) 195 + { 196 + /* TODO when we have YUV, we need to filter supported formats 197 + * based on pipe_id.. 198 + */ 199 + return mdp_get_formats(pixel_formats, max_formats); 200 + } 181 201 182 202 void mdp4_plane_install_properties(struct drm_plane *plane, 183 203 struct drm_mode_object *obj);
+2 -2
drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
··· 132 132 struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane); 133 133 struct mdp4_kms *mdp4_kms = get_kms(plane); 134 134 enum mdp4_pipe pipe = mdp4_plane->pipe; 135 - const struct mdp4_format *format; 135 + const struct mdp_format *format; 136 136 uint32_t op_mode = 0; 137 137 uint32_t phasex_step = MDP4_VG_PHASE_STEP_DEFAULT; 138 138 uint32_t phasey_step = MDP4_VG_PHASE_STEP_DEFAULT; ··· 175 175 176 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 180 mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_FORMAT(pipe), 181 181 MDP4_PIPE_SRC_FORMAT_A_BPC(format->bpc_a) |
+42
drivers/gpu/drm/msm/mdp/mdp_kms.h
··· 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__ */