u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert 9f62a472dfb2 ("video: Remove duplicate cursor-positioning function")
@ 2023-03-15 16:01 Tom Rini
  2023-03-15 16:23 ` Simon Glass
  2023-04-02  5:22 ` Simon Glass
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Rini @ 2023-03-15 16:01 UTC (permalink / raw)
  To: u-boot; +Cc: Simon Glass

This reverts commit 9f62a472dfb26ec14408a27938ddd2a25700009d.

The changes here aren't quite right, and on platforms such as Raspberry
Pi where we can have both serial and video output, the change above
causes output to change. This can be seen as the hush tests we have now
fail.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
Cc: Simon Glass <sjg@chromium.org>

Some other issues in my lab meant I thought I had tested this platform
when I took the PR in originally, but hadn't.  So I'd like to grab this
ASAP.
---
 drivers/video/vidconsole-uclass.c | 44 ++++++++++++++++++++++++-------
 1 file changed, 34 insertions(+), 10 deletions(-)

diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 61f4216750f2..1225de233325 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -126,14 +126,26 @@ void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y)
 	priv->ycur = y;
 }
 
-void vidconsole_position_cursor(struct udevice *dev, uint col, uint row)
+/**
+ * set_cursor_position() - set cursor position
+ *
+ * @priv:	private data of the video console
+ * @row:	new row
+ * @col:	new column
+ */
+static void set_cursor_position(struct vidconsole_priv *priv, int row, int col)
 {
-	struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
-	short x, y;
-
-	x = min_t(short, col, priv->cols - 1) * priv->x_charsize;
-	y = min_t(short, row, priv->rows - 1) * priv->y_charsize;
-	vidconsole_set_cursor_pos(dev, x, y);
+	/*
+	 * Ensure we stay in the bounds of the screen.
+	 */
+	if (row >= priv->rows)
+		row = priv->rows - 1;
+	if (col >= priv->cols)
+		col = priv->cols - 1;
+
+	priv->ycur = row * priv->y_charsize;
+	priv->xcur_frac = priv->xstart_frac +
+			  VID_TO_POS(col * priv->x_charsize);
 }
 
 /**
@@ -180,7 +192,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
 			int row = priv->row_saved;
 			int col = priv->col_saved;
 
-			vidconsole_position_cursor(dev, col, row);
+			set_cursor_position(priv, row, col);
 			priv->escape = 0;
 			return;
 		}
@@ -242,7 +254,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
 		if (row < 0)
 			row = 0;
 		/* Right and bottom overflows are handled in the callee. */
-		vidconsole_position_cursor(dev, col, row);
+		set_cursor_position(priv, row, col);
 		break;
 	}
 	case 'H':
@@ -266,7 +278,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
 		if (col)
 			--col;
 
-		vidconsole_position_cursor(dev, col, row);
+		set_cursor_position(priv, row, col);
 
 		break;
 	}
@@ -655,3 +667,15 @@ int vidconsole_clear_and_reset(struct udevice *dev)
 
 	return 0;
 }
+
+void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row)
+{
+	struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
+	struct udevice *vid_dev = dev->parent;
+	struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev);
+	short x, y;
+
+	x = min_t(short, col * priv->x_charsize, vid_priv->xsize - 1);
+	y = min_t(short, row * priv->y_charsize, vid_priv->ysize - 1);
+	vidconsole_set_cursor_pos(dev, x, y);
+}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Revert 9f62a472dfb2 ("video: Remove duplicate cursor-positioning function")
  2023-03-15 16:01 [PATCH] Revert 9f62a472dfb2 ("video: Remove duplicate cursor-positioning function") Tom Rini
@ 2023-03-15 16:23 ` Simon Glass
  2023-03-16 19:26   ` Tom Rini
  2023-04-02  5:22 ` Simon Glass
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Glass @ 2023-03-15 16:23 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot

On Wed, 15 Mar 2023 at 10:01, Tom Rini <trini@konsulko.com> wrote:
>
> This reverts commit 9f62a472dfb26ec14408a27938ddd2a25700009d.
>
> The changes here aren't quite right, and on platforms such as Raspberry
> Pi where we can have both serial and video output, the change above
> causes output to change. This can be seen as the hush tests we have now
> fail.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> Cc: Simon Glass <sjg@chromium.org>
>
> Some other issues in my lab meant I thought I had tested this platform
> when I took the PR in originally, but hadn't.  So I'd like to grab this
> ASAP.
> ---
>  drivers/video/vidconsole-uclass.c | 44 ++++++++++++++++++++++++-------
>  1 file changed, 34 insertions(+), 10 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

I'll give it another go

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Revert 9f62a472dfb2 ("video: Remove duplicate cursor-positioning function")
  2023-03-15 16:23 ` Simon Glass
