@@ -82,14 +82,13 @@ int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp)
return console_fixed_putc_xy(dev, x_frac, y, cp, priv->fontdata);
}
-static __maybe_unused int console_get_cursor_info(struct udevice *dev,
- bool visible, uint x, uint y,
- uint index)
+static __maybe_unused int console_get_cursor_info(struct udevice *dev)
{
struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
struct console_simple_priv *priv = dev_get_priv(dev);
struct video_fontdata *fontdata = priv->fontdata;
struct vidconsole_cursor *curs = &vc_priv->curs;
+ int x, y, index;
/* for now, this is not used outside expo */
if (!IS_ENABLED(CONFIG_EXPO))
@@ -1018,12 +1018,12 @@ static int truetype_entry_restore(struct udevice *dev, struct abuf *buf)
return 0;
}
-static int truetype_get_cursor_info(struct udevice *dev, bool visible,
- uint x, uint y, uint index)
+static int truetype_get_cursor_info(struct udevice *dev)
{
struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
struct console_tt_priv *priv = dev_get_priv(dev);
struct vidconsole_cursor *curs = &vc_priv->curs;
+ int x, y, index;
uint height;
if (xpl_phase() <= PHASE_SPL)
@@ -1034,14 +1034,12 @@ static int truetype_get_cursor_info(struct udevice *dev, bool visible,
* passed-in values, since an entry_restore() must have been done before
* calling this function.
*/
- if (visible) {
- index = priv->pos_ptr;
- if (index < priv->pos_ptr)
- x = VID_TO_PIXEL(priv->pos[index].xpos_frac);
- else
- x = VID_TO_PIXEL(vc_priv->xcur_frac);
- y = vc_priv->ycur;
- }
+ index = priv->pos_ptr;
+ if (index < priv->pos_ptr)
+ x = VID_TO_PIXEL(priv->pos[index].xpos_frac);
+ else
+ x = VID_TO_PIXEL(vc_priv->xcur_frac);
+ y = vc_priv->ycur;
/* Get font height from current font type */
if (priv->cur_fontdata)
@@ -1052,8 +1050,8 @@ static int truetype_get_cursor_info(struct udevice *dev, bool visible,
/* Store line pointer and height in cursor struct */
curs->x = x;
curs->y = y;
- curs->index = index;
curs->height = height;
+ curs->index = index;
return 0;
}
@@ -720,11 +720,12 @@ int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, uint index)
int ret;
/* find out where the cursor should be drawn */
- if (ops->get_cursor_info) {
- ret = ops->get_cursor_info(dev, true, x, y, index);
- if (ret && ret != -ENOSYS)
- return ret;
- }
+ if (!ops->get_cursor_info)
+ return -ENOSYS;
+
+ ret = ops->get_cursor_info(dev);
+ if (ret)
+ return ret;
/* If the driver stored cursor line and height, use them for drawing */
if (curs->height) {
@@ -342,17 +342,14 @@ struct vidconsole_ops {
/**
* get_cursor_info() - Get cursor position info
*
- * Calculates and stores cursor position information
+ * Calculates and stores cursor position information. This must fill in
+ * @x, @y, @height and @index using struct vidconsole_priv fields
+ * @xmark_frac, @ymark and @index
*
* @dev: Console device to use
- * @visible: true to show the cursor, false to hide it
- * @x: X position in pixels
- * @y: Y position in pixels
- * @index: Character position (0 = at start)
* Return: 0 if OK, -ve on error
*/
- int (*get_cursor_info)(struct udevice *dev, bool visible,
- uint x, uint y, uint index);
+ int (*get_cursor_info)(struct udevice *dev);
/**
* mark_start() - Mark the current position as the state of CLI entry