dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 25/38] vt: redefine world of cursor macros
       [not found] <20200615074910.19267-1-jslaby@suse.cz>
@ 2020-06-15  7:48 ` Jiri Slaby
  2020-06-15  7:48 ` [PATCH 26/38] vt: use newly defined CUR_* macros Jiri Slaby
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2020-06-15  7:48 UTC (permalink / raw)
  To: gregkh
  Cc: linux-fbdev, Bartlomiej Zolnierkiewicz, linux-kernel, dri-devel,
	linux-serial, Jiri Slaby

The cursor code used to use magic constants, ANDs, ORs, and some macros.
Redefine all this to make some sense.

In particular:
* Drop CUR_DEFAULT, which is CUR_UNDERLINE. CUR_DEFAULT was used only
  for cur_default variable initialization, so use CUR_UNDERLINE there to
  make obvious what's the default.
* Drop CUR_HWMASK. Instead, define CUR_SIZE() which explains it more.
  And use it all over the places.
* Define few more masks and bits which will be used in next patches
  instead of magic constants.
* Define CUR_MAKE to build up cursor value.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
---
 drivers/tty/vt/vt.c                  |  2 +-
 drivers/video/fbdev/core/bitblit.c   |  2 +-
 drivers/video/fbdev/core/fbcon_ccw.c |  2 +-
 drivers/video/fbdev/core/fbcon_cw.c  |  2 +-
 drivers/video/fbdev/core/fbcon_ud.c  |  2 +-
 include/linux/console_struct.h       | 28 +++++++++++++++++-----------
 6 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index f7d5a3c3845f..af1ef717f416 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -163,7 +163,7 @@ module_param(default_utf8, int, S_IRUGO | S_IWUSR);
 int global_cursor_default = -1;
 module_param(global_cursor_default, int, S_IRUGO | S_IWUSR);
 
