Skip to contentSkip to conversation

drm/omapdrm: dispc: Refuse x-decimation above 4 for all but 8-bit formats

PATCH Superseded Jyri Sarha 3 participants 6 messages Feb 7, 2017 – Feb 8, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jyri Sarha

author
#0 lore raw

PATCH 1/1 drm/omapdrm: dispc: Refuse x-decimation above 4 for all but 8-bit formats

Let's disable all scaling that requires horizontal decimation with higher factor than 4, until we have better estimates of what we can and can not do. However, 1 byte per pixel color format appear to work Ok with all decimation factors.

When decimating horizontally by more that 4 the dss is not able to fetch the data in burst mode. When this happens it is hard to tell if there enough bandwidth. Despite what theory says this appears to be true also for 16-bit color formats.

---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/gpu/drm/omapdrm/dss/dispc.c +19 -0
index 5554b72..61daef6 100644
@@ -2506,6 +2506,25 @@ static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk,
 		return -EINVAL;
 	}
 
+	if (*decim_x > 4 && color_mode_to_bpp(color_mode) > 8) {
+		/*
+		  Let's disable all scaling that requires horizontal
+		  decimation with higher factor than 4, until we have
+		  better estimates of what we can and can not
+		  do. However, 1 byte per pixel color format appear to
+		  work Ok with all decimation factors.
+
+		  When decimating horizontally by more that 4 the dss
+		  is not able to fetch the data in burst mode. When
+		  this happens it is hard to tell if there enough
+		  bandwidth. Despite what theory says this appears to
+		  be true also for 16-bit color formats.
+		*/
+		DSSERR("Not enough bandwidth (x-decimation factor %d > 4)",
+			*decim_x);
+		return -EINVAL;
+	}
+
 	*core_clk = dispc.feat->calc_core_clk(pclk, in_width, in_height,
 				out_width, out_height, mem_to_mem);
 	return 0;
Signature · 6 lines
1.9.1

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

Hi Jyri,

Thank you for the patch.

Quoted 30 lines · On Tuesday 07 Feb 2017 16:41:20 Jyri Sarha wrote:

Let's disable all scaling that requires horizontal decimation with higher factor than 4, until we have better estimates of what we can and can not do. However, 1 byte per pixel color format appear to work Ok with all decimation factors.

When decimating horizontally by more that 4 the dss is not able to fetch the data in burst mode. When this happens it is hard to tell if there enough bandwidth. Despite what theory says this appears to be true also for 16-bit color formats.

---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/dispc.c index 5554b72..61daef6 100644

drivers/gpu/drm/omapdrm/dss/dispc.c +7 -0
@@ -2506,6 +2506,25 @@ static int dispc_ovl_calc_scaling_44xx(unsigned long
 pclk, unsigned long lclk, return -EINVAL;
 	}
 
+	if (*decim_x > 4 && color_mode_to_bpp(color_mode) > 8) {
+		/*
+		  Let's disable all scaling that requires horizontal
+		  decimation with higher factor than 4, until we have
+		  better estimates of what we can and can not
+		  do. However, 1 byte per pixel color format appear to
+		  work Ok with all decimation factors.

drivers/gpu/drm/omapdrm/dss/dispc.c static int dispc_ovl_calc_scaling_44xx(unsigned long · line 2525

Quoted 10 lines
drivers/gpu/drm/omapdrm/dss/dispc.c +10 -0
+
+		  When decimating horizontally by more that 4 the dss
+		  is not able to fetch the data in burst mode. When
+		  this happens it is hard to tell if there enough
+		  bandwidth. Despite what theory says this appears to
+		  be true also for 16-bit color formats.
+		*/
+		DSSERR("Not enough bandwidth (x-decimation factor %d > 4)",
+			*decim_x);
+		return -EINVAL;

This needs to be validated during the atomic check phase to avoid failures at commit time that are much harder to handle properly.

Quoted 5 lines
drivers/gpu/drm/omapdrm/dss/dispc.c +2 -0
+	}
+
 	*core_clk = dispc.feat->calc_core_clk(pclk, in_width, in_height,
 				out_width, out_height, mem_to_mem);
 	return 0;
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 40 lines · Laurent Pinchart

Hi Jyri,

Thank you for the patch.

Quoted 35 lines · On Tuesday 07 Feb 2017 16:41:20 Jyri Sarha wrote:

