[4/5] drm/exynos: mixer: do blending setup in mixer_cfg_layer()
diff mbox

Message ID 1430919410-9917-5-git-send-email-tjakobi@math.uni-bielefeld.de
State New
Headers show

Commit Message

Tobias Jakobi May 6, 2015, 1:36 p.m. UTC
This updates the blending setup when the layer configuration
changes (triggered by mixer_win_{commit,disable}).

Extra care has to be taken for the layer that is currently
being enabled/disabled.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Joonyoung Shim May 22, 2015, 9:12 a.m. UTC | #1
On 05/06/2015 10:36 PM, Tobias Jakobi wrote:
> This updates the blending setup when the layer configuration
> changes (triggered by mixer_win_{commit,disable}).
> 
> Extra care has to be taken for the layer that is currently
> being enabled/disabled.
> 
> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 3ab7a01..430d10c 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -177,6 +177,18 @@ static inline bool is_alpha_format(const struct mixer_context* ctx, unsigned int
>  	}
>  }
>  
> +static inline unsigned int layer_bitmask(const struct mixer_context* ctx)
> +{
> +	unsigned int i, mask = 0;
> +
> +	for (i = 0; i < MIXER_WIN_NR; ++i) {
> +		if (ctx->planes[i].enabled)
> +			mask |= (1 << i);
> +	}
> +
> +	return mask;
> +}
> +
>  static inline u32 vp_reg_read(struct mixer_resources *res, u32 reg_id)
>  {
>  	return readl(res->vp_regs + reg_id);
> @@ -513,6 +525,7 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height)
>  static void mixer_cfg_layer(struct mixer_context *ctx, unsigned int win, bool enable)
>  {
>  	struct mixer_resources *res = &ctx->mixer_res;
> +	unsigned int enable_state;
>  	u32 val = enable ? ~0 : 0;
>  
>  	switch (win) {
> @@ -530,6 +543,16 @@ static void mixer_cfg_layer(struct mixer_context *ctx, unsigned int win, bool en
>  		}
>  		break;
>  	}
> +
> +	/* Determine the current enabled/disabled state of the layers. */
> +	enable_state = layer_bitmask(ctx);
> +	if (enable)
> +		enable_state |= (1 << win);
> +	else
> +		enable_state &= ~(1 << win);

I think way to remove to get enable_state of plane everytime, maybe
using atomic state information?

> +
> +	/* Layer configuration has changed, update blending setup. */
> +	mixer_layer_blending(ctx, enable_state);
>  }
>  
>  static void mixer_run(struct mixer_context *ctx)
>
Tobias Jakobi May 22, 2015, 9:50 a.m. UTC | #2
Hello Joonyoung,

On 2015-05-22 11:12, Joonyoung Shim wrote:
> On 05/06/2015 10:36 PM, Tobias Jakobi wrote:
>> This updates the blending setup when the layer configuration
>> changes (triggered by mixer_win_{commit,disable}).
>> 
>> Extra care has to be taken for the layer that is currently
>> being enabled/disabled.
>> 
>> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
>> ---
>>  drivers/gpu/drm/exynos/exynos_mixer.c | 23 +++++++++++++++++++++++
>>  1 file changed, 23 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
>> b/drivers/gpu/drm/exynos/exynos_mixer.c
>> index 3ab7a01..430d10c 100644
>> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
>> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
>> @@ -177,6 +177,18 @@ static inline bool is_alpha_format(const struct 
>> mixer_context* ctx, unsigned int
>>  	}
>>  }
>> 
>> +static inline unsigned int layer_bitmask(const struct mixer_context* 
>> ctx)
>> +{
>> +	unsigned int i, mask = 0;
>> +
>> +	for (i = 0; i < MIXER_WIN_NR; ++i) {
>> +		if (ctx->planes[i].enabled)
>> +			mask |= (1 << i);
>> +	}
>> +
>> +	return mask;
>> +}
>> +
>>  static inline u32 vp_reg_read(struct mixer_resources *res, u32 
>> reg_id)
>>  {
>>  	return readl(res->vp_regs + reg_id);
>> @@ -513,6 +525,7 @@ static void mixer_cfg_rgb_fmt(struct mixer_context 
>> *ctx, unsigned int height)
>>  static void mixer_cfg_layer(struct mixer_context *ctx, unsigned int 
>> win, bool enable)
>>  {
>>  	struct mixer_resources *res = &ctx->mixer_res;
>> +	unsigned int enable_state;
>>  	u32 val = enable ? ~0 : 0;
>> 
>>  	switch (win) {
>> @@ -530,6 +543,16 @@ static void mixer_cfg_layer(struct mixer_context 
>> *ctx, unsigned int win, bool en
>>  		}
>>  		break;
>>  	}
>> +
>> +	/* Determine the current enabled/disabled state of the layers. */
>> +	enable_state = layer_bitmask(ctx);
>> +	if (enable)
>> +		enable_state |= (1 << win);
>> +	else
>> +		enable_state &= ~(1 << win);
> 
> I think way to remove to get enable_state of plane everytime, maybe
> using atomic state information?
I had the same idea, but I don't know even about the atomic 
infrastructure to evaluate if this is possible. I guess Gustavo would be 
the one who could answer this.



> 
>> +
>> +	/* Layer configuration has changed, update blending setup. */
>> +	mixer_layer_blending(ctx, enable_state);
>>  }
>> 
>>  static void mixer_run(struct mixer_context *ctx)
>> 

With best wishes,
Tobias

Patch
diff mbox

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 3ab7a01..430d10c 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -177,6 +177,18 @@  static inline bool is_alpha_format(const struct mixer_context* ctx, unsigned int
 	}
 }
 
+static inline unsigned int layer_bitmask(const struct mixer_context* ctx)
+{
+	unsigned int i, mask = 0;
+
+	for (i = 0; i < MIXER_WIN_NR; ++i) {
+		if (ctx->planes[i].enabled)
+			mask |= (1 << i);
+	}
+
+	return mask;
+}
+
 static inline u32 vp_reg_read(struct mixer_resources *res, u32 reg_id)
 {
 	return readl(res->vp_regs + reg_id);
@@ -513,6 +525,7 @@  static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height)
 static void mixer_cfg_layer(struct mixer_context *ctx, unsigned int win, bool enable)
 {
 	struct mixer_resources *res = &ctx->mixer_res;
+	unsigned int enable_state;
 	u32 val = enable ? ~0 : 0;
 
 	switch (win) {
@@ -530,6 +543,16 @@  static void mixer_cfg_layer(struct mixer_context *ctx, unsigned int win, bool en
 		}
 		break;
 	}
+
+	/* Determine the current enabled/disabled state of the layers. */
+	enable_state = layer_bitmask(ctx);
+	if (enable)
+		enable_state |= (1 << win);
+	else
+		enable_state &= ~(1 << win);
+
+	/* Layer configuration has changed, update blending setup. */
+	mixer_layer_blending(ctx, enable_state);
 }
 
 static void mixer_run(struct mixer_context *ctx)