Re: svn commit: r317171 - head/sys/dev/vt

2017-05-01 Thread Jung-uk Kim
On 05/01/2017 16:55, Ed Maste wrote:
> On 20 April 2017 at 14:06, Jung-uk Kim  wrote:
>>
>> Maybe but I haven't seen much improvement in the area for many years.
>> Do you have any reason to believe someone is working on it?
>>
>> Even if we have such backend, I don't expect much difference in drawing
>> small area, i.e., redrawing narrow borders.  On top of that, I don't
>> like "if (vd->vd_driver->vd_drawrect == NULL) return (ENOTSUP)" stuff.
> 
> I don't believe anyone is working on it at the moment, but I expect
> that effort will go into improved VGA / VESA support at some point and
> that might implement an improved drawrect. I agree that there's
> unlikely to be a noticeable difference in the case of occasional
> operations filling a small region (e.g., border clearing after vt
> switch).
> 
> However, the vd_drawrect == NULL case is really no different than
> vd_setpixel == NULL. All vt drivers except ofwfb provide both, and
> ofwfb provides neither.

I can revert it but I don't like the previous implementation.  There
were overlapping regions and off-by-one issues.  Please see the attached
patch, which is against the previous version.

Jung-uk Kim
--- vt_core.c.orig
+++ vt_core.c
@@ -1546,21 +1546,23 @@
 	/* Left bar. */
 	if (vw->vw_draw_area.tr_begin.tp_col > 0)
 		vd->vd_driver->vd_drawrect(vd,
-		0, 0,
-		vw->vw_draw_area.tr_begin.tp_col - 1, vd->vd_height - 1,
+		0, vw->vw_draw_area.tr_begin.tp_row,
+		vw->vw_draw_area.tr_begin.tp_col - 1,
+		vw->vw_draw_area.tr_end.tp_row - 1,
 		1, c);
 
 	/* Right bar. */
 	if (vw->vw_draw_area.tr_end.tp_col < vd->vd_width)
 		vd->vd_driver->vd_drawrect(vd,
-		vw->vw_draw_area.tr_end.tp_col - 1, 0,
-		vd->vd_width - 1, vd->vd_height - 1,
+		vw->vw_draw_area.tr_end.tp_col,
+		vw->vw_draw_area.tr_begin.tp_row,
+		vd->vd_width - 1, vw->vw_draw_area.tr_end.tp_row - 1,
 		1, c);
 
 	/* Bottom bar. */
 	if (vw->vw_draw_area.tr_end.tp_row < vd->vd_height)
 		vd->vd_driver->vd_drawrect(vd,
-		0, vw->vw_draw_area.tr_end.tp_row - 1,
+		0, vw->vw_draw_area.tr_end.tp_row,
 		vd->vd_width - 1, vd->vd_height - 1,
 		1, c);
 


signature.asc
Description: OpenPGP digital signature


Re: svn commit: r317171 - head/sys/dev/vt

2017-05-01 Thread Ed Maste
On 20 April 2017 at 14:06, Jung-uk Kim  wrote:
>
> Maybe but I haven't seen much improvement in the area for many years.
> Do you have any reason to believe someone is working on it?
>
> Even if we have such backend, I don't expect much difference in drawing
> small area, i.e., redrawing narrow borders.  On top of that, I don't
> like "if (vd->vd_driver->vd_drawrect == NULL) return (ENOTSUP)" stuff.

I don't believe anyone is working on it at the moment, but I expect
that effort will go into improved VGA / VESA support at some point and
that might implement an improved drawrect. I agree that there's
unlikely to be a noticeable difference in the case of occasional
operations filling a small region (e.g., border clearing after vt
switch).

However, the vd_drawrect == NULL case is really no different than
vd_setpixel == NULL. All vt drivers except ofwfb provide both, and
ofwfb provides neither.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r317171 - head/sys/dev/vt

2017-04-20 Thread Jung-uk Kim
On 04/19/2017 22:22, Ed Maste wrote:
> On 19 April 2017 at 18:21, Jung-uk Kim  wrote:
>> Author: jkim
>> Date: Wed Apr 19 22:21:15 2017
>> New Revision: 317171
>> URL: https://svnweb.freebsd.org/changeset/base/317171
>>
>> Log:
>>   Micro-optimize vt_set_border().
> 
> I expect we'll eventually have vt drivers that have a non-trivial
> vd_drawrect, making the previous implementation preferable. Can you
> comment a bit more on this change?

