From: Simon Glass <simon.glass@canonical.com> Add a ctx parameter to scene_txt_render() to allow passing in a specific vidconsole context. If NULL, the default context is used. Update the caller accordingly. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- boot/scene.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index 6c70bd9038c..b6879315563 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -638,8 +638,23 @@ static void draw_string(struct udevice *cons, void *ctx, const char *str, } } +/** + * scene_txt_render() - Render text to the vidconsole + * + * @exp: Expo to use + * @dev: Video device + * @cons: Vidconsole device + * @ctx: Vidconsole context, or NULL to use default + * @obj: Object to render + * @gen: Generic text info + * @x: X position in pixels + * @y: Y position in pixels + * @menu_inset: Inset for menu items + * Return: 0 if OK, -ve on error + */ static int scene_txt_render(struct expo *exp, struct udevice *dev, - struct udevice *cons, struct scene_obj *obj, + struct udevice *cons, void *ctx, + struct scene_obj *obj, struct scene_txt_generic *gen, int x, int y, int menu_inset) { @@ -656,10 +671,10 @@ static int scene_txt_render(struct expo *exp, struct udevice *dev, return -ENOTSUPP; if (gen->font_name || gen->font_size) { - ret = vidconsole_select_font(cons, NULL, gen->font_name, + ret = vidconsole_select_font(cons, ctx, gen->font_name, gen->font_size); } else { - ret = vidconsole_select_font(cons, NULL, NULL, 0); + ret = vidconsole_select_font(cons, ctx, NULL, 0); } if (ret && ret != -ENOSYS) return log_msg_ret("font", ret); @@ -694,8 +709,8 @@ static int scene_txt_render(struct expo *exp, struct udevice *dev, bbox.y1 = obj->bbox.y1; if (!mline) { - vidconsole_set_cursor_pos(cons, NULL, x, y); - draw_string(cons, NULL, str, strlen(str), + vidconsole_set_cursor_pos(cons, ctx, x, y); + draw_string(cons, ctx, str, strlen(str), obj->flags & SCENEOF_PASSWORD); } @@ -713,8 +728,8 @@ 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, NULL, x, y); - draw_string(cons, NULL, str + mline->start, mline->len, + vidconsole_set_cursor_pos(cons, ctx, x, y); + draw_string(cons, ctx, str + mline->start, mline->len, obj->flags & SCENEOF_PASSWORD); } if (obj->flags & SCENEOF_POINT) @@ -761,8 +776,8 @@ static int scene_obj_render(struct scene_obj *obj, bool text_mode) case SCENEOBJT_TEXT: { struct scene_obj_txt *txt = (struct scene_obj_txt *)obj; - ret = scene_txt_render(exp, dev, cons, obj, &txt->gen, x, y, - theme->menu_inset); + ret = scene_txt_render(exp, dev, cons, NULL, obj, &txt->gen, + x, y, theme->menu_inset); break; } case SCENEOBJT_MENU: { -- 2.43.0