Let's disable all scaling that requires horizontal decimation with higher factor than 4, until we have better estimates of what we can and can not do. However, 1 byte per pixel color format appear to work Ok with all decimation factors.

When decimating horizontally by more that 4 the dss is not able to fetch the data in burst mode. When this happens it is hard to tell if there enough bandwidth. Despite what theory says this appears to be true also for 16-bit color formats.

---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/dispc.c index 5554b72..61daef6 100644

drivers/gpu/drm/omapdrm/dss/dispc.c +12 -0
@@ -2506,6 +2506,25 @@ static int dispc_ovl_calc_scaling_44xx(unsigned long
 pclk, unsigned long lclk, return -EINVAL;
 	}
 
+	if (*decim_x > 4 && color_mode_to_bpp(color_mode) > 8) {
+		/*
+		  Let's disable all scaling that requires horizontal
+		  decimation with higher factor than 4, until we have
+		  better estimates of what we can and can not
+		  do. However, 1 byte per pixel color format appear to
+		  work Ok with all decimation factors.
+
+		  When decimating horizontally by more that 4 the dss
+		  is not able to fetch the data in burst mode. When
+		  this happens it is hard to tell if there enough
+		  bandwidth. Despite what theory says this appears to
Quoted 8 lines

drivers/gpu/drm/omapdrm/dss/dispc.c static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk, · line 2525

Quoted 5 lines
drivers/gpu/drm/omapdrm/dss/dispc.c +5 -0
+		  be true also for 16-bit color formats.
+		*/
+		DSSERR("Not enough bandwidth (x-decimation factor %d > 4)",
+			*decim_x);
+		return -EINVAL;

This needs to be validated during the atomic check phase to avoid failures at commit time that are much harder to handle properly.

I agree, but that requires rewriting half of the dispc driver... This and the few earlier ones from Jyri are quick fixes to major issues we've found.

Tomi

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

author
#3 lore raw
In reply to Laurent Pinchart
Quoted 40 lines · Laurent Pinchart

Hi Jyri,

Thank you for the patch.

Quoted 35 lines · On Tuesday 07 Feb 2017 16:41:20 Jyri Sarha wrote:

Let's disable all scaling that requires horizontal decimation with higher factor than 4, until we have better estimates of what we can and can not do. However, 1 byte per pixel color format appear to work Ok with all decimation factors.

When decimating horizontally by more that 4 the dss is not able to fetch the data in burst mode. When this happens it is hard to tell if there enough bandwidth. Despite what theory says this appears to be true also for 16-bit color formats.

---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/dispc.c index 5554b72..61daef6 100644

drivers/gpu/drm/omapdrm/dss/dispc.c +12 -0
@@ -2506,6 +2506,25 @@ static int dispc_ovl_calc_scaling_44xx(unsigned long
 pclk, unsigned long lclk, return -EINVAL;
 	}
 
+	if (*decim_x > 4 && color_mode_to_bpp(color_mode) > 8) {
+		/*
+		  Let's disable all scaling that requires horizontal
+		  decimation with higher factor than 4, until we have
+		  better estimates of what we can and can not
+		  do. However, 1 byte per pixel color format appear to
+		  work Ok with all decimation factors.
+
+		  When decimating horizontally by more that 4 the dss
+		  is not able to fetch the data in burst mode. When
+		  this happens it is hard to tell if there enough
+		  bandwidth. Despite what theory says this appears to
Quoted 9 lines

drivers/gpu/drm/omapdrm/dss/dispc.c static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk, · line 2525

Quoted 5 lines
drivers/gpu/drm/omapdrm/dss/dispc.c +5 -0
+		  be true also for 16-bit color formats.
+		*/
+		DSSERR("Not enough bandwidth (x-decimation factor %d > 4)",
+			*decim_x);
+		return -EINVAL;

This needs to be validated during the atomic check phase to avoid failures at commit time that are much harder to handle properly.

Sure, but I can not fix everything in one step. This is a first simple quantitative test that is supposed to tell if scaling can be done without synclost errors. Next step is to make dispc to not look to HW for current clock settings, and then finally make all relevant check callbacks (or some flag in the config callbacks) in dispc.

Anyway, there will be a v2 of this patch that tests color_mode != OMAP_DSS_COLOR_NV12 instead of color_mode_to_bpp(color_mode) > 8. The NV12 appears to be the only color format that works reliably with current implementation.

Best regards,
Jyri

Quoted 6 lines

drivers/gpu/drm/omapdrm/dss/dispc.c static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk, · line 2530

Quoted 5 lines
drivers/gpu/drm/omapdrm/dss/dispc.c +2 -0
+	}
+
 	*core_clk = dispc.feat->calc_core_clk(pclk, in_width, in_height,
 				out_width, out_height, mem_to_mem);
 	return 0;

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

#4 lore raw
In reply to Jyri Sarha
Quoted 29 lines · Jyri Sarha

Let's disable all scaling that requires horizontal decimation with higher factor than 4, until we have better estimates of what we can and can not do. However, 1 byte per pixel color format appear to work Ok with all decimation factors.

When decimating horizontally by more that 4 the dss is not able to fetch the data in burst mode. When this happens it is hard to tell if there enough bandwidth. Despite what theory says this appears to be true also for 16-bit color formats.

---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/gpu/drm/omapdrm/dss/dispc.c +6 -0
index 5554b72..61daef6 100644
@@ -2506,6 +2506,25 @@ static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk,
 		return -EINVAL;
 	}
 
