Skip to contentSkip to conversation

drm/exynos: don't commit if plane scaling is required

PATCH In review Gustavo Padovan 5 participants 10 messages Mar 19, 2015 – Apr 17, 2015 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/exynos: don't commit if plane scaling is required

From: Gustavo Padovan <[email protected]>

exynos doesn't show scaled planes properly on the screen so disable the feature and show a message to the user.

---
 drivers/gpu/drm/exynos/exynos_mixer.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/exynos/exynos_mixer.c +6 -0
index 2e3bc57..a95fe84 100644
@@ -550,6 +550,12 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
 		fmt = ARGB8888;
 	}
 
+	if (win_data->crtc_width != win_data->src_width ||
+	    win_data->crtc_height != win_data->src_height) {
+		DRM_DEBUG_KMS("plane scaling not supported\n");
+		return;
+	}
+
 	/* 2x scaling feature */
 	x_ratio = 0;
 	y_ratio = 0;
Signature · 6 lines
2.1.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/3 drm/exynos: reset temporary value after write to register

From: Gustavo Padovan <[email protected]>

'val' wasn't clean after its last usage, so we could get garbage value and send the wrong command to the hw.

---
 drivers/gpu/drm/exynos/exynos_mixer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_mixer.c +1 -1
index a95fe84..7aff88f 100644
@@ -687,7 +687,7 @@ static void mixer_win_reset(struct mixer_context *ctx)
 	mixer_reg_write(res, MXR_GRAPHIC_CFG(0), val);
 
 	/* Blend layer 1 into layer 0 */
-	val |= MXR_GRP_CFG_BLEND_PRE_MUL;
+	val = MXR_GRP_CFG_BLEND_PRE_MUL;
 	val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
 	mixer_reg_write(res, MXR_GRAPHIC_CFG(1), val);
 
Signature · 6 lines
2.1.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Re: [PATCH 2/3] drm/exynos: reset temporary value after write to register

Hi Gustavo,

Quoted 15 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

'val' wasn't clean after its last usage, so we could get garbage value and send the wrong command to the hw.

---
 drivers/gpu/drm/exynos/exynos_mixer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_mixer.c +0 -0
index a95fe84..7aff88f 100644

drivers/gpu/drm/exynos/exynos_mixer.c static void mixer_win_reset(struct mixer_context *ctx) · line 690

Quoted 4 lines
drivers/gpu/drm/exynos/exynos_mixer.c +0 -1
@@ -687,7 +687,7 @@ static void mixer_win_reset(struct mixer_context *ctx)
 	mixer_reg_write(res, MXR_GRAPHIC_CFG(0), val);
 
 	/* Blend layer 1 into layer 0 */
-	val |= MXR_GRP_CFG_BLEND_PRE_MUL;

I know this is not wrong, current code means layer 1 needs above register setting value of layer 0 as default.

Thanks.

drivers/gpu/drm/exynos/exynos_mixer.c static void mixer_win_reset(struct mixer_context *ctx) · line 693

Quoted 5 lines
drivers/gpu/drm/exynos/exynos_mixer.c +1 -0
+	val = MXR_GRP_CFG_BLEND_PRE_MUL;
 	val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
 	mixer_reg_write(res, MXR_GRAPHIC_CFG(1), val);
 

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

PATCH 3/3 drm/exynos: enable/disable blend based on pixel format

In reply to Gustavo Padovan

From: Gustavo Padovan <[email protected]>

Change the switch to use the pixel_format instead of bpp to figure out if we need to enable or disable the layer blending.

---
 drivers/gpu/drm/exynos/exynos_mixer.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_mixer.c +25 -4
index 7aff88f..0c54098 100644
@@ -529,7 +529,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
 	unsigned int x_ratio, y_ratio;
 	unsigned int src_x_offset, src_y_offset, dst_x_offset, dst_y_offset;
 	dma_addr_t dma_addr;
-	unsigned int fmt;
+	unsigned int fmt, blend;
 	u32 val;
 
 	win_data = &ctx->win_data[win];
@@ -539,15 +539,26 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
 	#define ARGB4444 6
 	#define ARGB8888 7
 
