[PATCH v6 08/13] drm/sun4i: add support for Allwinner DE2 mixers
From: icenowy@aosc.io (Icenowy Zheng)
Date: 2017-05-05 12:39:44
Also in:
dri-devel, linux-clk, linux-devicetree, lkml
? 2017?5?5? GMT+08:00 ??8:36:18, Maxime Ripard [off-list ref] ??:
On Fri, May 05, 2017 at 12:50:51AM +0800, icenowy at aosc.io wrote:quoted
quoted
quoted
+void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer, + int layer, bool enable) +{ + u32 val; + /* Currently the first UI channel is used */ + int chan = mixer->cfg->vi_num; + + DRM_DEBUG_DRIVER("Enabling layer %d in channel %d\n", layer,chan);quoted
quoted
quoted
+ + if (enable) + val = SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN; + else + val = 0; + + regmap_update_bits(mixer->engine.regs, + SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer), + SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN, val); + + /* Set the alpha configuration */ + regmap_update_bits(mixer->engine.regs, + SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer), + SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_MASK, + SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_DEF); + regmap_update_bits(mixer->engine.regs, + SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer), + SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MASK, + SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF); +}This one too.It's called from sun8i_layer.c, so it cannot be static.Fair enough.quoted
quoted
quoted
+ /* Set base coordinates */ + DRM_DEBUG_DRIVER("Layer coordinates X: %d Y: %d\n", + state->crtc_x, state->crtc_y); + regmap_write(mixer->engine.regs, + SUN8I_MIXER_CHAN_UI_LAYER_COORD(chan, layer), + SUN8I_MIXER_COORD(state->crtc_x, state->crtc_y));X and Y are fixed point numbers. You want to keep only the higher16quoted
quoted
bits there.Do you mean "lower 16 bits"? Thus should I (x & 0xffff) or ((u16)x) ?Nevermind, I got confused with src_x and src_y.quoted
P.S. The negative coordinates are broken, how should I deal with it?orquoted
is the coordinates promised to be not negative?Adjust the buffer base address, and use a shorter line. You have such an example in the sun4i code.
Are they these two lines:
paddr += (state->src_x >> 16) * bpp;
paddr += (state->src_y >> 16) * fb->pitches[0];
I think I copied them here, so I don't need to mind this problem any more, right?
Maxime