Maybe but I haven't seen much improvement in the area for many years.
Do you have any reason to believe someone is working on it?

Even if we have such backend, I don't expect much difference in drawing
small area, i.e., redrawing narrow borders.  On top of that, I don't
like "if (vd->vd_driver->vd_drawrect == NULL) return (ENOTSUP)" stuff.

Jung-uk Kim



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r317171 - head/sys/dev/vt

2017-04-19 Thread Ed Maste
On 19 April 2017 at 18:21, Jung-uk Kim  wrote:
> Author: jkim
> Date: Wed Apr 19 22:21:15 2017
> New Revision: 317171
> URL: https://svnweb.freebsd.org/changeset/base/317171
>
> Log:
>   Micro-optimize vt_set_border().

I expect we'll eventually have vt drivers that have a non-trivial
vd_drawrect, making the previous implementation preferable. Can you
comment a bit more on this change?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317171 - head/sys/dev/vt

2017-04-19 Thread Jung-uk Kim
Author: jkim
Date: Wed Apr 19 22:21:15 2017
New Revision: 317171
URL: https://svnweb.freebsd.org/changeset/base/317171

Log:
  Micro-optimize vt_set_border().

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Wed Apr 19 22:20:41 2017(r317170)
+++ head/sys/dev/vt/vt_core.c   Wed Apr 19 22:21:15 2017(r317171)
@@ -1528,43 +1528,32 @@ vtterm_opened(struct terminal *tm, int o
VT_UNLOCK(vd);
 }
 
-static int
+static void
 vt_set_border(struct vt_window *vw, term_color_t c)
 {
struct vt_device *vd = vw->vw_device;
-
-   if (vd->vd_driver->vd_drawrect == NULL)
-   return (ENOTSUP);
+   term_rect_t *vda = >vw_draw_area;
+   int x, y;
 
/* Top bar. */
-   if (vw->vw_draw_area.tr_begin.tp_row > 0)
-   vd->vd_driver->vd_drawrect(vd,
-   0, 0,
-   vd->vd_width - 1, vw->vw_draw_area.tr_begin.tp_row - 1,
-   1, c);
-
-   /* Left bar. */
-   if (vw->vw_draw_area.tr_begin.tp_col > 0)
-   vd->vd_driver->vd_drawrect(vd,
-   0, 0,
-   vw->vw_draw_area.tr_begin.tp_col - 1, vd->vd_height - 1,
-   1, c);
-
-   /* Right bar. */
-   if (vw->vw_draw_area.tr_end.tp_col < vd->vd_width)
-   vd->vd_driver->vd_drawrect(vd,
-   vw->vw_draw_area.tr_end.tp_col - 1, 0,
-   vd->vd_width - 1, vd->vd_height - 1,
-   1, c);
+   for (y = 0; y < vda->tr_begin.tp_row; y++)
+   for (x = 0; x < vd->vd_width; x++)
+   vd->vd_driver->vd_setpixel(vd, x, y, c);
+
+   for (y = vda->tr_begin.tp_row; y <= vda->tr_end.tp_row; y++) {
+   /* Left bar. */
+   for (x = 0; x < vda->tr_begin.tp_col; x++)
+   vd->vd_driver->vd_setpixel(vd, x, y, c);
+
+   /* Right bar. */
+   for (x = vda->tr_end.tp_col + 1; x < vd->vd_width; x++)
+   vd->vd_driver->vd_setpixel(vd, x, y, c);
+   }
 
/* Bottom bar. */
-   if (vw->vw_draw_area.tr_end.tp_row < vd->vd_height)
-   vd->vd_driver->vd_drawrect(vd,
-   0, vw->vw_draw_area.tr_end.tp_row - 1,
-   vd->vd_width - 1, vd->vd_height - 1,
-   1, c);
-
-   return (0);
+   for (y = vda->tr_end.tp_row + 1; y < vd->vd_height; y++)
+   for (x = 0; x < vd->vd_width; x++)
+   vd->vd_driver->vd_setpixel(vd, x, y, c);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"