Re: wsfont: remove iso7/pcvt encoding macros and entries

2017-06-16 Thread Frederic Cambus
On Thu, Jun 15, 2017 at 01:52:07PM +0200, Frederic Cambus wrote:
> On Tue, Jun 13, 2017 at 11:29:59AM +, Miod Vallat wrote:
> > 
> > > Hi tech@,
> > >
> > > We do not support iso7 nor pcvt encoding, so remove macro definitions
> > > and commented entries.
> > 
> > If you do that, then you can probably optimize away
> > vga_valid_primary_font() in sys/dev/ic/vga.c as well.
> 
> Makes sense to me as well, thanks for pointing that out. Diff below.

Please discard the last diff, what did I have in mind?

The fonts we are looping through in vga_selectfont() are the builtin
font which is using the IBM encoding, and some potentially loaded fonts
which are either IBM or ISO encoded.

Therefore the condition checked by vga_valid_font() is always true, and
we can remove it.

Comments? OK?

Index: sys/dev/ic/vga.c
===
RCS file: /cvs/src/sys/dev/ic/vga.c,v
retrieving revision 1.68
diff -u -p -r1.68 vga.c
--- sys/dev/ic/vga.c9 Sep 2015 18:23:39 -   1.68
+++ sys/dev/ic/vga.c16 Jun 2017 20:50:42 -
@@ -344,10 +344,6 @@ bad:
  * We want at least ASCII 32..127 be present in the
  * first font slot.
  */
-#define vga_valid_primary_font(f) \
-   (f->encoding == WSDISPLAY_FONTENC_IBM || \
-   f->encoding == WSDISPLAY_FONTENC_ISO)
-
 int
 vga_selectfont(struct vga_config *vc, struct vgascreen *scr, const char *name1,
 const char *name2) /* NULL: take first found */
@@ -362,9 +358,7 @@ vga_selectfont(struct vga_config *vc, st
struct vgafont *f = vc->vc_fonts[i];
if (!f || f->height != type->fontheight)
continue;
-   if (!f1 &&
-   vga_valid_primary_font(f) &&
-   (!name1 || !*name1 ||
+   if (!f1 && (!name1 || !*name1 ||
 !strncmp(name1, f->name, WSFONT_NAME_SIZE))) {
f1 = f;
continue;



Re: wsfont: remove iso7/pcvt encoding macros and entries

2017-06-15 Thread Frederic Cambus
On Tue, Jun 13, 2017 at 11:29:59AM +, Miod Vallat wrote:
> 
> > Hi tech@,
> >
> > We do not support iso7 nor pcvt encoding, so remove macro definitions
> > and commented entries.
> 
> If you do that, then you can probably optimize away
> vga_valid_primary_font() in sys/dev/ic/vga.c as well.

Makes sense to me as well, thanks for pointing that out. Diff below.

Comments? OK?

Index: sys/dev/ic/vga.c
===
RCS file: /cvs/src/sys/dev/ic/vga.c,v
retrieving revision 1.68
diff -u -p -r1.68 vga.c
--- sys/dev/ic/vga.c9 Sep 2015 18:23:39 -   1.68
+++ sys/dev/ic/vga.c15 Jun 2017 10:47:09 -
@@ -344,10 +344,6 @@ bad:
  * We want at least ASCII 32..127 be present in the
  * first font slot.
  */
-#define vga_valid_primary_font(f) \
-   (f->encoding == WSDISPLAY_FONTENC_IBM || \
-   f->encoding == WSDISPLAY_FONTENC_ISO)
-
 int
 vga_selectfont(struct vga_config *vc, struct vgascreen *scr, const char *name1,
 const char *name2) /* NULL: take first found */
@@ -363,7 +359,8 @@ vga_selectfont(struct vga_config *vc, st
if (!f || f->height != type->fontheight)
continue;
if (!f1 &&
-   vga_valid_primary_font(f) &&
+   (f->encoding == WSDISPLAY_FONTENC_IBM ||
+f->encoding == WSDISPLAY_FONTENC_ISO) &&
(!name1 || !*name1 ||
 !strncmp(name1, f->name, WSFONT_NAME_SIZE))) {
f1 = f;



Re: wsfont: remove iso7/pcvt encoding macros and entries

2017-06-13 Thread Mike Larkin
On Tue, Jun 13, 2017 at 11:00:52AM +0200, Frederic Cambus wrote:
> Hi tech@,
> 
> We do not support iso7 nor pcvt encoding, so remove macro definitions
> and commented entries.
> 
> Comments? OK?
> 

ok mlarkin

also see what miod said in a later reply, maybe more "-" for you :)

> Index: sys/dev/wscons/wsconsio.h
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
> retrieving revision 1.82
> diff -u -p -r1.82 wsconsio.h
> --- sys/dev/wscons/wsconsio.h 13 Jun 2017 08:00:24 -  1.82
> +++ sys/dev/wscons/wsconsio.h 13 Jun 2017 08:41:20 -
> @@ -506,8 +506,6 @@ struct wsdisplay_font {
>   int encoding;
>  #define WSDISPLAY_FONTENC_ISO 0
>  #define WSDISPLAY_FONTENC_IBM 1
> -#define WSDISPLAY_FONTENC_PCVT 2
> -#define WSDISPLAY_FONTENC_ISO7 3 /* greek */
>   u_int fontwidth, fontheight, stride;
>  #define WSDISPLAY_MAXFONTSZ  (512*1024)
>   int bitorder, byteorder;
> Index: usr.sbin/wsfontload/wsfontload.c
> ===
> RCS file: /cvs/src/usr.sbin/wsfontload/wsfontload.c,v
> retrieving revision 1.16
> diff -u -p -r1.16 wsfontload.c
> --- usr.sbin/wsfontload/wsfontload.c  6 Sep 2015 20:07:46 -   1.16
> +++ usr.sbin/wsfontload/wsfontload.c  13 Jun 2017 08:41:21 -
> @@ -75,10 +75,6 @@ static const struct {
>  } encodings[] = {
>   {"iso",  WSDISPLAY_FONTENC_ISO},
>   {"ibm",  WSDISPLAY_FONTENC_IBM},
> -#if 0
> - {"pcvt", WSDISPLAY_FONTENC_PCVT},
> - {"iso7", WSDISPLAY_FONTENC_ISO7},
> -#endif
>  };
>  
>  int
> 



Re: wsfont: remove iso7/pcvt encoding macros and entries

2017-06-13 Thread Miod Vallat

> Hi tech@,
>
> We do not support iso7 nor pcvt encoding, so remove macro definitions
> and commented entries.

If you do that, then you can probably optimize away
vga_valid_primary_font() in sys/dev/ic/vga.c as well.