-	switch (win_data->bpp) {
-	case 16:
+	switch (win_data->pixel_format) {
+	case DRM_FORMAT_ARGB4444:
 		fmt = ARGB4444;
+		blend = 1;
 		break;
-	case 32:
+
+	case DRM_FORMAT_ARGB8888:
+		fmt = ARGB8888;
+		blend = 1;
+		break;
+
+	case DRM_FORMAT_XRGB8888:
 		fmt = ARGB8888;
+		blend = 0;
 		break;
+
 	default:
 		fmt = ARGB8888;
+		blend = 0;
+		break;
 	}
 
 	if (win_data->crtc_width != win_data->src_width ||
@@ -586,6 +597,16 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
 	mixer_reg_write(res, MXR_GRAPHIC_SPAN(win),
 			win_data->fb_pitch / (win_data->bpp >> 3));
 
+	if (blend) {
+		val = MXR_GRP_CFG_BLEND_PRE_MUL;
+		val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
+	} else {
+		val = 0;
+	}
+	mixer_reg_writemask(res, MXR_GRAPHIC_CFG(win), val,
+			    MXR_GRP_CFG_BLEND_PRE_MUL
+			    | MXR_GRP_CFG_PIXEL_BLEND_EN);
+
 	/* setup display size */
 	if (ctx->mxr_ver == MXR_VER_128_0_0_184 &&
 		win == MIXER_DEFAULT_WIN) {
Signature · 6 lines
2.1.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Re: [PATCH 3/3] drm/exynos: enable/disable blend based on pixel format

Hi Gustavo,

Quoted 5 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

Change the switch to use the pixel_format instead of bpp to figure out if we need to enable or disable the layer blending.

The default concept is ok about enable or disable of pixel blending feature by pixel_format, but it will make to possible blending with background layer. I'm not sure whether it's proper or not.

Thanks.

Quoted 66 lines
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_mixer.c +25 -4
index 7aff88f..0c54098 100644
@@ -529,7 +529,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
 	unsigned int x_ratio, y_ratio;
 	unsigned int src_x_offset, src_y_offset, dst_x_offset, dst_y_offset;
 	dma_addr_t dma_addr;
-	unsigned int fmt;
+	unsigned int fmt, blend;
 	u32 val;
 
 	win_data = &ctx->win_data[win];
@@ -539,15 +539,26 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
 	#define ARGB4444 6
 	#define ARGB8888 7
 
-	switch (win_data->bpp) {
-	case 16:
+	switch (win_data->pixel_format) {
+	case DRM_FORMAT_ARGB4444:
 		fmt = ARGB4444;
+		blend = 1;
 		break;
-	case 32:
+
+	case DRM_FORMAT_ARGB8888:
+		fmt = ARGB8888;
+		blend = 1;
+		break;
+
+	case DRM_FORMAT_XRGB8888:
 		fmt = ARGB8888;
+		blend = 0;
 		break;
+
 	default:
 		fmt = ARGB8888;
+		blend = 0;
+		break;
 	}
 
 	if (win_data->crtc_width != win_data->src_width ||
@@ -586,6 +597,16 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
 	mixer_reg_write(res, MXR_GRAPHIC_SPAN(win),
 			win_data->fb_pitch / (win_data->bpp >> 3));
 
+	if (blend) {
+		val = MXR_GRP_CFG_BLEND_PRE_MUL;
+		val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
+	} else {
+		val = 0;
+	}
+	mixer_reg_writemask(res, MXR_GRAPHIC_CFG(win), val,
+			    MXR_GRP_CFG_BLEND_PRE_MUL
+			    | MXR_GRP_CFG_PIXEL_BLEND_EN);
+
 	/* setup display size */
 	if (ctx->mxr_ver == MXR_VER_128_0_0_184 &&
 		win == MIXER_DEFAULT_WIN) {

A message that is not in the archive (sent off-list or not yet received): trinity-82a40b8e-a2bb-425f-a1c6-15696573bf32-1429273719156@3capp-gmx-bs40

#6 lore raw

Re: Fw: Re: [PATCH 3/3] drm/exynos: enable/disable blend based on pixel format

Hello Joonyoung,

Quoted 11 lines

Gesendet: Freitag, 17. April 2015 um 08:16 Uhr
Von: "Joonyoung Shim" <[email protected]>
An: "Gustavo Padovan" <[email protected]>, [email protected] Cc: [email protected], [email protected], "Gustavo Padovan" <[email protected]>
Betreff: Re: [PATCH 3/3] drm/exynos: enable/disable blend based on pixel format Hi Gustavo,

Quoted 2 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

Quoted 7 lines
Quoted 3 lines

Change the switch to use the pixel_format instead of bpp to figure out if we need to enable or disable the layer blending.

The default concept is ok about enable or disable of pixel blending feature by pixel_format, but it will make to possible blending with background layer. I'm not sure whether it's proper or not.

Wouldn't this be solved by only allowing non-alpha formats for the primary plane, or am I confusing the plane ordering?

With best wishes,
Tobias

Quoted 70 lines

Thanks.

Quoted 67 lines

---
drivers/gpu/drm/exynos/exynos_mixer.c | 29
+++++++++++++++++++++++++----

1 file changed, 25 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_mixer.c +1 -1
index 7aff88f..0c54098 100644
@@ -529,7 +529,7 @@ static void mixer_graph_buffer(struct 
 mixer_context *ctx, int win)
 unsigned int x_ratio, y_ratio;
 unsigned int src_x_offset, src_y_offset, dst_x_offset, dst_y_offset;
 dma_addr_t dma_addr;
- unsigned int fmt;
+ unsigned int fmt, blend;
 u32 val;
 

win_data = &ctx->win_data[win];

drivers/gpu/drm/exynos/exynos_mixer.c +12 -3
@@ -539,15 +539,26 @@ static void mixer_graph_buffer(struct 
 mixer_context *ctx, int win)
 #define ARGB4444 6
 #define ARGB8888 7
 
- switch (win_data->bpp) {
- case 16:
+ switch (win_data->pixel_format) {
+ case DRM_FORMAT_ARGB4444:
 fmt = ARGB4444;
+ blend = 1;
 break;
- case 32:
+
+ case DRM_FORMAT_ARGB8888:
+ fmt = ARGB8888;
+ blend = 1;
+ break;
+
+ case DRM_FORMAT_XRGB8888:
 fmt = ARGB8888;
+ blend = 0;
 break;
+

default:
fmt = ARGB8888;
+ blend = 0;
+ break;
}

if (win_data->crtc_width != win_data->src_width ||

drivers/gpu/drm/exynos/exynos_mixer.c +10 -0
@@ -586,6 +597,16 @@ static void mixer_graph_buffer(struct 
 mixer_context *ctx, int win)
 mixer_reg_write(res, MXR_GRAPHIC_SPAN(win),
 win_data->fb_pitch / (win_data->bpp >> 3));
 
+ if (blend) {
+ val = MXR_GRP_CFG_BLEND_PRE_MUL;
+ val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
+ } else {
+ val = 0;
+ }
+ mixer_reg_writemask(res, MXR_GRAPHIC_CFG(win), val,
+ MXR_GRP_CFG_BLEND_PRE_MUL
+ | MXR_GRP_CFG_PIXEL_BLEND_EN);
+
 /* setup display size */
Quoted 8 lines
Quoted 3 lines

if (ctx->mxr_ver == MXR_VER_128_0_0_184 &&
win == MIXER_DEFAULT_WIN) {

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

Re: Fw: Re: [PATCH 3/3] drm/exynos: enable/disable blend based on pixel format

In reply to a message not in the archive

Hello Joonyoung,

I thought about this some more.

Quoted 11 lines

Gesendet: Freitag, 17. April 2015 um 08:16 Uhr
Von: "Joonyoung Shim" <[email protected]>
An: "Gustavo Padovan" <[email protected]>, [email protected] Cc: [email protected], [email protected], "Gustavo Padovan" <[email protected]>
Betreff: Re: [PATCH 3/3] drm/exynos: enable/disable blend based on pixel format Hi Gustavo,

Quoted 2 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

Quoted 7 lines
Quoted 3 lines

Change the switch to use the pixel_format instead of bpp to figure out if we need to enable or disable the layer blending.

The default concept is ok about enable or disable of pixel blending feature by pixel_format, but it will make to possible blending with background layer. I'm not sure whether it's proper or not.

I think one of the reasons why this is currently causing confusion is because the background layer is not exposed to userspace. So an idea would be to expose BG as a normal DRM plane, with a background_rgb propery.

Then we just need to keep track which planes are enabled.

E.g. if just the primary plane is enabled, then we ignore any alpha pixelformat (in the sense that we map it to its non-alpha counterpart). If another plane, which is located 'underneath', is enabled, then we honor the alpha. This could then be the background plane.

With best wishes,
Tobias

Quoted 70 lines

Thanks.

Quoted 67 lines

---
drivers/gpu/drm/exynos/exynos_mixer.c | 29
+++++++++++++++++++++++++----

1 file changed, 25 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_mixer.c +1 -1
index 7aff88f..0c54098 100644
@@ -529,7 +529,7 @@ static void mixer_graph_buffer(struct 
 mixer_context *ctx, int win)
 unsigned int x_ratio, y_ratio;
 unsigned int src_x_offset, src_y_offset, dst_x_offset, dst_y_offset;
 dma_addr_t dma_addr;
- unsigned int fmt;
+ unsigned int fmt, blend;
 u32 val;
 

win_data = &ctx->win_data[win];

drivers/gpu/drm/exynos/exynos_mixer.c +12 -3
@@ -539,15 +539,26 @@ static void mixer_graph_buffer(struct 
 mixer_context *ctx, int win)
 #define ARGB4444 6
 #define ARGB8888 7
 
- switch (win_data->bpp) {
- case 16:
+ switch (win_data->pixel_format) {
+ case DRM_FORMAT_ARGB4444:
 fmt = ARGB4444;
+ blend = 1;
 break;
- case 32:
+
+ case DRM_FORMAT_ARGB8888:
+ fmt = ARGB8888;
+ blend = 1;
+ break;
+
+ case DRM_FORMAT_XRGB8888:
 fmt = ARGB8888;
+ blend = 0;
 break;
+

default:
fmt = ARGB8888;
+ blend = 0;
+ break;
}

if (win_data->crtc_width != win_data->src_width ||

drivers/gpu/drm/exynos/exynos_mixer.c +10 -0
@@ -586,6 +597,16 @@ static void mixer_graph_buffer(struct 
 mixer_context *ctx, int win)
 mixer_reg_write(res, MXR_GRAPHIC_SPAN(win),
 win_data->fb_pitch / (win_data->bpp >> 3));
 
+ if (blend) {
+ val = MXR_GRP_CFG_BLEND_PRE_MUL;
+ val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
+ } else {
+ val = 0;
+ }
+ mixer_reg_writemask(res, MXR_GRAPHIC_CFG(win), val,
+ MXR_GRP_CFG_BLEND_PRE_MUL
+ | MXR_GRP_CFG_PIXEL_BLEND_EN);
+
 /* setup display size */
Quoted 8 lines
Quoted 3 lines

if (ctx->mxr_ver == MXR_VER_128_0_0_184 &&
win == MIXER_DEFAULT_WIN) {

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

Re: Fw: Re: [PATCH 3/3] drm/exynos: enable/disable blend based on pixel format

Quoted 22 lines · Tobias Jakobi

Hello Joonyoung,

I thought about this some more.

Quoted 17 lines

Gesendet: Freitag, 17. April 2015 um 08:16 Uhr
Von: "Joonyoung Shim" <[email protected]>
An: "Gustavo Padovan" <[email protected]>, [email protected]
Cc: [email protected], [email protected], "Gustavo Padovan" <[email protected]>
Betreff: Re: [PATCH 3/3] drm/exynos: enable/disable blend based on pixel format
Hi Gustavo,

Quoted 5 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

Change the switch to use the pixel_format instead of bpp to figure out if we need to enable or disable the layer blending.

Quoted 7 lines
Quoted 3 lines

The default concept is ok about enable or disable of pixel blending feature by pixel_format, but it will make to possible blending with background layer. I'm not sure whether it's proper or not.

I think one of the reasons why this is currently causing confusion is because the background layer is not exposed to userspace. So an idea would be to expose BG as a normal DRM plane, with a background_rgb propery.

Is it just a color? The plan is to expose that simply as a crtc property. There have been some patches floating around for intel. Not sure if those were cc:d to dri-devel properly.

Quoted 99 lines

Then we just need to keep track which planes are enabled.

E.g. if just the primary plane is enabled, then we ignore any alpha pixelformat (in the sense that we map it to its non-alpha counterpart). If another plane, which is located 'underneath', is enabled, then we honor the alpha. This could then be the background plane.

With best wishes,
Tobias

Quoted 72 lines

Thanks.

Quoted 69 lines

---
drivers/gpu/drm/exynos/exynos_mixer.c | 29
+++++++++++++++++++++++++----

1 file changed, 25 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_mixer.c +1 -1
index 7aff88f..0c54098 100644
@@ -529,7 +529,7 @@ static void mixer_graph_buffer(struct 
 mixer_context *ctx, int win)
 unsigned int x_ratio, y_ratio;
 unsigned int src_x_offset, src_y_offset, dst_x_offset, dst_y_offset;
 dma_addr_t dma_addr;
- unsigned int fmt;
+ unsigned int fmt, blend;
 u32 val;
 

win_data = &ctx->win_data[win];

drivers/gpu/drm/exynos/exynos_mixer.c +12 -3
@@ -539,15 +539,26 @@ static void mixer_graph_buffer(struct 
 mixer_context *ctx, int win)
 #define ARGB4444 6
 #define ARGB8888 7
 
- switch (win_data->bpp) {
- case 16:
+ switch (win_data->pixel_format) {
+ case DRM_FORMAT_ARGB4444:
 fmt = ARGB4444;
+ blend = 1;
 break;
- case 32:
+
+ case DRM_FORMAT_ARGB8888:
+ fmt = ARGB8888;
+ blend = 1;
+ break;
+
+ case DRM_FORMAT_XRGB8888:
 fmt = ARGB8888;
+ blend = 0;
 break;
+

default:
fmt = ARGB8888;
+ blend = 0;
+ break;
}

if (win_data->crtc_width != win_data->src_width ||

drivers/gpu/drm/exynos/exynos_mixer.c +10 -0
@@ -586,6 +597,16 @@ static void mixer_graph_buffer(struct 
 mixer_context *ctx, int win)
 mixer_reg_write(res, MXR_GRAPHIC_SPAN(win),
 win_data->fb_pitch / (win_data->bpp >> 3));
 
+ if (blend) {
+ val = MXR_GRP_CFG_BLEND_PRE_MUL;
+ val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
+ } else {
+ val = 0;
+ }
+ mixer_reg_writemask(res, MXR_GRAPHIC_CFG(win), val,
+ MXR_GRP_CFG_BLEND_PRE_MUL
+ | MXR_GRP_CFG_PIXEL_BLEND_EN);
+
 /* setup display size */

if (ctx->mxr_ver == MXR_VER_128_0_0_184 &&

Quoted 8 lines
Quoted 2 lines

win == MIXER_DEFAULT_WIN) {

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw
In reply to Gustavo Padovan

Hello,

I've just send an alternate version of this patch, which at least exposes the 2x scaling feature (which is already alluded to in the code):
https://patchwork.kernel.org/patch/6095901/

@Gustavo: What do you think?

With best wishes,
Tobias

Quoted 28 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

exynos doesn't show scaled planes properly on the screen so disable the feature and show a message to the user.

---
 drivers/gpu/drm/exynos/exynos_mixer.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/exynos/exynos_mixer.c +6 -0
index 2e3bc57..a95fe84 100644
@@ -550,6 +550,12 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
 		fmt = ARGB8888;
 	}
 
+	if (win_data->crtc_width != win_data->src_width ||
+	    win_data->crtc_height != win_data->src_height) {
+		DRM_DEBUG_KMS("plane scaling not supported\n");
+		return;
+	}
+
 	/* 2x scaling feature */
 	x_ratio = 0;
 	y_ratio = 0;