+	if (*decim_x > 4 && color_mode_to_bpp(color_mode) > 8) {
+		/*
+		  Let's disable all scaling that requires horizontal
+		  decimation with higher factor than 4, until we have
+		  better estimates of what we can and can not
+		  do. However, 1 byte per pixel color format appear to

drivers/gpu/drm/omapdrm/dss/dispc.c static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk, · line 2524

Quoted 10 lines
drivers/gpu/drm/omapdrm/dss/dispc.c +10 -0
+		  work Ok with all decimation factors.
+
+		  When decimating horizontally by more that 4 the dss
+		  is not able to fetch the data in burst mode. When
+		  this happens it is hard to tell if there enough
+		  bandwidth. Despite what theory says this appears to
+		  be true also for 16-bit color formats.
+		*/
+		DSSERR("Not enough bandwidth (x-decimation factor %d > 4)",
+			*decim_x);

I think the error message could be improved. A normal user could hit this when setting up a plane, and I'm quite sure the above doesn't give any clue to the user what the issue is (too much downscaling).

Tomi

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

#5 lore raw

Hi Tomi,

Quoted 39 lines · On Wednesday 08 Feb 2017 15:51:08 Tomi Valkeinen wrote:
Quoted 38 lines · Jyri Sarha

Let's disable all scaling that requires horizontal decimation with higher factor than 4, until we have better estimates of what we can and can not do. However, 1 byte per pixel color format appear to work Ok with all decimation factors.

When decimating horizontally by more that 4 the dss is not able to fetch the data in burst mode. When this happens it is hard to tell if there enough bandwidth. Despite what theory says this appears to be true also for 16-bit color formats.

---

 drivers/gpu/drm/omapdrm/dss/dispc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/dispc.c index 5554b72..61daef6 100644

drivers/gpu/drm/omapdrm/dss/dispc.c +0 -0
@@ -2506,6 +2506,25 @@ static int dispc_ovl_calc_scaling_44xx(unsigned

long pclk, unsigned long lclk,>

drivers/gpu/drm/omapdrm/dss/dispc.c +12 -0
 		return -EINVAL;
 
 	}
 
+	if (*decim_x > 4 && color_mode_to_bpp(color_mode) > 8) {
+		/*
+		  Let's disable all scaling that requires horizontal
+		  decimation with higher factor than 4, until we have
+		  better estimates of what we can and can not
+		  do. However, 1 byte per pixel color format appear to
+		  work Ok with all decimation factors.
+
+		  When decimating horizontally by more that 4 the dss
+		  is not able to fetch the data in burst mode. When
+		  this happens it is hard to tell if there enough
+		  bandwidth. Despite what theory says this appears to
Quoted 8 lines

drivers/gpu/drm/omapdrm/dss/dispc.c static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk, · line 2524

Quoted 4 lines
drivers/gpu/drm/omapdrm/dss/dispc.c +4 -0
+		  be true also for 16-bit color formats.
+		*/
+		DSSERR("Not enough bandwidth (x-decimation factor %d > 4)",
+			*decim_x);

I think the error message could be improved. A normal user could hit this when setting up a plane, and I'm quite sure the above doesn't give any clue to the user what the issue is (too much downscaling).

Shouldn't the message be turned into a debug message ? Otherwise you'll give a way for users to flood the kernel log, which is never good.

Signature · 8 lines
Regards,

Laurent Pinchart

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