-static int cur_default = CUR_DEFAULT;
+static int cur_default = CUR_UNDERLINE;
 module_param(cur_default, int, S_IRUGO | S_IWUSR);
 
 /*
diff --git a/drivers/video/fbdev/core/bitblit.c b/drivers/video/fbdev/core/bitblit.c
index c750470a31ec..3b002b365a5a 100644
--- a/drivers/video/fbdev/core/bitblit.c
+++ b/drivers/video/fbdev/core/bitblit.c
@@ -325,7 +325,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 		ops->p->cursor_shape = vc->vc_cursor_type;
 		cursor.set |= FB_CUR_SETSHAPE;
 
-		switch (ops->p->cursor_shape & CUR_HWMASK) {
+		switch (CUR_SIZE(ops->p->cursor_shape)) {
 		case CUR_NONE:
 			cur_height = 0;
 			break;
diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c
index 9d06446a1a3b..5b67bcebe34c 100644
--- a/drivers/video/fbdev/core/fbcon_ccw.c
+++ b/drivers/video/fbdev/core/fbcon_ccw.c
@@ -325,7 +325,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 		ops->p->cursor_shape = vc->vc_cursor_type;
 		cursor.set |= FB_CUR_SETSHAPE;
 
-		switch (ops->p->cursor_shape & CUR_HWMASK) {
+		switch (CUR_SIZE(ops->p->cursor_shape)) {
 		case CUR_NONE:
 			cur_height = 0;
 			break;
diff --git a/drivers/video/fbdev/core/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c
index 4b5f76bb01e5..f1aab3ae3bc9 100644
--- a/drivers/video/fbdev/core/fbcon_cw.c
+++ b/drivers/video/fbdev/core/fbcon_cw.c
@@ -308,7 +308,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 		ops->p->cursor_shape = vc->vc_cursor_type;
 		cursor.set |= FB_CUR_SETSHAPE;
 
-		switch (ops->p->cursor_shape & CUR_HWMASK) {
+		switch (CUR_SIZE(ops->p->cursor_shape)) {
 		case CUR_NONE:
 			cur_height = 0;
 			break;
diff --git a/drivers/video/fbdev/core/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c
index 7e0ae3549dc7..81ed6f6bed67 100644
--- a/drivers/video/fbdev/core/fbcon_ud.c
+++ b/drivers/video/fbdev/core/fbcon_ud.c
@@ -348,7 +348,7 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 		ops->p->cursor_shape = vc->vc_cursor_type;
 		cursor.set |= FB_CUR_SETSHAPE;
 
-		switch (ops->p->cursor_shape & CUR_HWMASK) {
+		switch (CUR_SIZE(ops->p->cursor_shape)) {
 		case CUR_NONE:
 			cur_height = 0;
 			break;
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 40ed52f67bc5..153734816b49 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -173,17 +173,23 @@ struct vc {
 extern struct vc vc_cons [MAX_NR_CONSOLES];
 extern void vc_SAK(struct work_struct *work);
 
-#define CUR_DEF		0
-#define CUR_NONE	1
-#define CUR_UNDERLINE	2
-#define CUR_LOWER_THIRD	3
-#define CUR_LOWER_HALF	4
-#define CUR_TWO_THIRDS	5
-#define CUR_BLOCK	6
-#define CUR_HWMASK	0x0f
-#define CUR_SWMASK	0xfff0
-
-#define CUR_DEFAULT CUR_UNDERLINE
+#define CUR_MAKE(size, change, set)	((size) | ((change) << 8) |	\
+		((set) << 16))
+#define CUR_SIZE(c)		 ((c) & 0x00000f)
+# define CUR_DEF			       0
+# define CUR_NONE			       1
+# define CUR_UNDERLINE			       2
+# define CUR_LOWER_THIRD		       3
+# define CUR_LOWER_HALF			       4
+# define CUR_TWO_THIRDS			       5
+# define CUR_BLOCK			       6
+#define CUR_SW				0x000010
+#define CUR_ALWAYS_BG			0x000020
+#define CUR_INVERT_FG_BG		0x000040
+#define CUR_FG				0x000700
+#define CUR_BG				0x007000
+#define CUR_CHANGE(c)		 ((c) & 0x00ff00)
+#define CUR_SET(c)		(((c) & 0xff0000) >> 8)
 
 bool con_is_visible(const struct vc_data *vc);
 
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 26/38] vt: use newly defined CUR_* macros
       [not found] <20200615074910.19267-1-jslaby@suse.cz>
  2020-06-15  7:48 ` [PATCH 25/38] vt: redefine world of cursor macros Jiri Slaby
@ 2020-06-15  7:48 ` Jiri Slaby
  2020-06-15 20:31   ` Helge Deller
  1 sibling, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2020-06-15  7:48 UTC (permalink / raw)
  To: gregkh
  Cc: linux-fbdev, linux-usb, linux-parisc, Bartlomiej Zolnierkiewicz,
	Helge Deller, Thomas Winischhofer, linux-kernel, dri-devel,
	James E.J. Bottomley, linux-serial, Jiri Slaby

We defined macros for all the magic constants in the previous patch. So
let us use the macro in the code now.

No functional change intended.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-usb@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
Cc: linux-parisc@vger.kernel.org
---
 drivers/tty/vt/vt.c                     | 22 +++++++++++++---------
 drivers/usb/misc/sisusbvga/sisusb_con.c |  2 +-
 drivers/video/console/mdacon.c          |  2 +-
 drivers/video/console/sticon.c          |  2 +-
 drivers/video/console/vgacon.c          |  2 +-
 drivers/video/fbdev/core/bitblit.c      |  2 +-
 drivers/video/fbdev/core/fbcon.c        |  2 +-
 drivers/video/fbdev/core/fbcon_ccw.c    |  2 +-
 drivers/video/fbdev/core/fbcon_cw.c     |  2 +-
 drivers/video/fbdev/core/fbcon_ud.c     |  2 +-
 drivers/video/fbdev/core/tileblit.c     |  2 +-
 11 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index af1ef717f416..2b9fc628f05b 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -866,17 +866,18 @@ static void add_softcursor(struct vc_data *vc)
 	int i = scr_readw((u16 *) vc->vc_pos);
 	u32 type = vc->vc_cursor_type;
 
-	if (!(type & 0x10))
+	if (!(type & CUR_SW))
 		return;
 	if (softcursor_original != -1)
 		return;
 	softcursor_original = i;
-	i |= (type >> 8) & 0xff00;
-	i ^= type & 0xff00;
-	if ((type & 0x20) && (softcursor_original & 0x7000) == (i & 0x7000))
-		i ^= 0x7000;
-	if ((type & 0x40) && (i & 0x700) == ((i & 0x7000) >> 4))
-		i ^= 0x0700;
+	i |= CUR_SET(type);
+	i ^= CUR_CHANGE(type);
+	if ((type & CUR_ALWAYS_BG) &&
+			(softcursor_original & CUR_BG) == (i & CUR_BG))
+		i ^= CUR_BG;
+	if ((type & CUR_INVERT_FG_BG) && (i & CUR_FG) == ((i & CUR_BG) >> 4))
+		i ^= CUR_FG;
 	scr_writew(i, (u16 *)vc->vc_pos);
 	if (con_should_update(vc))
 		vc->vc_sw->con_putc(vc, i, vc->state.y, vc->state.x);
@@ -910,7 +911,7 @@ static void set_cursor(struct vc_data *vc)
 		if (vc_is_sel(vc))
 			clear_selection();
 		add_softcursor(vc);
-		if ((vc->vc_cursor_type & 0x0f) != 1)
+		if (CUR_SIZE(vc->vc_cursor_type) != CUR_NONE)
 			vc->vc_sw->con_cursor(vc, CM_DRAW);
 	} else
 		hide_cursor(vc);
@@ -2322,7 +2323,10 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
 		case 'c':
 			if (vc->vc_priv == EPdec) {
 				if (vc->vc_par[0])
-					vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16);
+					vc->vc_cursor_type =
+						CUR_MAKE(vc->vc_par[0],
+							 vc->vc_par[1],
+							 vc->vc_par[2]);
 				else
 					vc->vc_cursor_type = cur_default;
 				return;
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c b/drivers/usb/misc/sisusbvga/sisusb_con.c
index 80657c49310a..1058eaba3084 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -727,7 +727,7 @@ sisusbcon_cursor(struct vc_data *c, int mode)
 
 	baseline = c->vc_font.height - (c->vc_font.height < 10 ? 1 : 2);
 
-	switch (c->vc_cursor_type & 0x0f) {
+	switch (CUR_SIZE(c->vc_cursor_type)) {
 		case CUR_BLOCK:		from = 1;
 					to   = c->vc_font.height;
 					break;
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index 00cb6245fbef..ef29b321967f 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -492,7 +492,7 @@ static void mdacon_cursor(struct vc_data *c, int mode)
 
 	mda_set_cursor(c->state.y * mda_num_columns * 2 + c->state.x * 2);
 
-	switch (c->vc_cursor_type & 0x0f) {
+	switch (CUR_SIZE(c->vc_cursor_type)) {
 
 		case CUR_LOWER_THIRD:	mda_set_cursor_size(10, 13); break;
 		case CUR_LOWER_HALF:	mda_set_cursor_size(7,  13); break;
diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
index bbcdfd312c36..21a5c280c8c9 100644
--- a/drivers/video/console/sticon.c
+++ b/drivers/video/console/sticon.c
@@ -139,7 +139,7 @@ static void sticon_cursor(struct vc_data *conp, int mode)
 	break;
     case CM_MOVE:
     case CM_DRAW:
-	switch (conp->vc_cursor_type & 0x0f) {
+	switch (CUR_SIZE(conp->vc_cursor_type)) {
 	case CUR_UNDERLINE:
 	case CUR_LOWER_THIRD:
 	case CUR_LOWER_HALF:
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index c1c4ce28ac5e..f0f3d573f848 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -728,7 +728,7 @@ static void vgacon_cursor(struct vc_data *c, int mode)
 	case CM_MOVE:
 	case CM_DRAW:
 		write_vga(14, (c->vc_pos - vga_vram_base) / 2);
-		switch (c->vc_cursor_type & 0x0f) {
+		switch (CUR_SIZE(c->vc_cursor_type)) {
 		case CUR_UNDERLINE:
 			vgacon_set_cursor_size(c->state.x,
 					       c->vc_font.height -
diff --git a/drivers/video/fbdev/core/bitblit.c b/drivers/video/fbdev/core/bitblit.c
index 3b002b365a5a..dde8004d8610 100644
--- a/drivers/video/fbdev/core/bitblit.c
+++ b/drivers/video/fbdev/core/bitblit.c
@@ -241,7 +241,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
 	int w = DIV_ROUND_UP(vc->vc_font.width, 8), c;
 	int y = real_y(ops->p, vc->state.y);
-	int attribute, use_sw = (vc->vc_cursor_type & 0x10);
+	int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
 	int err = 1;
 	char *src;
 
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 38d2a00b0ccf..86fe41b1deb8 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -1393,7 +1393,7 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
 	if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
 		return;
 
-	if (vc->vc_cursor_type & 0x10)
+	if (vc->vc_cursor_type & CUR_SW)
 		fbcon_del_cursor_timer(info);
 	else
 		fbcon_add_cursor_timer(info);
diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c
index 5b67bcebe34c..b5dd8317086d 100644
--- a/drivers/video/fbdev/core/fbcon_ccw.c
+++ b/drivers/video/fbdev/core/fbcon_ccw.c
@@ -226,7 +226,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
 	int w = (vc->vc_font.height + 7) >> 3, c;
 	int y = real_y(ops->p, vc->state.y);
-	int attribute, use_sw = (vc->vc_cursor_type & 0x10);
+	int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
 	int err = 1, dx, dy;
 	char *src;
 	u32 vyres = GETVYRES(ops->p->scrollmode, info);
diff --git a/drivers/video/fbdev/core/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c
index f1aab3ae3bc9..dbb5dbf3dd01 100644
--- a/drivers/video/fbdev/core/fbcon_cw.c
+++ b/drivers/video/fbdev/core/fbcon_cw.c
@@ -209,7 +209,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
 	int w = (vc->vc_font.height + 7) >> 3, c;
 	int y = real_y(ops->p, vc->state.y);
-	int attribute, use_sw = (vc->vc_cursor_type & 0x10);
+	int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
 	int err = 1, dx, dy;
 	char *src;
 	u32 vxres = GETVXRES(ops->p->scrollmode, info);
diff --git a/drivers/video/fbdev/core/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c
index 81ed6f6bed67..b2c9cdbcc9e4 100644
--- a/drivers/video/fbdev/core/fbcon_ud.c
+++ b/drivers/video/fbdev/core/fbcon_ud.c
@@ -256,7 +256,7 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
 	int w = (vc->vc_font.width + 7) >> 3, c;
 	int y = real_y(ops->p, vc->state.y);
-	int attribute, use_sw = (vc->vc_cursor_type & 0x10);
+	int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
 	int err = 1, dx, dy;
 	char *src;
 	u32 vyres = GETVYRES(ops->p->scrollmode, info);
diff --git a/drivers/video/fbdev/core/tileblit.c b/drivers/video/fbdev/core/tileblit.c
index ac51425687e4..1dfaff0881fb 100644
--- a/drivers/video/fbdev/core/tileblit.c
+++ b/drivers/video/fbdev/core/tileblit.c
@@ -83,7 +83,7 @@ static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 			int softback_lines, int fg, int bg)
 {
 	struct fb_tilecursor cursor;
-	int use_sw = (vc->vc_cursor_type & 0x10);
+	int use_sw = vc->vc_cursor_type & CUR_SW;
 
 	cursor.sx = vc->state.x;
 	cursor.sy = vc->state.y;
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 26/38] vt: use newly defined CUR_* macros
  2020-06-15  7:48 ` [PATCH 26/38] vt: use newly defined CUR_* macros Jiri Slaby
@ 2020-06-15 20:31   ` Helge Deller
  0 siblings, 0 replies; 3+ messages in thread
From: Helge Deller @ 2020-06-15 20:31 UTC (permalink / raw)
  To: Jiri Slaby, gregkh
  Cc: linux-fbdev, Thomas Winischhofer, linux-parisc,
	Bartlomiej Zolnierkiewicz, linux-usb, linux-kernel, dri-devel,
	James E.J. Bottomley, linux-serial

On 15.06.20 09:48, Jiri Slaby wrote:
> We defined macros for all the magic constants in the previous patch. So
> let us use the macro in the code now.
>
> No functional change intended.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Thomas Winischhofer <thomas@winischhofer.net>
> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> Cc: Helge Deller <deller@gmx.de>
> Cc: linux-usb@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-fbdev@vger.kernel.org
> Cc: linux-parisc@vger.kernel.org


Acked-by: Helge Deller <deller@gmx.de>

Thanks!
Helge

> ---
>  drivers/tty/vt/vt.c                     | 22 +++++++++++++---------
>  drivers/usb/misc/sisusbvga/sisusb_con.c |  2 +-
>  drivers/video/console/mdacon.c          |  2 +-
>  drivers/video/console/sticon.c          |  2 +-
>  drivers/video/console/vgacon.c          |  2 +-
>  drivers/video/fbdev/core/bitblit.c      |  2 +-
>  drivers/video/fbdev/core/fbcon.c        |  2 +-
>  drivers/video/fbdev/core/fbcon_ccw.c    |  2 +-
>  drivers/video/fbdev/core/fbcon_cw.c     |  2 +-
>  drivers/video/fbdev/core/fbcon_ud.c     |  2 +-
>  drivers/video/fbdev/core/tileblit.c     |  2 +-
>  11 files changed, 23 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index af1ef717f416..2b9fc628f05b 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -866,17 +866,18 @@ static void add_softcursor(struct vc_data *vc)
>  	int i = scr_readw((u16 *) vc->vc_pos);
>  	u32 type = vc->vc_cursor_type;
>
> -	if (!(type & 0x10))
> +	if (!(type & CUR_SW))
>  		return;
>  	if (softcursor_original != -1)
>  		return;
>  	softcursor_original = i;
> -	i |= (type >> 8) & 0xff00;
> -	i ^= type & 0xff00;
> -	if ((type & 0x20) && (softcursor_original & 0x7000) == (i & 0x7000))
> -		i ^= 0x7000;
> -	if ((type & 0x40) && (i & 0x700) == ((i & 0x7000) >> 4))
> -		i ^= 0x0700;
> +	i |= CUR_SET(type);
> +	i ^= CUR_CHANGE(type);
> +	if ((type & CUR_ALWAYS_BG) &&
> +			(softcursor_original & CUR_BG) == (i & CUR_BG))
> +		i ^= CUR_BG;
> +	if ((type & CUR_INVERT_FG_BG) && (i & CUR_FG) == ((i & CUR_BG) >> 4))
> +		i ^= CUR_FG;
>  	scr_writew(i, (u16 *)vc->vc_pos);
>  	if (con_should_update(vc))
>  		vc->vc_sw->con_putc(vc, i, vc->state.y, vc->state.x);
> @@ -910,7 +911,7 @@ static void set_cursor(struct vc_data *vc)
>  		if (vc_is_sel(vc))
>  			clear_selection();
>  		add_softcursor(vc);
> -		if ((vc->vc_cursor_type & 0x0f) != 1)
> +		if (CUR_SIZE(vc->vc_cursor_type) != CUR_NONE)
>  			vc->vc_sw->con_cursor(vc, CM_DRAW);
>  	} else
>  		hide_cursor(vc);
> @@ -2322,7 +2323,10 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
>  		case 'c':
>  			if (vc->vc_priv == EPdec) {
>  				if (vc->vc_par[0])
> -					vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16);
> +					vc->vc_cursor_type =
> +						CUR_MAKE(vc->vc_par[0],
> +							 vc->vc_par[1],
> +							 vc->vc_par[2]);
>  				else
>  					vc->vc_cursor_type = cur_default;
>  				return;
> diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c b/drivers/usb/misc/sisusbvga/sisusb_con.c
> index 80657c49310a..1058eaba3084 100644
> --- a/drivers/usb/misc/sisusbvga/sisusb_con.c
> +++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
> @@ -727,7 +727,7 @@ sisusbcon_cursor(struct vc_data *c, int mode)
>
>  	baseline = c->vc_font.height - (c->vc_font.height < 10 ? 1 : 2);
>
> -	switch (c->vc_cursor_type & 0x0f) {
> +	switch (CUR_SIZE(c->vc_cursor_type)) {
>  		case CUR_BLOCK:		from = 1;
>  					to   = c->vc_font.height;
>  					break;
> diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
> index 00cb6245fbef..ef29b321967f 100644
> --- a/drivers/video/console/mdacon.c
> +++ b/drivers/video/console/mdacon.c
> @@ -492,7 +492,7 @@ static void mdacon_cursor(struct vc_data *c, int mode)
>
>  	mda_set_cursor(c->state.y * mda_num_columns * 2 + c->state.x * 2);
>
> -	switch (c->vc_cursor_type & 0x0f) {
> +	switch (CUR_SIZE(c->vc_cursor_type)) {
>
>  		case CUR_LOWER_THIRD:	mda_set_cursor_size(10, 13); break;
>  		case CUR_LOWER_HALF:	mda_set_cursor_size(7,  13); break;
> diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
> index bbcdfd312c36..21a5c280c8c9 100644
> --- a/drivers/video/console/sticon.c
> +++ b/drivers/video/console/sticon.c
> @@ -139,7 +139,7 @@ static void sticon_cursor(struct vc_data *conp, int mode)
>  	break;
>      case CM_MOVE:
>      case CM_DRAW:
> -	switch (conp->vc_cursor_type & 0x0f) {
> +	switch (CUR_SIZE(conp->vc_cursor_type)) {
>  	case CUR_UNDERLINE:
>  	case CUR_LOWER_THIRD:
>  	case CUR_LOWER_HALF:
> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> index c1c4ce28ac5e..f0f3d573f848 100644
> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -728,7 +728,7 @@ static void vgacon_cursor(struct vc_data *c, int mode)
>  	case CM_MOVE:
>  	case CM_DRAW:
>  		write_vga(14, (c->vc_pos - vga_vram_base) / 2);
> -		switch (c->vc_cursor_type & 0x0f) {
> +		switch (CUR_SIZE(c->vc_cursor_type)) {
>  		case CUR_UNDERLINE:
>  			vgacon_set_cursor_size(c->state.x,
>  					       c->vc_font.height -
> diff --git a/drivers/video/fbdev/core/bitblit.c b/drivers/video/fbdev/core/bitblit.c
> index 3b002b365a5a..dde8004d8610 100644
> --- a/drivers/video/fbdev/core/bitblit.c
> +++ b/drivers/video/fbdev/core/bitblit.c
> @@ -241,7 +241,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,
>  	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
>  	int w = DIV_ROUND_UP(vc->vc_font.width, 8), c;
>  	int y = real_y(ops->p, vc->state.y);
> -	int attribute, use_sw = (vc->vc_cursor_type & 0x10);
> +	int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
>  	int err = 1;
>  	char *src;
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 38d2a00b0ccf..86fe41b1deb8 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -1393,7 +1393,7 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
>  	if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
>  		return;
>
> -	if (vc->vc_cursor_type & 0x10)
> +	if (vc->vc_cursor_type & CUR_SW)
>  		fbcon_del_cursor_timer(info);
>  	else
>  		fbcon_add_cursor_timer(info);
> diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c
> index 5b67bcebe34c..b5dd8317086d 100644
> --- a/drivers/video/fbdev/core/fbcon_ccw.c
> +++ b/drivers/video/fbdev/core/fbcon_ccw.c
> @@ -226,7 +226,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
>  	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
>  	int w = (vc->vc_font.height + 7) >> 3, c;
>  	int y = real_y(ops->p, vc->state.y);
> -	int attribute, use_sw = (vc->vc_cursor_type & 0x10);
> +	int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
>  	int err = 1, dx, dy;
>  	char *src;
>  	u32 vyres = GETVYRES(ops->p->scrollmode, info);
> diff --git a/drivers/video/fbdev/core/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c
> index f1aab3ae3bc9..dbb5dbf3dd01 100644
> --- a/drivers/video/fbdev/core/fbcon_cw.c
> +++ b/drivers/video/fbdev/core/fbcon_cw.c
> @@ -209,7 +209,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
>  	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
>  	int w = (vc->vc_font.height + 7) >> 3, c;
>  	int y = real_y(ops->p, vc->state.y);
> -	int attribute, use_sw = (vc->vc_cursor_type & 0x10);
> +	int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
>  	int err = 1, dx, dy;
>  	char *src;
>  	u32 vxres = GETVXRES(ops->p->scrollmode, info);
> diff --git a/drivers/video/fbdev/core/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c
> index 81ed6f6bed67..b2c9cdbcc9e4 100644
> --- a/drivers/video/fbdev/core/fbcon_ud.c
> +++ b/drivers/video/fbdev/core/fbcon_ud.c
> @@ -256,7 +256,7 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,
>  	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
>  	int w = (vc->vc_font.width + 7) >> 3, c;
>  	int y = real_y(ops->p, vc->state.y);
> -	int attribute, use_sw = (vc->vc_cursor_type & 0x10);
> +	int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
>  	int err = 1, dx, dy;
>  	char *src;
>  	u32 vyres = GETVYRES(ops->p->scrollmode, info);
> diff --git a/drivers/video/fbdev/core/tileblit.c b/drivers/video/fbdev/core/tileblit.c
> index ac51425687e4..1dfaff0881fb 100644
> --- a/drivers/video/fbdev/core/tileblit.c
> +++ b/drivers/video/fbdev/core/tileblit.c
> @@ -83,7 +83,7 @@ static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode,
>  			int softback_lines, int fg, int bg)
>  {
>  	struct fb_tilecursor cursor;
> -	int use_sw = (vc->vc_cursor_type & 0x10);
> +	int use_sw = vc->vc_cursor_type & CUR_SW;
>
>  	cursor.sx = vc->state.x;
>  	cursor.sy = vc->state.y;
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-06-16  7:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200615074910.19267-1-jslaby@suse.cz>
2020-06-15  7:48 ` [PATCH 25/38] vt: redefine world of cursor macros Jiri Slaby
2020-06-15  7:48 ` [PATCH 26/38] vt: use newly defined CUR_* macros Jiri Slaby
2020-06-15 20:31   ` Helge Deller

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).