@ 2023-03-16 19:26   ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2023-03-16 19:26 UTC (permalink / raw)
  To: Simon Glass; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 965 bytes --]

On Wed, Mar 15, 2023 at 10:23:34AM -0600, Simon Glass wrote:
> On Wed, 15 Mar 2023 at 10:01, Tom Rini <trini@konsulko.com> wrote:
> >
> > This reverts commit 9f62a472dfb26ec14408a27938ddd2a25700009d.
> >
> > The changes here aren't quite right, and on platforms such as Raspberry
> > Pi where we can have both serial and video output, the change above
> > causes output to change. This can be seen as the hush tests we have now
> > fail.
> >
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> > ---
> > Cc: Simon Glass <sjg@chromium.org>
> >
> > Some other issues in my lab meant I thought I had tested this platform
> > when I took the PR in originally, but hadn't.  So I'd like to grab this
> > ASAP.
> > ---
> >  drivers/video/vidconsole-uclass.c | 44 ++++++++++++++++++++++++-------
> >  1 file changed, 34 insertions(+), 10 deletions(-)
> >
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Revert 9f62a472dfb2 ("video: Remove duplicate cursor-positioning function")
  2023-03-15 16:01 [PATCH] Revert 9f62a472dfb2 ("video: Remove duplicate cursor-positioning function") Tom Rini
  2023-03-15 16:23 ` Simon Glass
@ 2023-04-02  5:22 ` Simon Glass
  2023-04-02 14:32   ` Tom Rini
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Glass @ 2023-04-02  5:22 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot

Hi Tom,

On Thu, 16 Mar 2023 at 05:01, Tom Rini <trini@konsulko.com> wrote:
>
> This reverts commit 9f62a472dfb26ec14408a27938ddd2a25700009d.
>
> The changes here aren't quite right, and on platforms such as Raspberry
> Pi where we can have both serial and video output, the change above
> causes output to change. This can be seen as the hush tests we have now
> fail.

I took at look at sorting this out. I gave it a crack with:

CROSS_COMPILE=/home/sglass/.buildman-toolchains/gcc-7.3.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-
./test/py/test.py --bd rpi_3_32b --build-dir /tmp/b/rpi3  --build --id
sjg-rpi_3b -k hush
================ 67 passed, 1 skipped, 322 deselected in 13.02s ================

Do you know which rpi and which test?

Regards,
Simon
[..]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Revert 9f62a472dfb2 ("video: Remove duplicate cursor-positioning function")
  2023-04-02  5:22 ` Simon Glass
@ 2023-04-02 14:32   ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2023-04-02 14:32 UTC (permalink / raw)
  To: Simon Glass; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 963 bytes --]

On Sun, Apr 02, 2023 at 05:22:52PM +1200, Simon Glass wrote:
> Hi Tom,
> 
> On Thu, 16 Mar 2023 at 05:01, Tom Rini <trini@konsulko.com> wrote:
> >
> > This reverts commit 9f62a472dfb26ec14408a27938ddd2a25700009d.
> >
> > The changes here aren't quite right, and on platforms such as Raspberry
> > Pi where we can have both serial and video output, the change above
> > causes output to change. This can be seen as the hush tests we have now
> > fail.
> 
> I took at look at sorting this out. I gave it a crack with:
> 
> CROSS_COMPILE=/home/sglass/.buildman-toolchains/gcc-7.3.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-
> ./test/py/test.py --bd rpi_3_32b --build-dir /tmp/b/rpi3  --build --id
> sjg-rpi_3b -k hush
> ================ 67 passed, 1 skipped, 322 deselected in 13.02s ================
> 
> Do you know which rpi and which test?

It was the if one about spaces, did you have video hooked up as well as
serial?

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-02 14:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 16:01 [PATCH] Revert 9f62a472dfb2 ("video: Remove duplicate cursor-positioning function") Tom Rini
2023-03-15 16:23 ` Simon Glass
2023-03-16 19:26   ` Tom Rini
2023-04-02  5:22 ` Simon Glass
2023-04-02 14:32   ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).