@@ -180,14 +180,14 @@ int expo_test_render(struct expo *exp)
snprintf(buf, sizeof(buf), "frame %6d", test->render_count);
x = vid_priv->xsize - 18 * ctx->x_charsize;
y = 10;
- vidconsole_set_cursor_pos(exp->cons, x, y);
+ vidconsole_set_cursor_pos(exp->cons, NULL, x, y);
vidconsole_put_string(exp->cons, buf);
/* Display FPS on next line (only if non-zero) */
if (test->fps_last > 0) {
snprintf(buf, sizeof(buf), "fps %6d", test->fps_last);
y += ctx->y_charsize;
- vidconsole_set_cursor_pos(exp->cons, x, y);
+ vidconsole_set_cursor_pos(exp->cons, NULL, x, y);
vidconsole_put_string(exp->cons, buf);
}
@@ -196,7 +196,7 @@ int expo_test_render(struct expo *exp)
test->render_avg_us / 1000,
(test->render_avg_us % 1000) / 100);
y += ctx->y_charsize;
- vidconsole_set_cursor_pos(exp->cons, x, y);
+ vidconsole_set_cursor_pos(exp->cons, NULL, x, y);
vidconsole_put_string(exp->cons, buf);
/* Display average sync time in milliseconds on next line */
@@ -204,7 +204,7 @@ int expo_test_render(struct expo *exp)
test->sync_avg_us / 1000,
(test->sync_avg_us % 1000) / 100);
y += ctx->y_charsize;
- vidconsole_set_cursor_pos(exp->cons, x, y);
+ vidconsole_set_cursor_pos(exp->cons, NULL, x, y);
vidconsole_put_string(exp->cons, buf);
/* Display average poll time in milliseconds on next line */
@@ -212,7 +212,7 @@ int expo_test_render(struct expo *exp)
test->poll_avg_us / 1000,
(test->poll_avg_us % 1000) / 100);
y += ctx->y_charsize;
- vidconsole_set_cursor_pos(exp->cons, x, y);
+ vidconsole_set_cursor_pos(exp->cons, NULL, x, y);
vidconsole_put_string(exp->cons, buf);
return 0;
@@ -685,7 +685,7 @@ static int scene_txt_render(struct expo *exp, struct udevice *dev,
bbox.y1 = obj->bbox.y1;
if (!mline) {
- vidconsole_set_cursor_pos(cons, x, y);
+ vidconsole_set_cursor_pos(cons, NULL, x, y);
draw_string(cons, str, strlen(str),
obj->flags & SCENEOF_PASSWORD);
}
@@ -704,7 +704,7 @@ static int scene_txt_render(struct expo *exp, struct udevice *dev,
y = obj->bbox.y0 + offset.yofs + mline->bbox.y0;
if (y > bbox.y1)
break; /* clip this line and any following */
- vidconsole_set_cursor_pos(cons, x, y);
+ vidconsole_set_cursor_pos(cons, NULL, x, y);
draw_string(cons, str + mline->start, mline->len,
obj->flags & SCENEOF_PASSWORD);
}
@@ -126,7 +126,7 @@ int scene_txtin_open(struct scene *scn, struct scene_obj *obj,
if (!txt)
return log_msg_ret("cur", -ENOENT);
- vidconsole_set_cursor_pos(cons, txt->obj.bbox.x0, txt->obj.bbox.y0);
+ vidconsole_set_cursor_pos(cons, NULL, txt->obj.bbox.x0, txt->obj.bbox.y0);
vidconsole_entry_start(cons);
cli_cread_init(&scn->cls, abuf_data(&tin->buf), tin->line_chars);
scn->cls.insert = true;
@@ -85,7 +85,7 @@ static int do_video_write(struct cmd_tbl *cmdtp, int flag, int argc,
row = hextoul(colon + 1, NULL);
if (use_pixels)
- vidconsole_set_cursor_pos(dev, col, row);
+ vidconsole_set_cursor_pos(dev, NULL, col, row);
else
vidconsole_position_cursor(dev, col, row);
@@ -130,10 +130,10 @@ static char *parsenum(char *s, int *num)
return end;
}
-void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y)
+void vidconsole_set_cursor_pos(struct udevice *dev, void *ctxp, int x, int y)
{
struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
- struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(priv);
+ struct vidconsole_ctx *ctx = ctxp ? ctxp : vidconsole_ctx_from_priv(priv);
/* Hide cursor at old position if it's visible */
vidconsole_hide_cursor(dev);
@@ -964,7 +964,7 @@ void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row)
x = min_t(short, col * ctx->x_charsize, vid_priv->xsize - 1);
y = min_t(short, row * ctx->y_charsize, vid_priv->ysize - 1);
- vidconsole_set_cursor_pos(dev, x, y);
+ vidconsole_set_cursor_pos(dev, NULL, x, y);
}
void vidconsole_set_quiet(struct udevice *dev, bool quiet)
@@ -774,10 +774,11 @@ int vidconsole_clear_and_reset(struct udevice *dev);
* updated to the same position, so that a newline will return to @x
*
* @dev: video console device to update
+ * @ctx: vidconsole context to use, or NULL to use the default
* @x: x position from left in pixels
* @y: y position from top in pixels
*/
-void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y);
+void vidconsole_set_cursor_pos(struct udevice *dev, void *ctx, int x, int y);
/**
* vidconsole_list_fonts() - List the available fonts