@@ -161,7 +161,7 @@ static __maybe_unused int normal_entry_save(struct udevice *dev,
return log_msg_ret("sav", -ENOMEM);
store.xpos_frac = ctx->xcur_frac;
- store.ypos = vc_priv->ycur;
+ store.ypos = ctx->ycur;
store.cli_index = vc_priv->cli_index;
memcpy(abuf_data(buf), &store, size);
@@ -181,7 +181,7 @@ static __maybe_unused int normal_entry_restore(struct udevice *dev,
memcpy(&store, abuf_data(buf), sizeof(store));
ctx->xcur_frac = store.xpos_frac;
- vc_priv->ycur = store.ypos;
+ ctx->ycur = store.ypos;
vc_priv->cli_index = store.cli_index;
return 0;
@@ -497,7 +497,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y,
pos = &ctx->pos[ctx->pos_ptr];
pos->xpos_frac = vc_ctx->xcur_frac;
- pos->ypos = vc_priv->ycur;
+ pos->ypos = vc_ctx->ycur;
pos->width = (width_frac + VID_FRAC_DIV - 1) / VID_FRAC_DIV;
pos->cp = cp;
ctx->pos_ptr++;
@@ -707,14 +707,14 @@ static int console_truetype_backspace(struct udevice *dev)
* cursor position, but if we are clearing a character on the previous
* line, we clear from the end of the line.
*/
- if (pos->ypos == vc_priv->ycur)
+ if (pos->ypos == vc_ctx->ycur)
xend = VID_TO_PIXEL(vc_ctx->xcur_frac);
else
xend = vid_priv->xsize;
/* Move the cursor back to where it was when we pushed this record */
vc_ctx->xcur_frac = pos->xpos_frac;
- vc_priv->ycur = pos->ypos;
+ vc_ctx->ycur = pos->ypos;
return 0;
}
@@ -1202,7 +1202,7 @@ static int truetype_entry_save(struct udevice *dev, struct abuf *buf)
store.priv = *priv;
store.cur.xpos_frac = vc_ctx->xcur_frac;
- store.cur.ypos = vc_priv->ycur;
+ store.cur.ypos = vc_ctx->ycur;
memcpy(abuf_data(buf), &store, size);
return 0;
@@ -1222,7 +1222,7 @@ static int truetype_entry_restore(struct udevice *dev, struct abuf *buf)
memcpy(&store, abuf_data(buf), sizeof(store));
vc_ctx->xcur_frac = store.cur.xpos_frac;
- vc_priv->ycur = store.cur.ypos;
+ vc_ctx->ycur = store.cur.ypos;
*ctx = store.priv.ctx;
return 0;
@@ -1255,7 +1255,7 @@ static int truetype_get_cursor_info(struct udevice *dev)
x = VID_TO_PIXEL(ctx->pos[index].xpos_frac);
else
x = VID_TO_PIXEL(vc_ctx->xcur_frac);
- y = vc_priv->ycur;
+ y = vc_ctx->ycur;
/* Get font height from current font type */
if (priv->cur_fontdata)
@@ -80,9 +80,9 @@ static int vidconsole_back(struct udevice *dev)
if (ctx->xcur_frac < priv->xstart_frac) {
ctx->xcur_frac = (ctx->cols - 1) *
VID_TO_POS(ctx->x_charsize);
- priv->ycur -= ctx->y_charsize;
- if (priv->ycur < 0)
- priv->ycur = 0;
+ ctx->ycur -= ctx->y_charsize;
+ if (ctx->ycur < 0)
+ ctx->ycur = 0;
}
assert(priv->cli_index);
cli_index_adjust(priv, -1);
@@ -101,17 +101,17 @@ static void vidconsole_newline(struct udevice *dev)
int i, ret;
ctx->xcur_frac = priv->xstart_frac;
- priv->ycur += ctx->y_charsize;
+ ctx->ycur += ctx->y_charsize;
/* Check if we need to scroll the terminal */
if (vid_priv->rot % 2 ?
- priv->ycur + ctx->x_charsize > vid_priv->xsize :
- priv->ycur + ctx->y_charsize > vid_priv->ysize) {
+ ctx->ycur + ctx->x_charsize > vid_priv->xsize :
+ ctx->ycur + ctx->y_charsize > vid_priv->ysize) {
vidconsole_move_rows(dev, 0, rows, ctx->rows - rows);
for (i = 0; i < rows; i++)
vidconsole_set_row(dev, ctx->rows - i - 1,
vid_priv->colour_bg);
- priv->ycur -= rows * ctx->y_charsize;
+ ctx->ycur -= rows * ctx->y_charsize;
}
priv->last_ch = 0;
@@ -140,7 +140,7 @@ void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y)
ctx->xcur_frac = VID_TO_POS(x);
priv->xstart_frac = ctx->xcur_frac;
- priv->ycur = y;
+ ctx->ycur = y;
/* make sure not to kern against the previous character */
priv->last_ch = 0;
@@ -181,7 +181,7 @@ static void get_cursor_position(struct vidconsole_priv *priv,
{
struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(priv);
- *row = priv->ycur / ctx->y_charsize;
+ *row = ctx->ycur / ctx->y_charsize;
*col = VID_TO_PIXEL(ctx->xcur_frac - priv->xstart_frac) /
ctx->x_charsize;
}
@@ -332,7 +332,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
console_puts_select_stderr(true, "[vc err: video_sync]");
#endif
}
- priv->ycur = 0;
+ ctx->ycur = 0;
ctx->xcur_frac = priv->xstart_frac;
} else {
debug("unsupported clear mode: %d\n", mode);
@@ -467,10 +467,10 @@ static int vidconsole_output_glyph(struct udevice *dev, int ch)
* colour depth. Check this and return an error to help with
* diagnosis.
*/
- ret = vidconsole_putc_xy(dev, ctx->xcur_frac, priv->ycur, ch);
+ ret = vidconsole_putc_xy(dev, ctx->xcur_frac, ctx->ycur, ch);
if (ret == -EAGAIN) {
vidconsole_newline(dev);
- ret = vidconsole_putc_xy(dev, ctx->xcur_frac, priv->ycur, ch);
+ ret = vidconsole_putc_xy(dev, ctx->xcur_frac, ctx->ycur, ch);
}
if (ret < 0)
return ret;
@@ -840,7 +840,7 @@ int vidconsole_mark_start(struct udevice *dev)
struct vidconsole_ops *ops = vidconsole_get_ops(dev);
priv->xmark_frac = ctx->xcur_frac;
- priv->ymark = priv->ycur;
+ priv->ymark = ctx->ycur;
priv->cli_index = 0;
if (ops->mark_start) {
int ret;
@@ -84,6 +84,7 @@ struct vidconsole_cursor {
* @x_charsize: Character width in pixels
* @y_charsize: Character height in pixels
* @xcur_frac: Current X position, in fractional units (VID_TO_POS(x))
+ * @ycur: Current Y position in pixels (0=top)
*/
struct vidconsole_ctx {
int rows;
@@ -91,6 +92,7 @@ struct vidconsole_ctx {
int x_charsize;
int y_charsize;
int xcur_frac;
+ int ycur;
};
/**
@@ -123,13 +125,12 @@ struct vidconsole_ansi {
* Note that these values relate to the rotated console, so that an 80x25
* console which is rotated 90 degrees will have rows=80 and cols=25
*
- * The ctx.xcur_frac and ycur values refer to the unrotated coordinates, that
- * is ctx.xcur_frac always advances with each character, even if its limit
+ * The ctx.xcur_frac and ctx.ycur values refer to the unrotated coordinates,
+ * that is ctx.xcur_frac always advances with each character, even if its limit
* might be vid_priv->ysize instead of vid_priv->xsize if the console is
* rotated 90 or 270 degrees.
*
* @sdev: stdio device, acting as an output sink
- * @ycur: Current Y position in pixels (0=top)
* @ctx: Per-client context
* @tab_width_frac: Tab width in fractional units
* @xsize_frac: Width of the display in fractional units
@@ -146,7 +147,6 @@ struct vidconsole_ansi {
struct vidconsole_priv {
struct stdio_dev sdev;
struct vidconsole_ctx ctx;
- int ycur;
int tab_width_frac;
int xsize_frac;
int xstart_frac;