mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 10:14:25 +07:00
drm/sun4i: frontend: Configure and enable YUV to RGB CSC when needed
In prevision of adding support for YUV formats, set the YUV to RGB colorspace conversion coefficients if required and don't bypass the CSC engine when converting. The BT601 coefficients from the A33 BSP are copied over from the backend code. Because of module inter-dependency, we can't have the frontend use these coefficients from the backend directly. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190118145133.21281-8-paul.kocialkowski@bootlin.com
This commit is contained in:
parent
e6ae40bd94
commit
b38f61f52e
@ -213,6 +213,8 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
|
|||||||
const struct drm_format_info *format = fb->format;
|
const struct drm_format_info *format = fb->format;
|
||||||
u32 out_fmt_val;
|
u32 out_fmt_val;
|
||||||
u32 in_fmt_val, in_mod_val, in_ps_val;
|
u32 in_fmt_val, in_mod_val, in_ps_val;
|
||||||
|
unsigned int i;
|
||||||
|
u32 bypass;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = sun4i_frontend_drm_format_to_input_fmt(format, &in_fmt_val);
|
ret = sun4i_frontend_drm_format_to_input_fmt(format, &in_fmt_val);
|
||||||
@ -250,9 +252,26 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
|
|||||||
regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_VERTPHASE1_REG, 0x400);
|
regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_VERTPHASE1_REG, 0x400);
|
||||||
regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_VERTPHASE1_REG, 0x400);
|
regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_VERTPHASE1_REG, 0x400);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Checking the input format is sufficient since we currently only
|
||||||
|
* support RGB output formats to the backend. If YUV output formats
|
||||||
|
* ever get supported, an YUV input and output would require bypassing
|
||||||
|
* the CSC engine too.
|
||||||
|
*/
|
||||||
|
if (format->is_yuv) {
|
||||||
|
/* Setup the CSC engine for YUV to RGB conversion. */
|
||||||
|
bypass = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(sunxi_bt601_yuv2rgb_coef); i++)
|
||||||
|
regmap_write(frontend->regs,
|
||||||
|
SUN4I_FRONTEND_CSC_COEF_REG(i),
|
||||||
|
sunxi_bt601_yuv2rgb_coef[i]);
|
||||||
|
} else {
|
||||||
|
bypass = SUN4I_FRONTEND_BYPASS_CSC_EN;
|
||||||
|
}
|
||||||
|
|
||||||
regmap_update_bits(frontend->regs, SUN4I_FRONTEND_BYPASS_REG,
|
regmap_update_bits(frontend->regs, SUN4I_FRONTEND_BYPASS_REG,
|
||||||
SUN4I_FRONTEND_BYPASS_CSC_EN,
|
SUN4I_FRONTEND_BYPASS_CSC_EN, bypass);
|
||||||
SUN4I_FRONTEND_BYPASS_CSC_EN);
|
|
||||||
|
|
||||||
regmap_write(frontend->regs, SUN4I_FRONTEND_INPUT_FMT_REG,
|
regmap_write(frontend->regs, SUN4I_FRONTEND_INPUT_FMT_REG,
|
||||||
in_mod_val | in_fmt_val | in_ps_val);
|
in_mod_val | in_fmt_val | in_ps_val);
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#define SUN4I_FRONTEND_OUTPUT_FMT_DATA_FMT_BGRX8888 1
|
#define SUN4I_FRONTEND_OUTPUT_FMT_DATA_FMT_BGRX8888 1
|
||||||
#define SUN4I_FRONTEND_OUTPUT_FMT_DATA_FMT_XRGB8888 2
|
#define SUN4I_FRONTEND_OUTPUT_FMT_DATA_FMT_XRGB8888 2
|
||||||
|
|
||||||
|
#define SUN4I_FRONTEND_CSC_COEF_REG(c) (0x070 + (0x4 * (c)))
|
||||||
|
|
||||||
#define SUN4I_FRONTEND_CH0_INSIZE_REG 0x100
|
#define SUN4I_FRONTEND_CH0_INSIZE_REG 0x100
|
||||||
#define SUN4I_FRONTEND_INSIZE(h, w) ((((h) - 1) << 16) | (((w) - 1)))
|
#define SUN4I_FRONTEND_INSIZE(h, w) ((((h) - 1) << 16) | (((w) - 1)))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user