Re: inteldrm: add a handler for the WSDISPLAYIO_GINFO ioctl

2017-06-17 Thread Ted Unangst
Frederic Cambus wrote:
> Hi tech@,
> 
> Add a handler for the WSDISPLAYIO_GINFO ioctl in inteldrm, allowing
> to retrieve basic information about a framebuffer display.
> 
> When running wsconsctl on a machine with inteldrm support, this now
> returns those additional fields:
> 
> display.width=1600
> display.height=900
> display.depth=32
> 
> Comments? OK?

why? what program will use this information?



inteldrm: add a handler for the WSDISPLAYIO_GINFO ioctl

2017-06-17 Thread Frederic Cambus
Hi tech@,

Add a handler for the WSDISPLAYIO_GINFO ioctl in inteldrm, allowing
to retrieve basic information about a framebuffer display.

When running wsconsctl on a machine with inteldrm support, this now
returns those additional fields:

display.width=1600
display.height=900
display.depth=32

Comments? OK?

Index: sys/dev/pci/drm/i915/i915_drv.c
===
RCS file: /cvs/src/sys/dev/pci/drm/i915/i915_drv.c,v
retrieving revision 1.101
diff -u -p -r1.101 i915_drv.c
--- sys/dev/pci/drm/i915/i915_drv.c 8 Jan 2017 12:11:54 -   1.101
+++ sys/dev/pci/drm/i915/i915_drv.c 17 Jun 2017 19:15:04 -
@@ -1037,11 +1037,20 @@ inteldrm_wsioctl(void *v, u_long cmd, ca
 {
struct inteldrm_softc *dev_priv = v;
struct drm_device *dev = dev_priv->dev;
+   struct rasops_info *ri = _priv->ro;
+   struct wsdisplay_fbinfo *wdf;
struct wsdisplay_param *dp = (struct wsdisplay_param *)data;
 
switch (cmd) {
case WSDISPLAYIO_GTYPE:
*(int *)data = WSDISPLAY_TYPE_INTELDRM;
+   return 0;
+   case WSDISPLAYIO_GINFO:
+   wdf = (struct wsdisplay_fbinfo *)data;
+   wdf->width = ri->ri_width;
+   wdf->height = ri->ri_height;
+   wdf->depth = ri->ri_depth;
+   wdf->cmsize = 0;
return 0;
case WSDISPLAYIO_GETPARAM:
if (ws_get_param && ws_get_param(dp) == 0)



csh(1): move win variable

2017-06-17 Thread Anton Lindqvist
Hi,
Tiny diff, move the win variable into print_by_column() since it's the
only function using it.

Comments? OK?

Index: file.c
===
RCS file: /cvs/src/bin/csh/file.c,v
retrieving revision 1.23
diff -u -p -r1.23 file.c
--- file.c  26 Dec 2015 13:48:38 -  1.23
+++ file.c  17 Jun 2017 17:32:19 -
@@ -224,14 +224,13 @@ filetype(Char *dir, Char *file)
 return (' ');
 }
 
-static struct winsize win;
-
 /*
  * Print sorted down columns
  */
 static void
 print_by_column(Char *dir, Char *items[], int count)
 {
+struct winsize win;
 int i, rows, r, c, maxwidth = 0, columns;
 
 if (ioctl(SHOUT, TIOCGWINSZ, (ioctl_t) & win) < 0 || win.ws_col == 0)



Re: faster timecounters for kvm/xen

2017-06-17 Thread Mike Belopuhov
On 17 June 2017 at 14:17, Jonathan Matthew  wrote:
>
> On Fri, Jun 16, 2017 at 01:19:02PM +0200, Mike Belopuhov wrote:
> > On Fri, Jun 16, 2017 at 10:25 +0200, Mike Belopuhov wrote:
> > > I don't know if it's a good idea to depend on Xen's
> > > definition of vcpu_time_info.  I think I have factored
> > > it out into the pvclock_time_info and put it into the
> > > pvclockvar.h or something like that.  And then made Xen
> > > use those definitions instead of its own.  Dunno what's
> > > the best course of action here.
> > >
> >
> > This is what I would like to use.  I've stripped the API
> > part, but we can add it as well.  I don't believe this
> > file requires a specific license since there's a handful
> > of pvclock header files out there implementing a common
> > interface so a person committing such a file can add his
> > own copyright.  Opinions?
>
> Looks good to me.  Can we put the #defines for flag bits in there too?
>
> #define PVCLOCK_FLAG_TSC_STABLE_BIT (1 << 0)
> #define PVCLOCK_FLAG_GUEST_STOPPED  (1 << 1)
>
> As far as I can tell, xen doesn't use these, but Linux handles them in its
> common pvclock code anyway.
>

Sure, go for it.


Re: faster timecounters for kvm/xen

2017-06-17 Thread Jonathan Matthew
On Fri, Jun 16, 2017 at 01:19:02PM +0200, Mike Belopuhov wrote:
> On Fri, Jun 16, 2017 at 10:25 +0200, Mike Belopuhov wrote:
> > I don't know if it's a good idea to depend on Xen's
> > definition of vcpu_time_info.  I think I have factored
> > it out into the pvclock_time_info and put it into the
> > pvclockvar.h or something like that.  And then made Xen
> > use those definitions instead of its own.  Dunno what's
> > the best course of action here.
> > 
> 
> This is what I would like to use.  I've stripped the API
> part, but we can add it as well.  I don't believe this
> file requires a specific license since there's a handful
> of pvclock header files out there implementing a common
> interface so a person committing such a file can add his
> own copyright.  Opinions?

Looks good to me.  Can we put the #defines for flag bits in there too?

#define PVCLOCK_FLAG_TSC_STABLE_BIT (1 << 0)
#define PVCLOCK_FLAG_GUEST_STOPPED  (1 << 1)

As far as I can tell, xen doesn't use these, but Linux handles them in its
common pvclock code anyway.

> 
> 
> #ifndef _PV_PVCLOCK_H_
> #define _PV_PVCLOCK_H_
> 
> struct pvclock_vcpu_time_info {
>   volatile uint32_t   version;
>   volatile uint32_t   pad1;
>   volatile uint64_t   tsc_timestamp;
>   volatile uint64_t   system_time;
>   volatile uint32_t   tsc_to_system_mul;
>   volatile int8_t tsc_shift;
>   volatile uint8_tflags;
>   volatile uint8_tpad2[2];
> } __packed;
> 
> struct pvclock_wall_clock {
>   volatile uint32_t   version;
>   volatile uint32_t   sec;
>   volatile uint32_t   nsec;
> } __packed;
> 
> #endif/* _PV_PVCLOCK_H_ */



wsfontload(8): account for the WSFONT_NAME_SIZE change

2017-06-17 Thread Frederic Cambus
Hi tech@,

Since WSFONT_NAME_SIZE was switched from 16 to 32, account for the
change in wsfontload as well: tweak spacing and printf format string.

Comments? OK?

Index: usr.sbin/wsfontload/wsfontload.c
===
RCS file: /cvs/src/usr.sbin/wsfontload/wsfontload.c,v
retrieving revision 1.17
diff -u -p -r1.17 wsfontload.c
--- usr.sbin/wsfontload/wsfontload.c15 Jun 2017 11:48:49 -  1.17
+++ usr.sbin/wsfontload/wsfontload.c17 Jun 2017 08:20:20 -
@@ -147,7 +147,7 @@ main(int argc, char *argv[])
 
if (list) {
i = 0;
-   p = " # Name Encoding  W  H";
+   p = " # Name Encoding  W  H";
do {
f.index = i;
res = ioctl(wsfd, WSDISPLAYIO_LSFONT, );
@@ -157,7 +157,7 @@ main(int argc, char *argv[])
puts(p);
p = NULL;
}
-   printf("%2d %-16s %8s %2d %2d\n",
+   printf("%2d %-32s %8s %2d %2d\n",
f.index, f.name,
encodings[f.encoding].name,
f.fontwidth, f.fontheight);