svn commit: r356083 - stable/12/contrib/elftoolchain/elfcopy

2019-12-25 Thread Aleksandr Rybalko
Author: ray
Date: Wed Dec 25 22:19:23 2019
New Revision: 356083
URL: https://svnweb.freebsd.org/changeset/base/356083

Log:
  MFC r352878:
  
  Initialize baseaddr to suppres warning.

Modified:
  stable/12/contrib/elftoolchain/elfcopy/binary.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/elftoolchain/elfcopy/binary.c
==
--- stable/12/contrib/elftoolchain/elfcopy/binary.c Wed Dec 25 22:07:24 
2019(r356082)
+++ stable/12/contrib/elftoolchain/elfcopy/binary.c Wed Dec 25 22:19:23 
2019(r356083)
@@ -58,6 +58,7 @@ create_binary(int ifd, int ofd)
errx(EXIT_FAILURE, "elf_begin() failed: %s",
elf_errmsg(-1));
 
+   baseaddr = 0;
baseoff = 0;
if (lseek(ofd, baseoff, SEEK_SET) < 0)
err(EXIT_FAILURE, "lseek failed");
___
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: r356082 - stable/12/contrib/elftoolchain/elfcopy

2019-12-25 Thread Aleksandr Rybalko
Author: ray
Date: Wed Dec 25 22:07:24 2019
New Revision: 356082
URL: https://svnweb.freebsd.org/changeset/base/356082

Log:
  MFC r352875:
  
  Put sections into expected offset in binary format.
  Calculate binary file offset using address field, bacause software know only 
offset to known data, not where to load segment.
  With that patch, kernel .data section can have any alignment/offset - kernel 
boor fine.
  
  PR:   235391
  Reviewed by:  markj
  Differential Revision:D21827

Modified:
  stable/12/contrib/elftoolchain/elfcopy/binary.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/elftoolchain/elfcopy/binary.c
==
--- stable/12/contrib/elftoolchain/elfcopy/binary.c Wed Dec 25 20:57:24 
2019(r356081)
+++ stable/12/contrib/elftoolchain/elfcopy/binary.c Wed Dec 25 22:07:24 
2019(r356082)
@@ -49,22 +49,23 @@ create_binary(int ifd, int ofd)
Elf *e;
Elf_Scn *scn;
Elf_Data *d;
+   Elf64_Addr baseaddr;
GElf_Shdr sh;
-   off_t base, off;
+   off_t baseoff, off;
int elferr;
 
if ((e = elf_begin(ifd, ELF_C_READ, NULL)) == NULL)
errx(EXIT_FAILURE, "elf_begin() failed: %s",
elf_errmsg(-1));
 
-   base = 0;
-   if (lseek(ofd, base, SEEK_SET) < 0)
+   baseoff = 0;
+   if (lseek(ofd, baseoff, SEEK_SET) < 0)
err(EXIT_FAILURE, "lseek failed");
 
/*
 * Find base offset in the first iteration.
 */
-   base = -1;
+   baseoff = -1;
scn = NULL;
while ((scn = elf_nextscn(e, scn)) != NULL) {
if (gelf_getshdr(scn, ) == NULL) {
@@ -76,14 +77,16 @@ create_binary(int ifd, int ofd)
sh.sh_type == SHT_NOBITS ||
sh.sh_size == 0)
continue;
-   if (base == -1 || (off_t) sh.sh_offset < base)
-   base = sh.sh_offset;
+   if (baseoff == -1 || (off_t) sh.sh_offset < baseoff) {
+   baseoff = sh.sh_offset;
+   baseaddr = sh.sh_addr;
+   }
}
elferr = elf_errno();
if (elferr != 0)
warnx("elf_nextscn failed: %s", elf_errmsg(elferr));
 
-   if (base == -1)
+   if (baseoff == -1)
return;
 
/*
@@ -110,8 +113,8 @@ create_binary(int ifd, int ofd)
if (d->d_buf == NULL || d->d_size == 0)
continue;
 
-   /* lseek to section offset relative to `base'. */
-   off = sh.sh_offset - base;
+   /* lseek to section offset relative to `baseaddr'. */
+   off = sh.sh_addr - baseaddr;
if (lseek(ofd, off, SEEK_SET) < 0)
err(EXIT_FAILURE, "lseek failed");
 
___
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: r352878 - head/contrib/elftoolchain/elfcopy

2019-09-29 Thread Aleksandr Rybalko
Author: ray
Date: Sun Sep 29 23:47:23 2019
New Revision: 352878
URL: https://svnweb.freebsd.org/changeset/base/352878

Log:
  Initialize baseaddr to suppres warning.
  
  Pointy hat to:ray

Modified:
  head/contrib/elftoolchain/elfcopy/binary.c

Modified: head/contrib/elftoolchain/elfcopy/binary.c
==
--- head/contrib/elftoolchain/elfcopy/binary.c  Sun Sep 29 22:41:06 2019
(r352877)
+++ head/contrib/elftoolchain/elfcopy/binary.c  Sun Sep 29 23:47:23 2019
(r352878)
@@ -58,6 +58,7 @@ create_binary(int ifd, int ofd)
errx(EXIT_FAILURE, "elf_begin() failed: %s",
elf_errmsg(-1));
 
+   baseaddr = 0;
baseoff = 0;
if (lseek(ofd, baseoff, SEEK_SET) < 0)
err(EXIT_FAILURE, "lseek failed");
___
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: r352875 - head/contrib/elftoolchain/elfcopy

2019-09-29 Thread Aleksandr Rybalko
Author: ray
Date: Sun Sep 29 22:34:01 2019
New Revision: 352875
URL: https://svnweb.freebsd.org/changeset/base/352875

Log:
  ections into expected offset in binary format.
  Calculate binary file offset using address field, bacause software know only 
offset to known data, not where to load segment.
  With that patch, kernel .data section can have any alignment/offset - kernel 
boor fine.
  
  PR:   235391
  Reviewed by:  markj
  MFC after:1 month
  Differential Revision:D21827

Modified:
  head/contrib/elftoolchain/elfcopy/binary.c

Modified: head/contrib/elftoolchain/elfcopy/binary.c
==
--- head/contrib/elftoolchain/elfcopy/binary.c  Sun Sep 29 20:44:13 2019
(r352874)
+++ head/contrib/elftoolchain/elfcopy/binary.c  Sun Sep 29 22:34:01 2019
(r352875)
@@ -49,22 +49,23 @@ create_binary(int ifd, int ofd)
Elf *e;
Elf_Scn *scn;
Elf_Data *d;
+   Elf64_Addr baseaddr;
GElf_Shdr sh;
-   off_t base, off;
+   off_t baseoff, off;
int elferr;
 
if ((e = elf_begin(ifd, ELF_C_READ, NULL)) == NULL)
errx(EXIT_FAILURE, "elf_begin() failed: %s",
elf_errmsg(-1));
 
-   base = 0;
-   if (lseek(ofd, base, SEEK_SET) < 0)
+   baseoff = 0;
+   if (lseek(ofd, baseoff, SEEK_SET) < 0)
err(EXIT_FAILURE, "lseek failed");
 
/*
 * Find base offset in the first iteration.
 */
-   base = -1;
+   baseoff = -1;
scn = NULL;
while ((scn = elf_nextscn(e, scn)) != NULL) {
if (gelf_getshdr(scn, ) == NULL) {
@@ -76,14 +77,16 @@ create_binary(int ifd, int ofd)
sh.sh_type == SHT_NOBITS ||
sh.sh_size == 0)
continue;
-   if (base == -1 || (off_t) sh.sh_offset < base)
-   base = sh.sh_offset;
+   if (baseoff == -1 || (off_t) sh.sh_offset < baseoff) {
+   baseoff = sh.sh_offset;
+   baseaddr = sh.sh_addr;
+   }
}
elferr = elf_errno();
if (elferr != 0)
warnx("elf_nextscn failed: %s", elf_errmsg(elferr));
 
-   if (base == -1)
+   if (baseoff == -1)
return;
 
/*
@@ -110,8 +113,8 @@ create_binary(int ifd, int ofd)
if (d->d_buf == NULL || d->d_size == 0)
continue;
 
-   /* lseek to section offset relative to `base'. */
-   off = sh.sh_offset - base;
+   /* lseek to section offset relative to `baseaddr'. */
+   off = sh.sh_addr - baseaddr;
if (lseek(ofd, off, SEEK_SET) < 0)
err(EXIT_FAILURE, "lseek failed");
 
___
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: r352442 - stable/12/sys/arm/arm

2019-09-17 Thread Aleksandr Rybalko
Author: ray
Date: Tue Sep 17 11:20:53 2019
New Revision: 352442
URL: https://svnweb.freebsd.org/changeset/base/352442

Log:
  MFC r351649 Check for region dups.

Modified:
  stable/12/sys/arm/arm/physmem.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/arm/physmem.c
==
--- stable/12/sys/arm/arm/physmem.c Tue Sep 17 10:09:59 2019
(r352441)
+++ stable/12/sys/arm/arm/physmem.c Tue Sep 17 11:20:53 2019
(r352442)
@@ -287,6 +287,8 @@ insert_region(struct region *regions, size_t rcnt, vm_
 
ep = regions + rcnt;
for (i = 0, rp = regions; i < rcnt; ++i, ++rp) {
+   if (rp->addr == addr && rp->size == size) /* Pure dup. */
+   return (rcnt);
if (flags == rp->flags) {
if (addr + size == rp->addr) {
rp->addr = addr;
___
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: r351827 - stable/12/sys/vm

2019-09-04 Thread Aleksandr Rybalko
Author: ray
Date: Wed Sep  4 19:32:50 2019
New Revision: 351827
URL: https://svnweb.freebsd.org/changeset/base/351827

Log:
  MFC r351213: assert that td_lk_slocks is not leaked upon return from kernel

Modified:
  stable/12/sys/vm/vm_reserv.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/vm_reserv.c
==
--- stable/12/sys/vm/vm_reserv.cWed Sep  4 19:31:37 2019
(r351826)
+++ stable/12/sys/vm/vm_reserv.cWed Sep  4 19:32:50 2019
(r351827)
@@ -316,7 +316,8 @@ sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS)
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = _phys_segs[segind];
paddr = roundup2(seg->start, VM_LEVEL_0_SIZE);
-   while (paddr + VM_LEVEL_0_SIZE <= seg->end) {
+   while (paddr + VM_LEVEL_0_SIZE > paddr && paddr +
+   VM_LEVEL_0_SIZE <= seg->end) {
rv = _reserv_array[paddr >> VM_LEVEL_0_SHIFT];
fullpop += rv->popcnt == VM_LEVEL_0_NPAGES;
paddr += VM_LEVEL_0_SIZE;
@@ -1164,7 +1165,8 @@ vm_reserv_init(void)
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = _phys_segs[segind];
paddr = roundup2(seg->start, VM_LEVEL_0_SIZE);
-   while (paddr + VM_LEVEL_0_SIZE <= seg->end) {
+   while (paddr + VM_LEVEL_0_SIZE > paddr && paddr +
+   VM_LEVEL_0_SIZE <= seg->end) {
rv = _reserv_array[paddr >> VM_LEVEL_0_SHIFT];
rv->pages = PHYS_TO_VM_PAGE(paddr);
rv->domain = seg->domain;
___
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: r351826 - stable/11/sys/vm

2019-09-04 Thread Aleksandr Rybalko
Author: ray
Date: Wed Sep  4 19:31:37 2019
New Revision: 351826
URL: https://svnweb.freebsd.org/changeset/base/351826

Log:
  MFC r351213: assert that td_lk_slocks is not leaked upon return from kernel

Modified:
  stable/11/sys/vm/vm_reserv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/vm_reserv.c
==
--- stable/11/sys/vm/vm_reserv.cWed Sep  4 19:23:18 2019
(r351825)
+++ stable/11/sys/vm/vm_reserv.cWed Sep  4 19:31:37 2019
(r351826)
@@ -258,7 +258,8 @@ sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS)
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = _phys_segs[segind];
paddr = roundup2(seg->start, VM_LEVEL_0_SIZE);
-   while (paddr + VM_LEVEL_0_SIZE <= seg->end) {
+   while (paddr + VM_LEVEL_0_SIZE > paddr && paddr +
+   VM_LEVEL_0_SIZE <= seg->end) {
rv = _reserv_array[paddr >> VM_LEVEL_0_SHIFT];
fullpop += rv->popcnt == VM_LEVEL_0_NPAGES;
paddr += VM_LEVEL_0_SIZE;
@@ -851,7 +852,8 @@ vm_reserv_init(void)
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = _phys_segs[segind];
paddr = roundup2(seg->start, VM_LEVEL_0_SIZE);
-   while (paddr + VM_LEVEL_0_SIZE <= seg->end) {
+   while (paddr + VM_LEVEL_0_SIZE > paddr && paddr +
+   VM_LEVEL_0_SIZE <= seg->end) {
vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT].pages =
PHYS_TO_VM_PAGE(paddr);
paddr += VM_LEVEL_0_SIZE;
___
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: r351649 - head/sys/arm/arm

2019-08-31 Thread Aleksandr Rybalko
Author: ray
Date: Sat Aug 31 21:28:06 2019
New Revision: 351649
URL: https://svnweb.freebsd.org/changeset/base/351649

Log:
  ARM kernel can get RAM regions three ways:
  o from FDT;
  o from EFI;
  o from Linux Boot API (ATAG).
  U-Boot may pass RAM info all that 3 ways simultaneously.
  We do select between FDT and EFI, but not for ATAG.
  So this is not problem fix, but correctness check.
  
  MFC after:2 weeks

Modified:
  head/sys/arm/arm/physmem.c

Modified: head/sys/arm/arm/physmem.c
==
--- head/sys/arm/arm/physmem.c  Sat Aug 31 20:45:45 2019(r351648)
+++ head/sys/arm/arm/physmem.c  Sat Aug 31 21:28:06 2019(r351649)
@@ -264,6 +264,8 @@ insert_region(struct region *regions, size_t rcnt, vm_
 
ep = regions + rcnt;
for (i = 0, rp = regions; i < rcnt; ++i, ++rp) {
+   if (rp->addr == addr && rp->size == size) /* Pure dup. */
+   return (rcnt);
if (flags == rp->flags) {
if (addr + size == rp->addr) {
rp->addr = addr;
___
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: r351133 - head/sys/vm

2019-08-16 Thread Aleksandr Rybalko
Author: ray
Date: Fri Aug 16 19:27:05 2019
New Revision: 351133
URL: https://svnweb.freebsd.org/changeset/base/351133

Log:
  Check paddr for overflow.
  Fix panic on initialize of "vm reserv" per-superpage lock in case when RAM 
ends at upper boundary of address space.
  Observed on ARM32 board BPI-R2 (2GB RAM 0x8000-0x).
  
  PR:   235362
  Reviewed by:  kib, markj, alc
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D21272

Modified:
  head/sys/vm/vm_reserv.c

Modified: head/sys/vm/vm_reserv.c
==
--- head/sys/vm/vm_reserv.c Fri Aug 16 18:57:32 2019(r351132)
+++ head/sys/vm/vm_reserv.c Fri Aug 16 19:27:05 2019(r351133)
@@ -316,7 +316,8 @@ sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS)
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = _phys_segs[segind];
paddr = roundup2(seg->start, VM_LEVEL_0_SIZE);
-   while (paddr + VM_LEVEL_0_SIZE <= seg->end) {
+   while (paddr + VM_LEVEL_0_SIZE > paddr && paddr +
+   VM_LEVEL_0_SIZE <= seg->end) {
rv = _reserv_array[paddr >> VM_LEVEL_0_SHIFT];
fullpop += rv->popcnt == VM_LEVEL_0_NPAGES;
paddr += VM_LEVEL_0_SIZE;
@@ -1055,7 +1056,8 @@ vm_reserv_init(void)
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = _phys_segs[segind];
paddr = roundup2(seg->start, VM_LEVEL_0_SIZE);
-   while (paddr + VM_LEVEL_0_SIZE <= seg->end) {
+   while (paddr + VM_LEVEL_0_SIZE > paddr && paddr +
+   VM_LEVEL_0_SIZE <= seg->end) {
rv = _reserv_array[paddr >> VM_LEVEL_0_SHIFT];
rv->pages = PHYS_TO_VM_PAGE(paddr);
rv->domain = seg->domain;
___
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: r313547 - head/sys/dev/vt

2017-02-10 Thread Aleksandr Rybalko
Ed,

thanks, I will define PR on planned fix


2017-02-10 16:24 GMT+02:00 Ed Maste <ema...@freebsd.org>:

> On 10 February 2017 at 08:28, Aleksandr Rybalko <r...@freebsd.org> wrote:
> > Author: ray
> > Date: Fri Feb 10 13:28:30 2017
> > New Revision: 313547
> > URL: https://svnweb.freebsd.org/changeset/base/313547
> >
> > Log:
> >   o Reset mouse selection when new lines reach selection lines.
> >   o Fix how selection handled on display.
>
> PR: 211922
>



-- 
WBW
---
Rybalko Aleksandr <r...@ddteam.net>
___
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: r313547 - head/sys/dev/vt

2017-02-10 Thread Aleksandr Rybalko
Author: ray
Date: Fri Feb 10 13:28:30 2017
New Revision: 313547
URL: https://svnweb.freebsd.org/changeset/base/313547

Log:
  o Reset mouse selection when new lines reach selection lines.
  o Fix how selection handled on display.
  
  Submitted by: hselasky
  Reviewed by:  hselasky, emaste(previous version)
  Todo: track mouse select direction.

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

Modified: head/sys/dev/vt/vt_buf.c
==
--- head/sys/dev/vt/vt_buf.cFri Feb 10 11:17:45 2017(r313546)
+++ head/sys/dev/vt/vt_buf.cFri Feb 10 13:28:30 2017(r313547)
@@ -54,6 +54,11 @@ static MALLOC_DEFINE(M_VTBUF, "vtbuf", "
(d).tp_row = (s).tp_row;\
 } while (0)
 
+#ifndef SC_NO_CUTPASTE
+static int vtbuf_wth(const struct vt_buf *vb, int row);
+static int vtbuf_in_this_range(int begin, int test, int end, int sz);
+#endif
+static int vtbuf_htw(const struct vt_buf *vb, int row);
 
 /*
  * line4
@@ -122,6 +127,9 @@ vthistory_seek(struct vt_buf *vb, int of
 void
 vthistory_addlines(struct vt_buf *vb, int offset)
 {
+#ifndef SC_NO_CUTPASTE
+   int cur, sz;
+#endif
 
vb->vb_curroffset += offset;
if (vb->vb_curroffset < 0)
@@ -132,6 +140,17 @@ vthistory_addlines(struct vt_buf *vb, in
if ((vb->vb_flags & VBF_SCROLL) == 0) {
vb->vb_roffset = vb->vb_curroffset;
}
+
+#ifndef SC_NO_CUTPASTE
+   sz = vb->vb_history_size;
+   cur = vb->vb_roffset + vb->vb_scr_size.tp_row + sz - 1;
+   if (vtbuf_in_this_range(cur, vb->vb_mark_start.tp_row, cur + offset, 
sz) ||
+   vtbuf_in_this_range(cur, vb->vb_mark_end.tp_row, cur + offset, sz)) 
{
+   /* clear screen selection */
+   vb->vb_mark_start.tp_row = vb->vb_mark_end.tp_row;
+   vb->vb_mark_start.tp_col = vb->vb_mark_end.tp_col;
+   }
+#endif
 }
 
 void
@@ -144,11 +163,33 @@ vthistory_getpos(const struct vt_buf *vb
 #ifndef SC_NO_CUTPASTE /* Only mouse support use it now. */
 /* Translate current view row number to history row. */
 static int
-vtbuf_wth(struct vt_buf *vb, int row)
+vtbuf_wth(const struct vt_buf *vb, int row)
 {
 
return ((vb->vb_roffset + row) % vb->vb_history_size);
 }
+
+/*
+ * Test if an index in a circular buffer is within a range.
+ *
+ * begin - start index
+ * end - end index
+ * test - test index
+ * sz - size of circular buffer when it turns over
+ */
+static int
+vtbuf_in_this_range(int begin, int test, int end, int sz)
+{
+
+   begin %= sz;
+   end %= sz;
+
+   /* check for inversion */
+   if (begin > end)
+   return (test >= begin || test < end);
+   else
+   return (test >= begin && test < end);
+}
 #endif
 
 /* Translate history row to current view row number. */
@@ -169,33 +210,44 @@ vtbuf_htw(const struct vt_buf *vb, int r
 int
 vtbuf_iscursor(const struct vt_buf *vb, int row, int col)
 {
-   int sc, sr, ec, er, tmp;
+#ifndef SC_NO_CUTPASTE
+   int sc, sr, sz, ec, er, tmp;
+#endif
 
if ((vb->vb_flags & (VBF_CURSOR|VBF_SCROLL)) == VBF_CURSOR &&
(vb->vb_cursor.tp_row == row) && (vb->vb_cursor.tp_col == col))
return (1);
 
+#ifndef SC_NO_CUTPASTE
/* Mark cut/paste region. */
+   if (vb->vb_mark_start.tp_col == vb->vb_mark_end.tp_col &&
+   vb->vb_mark_start.tp_row == vb->vb_mark_end.tp_row)
+   return (0);
 
-   /*
-* Luckily screen view is not like circular buffer, so we will
-* calculate in screen coordinates.  Translate first.
-*/
sc = vb->vb_mark_start.tp_col;
-   sr = vtbuf_htw(vb, vb->vb_mark_start.tp_row);
+   sr = vb->vb_mark_start.tp_row;
ec = vb->vb_mark_end.tp_col;
-   er = vtbuf_htw(vb, vb->vb_mark_end.tp_row);
+   er = vb->vb_mark_end.tp_row;
 
+   /*
+* Information about if the selection was made bottom-top or
+* top-bottom is lost due to modulo arithmetics and needs to
+* be recovered:
+*/
+   sz = vb->vb_history_size;
+   tmp = (sz + er - sr) % sz;
+   row = vtbuf_wth(vb, row);
 
-   /* Swap start and end if start > end. */
-   if (POS_INDEX(sc, sr) > POS_INDEX(ec, er)) {
+   /* Swap start and end if start > end */
+   if ((2 * tmp) > sz || (tmp == 0 && sc > ec)) {
tmp = sc; sc = ec; ec = tmp;
tmp = sr; sr = er; er = tmp;
}
 
-   if ((POS_INDEX(sc, sr) <= POS_INDEX(col, row)) &&
-   (POS_INDEX(col, row) < POS_INDEX(ec, er)))
+   if (vtbuf_in_this_range(POS_INDEX(sc, sr), POS_INDEX(col, row),
+   POS_INDEX(ec, er), POS_INDEX(0, sz)))
return (1);
+#endif
 
return (0);
 }
@@ -627,8 +679,8 @@ vtbuf_flush_mark(struct vt_buf *vb)
int s, e;
 
/* Notify renderer to update marked region. */
-   if (vb->vb_mark_start.tp_col || vb->vb_mark_end.tp_col ||
-   

Re: svn commit: r287782 - stable/10/sys/dev/vt

2015-09-16 Thread Aleksandr Rybalko
On Tue, 15 Sep 2015 01:34:21 +
Alexey Dokuchaev <da...@freebsd.org> wrote:

> On Mon, Sep 14, 2015 at 02:42:07PM +, Aleksandr Rybalko wrote:
> > New Revision: 287782
> > URL: https://svnweb.freebsd.org/changeset/base/287782
> > 
> > Log:
> >   MFC: r272715
> > Allow vt(4) to disable terminal bell with
> >   `sysctl kern.vt.bell_enable=0`, similar as syscons(4) do.
> > [...]
> > +VT_SYSCTL_INT(enable_bell, 1, "Enable bell");
> 
> I think you've meant `sysctl kern.vt.enable_bell=0' in the commit log.

Yes.
Just copied message with mistake of original commit.
Sorry for that. :)

> 
> > +   if (!vt_enable_bell)
> > +   return;
> > +
> > if (vd->vd_flags & VDF_QUIET_BELL)
> > return;
> 
> Hm, I'm wondering why having another sysctl is required when there's already
> a way to shut the bell up with VDF_QUIET_BELL flag?

Many guys found sysctl way as most comfort. I have no objections,
because that way was present in the syscons(4).
Name was changed to more obvious one, since '.bell' may be treated
as type of bell, but switch just do enable/disable. 

> 
> Also, there's certain naming inconsistency between syscons(4) and vt(4).
> On my stable/8 laptop, I see this:
> 
> $ sysctl -d hw.syscons.bell
> hw.syscons.bell: enable bell
> 
> On my -CURRENT desktop, this:
> 
> $ sysctl -d kern.vt.enable_bell
> kern.vt.enable_bell: Enable bell
> 
> ./danfe

Thanks you, Alexey!

WBW
-- 
Aleksandr Rybalko <r...@freebsd.org>
___
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: r287782 - stable/10/sys/dev/vt

2015-09-14 Thread Aleksandr Rybalko
Author: ray
Date: Mon Sep 14 14:42:06 2015
New Revision: 287782
URL: https://svnweb.freebsd.org/changeset/base/287782

Log:
  MFC: r272715
Allow vt(4) to disable terminal bell with `sysctl 
kern.vt.bell_enable=0`,
similar as syscons(4) do.
  
  Submitted by: Tiwei Bie 
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/dev/vt/vt_core.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/vt/vt_core.c
==
--- stable/10/sys/dev/vt/vt_core.c  Mon Sep 14 12:25:45 2015
(r287781)
+++ stable/10/sys/dev/vt/vt_core.c  Mon Sep 14 14:42:06 2015
(r287782)
@@ -121,6 +121,7 @@ const struct terminal_class vt_termclass
 
 static SYSCTL_NODE(_kern, OID_AUTO, vt, CTLFLAG_RD, 0, "vt(9) parameters");
 VT_SYSCTL_INT(enable_altgr, 1, "Enable AltGr key (Do not assume R.Alt as 
Alt)");
+VT_SYSCTL_INT(enable_bell, 1, "Enable bell");
 VT_SYSCTL_INT(debug, 0, "vt(9) debug level");
 VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode");
 VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend");
@@ -935,6 +936,9 @@ vtterm_bell(struct terminal *tm)
struct vt_window *vw = tm->tm_softc;
struct vt_device *vd = vw->vw_device;
 
+   if (!vt_enable_bell)
+   return;
+
if (vd->vd_flags & VDF_QUIET_BELL)
return;
 
@@ -946,6 +950,9 @@ vtterm_beep(struct terminal *tm, u_int p
 {
u_int freq, period;
 
+   if (!vt_enable_bell)
+   return;
+
if ((param == 0) || ((param & 0x) == 0)) {
vtterm_bell(tm);
return;
___
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: r272715 - head/sys/dev/vt

2014-10-07 Thread Aleksandr Rybalko
Author: ray
Date: Tue Oct  7 18:47:53 2014
New Revision: 272715
URL: https://svnweb.freebsd.org/changeset/base/272715

Log:
  Allow vt(4) to disable terminal bell with `sysctl kern.vt.bell_enable=0`,
  similar as syscons(4) do.
  
  Submitted by: Tiwei Bie b...@mail.ustc.edu.cn
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Tue Oct  7 18:22:05 2014(r272714)
+++ head/sys/dev/vt/vt_core.c   Tue Oct  7 18:47:53 2014(r272715)
@@ -120,6 +120,7 @@ const struct terminal_class vt_termclass
 
 static SYSCTL_NODE(_kern, OID_AUTO, vt, CTLFLAG_RD, 0, vt(9) parameters);
 VT_SYSCTL_INT(enable_altgr, 1, Enable AltGr key (Do not assume R.Alt as 
Alt));
+VT_SYSCTL_INT(enable_bell, 1, Enable bell);
 VT_SYSCTL_INT(debug, 0, vt(9) debug level);
 VT_SYSCTL_INT(deadtimer, 15, Time to wait busy process in VT_PROCESS mode);
 VT_SYSCTL_INT(suspendswitch, 1, Switch to VT0 before suspend);
@@ -904,6 +905,9 @@ vtterm_bell(struct terminal *tm)
struct vt_window *vw = tm-tm_softc;
struct vt_device *vd = vw-vw_device;
 
+   if (!vt_enable_bell)
+   return;
+
if (vd-vd_flags  VDF_QUIET_BELL)
return;
 
@@ -915,6 +919,9 @@ vtterm_beep(struct terminal *tm, u_int p
 {
u_int freq, period;
 
+   if (!vt_enable_bell)
+   return;
+
if ((param == 0) || ((param  0x) == 0)) {
vtterm_bell(tm);
return;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r272104 - stable/10/sys/dev/drm2

2014-09-25 Thread Aleksandr Rybalko
Author: ray
Date: Thu Sep 25 13:08:31 2014
New Revision: 272104
URL: http://svnweb.freebsd.org/changeset/base/272104

Log:
  MFC r268981
  Remove #ifdef-s to reduce difference to upstream.
  
  Pointed by: kib
  Approved by:re (glebius)
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/dev/drm2/drm_fb_helper.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/drm2/drm_fb_helper.c
==
--- stable/10/sys/dev/drm2/drm_fb_helper.c  Thu Sep 25 11:38:26 2014
(r272103)
+++ stable/10/sys/dev/drm2/drm_fb_helper.c  Thu Sep 25 13:08:31 2014
(r272104)
@@ -36,7 +36,6 @@ __FBSDID($FreeBSD$);
 #include dev/drm2/drm_fb_helper.h
 #include dev/drm2/drm_crtc_helper.h
 
-#if defined(__FreeBSD__)
 
 #include sys/kdb.h
 
@@ -76,7 +75,6 @@ vt_kms_postswitch(void *arg)
 
return (0);
 }
-#endif
 
 static DRM_LIST_HEAD(kernel_fb_helper_list);
 
@@ -941,10 +939,8 @@ int drm_fb_helper_single_fb_probe(struct
struct fb_info *info;
struct drm_fb_helper_surface_size sizes;
int gamma_size = 0;
-#if defined(__FreeBSD__)
struct vt_kms_softc *sc;
device_t kdev;
-#endif
 
memset(sizes, 0, sizeof(struct drm_fb_helper_surface_size));
sizes.surface_depth = 24;
@@ -1021,7 +1017,6 @@ int drm_fb_helper_single_fb_probe(struct
if (new_fb  0)
return new_fb;
 
-#if defined(__FreeBSD__)
sc = malloc(sizeof(struct vt_kms_softc), DRM_MEM_KMS,
M_WAITOK | M_ZERO);
sc-fb_helper = fb_helper;
@@ -1036,14 +1031,12 @@ int drm_fb_helper_single_fb_probe(struct
info-fb_stride = fb_helper-fb-pitches[0];
info-fb_priv = sc;
info-enter = vt_kms_postswitch;
-#endif
 
/* set the fb pointer */
for (i = 0; i  fb_helper-crtc_count; i++) {
fb_helper-crtc_info[i].mode_set.fb = fb_helper-fb;
}
 
-#if defined(__FreeBSD__)
if (new_fb) {
device_t fbd;
int ret;
@@ -1059,30 +1052,6 @@ int drm_fb_helper_single_fb_probe(struct
DRM_ERROR(Failed to attach fbd device: %d\n, ret);
 #endif
}
-#else
-   if (new_fb) {
-   info-var.pixclock = 0;
-   if (register_framebuffer(info)  0) {
-   return -EINVAL;
-   }
-
-   printf(fb%d: %s frame buffer device\n, info-node,
-  info-fix.id);
-
-   } else {
-   drm_fb_helper_set_par(info);
-   }
-
-   /* Switch back to kernel console on panic */
-   /* multi card linked list maybe */
-   if (list_empty(kernel_fb_helper_list)) {
-   printf(drm: registered panic notifier\n);
-   atomic_notifier_chain_register(panic_notifier_list,
-  paniced);
-   }
-   if (new_fb)
-   list_add(fb_helper-kernel_fb_list, kernel_fb_helper_list);
-#endif
return 0;
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r271952 - in stable/10/sys/dev/vt: . hw/ofwfb logo

2014-09-22 Thread Aleksandr Rybalko
Author: ray
Date: Mon Sep 22 10:21:08 2014
New Revision: 271952
URL: http://svnweb.freebsd.org/changeset/base/271952

Log:
  MFC 271381-271382,271385,271463-271466,271485,271506
  
  o Add sysctls to enable/disable potentially dengerous key combinations, like
  reboot/halt/debug.
  o Add support for most key combinations supported by syscons(4).
  o Some spelling fixes
  o Remove stray whitespaces.
  o Switch vt(4) to traditional behaviour with copy-paste same as syscons(4) do.
  o Fix stray char on paste.
  o Fix 'function declaration isn't a prototype' warning.
  o vt(4): Enclose vt_mouse_paste() prototype inside #ifndef 
SC_NO_CUTPASTE/#endif
  
  Approved by:  re (gjb)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/dev/vt/hw/ofwfb/ofwfb.c
  stable/10/sys/dev/vt/logo/logo_freebsd.c
  stable/10/sys/dev/vt/vt.h
  stable/10/sys/dev/vt/vt_buf.c
  stable/10/sys/dev/vt/vt_consolectl.c
  stable/10/sys/dev/vt/vt_core.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/vt/hw/ofwfb/ofwfb.c
==
--- stable/10/sys/dev/vt/hw/ofwfb/ofwfb.c   Mon Sep 22 10:05:36 2014
(r271951)
+++ stable/10/sys/dev/vt/hw/ofwfb/ofwfb.c   Mon Sep 22 10:21:08 2014
(r271952)
@@ -53,7 +53,7 @@ struct ofwfb_softc {
 
phandle_t   sc_node;
ihandle_t   sc_handle;
-   bus_space_tag_t sc_memt; 
+   bus_space_tag_t sc_memt;
 };
 
 static vd_probe_t  ofwfb_probe;

Modified: stable/10/sys/dev/vt/logo/logo_freebsd.c
==
--- stable/10/sys/dev/vt/logo/logo_freebsd.cMon Sep 22 10:05:36 2014
(r271951)
+++ stable/10/sys/dev/vt/logo/logo_freebsd.cMon Sep 22 10:21:08 2014
(r271952)
@@ -637,5 +637,5 @@ unsigned char vt_logo_image[] = {
0x1f, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x0e, 0x00, 0x00,
0x00, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x00,
0x3f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x00,
 };

Modified: stable/10/sys/dev/vt/vt.h
==
--- stable/10/sys/dev/vt/vt.h   Mon Sep 22 10:05:36 2014(r271951)
+++ stable/10/sys/dev/vt/vt.h   Mon Sep 22 10:21:08 2014(r271952)
@@ -114,11 +114,17 @@ typedef unsigned int  vt_axis_t;
 struct vt_mouse_cursor;
 #endif
 
+struct vt_pastebuf {
+   term_char_t *vpb_buf;   /* Copy-paste buffer. */
+   unsigned int vpb_bufsz; /* Buffer size. */
+   unsigned int vpb_len;   /* Length of a last selection. 
*/
+};
+
 struct vt_device {
struct vt_window*vd_windows[VT_MAXWINDOWS]; /* (c) Windows. */
struct vt_window*vd_curwindow;  /* (d) Current window. */
struct vt_window*vd_savedwindow;/* (?) Saved for suspend. */
-   struct vt_window*vd_markedwin;  /* (?) Copy/paste buf owner. */
+   struct vt_pastebuf   vd_pastebuf;   /* (?) Copy/paste buf. */
const struct vt_driver  *vd_driver; /* (c) Graphics driver. */
void*vd_softc;  /* (u) Driver data. */
 #ifndef SC_NO_CUTPASTE
@@ -152,6 +158,10 @@ struct vt_device {
unsigned int vd_unit;   /* (c) Device unit. */
 };
 
+#defineVD_PASTEBUF(vd) ((vd)-vd_pastebuf.vpb_buf)
+#defineVD_PASTEBUFSZ(vd)   ((vd)-vd_pastebuf.vpb_bufsz)
+#defineVD_PASTEBUFLEN(vd)  ((vd)-vd_pastebuf.vpb_len)
+
 /*
  * Per-window terminal screen buffer.
  *

Modified: stable/10/sys/dev/vt/vt_buf.c
==
--- stable/10/sys/dev/vt/vt_buf.c   Mon Sep 22 10:05:36 2014
(r271951)
+++ stable/10/sys/dev/vt/vt_buf.c   Mon Sep 22 10:21:08 2014
(r271952)
@@ -321,7 +321,7 @@ vtbuf_copy(struct vt_buf *vb, const term
if (r-tr_begin.tp_row  p2-tp_row  r-tr_begin.tp_col == 0 
r-tr_end.tp_col == vb-vb_scr_size.tp_col  /* Full row. */
(rows + rdiff) == vb-vb_scr_size.tp_row  /* Whole screen. */
-   rdiff  0) { /* Only forward dirrection. Do not eat history. */
+   rdiff  0) { /* Only forward direction. Do not eat history. */
vthistory_addlines(vb, rdiff);
} else if (p2-tp_row  p1-tp_row) {
/* Handle overlapping copies of line segments. */
@@ -603,7 +603,7 @@ vtbuf_get_marked_len(struct vt_buf *vb)
ei = e.tp_row * vb-vb_scr_size.tp_col + e.tp_col;
 
/* Number symbols and number of rows to inject \n */
-   sz = ei - si + ((e.tp_row - s.tp_row) * 2) + 1;
+   sz = ei - si + ((e.tp_row - s.tp_row) * 2);
 
return (sz * sizeof(term_char_t));
 }

Modified: stable/10/sys/dev/vt/vt_consolectl.c

svn commit: r271463 - in head/sys/dev/vt: . hw/ofwfb logo

2014-09-12 Thread Aleksandr Rybalko
Author: ray
Date: Fri Sep 12 14:07:20 2014
New Revision: 271463
URL: http://svnweb.freebsd.org/changeset/base/271463

Log:
  Remove stray whitespaces.

Modified:
  head/sys/dev/vt/hw/ofwfb/ofwfb.c
  head/sys/dev/vt/logo/logo_freebsd.c
  head/sys/dev/vt/vt_consolectl.c

Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c
==
--- head/sys/dev/vt/hw/ofwfb/ofwfb.cFri Sep 12 13:12:06 2014
(r271462)
+++ head/sys/dev/vt/hw/ofwfb/ofwfb.cFri Sep 12 14:07:20 2014
(r271463)
@@ -53,7 +53,7 @@ struct ofwfb_softc {
 
phandle_t   sc_node;
ihandle_t   sc_handle;
-   bus_space_tag_t sc_memt; 
+   bus_space_tag_t sc_memt;
 };
 
 static vd_probe_t  ofwfb_probe;

Modified: head/sys/dev/vt/logo/logo_freebsd.c
==
--- head/sys/dev/vt/logo/logo_freebsd.c Fri Sep 12 13:12:06 2014
(r271462)
+++ head/sys/dev/vt/logo/logo_freebsd.c Fri Sep 12 14:07:20 2014
(r271463)
@@ -637,5 +637,5 @@ unsigned char vt_logo_image[] = {
0x1f, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x0e, 0x00, 0x00,
0x00, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x00,
0x3f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x00, 
+   0x00, 0x00, 0x00,
 };

Modified: head/sys/dev/vt/vt_consolectl.c
==
--- head/sys/dev/vt/vt_consolectl.c Fri Sep 12 13:12:06 2014
(r271462)
+++ head/sys/dev/vt/vt_consolectl.c Fri Sep 12 14:07:20 2014
(r271463)
@@ -51,7 +51,7 @@ consolectl_ioctl(struct cdev *dev, u_lon
 {
 
switch (cmd) {
-   case CONS_GETVERS: 
+   case CONS_GETVERS:
*(int*)data = 0x200;
return 0;
case CONS_MOUSECTL: {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-09-12 Thread Aleksandr Rybalko
Author: ray
Date: Fri Sep 12 14:14:50 2014
New Revision: 271464
URL: http://svnweb.freebsd.org/changeset/base/271464

Log:
  Switch vt(4) to traditional behaviour with copy-paste same as syscons(4) do.
  
  Reviewed by:  dumbbell (as D755)
  MFC after:1 week

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Fri Sep 12 14:07:20 2014(r271463)
+++ head/sys/dev/vt/vt_core.c   Fri Sep 12 14:14:50 2014(r271464)
@@ -162,6 +162,7 @@ static int vt_late_window_switch(struct 
 static int vt_proc_alive(struct vt_window *);
 static void vt_resize(struct vt_device *);
 static void vt_update_static(void *);
+static void vt_mouse_paste();
 
 SET_DECLARE(vt_drv_set, struct vt_driver);
 
@@ -176,10 +177,14 @@ static struct vt_device   vt_consdev = {
.vd_flags = VDF_INVALID,
.vd_windows = { [VT_CONSWINDOW] =  vt_conswindow, },
.vd_curwindow = vt_conswindow,
-   .vd_markedwin = NULL,
.vd_kbstate = 0,
 
 #ifndef SC_NO_CUTPASTE
+   .vd_pastebuf = {
+   .vpb_buf = NULL,
+   .vpb_bufsz = 0,
+   .vpb_len = 0
+   },
.vd_mcursor = vt_default_mouse_pointer,
.vd_mcursor_fg = TC_WHITE,
.vd_mcursor_bg = TC_BLACK,
@@ -508,7 +513,7 @@ vt_machine_kbdevent(int c)
case SPCLKEY | PASTE: /* kbdmap(5) keyword `paste`. */
 #ifndef SC_NO_CUTPASTE
/* Insert text from cut-paste buffer. */
-   /* TODO */
+   vt_mouse_paste();
 #endif
break;
case SPCLKEY | PDWN: /* kbdmap(5) keyword `pdwn`. */
@@ -1576,7 +1581,7 @@ vt_mouse_terminput_button(struct vt_devi
mouseb[4] = '!' + x;
mouseb[5] = '!' + y;
 
-   for (i = 0; i  sizeof(mouseb); i++ )
+   for (i = 0; i  sizeof(mouseb); i++)
terminal_input_char(vw-vw_terminal, mouseb[i]);
 }
 
@@ -1614,6 +1619,23 @@ vt_mouse_terminput(struct vt_device *vd,
}
 }
 
+static void
+vt_mouse_paste()
+{
+   term_char_t *buf;
+   int i, len;
+
+   len = VD_PASTEBUFLEN(main_vd);
+   buf = VD_PASTEBUF(main_vd);
+   len /= sizeof(term_char_t);
+   for (i = 0; i  len; i++) {
+   if (buf[i] == '\0')
+   continue;
+   terminal_input_char(main_vd-vd_curwindow-vw_terminal,
+   buf[i]);
+   }
+}
+
 void
 vt_mouse_event(int type, int x, int y, int event, int cnt, int mlevel)
 {
@@ -1621,8 +1643,7 @@ vt_mouse_event(int type, int x, int y, i
struct vt_window *vw;
struct vt_font *vf;
term_pos_t size;
-   term_char_t *buf;
-   int i, len, mark;
+   int len, mark;
 
vd = main_vd;
vw = vd-vd_curwindow;
@@ -1665,17 +1686,10 @@ vt_mouse_event(int type, int x, int y, i
 
vd-vd_mx = x;
vd-vd_my = y;
-   if ((vd-vd_mstate  MOUSE_BUTTON1DOWN) 
-   (vtbuf_set_mark(vw-vw_buf, VTB_MARK_MOVE,
-   vd-vd_mx / vf-vf_width,
-   vd-vd_my / vf-vf_height) == 1)) {
-
-   /*
-* We have something marked to copy, so update pointer
-* to window with selection.
-*/
-   vd-vd_markedwin = vw;
-   }
+   if (vd-vd_mstate  MOUSE_BUTTON1DOWN)
+   vtbuf_set_mark(vw-vw_buf, VTB_MARK_MOVE,
+   vd-vd_mx / vf-vf_width,
+   vd-vd_my / vf-vf_height);
 
vt_resume_flush_timer(vw-vw_device, 0);
return; /* Done */
@@ -1708,27 +1722,7 @@ vt_mouse_event(int type, int x, int y, i
case 0: /* up */
break;
default:
-   if (vd-vd_markedwin == NULL)
-   return;
-   /* Get current selecton size in bytes. */
-   len = vtbuf_get_marked_len(vd-vd_markedwin-vw_buf);
-   if (len = 0)
-   return;
-
-   buf = malloc(len, M_VT, M_WAITOK | M_ZERO);
-   /* Request copy/paste buffer data, no more than `len' */
-   vtbuf_extract_marked(vd-vd_markedwin-vw_buf, buf,
-   len);
-
-   len /= sizeof(term_char_t);
-   for (i = 0; i  len; i++ ) {
-   if (buf[i] == '\0')
-   continue;
-   terminal_input_char(vw-vw_terminal, buf[i]);
-   }
-
-   /* Done, so cleanup. */
-   free(buf, M_VT);
+   vt_mouse_paste();
break;
}
return; /* 

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

2014-09-12 Thread Aleksandr Rybalko
Author: ray
Date: Fri Sep 12 14:16:10 2014
New Revision: 271465
URL: http://svnweb.freebsd.org/changeset/base/271465

Log:
  Switch vt(4) to traditional behaviour with copy-paste same as syscons(4) do.
  (forgetted in last commit)
  
  Reviewed by:  dumbbell (as D755)
  MFC after:1 week

Modified:
  head/sys/dev/vt/vt.h

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hFri Sep 12 14:14:50 2014(r271464)
+++ head/sys/dev/vt/vt.hFri Sep 12 14:16:10 2014(r271465)
@@ -113,11 +113,17 @@ typedef unsigned int  vt_axis_t;
 struct vt_mouse_cursor;
 #endif
 
+struct vt_pastebuf {
+   term_char_t *vpb_buf;   /* Copy-paste buffer. */
+   unsigned int vpb_bufsz; /* Buffer size. */
+   unsigned int vpb_len;   /* Length of a last selection. 
*/
+};
+
 struct vt_device {
struct vt_window*vd_windows[VT_MAXWINDOWS]; /* (c) Windows. */
struct vt_window*vd_curwindow;  /* (d) Current window. */
struct vt_window*vd_savedwindow;/* (?) Saved for suspend. */
-   struct vt_window*vd_markedwin;  /* (?) Copy/paste buf owner. */
+   struct vt_pastebuf   vd_pastebuf;   /* (?) Copy/paste buf. */
const struct vt_driver  *vd_driver; /* (c) Graphics driver. */
void*vd_softc;  /* (u) Driver data. */
 #ifndef SC_NO_CUTPASTE
@@ -151,6 +157,10 @@ struct vt_device {
unsigned int vd_unit;   /* (c) Device unit. */
 };
 
+#defineVD_PASTEBUF(vd) ((vd)-vd_pastebuf.vpb_buf)
+#defineVD_PASTEBUFSZ(vd)   ((vd)-vd_pastebuf.vpb_bufsz)
+#defineVD_PASTEBUFLEN(vd)  ((vd)-vd_pastebuf.vpb_len)
+
 /*
  * Per-window terminal screen buffer.
  *
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-09-12 Thread Aleksandr Rybalko
Author: ray
Date: Fri Sep 12 14:17:09 2014
New Revision: 271466
URL: http://svnweb.freebsd.org/changeset/base/271466

Log:
  Fix stray char on paste.
  
  Tested by:dumbbell and me
  MFC after:1 week

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

Modified: head/sys/dev/vt/vt_buf.c
==
--- head/sys/dev/vt/vt_buf.cFri Sep 12 14:16:10 2014(r271465)
+++ head/sys/dev/vt/vt_buf.cFri Sep 12 14:17:09 2014(r271466)
@@ -603,7 +603,7 @@ vtbuf_get_marked_len(struct vt_buf *vb)
ei = e.tp_row * vb-vb_scr_size.tp_col + e.tp_col;
 
/* Number symbols and number of rows to inject \n */
-   sz = ei - si + ((e.tp_row - s.tp_row) * 2) + 1;
+   sz = ei - si + ((e.tp_row - s.tp_row) * 2);
 
return (sz * sizeof(term_char_t));
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-09-12 Thread Aleksandr Rybalko
Author: ray
Date: Fri Sep 12 20:55:17 2014
New Revision: 271485
URL: http://svnweb.freebsd.org/changeset/base/271485

Log:
  Fix 'function declaration isn't a prototype' warning.
  
  Pointed by:   ian
  MFC after:1 week

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Fri Sep 12 20:34:19 2014(r271484)
+++ head/sys/dev/vt/vt_core.c   Fri Sep 12 20:55:17 2014(r271485)
@@ -162,7 +162,7 @@ static int vt_late_window_switch(struct 
 static int vt_proc_alive(struct vt_window *);
 static void vt_resize(struct vt_device *);
 static void vt_update_static(void *);
-static void vt_mouse_paste();
+static void vt_mouse_paste(void);
 
 SET_DECLARE(vt_drv_set, struct vt_driver);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-09-10 Thread Aleksandr Rybalko
Author: ray
Date: Wed Sep 10 11:13:13 2014
New Revision: 271381
URL: http://svnweb.freebsd.org/changeset/base/271381

Log:
  o Add sysctls to enable/disable potentially dengerous key combinations, like
  reboot/halt/debug.
  o Add support for most key combinations supported by syscons(4).
  
  Reviewed by:  dumbbell, emaste (prev revision of D747)
  MFC after:5 days
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Wed Sep 10 11:06:02 2014(r271380)
+++ head/sys/dev/vt/vt_core.c   Wed Sep 10 11:13:13 2014(r271381)
@@ -45,6 +45,7 @@ __FBSDID($FreeBSD$);
 #include sys/lock.h
 #include sys/malloc.h
 #include sys/mutex.h
+#include sys/power.h
 #include sys/priv.h
 #include sys/proc.h
 #include sys/reboot.h
@@ -123,6 +124,18 @@ VT_SYSCTL_INT(debug, 0, vt(9) debug lev
 VT_SYSCTL_INT(deadtimer, 15, Time to wait busy process in VT_PROCESS mode);
 VT_SYSCTL_INT(suspendswitch, 1, Switch to VT0 before suspend);
 
+/* Allow to disable some keyboard combinations. */
+VT_SYSCTL_INT(kbd_halt, 1, Enable halt keyboard combination.  
+See kbdmap(5) to configure.);
+VT_SYSCTL_INT(kbd_poweroff, 1, Enable Power Off keyboard combination.  
+See kbdmap(5) to configure.);
+VT_SYSCTL_INT(kbd_reboot, 1, Enable reboot keyboard combination.  
+See kbdmap(5) to configure (typically Ctrl-Alt-Delete).);
+VT_SYSCTL_INT(kbd_debug, 1, Enable key combination to enter debugger.  
+See kbdmap(5) to configure (typically Ctrl-Alt-Esc).);
+VT_SYSCTL_INT(kbd_panic, 0, Enable request to panic.  
+See kbdmap(5) to configure.);
+
 static struct vt_devicevt_consdev;
 static unsigned int vt_unit = 0;
 static MALLOC_DEFINE(M_VT, vt, vt device);
@@ -484,18 +497,47 @@ vt_machine_kbdevent(int c)
 {
 
switch (c) {
-   case SPCLKEY | DBG:
-   kdb_enter(KDB_WHY_BREAK, manual escape to debugger);
+   case SPCLKEY | DBG: /* kbdmap(5) keyword `debug`. */
+   if (vt_kbd_debug)
+   kdb_enter(KDB_WHY_BREAK, manual escape to debugger);
+   return (1);
+   case SPCLKEY | HALT: /* kbdmap(5) keyword `halt`. */
+   if (vt_kbd_halt)
+   shutdown_nice(RB_HALT);
+   return (1);
+   case SPCLKEY | PASTE: /* kbdmap(5) keyword `paste`. */
+#ifndef SC_NO_CUTPASTE
+   /* Insert text from cut-paste buffer. */
+   /* TODO */
+#endif
+   break;
+   case SPCLKEY | PDWN: /* kbdmap(5) keyword `pdwn`. */
+   if (vt_kbd_poweroff)
+   shutdown_nice(RB_HALT|RB_POWEROFF);
+   return (1);
+   case SPCLKEY | PNC: /* kbdmap(5) keyword `panic`. */
+   /*
+* Request to immediate panic if sysctl
+* kern.vt.enable_panic_key allow it.
+*/
+   if (vt_kbd_panic)
+   panic(Forced by the panic key);
+   return (1);
+   case SPCLKEY | RBT: /* kbdmap(5) keyword `boot`. */
+   if (vt_kbd_reboot)
+   shutdown_nice(RB_AUTOBOOT);
return (1);
-   case SPCLKEY | RBT:
-   /* XXX: Make this configurable! */
-   shutdown_nice(0);
+   case SPCLKEY | SPSC: /* kbdmap(5) keyword `spsc`. */
+   /* Force activatation/deactivation of the screen saver. */
+   /* TODO */
return (1);
-   case SPCLKEY | HALT:
-   shutdown_nice(RB_HALT);
+   case SPCLKEY | STBY: /* XXX Not present in kbdcontrol parser. */
+   /* Put machine into Stend-By mode. */
+   power_pm_suspend(POWER_SLEEP_STATE_STANDBY);
return (1);
-   case SPCLKEY | PDWN:
-   shutdown_nice(RB_HALT|RB_POWEROFF);
+   case SPCLKEY | SUSP: /* kbdmap(5) keyword `susp`. */
+   /* Suspend machine. */
+   power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
return (1);
};
 
@@ -611,6 +653,20 @@ vt_processkey(keyboard_t *kbd, struct vt
}
 
switch (c) {
+   case NEXT:
+   /* Switch to next VT. */
+   c = (vw-vw_number + 1) % VT_MAXWINDOWS;
+   vw = vd-vd_windows[c];
+   if (vw != NULL)
+   vt_proc_window_switch(vw);
+   return (0);
+   case PREV:
+   /* Switch to previous VT. */
+   c = (vw-vw_number - 1) % VT_MAXWINDOWS;
+   vw = vd-vd_windows[c];
+   if (vw != NULL)
+   vt_proc_window_switch(vw);
+   return (0);
case SLK: {
 
kbdd_ioctl(kbd, 

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

2014-09-10 Thread Aleksandr Rybalko
Author: ray
Date: Wed Sep 10 11:27:33 2014
New Revision: 271382
URL: http://svnweb.freebsd.org/changeset/base/271382

Log:
  spelling fixes
  
  Submitted by: Sam Fourman Jr. sfour...@gmail.com
  MFC after:1 week

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

Modified: head/sys/dev/vt/vt_buf.c
==
--- head/sys/dev/vt/vt_buf.cWed Sep 10 11:13:13 2014(r271381)
+++ head/sys/dev/vt/vt_buf.cWed Sep 10 11:27:33 2014(r271382)
@@ -321,7 +321,7 @@ vtbuf_copy(struct vt_buf *vb, const term
if (r-tr_begin.tp_row  p2-tp_row  r-tr_begin.tp_col == 0 
r-tr_end.tp_col == vb-vb_scr_size.tp_col  /* Full row. */
(rows + rdiff) == vb-vb_scr_size.tp_row  /* Whole screen. */
-   rdiff  0) { /* Only forward dirrection. Do not eat history. */
+   rdiff  0) { /* Only forward direction. Do not eat history. */
vthistory_addlines(vb, rdiff);
} else if (p2-tp_row  p1-tp_row) {
/* Handle overlapping copies of line segments. */

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Wed Sep 10 11:13:13 2014(r271381)
+++ head/sys/dev/vt/vt_core.c   Wed Sep 10 11:27:33 2014(r271382)
@@ -347,7 +347,7 @@ vt_proc_window_switch(struct vt_window *
if (curvw-vw_flags  VWF_VTYLOCK)
return (EBUSY);
 
-   /* Ask current process permitions to switch away. */
+   /* Ask current process permission to switch away. */
if (curvw-vw_smode.mode == VT_PROCESS) {
DPRINTF(30, %s: VT_PROCESS , __func__);
if (vt_proc_alive(curvw) == FALSE) {
@@ -1716,7 +1716,7 @@ vt_mouse_event(int type, int x, int y, i
return;
 
buf = malloc(len, M_VT, M_WAITOK | M_ZERO);
-   /* Request cupy/paste buffer data, no more than `len' */
+   /* Request copy/paste buffer data, no more than `len' */
vtbuf_extract_marked(vd-vd_markedwin-vw_buf, buf,
len);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-09-10 Thread Aleksandr Rybalko
Author: ray
Date: Wed Sep 10 11:48:13 2014
New Revision: 271385
URL: http://svnweb.freebsd.org/changeset/base/271385

Log:
  Fix one more spelling mistake.
  
  Pointed by:   danfe

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Wed Sep 10 11:33:42 2014(r271384)
+++ head/sys/dev/vt/vt_core.c   Wed Sep 10 11:48:13 2014(r271385)
@@ -532,7 +532,7 @@ vt_machine_kbdevent(int c)
/* TODO */
return (1);
case SPCLKEY | STBY: /* XXX Not present in kbdcontrol parser. */
-   /* Put machine into Stend-By mode. */
+   /* Put machine into Stand-By mode. */
power_pm_suspend(POWER_SLEEP_STATE_STANDBY);
return (1);
case SPCLKEY | SUSP: /* kbdmap(5) keyword `susp`. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-09-09 Thread Aleksandr Rybalko
Author: ray
Date: Tue Sep  9 14:18:56 2014
New Revision: 271312
URL: http://svnweb.freebsd.org/changeset/base/271312

Log:
  Revert r269474. Special keyboard combinations should be handled by separate
  sysctls.

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

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hTue Sep  9 14:09:51 2014(r271311)
+++ head/sys/dev/vt/vt.hTue Sep  9 14:18:56 2014(r271312)
@@ -87,12 +87,6 @@ static int vt_##_name = _default;
\
 SYSCTL_INT(_kern_vt, OID_AUTO, _name, CTLFLAG_RWTUN, vt_##_name, _default,\
_descr);
 
-/* Allow to disable some special keys by users. */
-#defineVT_DEBUG_KEY_ENABLED(1  0)
-#defineVT_REBOOT_KEY_ENABLED   (1  1)
-#defineVT_HALT_KEY_ENABLED (1  2)
-#defineVT_POWEROFF_KEY_ENABLED (1  3)
-
 struct vt_driver;
 
 void vt_allocate(struct vt_driver *, void *);

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Tue Sep  9 14:09:51 2014(r271311)
+++ head/sys/dev/vt/vt_core.c   Tue Sep  9 14:18:56 2014(r271312)
@@ -122,9 +122,6 @@ VT_SYSCTL_INT(enable_altgr, 1, Enable A
 VT_SYSCTL_INT(debug, 0, vt(9) debug level);
 VT_SYSCTL_INT(deadtimer, 15, Time to wait busy process in VT_PROCESS mode);
 VT_SYSCTL_INT(suspendswitch, 1, Switch to VT0 before suspend);
-VT_SYSCTL_INT(spclkeys, (VT_DEBUG_KEY_ENABLED|VT_REBOOT_KEY_ENABLED|
-VT_HALT_KEY_ENABLED|VT_POWEROFF_KEY_ENABLED), Enabled special keys 
-handled by vt(4));
 
 static struct vt_devicevt_consdev;
 static unsigned int vt_unit = 0;
@@ -488,21 +485,17 @@ vt_machine_kbdevent(int c)
 
switch (c) {
case SPCLKEY | DBG:
-   if (vt_spclkeys  VT_DEBUG_KEY_ENABLED)
-   kdb_enter(KDB_WHY_BREAK, manual escape to debugger);
+   kdb_enter(KDB_WHY_BREAK, manual escape to debugger);
return (1);
case SPCLKEY | RBT:
-   if (vt_spclkeys  VT_REBOOT_KEY_ENABLED)
-   /* XXX: Make this configurable! */
-   shutdown_nice(0);
+   /* XXX: Make this configurable! */
+   shutdown_nice(0);
return (1);
case SPCLKEY | HALT:
-   if (vt_spclkeys  VT_HALT_KEY_ENABLED)
-   shutdown_nice(RB_HALT);
+   shutdown_nice(RB_HALT);
return (1);
case SPCLKEY | PDWN:
-   if (vt_spclkeys  VT_POWEROFF_KEY_ENABLED)
-   shutdown_nice(RB_HALT|RB_POWEROFF);
+   shutdown_nice(RB_HALT|RB_POWEROFF);
return (1);
};
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r269474 - in head: share/man/man4 sys/dev/vt

2014-09-09 Thread Aleksandr Rybalko
On Tue, 12 Aug 2014 13:17:55 +1000 (EST)
Bruce Evans b...@optusnet.com.au wrote:

 On Mon, 11 Aug 2014, John Baldwin wrote:
 
  On Monday, August 04, 2014 8:03:58 pm Bruce Evans wrote:
  On Mon, 4 Aug 2014, John Baldwin wrote:
  I realize the API uses 'SPCL' as an abbreviation, but for user-facing 
  things like a sysctl and tunable, I think it might be better to spell it 
  out as
  specialkeys instead?
 
  It is a bad name, and also gratuitously different from syscons where the
  names are:
 
   hw.syscons.kbd_reboot
   hw.syscons.kbd_debug
   hw.syscons.sc_no_suspend_vtswitch
 
  I would prefer individual nodes for vt along these lines as I think it is
  clearer to the user (what exactly constitutes a special key?)
 
 But rename them a bit so it is clearer that they give limited access
 control.  The sysctl -d descriptions are no better about this:
 
 % hw.syscons.kbd_reboot: enable keyboard reboot
 % hw.syscons.kbd_debug: enable keyboard debug
 % hw.syscons.sc_no_suspend_vtswitch: Disable VT switch before suspend.
 
 These also have some style bugs (enable is not capitalized; the last
 description is terminated).
 
 The option name SC_DISABLE_KDBKEY is better.  It more clearly controls
 a key, not debugging.  The option name SC_DISABLE_REBOOT is no better.
 
 Bruce

Hello John, Bruce and other hackers!

I did revert r269474, but not commit yet new version.
Instead, I've put new version into phabricator.
Please look it here https://reviews.freebsd.org/D747.

Thanks a lot for your hints/comments.
And sorry for long delay.

WBW
-- 
Aleksandr Rybalko r...@ddteam.net
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r271023 - stable/10/sys/dev/vt

2014-09-05 Thread Aleksandr Rybalko
Hi Alexey!

On Fri, 5 Sep 2014 16:34:34 +
Alexey Dokuchaev da...@freebsd.org wrote:

 On Thu, Sep 04, 2014 at 11:05:27AM +0200, Jean-SИbastien PИdron wrote:
  One bug in vt(4) was that the mouse cursor position, even if it was
  invisible before moused(8) starts, was always considered dirty and
  required a redraw. The default position being [0;0], each new character
  written would trigger a full refresh of the screen from [0;0] to the
  position of this character.
 
 For quite a while (since I started using vt(4)) I'm observing a rather
 annoying thing: sometimes small area of screen would get selected like if
 pressed mouse button or something.  If I do a long build on the console,
 periodically, white rectangle (selected area) will suddenly pop up and
 scroll away.  Is this a known thing?  It can be very annoyting for text
 editing on the console, as these sporadic selects are overwriting my
 selection buffer contents with whatever was on the screen at that time
 when they suddenly appear.  (Rat itself it motionless while it happens.)

Yeah, it is known. It is due different logic than in syscons(4). vt(4) save
not skected text, but position inside history buffer.
Return to old (well known syscons(4)) behaviour is in TODO.

 
  Those two problems combined explain the slownness of vt(4), especially
  with discrete GPU and virtual machines; i915 users were mostly spared.
  
  Regarding the incorrect refresh when vt-switching, it was caused by a
  race between the redraw thread and the switch. The redraw thread was not
  stopped during a switch. Therefore, if the thread ran while the switch
  was in progress, it could mark the screen as up-to-date even though it
  displayed the wrong data.
  
  One change did reduce the vt-switch time specifically: in vt_vga, a
  switch triggers a clear of the video memory. The loop did read from the
  video memory, then wrote 8 black pixels. The useless read was removed.
 
 I must say that after I rebuilt my -CURRENT kernel today, vt(4) behaves
 much nicer than few weeks ago: switching is fast, no damaged screen any-
 more (both before and after I do kldload i915kms).  Good work guys, and
 thanks for explanations!
 
 ./danfe
 


-- 
Aleksandr Rybalko r...@ddteam.net
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org

Re: svn commit: r270114 - head/share/vt/keymaps

2014-08-17 Thread Aleksandr Rybalko
On Sun, 17 Aug 2014 19:54:21 + (UTC)
Stefan Esser s...@freebsd.org wrote:

 Author: se
 Date: Sun Aug 17 19:54:21 2014
 New Revision: 270114
 URL: http://svnweb.freebsd.org/changeset/base/270114
 
 Log:
   Attempt at converting the SYSCONS keymaps to Unicode for use with NEWCONS.
   I have spent many hours comparing source and destination formats, and hope
   to have caught the most severe conversion errors.
   
   Files were converted with a Perl script which I'll shortly commit to the
   tools directory. This script is a much enhanced version of the one
   provided by ray@ and is expected to support the full kbdmap(5) syntax.
   
   The naming convention used is:
   
2-letter country code.variant.kbd
   
   Only if there are multiple layouts for different languages:
   
2-letter country code-2-letter language code.variant.kbd
   
   In nearly all cases, the keyboards are country specific, only. Currently
   there is only one case where the language was added (ch-fr.kbd for
   the Swiss-French keyboard layout).
   
   I choose to write Unicode character codes as hex numbers. While this
   increases the diff to the SYSCONS keymap files for the trivial cases
   (conversion from ISO8859-1), it really helps to verify the more complex
   cases against a Unicode table (which is indexed by hex numbers).
   
   This commit does not cover all files that have been converted, since I
   need to sort out which ones to use, if there were several with different
   source encodings to choose from.
   
   Review and test of the keymap files is highly desirable before 10.1 is
   released. I'd also appreciate educated opinions regarding the optimum
   variant (to be made available as the default for each language).
   
   Since there are no NEWCONS keymaps in 10-STABLE, I plan to MFC after
   the minimum allowed delay of 3 days, to allow at least a few weeks to
   test and improve what will be in the next release.
   
   MFC after:  3 days
 

Thank you very much Stefan for such great help!!!

WBW
-- 
Aleksandr Rybalko r...@ddteam.net
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269471 - head/sys/dev/vt/hw/vga

2014-08-03 Thread Aleksandr Rybalko
Author: ray
Date: Sun Aug  3 11:01:35 2014
New Revision: 269471
URL: http://svnweb.freebsd.org/changeset/base/269471

Log:
  Fix vt_vga driver to draw not-8-bit-aligned fonts correctly.
  Still one bug here: mouse left some gaps on track when moving left.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/hw/vga/vt_vga.c

Modified: head/sys/dev/vt/hw/vga/vt_vga.c
==
--- head/sys/dev/vt/hw/vga/vt_vga.c Sun Aug  3 10:47:45 2014
(r269470)
+++ head/sys/dev/vt/hw/vga/vt_vga.c Sun Aug  3 11:01:35 2014
(r269471)
@@ -87,7 +87,7 @@ static const struct vt_driver vt_vga_dri
.vd_init= vga_init,
.vd_blank   = vga_blank,
.vd_bitbltchr   = vga_bitbltchr,
-   .vd_maskbitbltchr = vga_maskbitbltchr,
+   .vd_maskbitbltchr = vga_bitbltchr,
.vd_drawrect= vga_drawrect,
.vd_setpixel= vga_setpixel,
.vd_putchar = vga_putchar,
@@ -172,88 +172,83 @@ vga_drawrect(struct vt_device *vd, int x
}
 }
 
-static inline void
-vga_bitblt_draw(struct vt_device *vd, const uint8_t *src,
-u_long ldst, uint8_t shift, unsigned int width, unsigned int height,
-term_color_t color, int negate)
-{
-   u_long dst;
-   int w;
-   uint8_t b, r, out;
-
-   for (; height  0; height--) {
-   dst = ldst;
-   ldst += VT_VGA_WIDTH / 8;
-   r = 0;
-   for (w = width; w  0; w -= 8) {
-   b = *src++;
-   if (negate) {
-   b = ~b;
-   /* Don't go too far. */
-   if (w  8)
-   b = 0xff  (8 - w);
-   }
-   /* Reintroduce bits from previous column. */
-   out = (b  shift) | r;
-   r = b  (8 - shift);
-   vga_bitblt_put(vd, dst++, color, out);
-   }
-   /* Print the remainder. */
-   vga_bitblt_put(vd, dst, color, r);
+/*
+ * Shift bitmap of one row of the glyph.
+ * a - array of bytes with src bitmap and result storage.
+ * m - resulting background color bitmask.
+ * size - number of bytes per glyph row (+ one byte to store shift overflow).
+ * shift - offset for target bitmap.
+ */
+
+static void
+vga_shift_u8array(uint8_t *a, uint8_t *m, int size, int shift)
+{
+   int i;
+
+   for (i = (size - 1); i  0; i--) {
+   a[i] = (a[i]  shift) | (a[i-1]  (7 - shift));
+   m[i] = ~a[i];
}
+   a[0] = (a[0]  shift);
+   m[0] = ~a[0]  (0xff  shift);
+   m[size - 1] = ~a[size - 1]  (0xff  (7 - shift));
 }
 
+/* XXX: fix gaps on mouse track when character size is not rounded to 8. */
 static void
 vga_bitbltchr(struct vt_device *vd, const uint8_t *src, const uint8_t *mask,
 int bpl, vt_axis_t top, vt_axis_t left, unsigned int width,
 unsigned int height, term_color_t fg, term_color_t bg)
 {
-   u_long dst, ldst;
-   int w;
+   uint8_t aa[64], ma[64], *r;
+   int dst, shift, sz, x, y;
+   struct vga_softc *sc;
 
-   /* Don't try to put off screen pixels */
-   if (((left + width)  VT_VGA_WIDTH) || ((top + height) 
-   VT_VGA_HEIGHT))
+   if ((left + width)  VT_VGA_WIDTH)
+   return;
+   if ((top + height)  VT_VGA_HEIGHT)
return;
 
-   dst = (VT_VGA_WIDTH * top + left) / 8;
-
-   for (; height  0; height--) {
-   ldst = dst;
-   for (w = width; w  0; w -= 8) {
-   vga_bitblt_put(vd, ldst, fg, *src);
-   vga_bitblt_put(vd, ldst, bg, ~*src);
-   ldst++;
-   src++;
-   }
-   dst += VT_VGA_WIDTH / 8;
-   }
-}
+   sc = vd-vd_softc;
 
-/* Bitblt with mask support. Slow. */
-static void
-vga_maskbitbltchr(struct vt_device *vd, const uint8_t *src, const uint8_t 
*mask,
-int bpl, vt_axis_t top, vt_axis_t left, unsigned int width,
-unsigned int height, term_color_t fg, term_color_t bg)
-{
-   struct vga_softc *sc = vd-vd_softc;
-   u_long dst;
-   uint8_t shift;
+   sz = (width + 7) / 8;
+   shift = left % 8;
 
dst = (VT_VGA_WIDTH * top + left) / 8;
-   shift = left % 8;
 
-   /* Don't try to put off screen pixels */
-   if (((left + width)  VT_VGA_WIDTH) || ((top + height) 
-   VT_VGA_HEIGHT))
-   return;
+   for (y = 0; y  height; y++) {
+   r = (uint8_t *)src + (y * sz);
+   memcpy(aa, r, sz);
+   aa[sz] = 0;
+   vga_shift_u8array(aa, ma, sz + 1, shift);
+
+   vga_setcolor(vd, bg);
+   for (x = 0; x  (sz + 1); x ++) {
+   if (ma[x] == 0)
+   

svn commit: r269474 - in head: share/man/man4 sys/dev/vt

2014-08-03 Thread Aleksandr Rybalko
Author: ray
Date: Sun Aug  3 13:07:25 2014
New Revision: 269474
URL: http://svnweb.freebsd.org/changeset/base/269474

Log:
  Allow to disable some special key combinations handled by vt(4), like debug
  request, reboot request.
  
  Requested by: Claude Buisson
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man4/vt.4
  head/sys/dev/vt/vt.h
  head/sys/dev/vt/vt_core.c

Modified: head/share/man/man4/vt.4
==
--- head/share/man/man4/vt.4Sun Aug  3 12:19:45 2014(r269473)
+++ head/share/man/man4/vt.4Sun Aug  3 13:07:25 2014(r269474)
@@ -45,6 +45,7 @@ In
 .Xr loader.conf 5 :
 .Cd hw.vga.textmode=1
 .Cd kern.vty=vt
+.Cd kern.vt.spclkeys=15
 .Sh DESCRIPTION
 The
 .Nm
@@ -195,6 +196,19 @@ or
 If this value is not set,
 .Xr sc 4
 is used.
+.It Va kern.vt.spclkeys
+bitmap of allowed special keys. 1 is enabled, 0 is disabled. Encoded as:
+.Bl -tag -compact -width 0x00
+.It 0x0001
+Debug request key combination. (Ctrl+Alt+Esc)
+.It 0x0002
+Reboot. (Ctrl+Alt+Del)
+.It 0x0004
+Halt.
+.It 0x0008
+Power down.
+.El
+Default is 15, all enabled.
 .El
 .Sh FILES
 .Bl -tag -width /usr/share/syscons/keymaps/* -compact

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hSun Aug  3 12:19:45 2014(r269473)
+++ head/sys/dev/vt/vt.hSun Aug  3 13:07:25 2014(r269474)
@@ -87,6 +87,12 @@ static int vt_##_name = _default;
\
 SYSCTL_INT(_kern_vt, OID_AUTO, _name, CTLFLAG_RWTUN, vt_##_name, _default,\
_descr);
 
+/* Allow to disable some special keys by users. */
+#defineVT_DEBUG_KEY_ENABLED(1  0)
+#defineVT_REBOOT_KEY_ENABLED   (1  1)
+#defineVT_HALT_KEY_ENABLED (1  2)
+#defineVT_POWEROFF_KEY_ENABLED (1  3)
+
 struct vt_driver;
 
 void vt_allocate(struct vt_driver *, void *);

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Sun Aug  3 12:19:45 2014(r269473)
+++ head/sys/dev/vt/vt_core.c   Sun Aug  3 13:07:25 2014(r269474)
@@ -116,6 +116,9 @@ VT_SYSCTL_INT(enable_altgr, 1, Enable A
 VT_SYSCTL_INT(debug, 0, vt(9) debug level);
 VT_SYSCTL_INT(deadtimer, 15, Time to wait busy process in VT_PROCESS mode);
 VT_SYSCTL_INT(suspendswitch, 1, Switch to VT0 before suspend);
+VT_SYSCTL_INT(spclkeys, (VT_DEBUG_KEY_ENABLED|VT_REBOOT_KEY_ENABLED|
+VT_HALT_KEY_ENABLED|VT_POWEROFF_KEY_ENABLED), Enabled special keys 
+handled by vt(4));
 
 static struct vt_devicevt_consdev;
 static unsigned int vt_unit = 0;
@@ -402,17 +405,21 @@ vt_machine_kbdevent(int c)
 
switch (c) {
case SPCLKEY | DBG:
-   kdb_enter(KDB_WHY_BREAK, manual escape to debugger);
+   if (vt_spclkeys  VT_DEBUG_KEY_ENABLED)
+   kdb_enter(KDB_WHY_BREAK, manual escape to debugger);
return (1);
case SPCLKEY | RBT:
-   /* XXX: Make this configurable! */
-   shutdown_nice(0);
+   if (vt_spclkeys  VT_REBOOT_KEY_ENABLED)
+   /* XXX: Make this configurable! */
+   shutdown_nice(0);
return (1);
case SPCLKEY | HALT:
-   shutdown_nice(RB_HALT);
+   if (vt_spclkeys  VT_HALT_KEY_ENABLED)
+   shutdown_nice(RB_HALT);
return (1);
case SPCLKEY | PDWN:
-   shutdown_nice(RB_HALT|RB_POWEROFF);
+   if (vt_spclkeys  VT_POWEROFF_KEY_ENABLED)
+   shutdown_nice(RB_HALT|RB_POWEROFF);
return (1);
};
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269233 - head/sys/arm/conf

2014-07-29 Thread Aleksandr Rybalko
Author: ray
Date: Tue Jul 29 12:04:11 2014
New Revision: 269233
URL: http://svnweb.freebsd.org/changeset/base/269233

Log:
  Remove SC_DFLT_FONT option. vt(4) don't use it.
  
  Suggested by: emaste
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm/conf/RPI-B

Modified: head/sys/arm/conf/RPI-B
==
--- head/sys/arm/conf/RPI-B Tue Jul 29 11:43:45 2014(r269232)
+++ head/sys/arm/conf/RPI-B Tue Jul 29 12:04:11 2014(r269233)
@@ -72,8 +72,6 @@ devicepty
 # Comment following lines for boot console on serial port
 device vt
 device kbdmux
-options SC_DFLT_FONT   # compile font in
-makeoptions SC_DFLT_FONT=cp437
 device ukbd
 
 device sdhci
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-07-29 Thread Aleksandr Rybalko
On Mon, 28 Jul 2014 16:37:23 +0200
Stefan Farfeleder stef...@freebsd.org wrote:

 On Mon, Jul 28, 2014 at 02:22:34PM +, Aleksandr Rybalko wrote:
  Author: ray
  Date: Mon Jul 28 14:22:34 2014
  New Revision: 269188
  URL: http://svnweb.freebsd.org/changeset/base/269188
  
  Log:
Avoid embedding buffers into static virtual terminal window.

MFC after:1 week
Sponsored by: The FreeBSD Foundation
  
  Modified:
head/sys/dev/vt/vt_core.c
  
  Modified: head/sys/dev/vt/vt_core.c
  ==
  --- head/sys/dev/vt/vt_core.c   Mon Jul 28 14:20:31 2014
  (r269187)
  +++ head/sys/dev/vt/vt_core.c   Mon Jul 28 14:22:34 2014
  (r269188)
  @@ -166,8 +166,8 @@ static struct vt_window vt_conswindow = 
  .vw_number = VT_CONSWINDOW,
  .vw_flags = VWF_CONSOLE,
  .vw_buf = {
  -   .vb_buffer = vt_constextbuf,
  -   .vb_rows = vt_constextbufrows,
  +   .vb_buffer = vt_constextbuf[0],
  +   .vb_rows = vt_constextbufrows[0],
  .vb_history_size = VBF_DEFAULT_HISTORY_SIZE,
  .vb_curroffset = 0,
  .vb_roffset = 0,
  
 
 Hi Aleksandr,
 
 What's that supposed to change exactly? I'd be very surprised if it
 didn't produce the same binary code.
 
 BR,
 Stefan

Hi Stefan!

yeah, you a right, it's change nothing. I did wrong assumption, confuse with 
other things.
But will left it. It looks better for me :) 

Thanks for review!

WBW
-- 
Aleksandr Rybalko r...@ddteam.net
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-07-28 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jul 28 14:14:33 2014
New Revision: 269185
URL: http://svnweb.freebsd.org/changeset/base/269185

Log:
  Remove unused macro VT_CONSDEV_DECLARE. Join console device now declared in 
one
  place.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt.h

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hMon Jul 28 13:47:02 2014(r269184)
+++ head/sys/dev/vt/vt.hMon Jul 28 14:14:33 2014(r269185)
@@ -347,54 +347,6 @@ void vt_upgrade(struct vt_device *vd);
 #defineVT_FB_DEFAULT_HEIGHT1200
 #endif
 
-#defineVT_CONSDEV_DECLARE(driver, width, height, softc)
\
-static struct terminal driver ## _consterm;\
-static struct vt_windowdriver ## _conswindow;  
\
-static struct vt_devicedriver ## _consdev = {  
\
-   .vd_driver = driver,   \
-   .vd_softc = (softc),\
-   .vd_flags = VDF_INVALID,\
-   .vd_windows = { [VT_CONSWINDOW] =  driver ## _conswindow, },   \
-   .vd_curwindow = driver ## _conswindow, \
-   .vd_markedwin = NULL,   \
-   .vd_kbstate = 0,\
-}; \
-static term_char_t driver ## _constextbuf[(width) *\
-   (VBF_DEFAULT_HISTORY_SIZE)];\
-static term_char_t *driver ## _constextbufrows[\
-   VBF_DEFAULT_HISTORY_SIZE];  \
-static struct vt_windowdriver ## _conswindow = {   
\
-   .vw_number = VT_CONSWINDOW, \
-   .vw_flags = VWF_CONSOLE,\
-   .vw_buf = { \
-   .vb_buffer = driver ## _constextbuf,\
-   .vb_rows = driver ## _constextbufrows,  \
-   .vb_history_size = VBF_DEFAULT_HISTORY_SIZE,\
-   .vb_curroffset = 0, \
-   .vb_roffset = 0,\
-   .vb_flags = VBF_STATIC, \
-   .vb_mark_start = {  \
-   .tp_row = 0,\
-   .tp_col = 0,\
-   },  \
-   .vb_mark_end = {\
-   .tp_row = 0,\
-   .tp_col = 0,\
-   },  \
-   .vb_scr_size = {\
-   .tp_row = height,   \
-   .tp_col = width,\
-   },  \
-   },  \
-   .vw_device = driver ## _consdev,   \
-   .vw_terminal = driver ## _consterm,\
-   .vw_kbdmode = K_XLATE,  \
-}; \
-TERMINAL_DECLARE_EARLY(driver ## _consterm, vt_termclass,  \
-driver ## _conswindow);   \
-SYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY,  \
-vt_upgrade, driver ## _consdev)
-
 /* name argument is not used yet. */
 #define VT_DRIVER_DECLARE(name, drv) DATA_SET(vt_drv_set, drv)
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-07-28 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jul 28 14:15:41 2014
New Revision: 269186
URL: http://svnweb.freebsd.org/changeset/base/269186

Log:
  o Remove useless debug string.
  o Fix indent.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Mon Jul 28 14:14:33 2014(r269185)
+++ head/sys/dev/vt/vt_core.c   Mon Jul 28 14:15:41 2014(r269186)
@@ -2025,9 +2025,8 @@ vt_upgrade(struct vt_device *vd)
vd-vd_curwindow = vd-vd_windows[VT_CONSWINDOW];
 
if (!(vd-vd_flags  VDF_ASYNC)) {
-   /* Attach keyboard. */
-   vt_allocate_keyboard(vd);
-   DPRINTF(20, %s: vd_keyboard = %d\n, __func__, vd-vd_keyboard);
+   /* Attach keyboard. */
+   vt_allocate_keyboard(vd);
 
/* Init 25 Hz timer. */
callout_init_mtx(vd-vd_timer, vd-vd_lock, 0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-07-28 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jul 28 14:22:34 2014
New Revision: 269188
URL: http://svnweb.freebsd.org/changeset/base/269188

Log:
  Avoid embedding buffers into static virtual terminal window.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Mon Jul 28 14:20:31 2014(r269187)
+++ head/sys/dev/vt/vt_core.c   Mon Jul 28 14:22:34 2014(r269188)
@@ -166,8 +166,8 @@ static struct vt_window vt_conswindow = 
.vw_number = VT_CONSWINDOW,
.vw_flags = VWF_CONSOLE,
.vw_buf = {
-   .vb_buffer = vt_constextbuf,
-   .vb_rows = vt_constextbufrows,
+   .vb_buffer = vt_constextbuf[0],
+   .vb_rows = vt_constextbufrows[0],
.vb_history_size = VBF_DEFAULT_HISTORY_SIZE,
.vb_curroffset = 0,
.vb_roffset = 0,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-07-28 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jul 28 14:35:21 2014
New Revision: 269192
URL: http://svnweb.freebsd.org/changeset/base/269192

Log:
  Remove special handling of console window size. It's done in vt_upgrade() for
  all windows.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Mon Jul 28 14:32:20 2014(r269191)
+++ head/sys/dev/vt/vt_core.c   Mon Jul 28 14:35:21 2014(r269192)
@@ -2064,7 +2064,6 @@ void
 vt_allocate(struct vt_driver *drv, void *softc)
 {
struct vt_device *vd;
-   struct winsize wsz;
 
if (!vty_enabled(VTY_VT))
return;
@@ -2125,11 +2124,6 @@ vt_allocate(struct vt_driver *drv, void 
}
 
termcn_cnregister(vd-vd_windows[VT_CONSWINDOW]-vw_terminal);
-
-   /* Update console window sizes to actual. */
-   vt_winsize(vd, vd-vd_windows[VT_CONSWINDOW]-vw_font, wsz);
-   terminal_set_winsize_blank(vd-vd_windows[VT_CONSWINDOW]-vw_terminal,
-   wsz, 0, NULL);
 }
 
 void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-07-28 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jul 28 14:37:59 2014
New Revision: 269193
URL: http://svnweb.freebsd.org/changeset/base/269193

Log:
  Update comments.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Mon Jul 28 14:35:21 2014(r269192)
+++ head/sys/dev/vt/vt_core.c   Mon Jul 28 14:37:59 2014(r269193)
@@ -2111,6 +2111,7 @@ vt_allocate(struct vt_driver *drv, void 
vd-vd_driver-vd_init(vd);
VT_UNLOCK(vd);
 
+   /* Update windows sizes and initialize last items. */
vt_upgrade(vd);
 
 #ifdef DEV_SPLASH
@@ -2119,10 +2120,16 @@ vt_allocate(struct vt_driver *drv, void 
 #endif
 
if (vd-vd_flags  VDF_ASYNC) {
+   /* Allow to put chars now. */
terminal_mute(vd-vd_curwindow-vw_terminal, 0);
+   /* Rerun timer for screen updates. */
callout_schedule(vd-vd_timer, hz / VT_TIMERFREQ);
}
 
+   /*
+* Register as console. If it already registered, cnadd() will ignore
+* it.
+*/
termcn_cnregister(vd-vd_windows[VT_CONSWINDOW]-vw_terminal);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-07-28 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jul 28 14:41:22 2014
New Revision: 269194
URL: http://svnweb.freebsd.org/changeset/base/269194

Log:
  Revise font initialization handling.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Mon Jul 28 14:37:59 2014(r269193)
+++ head/sys/dev/vt/vt_core.c   Mon Jul 28 14:41:22 2014(r269194)
@@ -996,7 +996,7 @@ vtterm_cnprobe(struct terminal *tm, stru
sprintf(cp-cn_name, ttyv%r, VT_UNIT(vw));
 
/* Attach default font if not in TEXTMODE. */
-   if (!(vd-vd_flags  VDF_TEXTMODE))
+   if ((vd-vd_flags  VDF_TEXTMODE) == 0)
vw-vw_font = vtfont_ref(vt_font_default);
 
vtbuf_init_early(vw-vw_buf);
@@ -1147,7 +1147,7 @@ vt_change_font(struct vt_window *vw, str
VT_UNLOCK(vd);
return (EBUSY);
}
-   if (vw-vw_font == NULL) {
+   if (vd-vd_flags  VDF_TEXTMODE) {
/* Our device doesn't need fonts. */
VT_UNLOCK(vd);
return (ENOTTY);
@@ -1169,8 +1169,14 @@ vt_change_font(struct vt_window *vw, str
 
/* Actually apply the font to the current window. */
VT_LOCK(vd);
-   vtfont_unref(vw-vw_font);
-   vw-vw_font = vtfont_ref(vf);
+   if (vw-vw_font != vf) {
+   /*
+* In case vt_change_font called to update size we don't need
+* to update font link.
+*/
+   vtfont_unref(vw-vw_font);
+   vw-vw_font = vtfont_ref(vf);
+   }
 
/* Force a full redraw the next timer tick. */
if (vd-vd_curwindow == vw)
@@ -1978,7 +1984,7 @@ vt_allocate_window(struct vt_device *vd,
vw-vw_number = window;
vw-vw_kbdmode = K_XLATE;
 
-   if (!(vd-vd_flags  VDF_TEXTMODE))
+   if ((vd-vd_flags  VDF_TEXTMODE) == 0)
vw-vw_font = vtfont_ref(vt_font_default);
 
vt_termsize(vd, vw-vw_font, size);
@@ -2056,7 +2062,10 @@ vt_resize(struct vt_device *vd)
vw-vw_font = vtfont_ref(vt_font_default);
VT_UNLOCK(vd);
/* Resize terminal windows */
-   vt_change_font(vw, vw-vw_font);
+   while (vt_change_font(vw, vw-vw_font) == EBUSY) {
+   DPRINTF(100, %s: vt_change_font() is busy, 
+   window %d\n, __func__, i);
+   }
}
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268981 - head/sys/dev/drm2

2014-07-22 Thread Aleksandr Rybalko
Author: ray
Date: Tue Jul 22 08:52:49 2014
New Revision: 268981
URL: http://svnweb.freebsd.org/changeset/base/268981

Log:
  Remove #ifdef-s to reduce difference to upstream.
  
  Pointed by:   kib
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/drm2/drm_fb_helper.c

Modified: head/sys/dev/drm2/drm_fb_helper.c
==
--- head/sys/dev/drm2/drm_fb_helper.c   Tue Jul 22 08:37:01 2014
(r268980)
+++ head/sys/dev/drm2/drm_fb_helper.c   Tue Jul 22 08:52:49 2014
(r268981)
@@ -36,7 +36,6 @@ __FBSDID($FreeBSD$);
 #include dev/drm2/drm_fb_helper.h
 #include dev/drm2/drm_crtc_helper.h
 
-#if defined(__FreeBSD__)
 struct vt_kms_softc {
struct drm_fb_helper *fb_helper;
struct task fb_mode_task;
@@ -69,7 +68,6 @@ vt_kms_postswitch(void *arg)
 
return (0);
 }
-#endif
 
 static DRM_LIST_HEAD(kernel_fb_helper_list);
 
@@ -934,10 +932,8 @@ int drm_fb_helper_single_fb_probe(struct
struct fb_info *info;
struct drm_fb_helper_surface_size sizes;
int gamma_size = 0;
-#if defined(__FreeBSD__)
struct vt_kms_softc *sc;
device_t kdev;
-#endif
 
memset(sizes, 0, sizeof(struct drm_fb_helper_surface_size));
sizes.surface_depth = 24;
@@ -1014,7 +1010,6 @@ int drm_fb_helper_single_fb_probe(struct
if (new_fb  0)
return new_fb;
 
-#if defined(__FreeBSD__)
sc = malloc(sizeof(struct vt_kms_softc), DRM_MEM_KMS,
M_WAITOK | M_ZERO);
sc-fb_helper = fb_helper;
@@ -1029,14 +1024,12 @@ int drm_fb_helper_single_fb_probe(struct
info-fb_stride = fb_helper-fb-pitches[0];
info-fb_priv = sc;
info-enter = vt_kms_postswitch;
-#endif
 
/* set the fb pointer */
for (i = 0; i  fb_helper-crtc_count; i++) {
fb_helper-crtc_info[i].mode_set.fb = fb_helper-fb;
}
 
-#if defined(__FreeBSD__)
if (new_fb) {
device_t fbd;
int ret;
@@ -1052,30 +1045,6 @@ int drm_fb_helper_single_fb_probe(struct
DRM_ERROR(Failed to attach fbd device: %d\n, ret);
 #endif
}
-#else
-   if (new_fb) {
-   info-var.pixclock = 0;
-   if (register_framebuffer(info)  0) {
-   return -EINVAL;
-   }
-
-   printf(fb%d: %s frame buffer device\n, info-node,
-  info-fix.id);
-
-   } else {
-   drm_fb_helper_set_par(info);
-   }
-
-   /* Switch back to kernel console on panic */
-   /* multi card linked list maybe */
-   if (list_empty(kernel_fb_helper_list)) {
-   printf(drm: registered panic notifier\n);
-   atomic_notifier_chain_register(panic_notifier_list,
-  paniced);
-   }
-   if (new_fb)
-   list_add(fb_helper-kernel_fb_list, kernel_fb_helper_list);
-#endif
return 0;
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268771 - in head/sys: dev/fb dev/vt/hw/fb sys

2014-07-17 Thread Aleksandr Rybalko
++)
 + info-wr1(info, h*info-fb_stride + o, c);

Tell me please, what is it? ^^
Looks like you mean for (h = 0; h  info-fb_height; h++), but anyway
you can do one loop up to info-fb_size.

   break;
   case 2:
 - for (o = 0; o  info-fb_stride; o += 2)
 - info-wr2(info, o, c);
 + for (h = 0; h  info-fb_stride; h++)
 + for (o = 0; o  info-fb_stride; o += 2)
 + info-wr2(info, h*info-fb_stride + o, c);
   break;
   case 3:
 - /* line 0 */
 - for (o = 0; o  info-fb_stride; o += 3) {
 - info-wr1(info, o, (c  16)  0xff);
 - info-wr1(info, o + 1, (c  8)  0xff);
 - info-wr1(info, o + 2, c  0xff);
 - }
 + for (h = 0; h  info-fb_stride; h++)
 + for (o = 0; o  info-fb_stride; o += 3) {
 + info-wr1(info, h*info-fb_stride + o,
 + (c  16)  0xff);
 + info-wr1(info, h*info-fb_stride + o + 1,
 + (c  8)  0xff);
 + info-wr1(info, h*info-fb_stride + o + 2,
 + c  0xff);
 + }
   break;
   case 4:
 - for (o = 0; o  info-fb_stride; o += 4)
 - info-wr4(info, o, c);
 + for (h = 0; h  info-fb_stride; h++)
 + for (o = 0; o  info-fb_stride; o += 4)
 + info-wr4(info, o, c);
   break;
   default:
   /* panic? */
   return;
   }
 - /* Copy line0 to all other lines. */
 - /* XXX will copy with borders. */
 - for (o = info-fb_stride; o  info-fb_size; o += info-fb_stride) {
 - info-copy(info, o, 0, info-fb_stride);
 - }
  }
  
  void
 
 Modified: head/sys/dev/vt/hw/fb/vt_fb.h
 ==
 --- head/sys/dev/vt/hw/fb/vt_fb.h Wed Jul 16 16:42:58 2014
 (r268770)
 +++ head/sys/dev/vt/hw/fb/vt_fb.h Wed Jul 16 18:49:46 2014
 (r268771)
 @@ -43,5 +43,7 @@ vd_blank_t  vt_fb_blank;
  vd_bitbltchr_t   vt_fb_bitbltchr;
  vd_maskbitbltchr_t vt_fb_maskbitbltchr;
  vd_postswitch_t  vt_fb_postswitch;
 +vd_fb_ioctl_tvt_fb_ioctl;
 +vd_fb_mmap_t vt_fb_mmap;
  
  #endif /* _DEV_VT_HW_FB_VT_FB_H_ */
 
 Modified: head/sys/sys/fbio.h
 ==
 --- head/sys/sys/fbio.h   Wed Jul 16 16:42:58 2014(r268770)
 +++ head/sys/sys/fbio.h   Wed Jul 16 18:49:46 2014(r268771)
 @@ -141,8 +141,6 @@ struct fb_info {
   /* Methods. */
   fb_write_t  *fb_write;  /* if NULL, direct mem write. */
   fb_read_t   *fb_read;   /* if NULL, direct mem read. */
 - fb_ioctl_t  *fb_ioctl;  /* Can be NULL. */
 - fb_mmap_t   *fb_mmap;   /* Can be NULL. */
  
   struct cdev *fb_cdev;
  
 

Thanks!

WBW
-- 
Aleksandr Rybalko r...@ddteam.net
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r268771 - in head/sys: dev/fb dev/vt/hw/fb sys

2014-07-17 Thread Aleksandr Rybalko
On Thu, 17 Jul 2014 05:48:47 -0700
Nathan Whitehorn nwhiteh...@freebsd.org wrote:

 
 On 07/17/14 04:35, Aleksandr Rybalko wrote:
  Hi Nathan!
 
  On Wed, 16 Jul 2014 18:49:46 + (UTC)
  Nathan Whitehorn nwhiteh...@freebsd.org wrote:
 
  Author: nwhitehorn
  Date: Wed Jul 16 18:49:46 2014
  New Revision: 268771
  URL: http://svnweb.freebsd.org/changeset/base/268771
 
  Log:
 Allow console drivers active from early boot to be used with 
  xf86-video-scfb,
 rather than only drivers attached later on. This involves a small 
  amount of
 code duplication with dev/fb/fbd.c, which will fixed later on.
 
 Also improve performance of vt_blank() by making it not read from the
 framebuffer unnecessarily.
 
  Modified:
 head/sys/dev/fb/fbd.c
 head/sys/dev/vt/hw/fb/vt_fb.c
 head/sys/dev/vt/hw/fb/vt_fb.h
 head/sys/sys/fbio.h
 
  Modified: head/sys/dev/fb/fbd.c
  ==
  --- head/sys/dev/fb/fbd.c  Wed Jul 16 16:42:58 2014(r268770)
  +++ head/sys/dev/fb/fbd.c  Wed Jul 16 18:49:46 2014(r268771)
  @@ -257,9 +257,6 @@ fb_probe(struct fb_info *info)
 } else if (info-fb_vbase != 0) {
 if (info-fb_pbase == 0) {
 info-fb_flags |= FB_FLAG_NOMMAP;
  -  } else {
  -  if (info-fb_mmap == NULL)
  -  info-fb_mmap = fb_mmap;
 }
 info-wr1 = vt_fb_mem_wr1;
 info-wr2 = vt_fb_mem_wr2;
  @@ -268,10 +265,6 @@ fb_probe(struct fb_info *info)
 } else
 return (ENXIO);

  -  if (info-fb_ioctl == NULL)
  -  info-fb_ioctl = fb_ioctl;
  -
  -
 return (0);
}

 
  Modified: head/sys/dev/vt/hw/fb/vt_fb.c
  ==
  --- head/sys/dev/vt/hw/fb/vt_fb.c  Wed Jul 16 16:42:58 2014
  (r268770)
  +++ head/sys/dev/vt/hw/fb/vt_fb.c  Wed Jul 16 18:49:46 2014
  (r268771)
  @@ -41,10 +41,6 @@ __FBSDID($FreeBSD$);
#include dev/vt/hw/fb/vt_fb.h
#include dev/vt/colors/vt_termcolors.h

  -static int vt_fb_ioctl(struct vt_device *vd, u_long cmd, caddr_t data,
  -struct thread *td);
  -static int vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset,
  -vm_paddr_t *paddr, int prot, vm_memattr_t *memattr);
void vt_fb_drawrect(struct vt_device *vd, int x1, int y1, int x2, int y2,
int fill, term_color_t color);
void vt_fb_setpixel(struct vt_device *vd, int x, int y, term_color_t 
  color);
  @@ -65,20 +61,47 @@ static struct vt_driver vt_fb_driver = {

VT_DRIVER_DECLARE(vt_fb, vt_fb_driver);

  -static int
  +int
vt_fb_ioctl(struct vt_device *vd, u_long cmd, caddr_t data, struct 
  thread *td)
{
 struct fb_info *info;
  +  int error = 0;

 info = vd-vd_softc;

  -  if (info-fb_ioctl == NULL)
  -  return (-1);
  +  switch (cmd) {
  +  case FBIOGTYPE:
  +  bcopy(info, (struct fbtype *)data, sizeof(struct fbtype));
  +  break;
  +
  +  case FBIO_GETWINORG:/* get frame buffer window origin */
  +  *(u_int *)data = 0;
  +  break;
  +
  +  case FBIO_GETDISPSTART: /* get display start address */
  +  ((video_display_start_t *)data)-x = 0;
  +  ((video_display_start_t *)data)-y = 0;
  +  break;
  +
  +  case FBIO_GETLINEWIDTH: /* get scan line width in bytes */
  +  *(u_int *)data = info-fb_stride;
  +  break;

  -  return (info-fb_ioctl(info-fb_cdev, cmd, data, 0, td));
  +  case FBIO_BLANK:/* blank display */
  +  if (vd-vd_driver-vd_blank == NULL)
  +  return (ENODEV);
  +  vd-vd_driver-vd_blank(vd, TC_BLACK);
  +  break;
  +
  +  default:
  +  error = ENOIOCTL;
  +  break;
  +  }
  +
  +  return (error);
}

  -static int
  +int
vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, vm_paddr_t *paddr,
int prot, vm_memattr_t *memattr)
{
  @@ -86,10 +109,18 @@ vt_fb_mmap(struct vt_device *vd, vm_ooff

 info = vd-vd_softc;

  -  if (info-fb_ioctl == NULL)
  -  return (ENXIO);
  +  if (info-fb_flags  FB_FLAG_NOMMAP)
  +  return (ENODEV);

  -  return (info-fb_mmap(info-fb_cdev, offset, paddr, prot, memattr));
  +  if (offset = 0  offset  info-fb_size) {
  +  *paddr = info-fb_pbase + offset;
  +  #ifdef VM_MEMATTR_WRITE_COMBINING
  +  *memattr = VM_MEMATTR_WRITE_COMBINING;
  +  #endif
  +  return (0);
  +  }
  +
  +  return (EINVAL);
}

void
  @@ -147,41 +178,42 @@ vt_fb_blank(struct vt_device *vd, term_c
{
 struct fb_info *info;
 uint32_t c;
  -  u_int o;
  +  u_int o, h;

 info = vd-vd_softc;
 c = info-fb_cmap[color];

 switch (FBTYPE_GET_BYTESPP(info)) {
 case 1:
  -  for (o = 0; o  info-fb_stride; o++)
  -  info-wr1(info, o, c

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

2014-07-09 Thread Aleksandr Rybalko
Author: ray
Date: Wed Jul  9 14:36:03 2014
New Revision: 268460
URL: http://svnweb.freebsd.org/changeset/base/268460

Log:
  Fix inconsistent token parameters for kbd_allocate() and kbd_release() in 
vt(4).
  
  PR:   191306
  Submitted by: jau...@gmail.com
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Wed Jul  9 13:37:24 2014(r268459)
+++ head/sys/dev/vt/vt_core.c   Wed Jul  9 14:36:03 2014(r268460)
@@ -618,7 +618,7 @@ vt_kbdevent(keyboard_t *kbd, int event, 
case KBDIO_UNLOADING:
mtx_lock(Giant);
vd-vd_keyboard = -1;
-   kbd_release(kbd, (void *)vd-vd_keyboard);
+   kbd_release(kbd, (void *)vd);
mtx_unlock(Giant);
return (0);
default:
@@ -1785,11 +1785,10 @@ skip_thunk:
return (EINVAL);
}
i = kbd_allocate(kbd-kb_name, kbd-kb_unit,
-   (void *)vd-vd_keyboard, vt_kbdevent, vd);
+   (void *)vd, vt_kbdevent, vd);
if (i = 0) {
if (vd-vd_keyboard != -1) {
-   kbd_release(kbd,
-   (void *)vd-vd_keyboard);
+   kbd_release(kbd, (void *)vd);
}
kbd = kbd_get_keyboard(i);
vd-vd_keyboard = i;
@@ -1811,7 +1810,7 @@ skip_thunk:
mtx_unlock(Giant);
return (EINVAL);
}
-   error = kbd_release(kbd, (void *)vd-vd_keyboard);
+   error = kbd_release(kbd, (void *)vd);
if (error == 0) {
vd-vd_keyboard = -1;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268472 - head/sys/dev/fb

2014-07-09 Thread Aleksandr Rybalko
Author: ray
Date: Wed Jul  9 21:55:34 2014
New Revision: 268472
URL: http://svnweb.freebsd.org/changeset/base/268472

Log:
  Should check fb_read method presence instead of double check for fb_write.
  
  Pointed by: emaste
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/fb/fbd.c

Modified: head/sys/dev/fb/fbd.c
==
--- head/sys/dev/fb/fbd.c   Wed Jul  9 21:39:40 2014(r268471)
+++ head/sys/dev/fb/fbd.c   Wed Jul  9 21:55:34 2014(r268472)
@@ -246,7 +246,7 @@ fb_probe(struct fb_info *info)
return (ENXIO);
 
if (info-fb_write != NULL) {
-   if (info-fb_write == NULL) {
+   if (info-fb_read == NULL) {
return (EINVAL);
}
info-fb_flags |= FB_FLAG_NOMMAP;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268366 - in stable/10: share/man/man4 sys/amd64/conf sys/conf sys/dev/syscons sys/dev/vt sys/dev/vt/hw/vga sys/i386/conf sys/kern sys/sys usr.sbin/kbdcontrol usr.sbin/vidcontrol

2014-07-07 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jul  7 14:16:05 2014
New Revision: 268366
URL: http://svnweb.freebsd.org/changeset/base/268366

Log:
  267622 Log:
Rename vt(4) vga module to dismiss interference with syscons(4) vga module.
  267623 Log:
Remove stale link to deleted vt(4) xboxfb driver.
  267624 Log:
syscons(4) and vt(4) can be built together now.
  267625 Log:
Allow to disable syscons(4) if hw.syscons.disable kenv is set.
  267626 Log:
Suspend vt(4) initialization if kern.vt.disable kenv is set.
  267965 by emaste@ Log:
Use a common tunable to choose between vt(4)/sc(4)
With this change and previous work from ray@ it will be possible to put
both in GENERIC, and have one enabled by default, but allow the other to
be selected via the loader.
(The previous implementation had separate kern.vt.disable and
hw.syscons.disable tunables, and would panic if both drivers were
compiled in and neither was explicitly disabled.)
  268175 by emaste@ Log:
Fix vt(4) detection in kbdcontrol and vidcontrol
As sc(4) and vt(4) coexist and are both enabled in GENERIC, the existence
of a vt(4) sysctl is not sufficient to determine that vt(4) is in use.
Reported by:  Trond Endrestøl
  268045 by emaste@ Log:
Add vt(4) to GENERIC and retire the separate VT config
vt(4) and sc(4) can now coexist in the same kernel.  To choose the vt
driver, set the loader tunable kern.vty=vt .
  
  Sponsored by: The FreeBSD Foundation

Added:
  stable/10/sys/dev/vt/hw/vga/vt_vga.c
 - copied unchanged from r267622, head/sys/dev/vt/hw/vga/vt_vga.c
  stable/10/sys/dev/vt/hw/vga/vt_vga_reg.h
 - copied unchanged from r267622, head/sys/dev/vt/hw/vga/vt_vga_reg.h
Deleted:
  stable/10/sys/amd64/conf/VT
  stable/10/sys/dev/vt/hw/vga/vga.c
  stable/10/sys/dev/vt/hw/vga/vga_reg.h
  stable/10/sys/i386/conf/VT
Modified:
  stable/10/share/man/man4/vt.4
  stable/10/sys/amd64/conf/GENERIC
  stable/10/sys/conf/files
  stable/10/sys/conf/files.i386
  stable/10/sys/dev/syscons/syscons.c
  stable/10/sys/dev/syscons/sysmouse.c
  stable/10/sys/dev/vt/vt.h
  stable/10/sys/dev/vt/vt_consolectl.c
  stable/10/sys/dev/vt/vt_core.c
  stable/10/sys/dev/vt/vt_sysmouse.c
  stable/10/sys/i386/conf/GENERIC
  stable/10/sys/kern/kern_cons.c
  stable/10/sys/sys/cons.h
  stable/10/usr.sbin/kbdcontrol/kbdcontrol.c
  stable/10/usr.sbin/vidcontrol/vidcontrol.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/vt.4
==
--- stable/10/share/man/man4/vt.4   Mon Jul  7 14:03:30 2014
(r268365)
+++ stable/10/share/man/man4/vt.4   Mon Jul  7 14:16:05 2014
(r268366)
@@ -44,6 +44,7 @@
 In
 .Xr loader.conf 5 :
 .Cd hw.vga.textmode=1
+.Cd kern.vty=vt
 .Sh DESCRIPTION
 The
 .Nm
@@ -182,6 +183,12 @@ prompt or in
 Set to 1 to use virtual terminals in text mode instead of graphics mode.
 Features that require graphics mode, like loadable fonts, will be
 disabled.
+.It Va kern.vty
+Set to vt to choose the
+.Nm
+driver for the system console, if the
+.Xr syscons 4
+driver is also compiled in and is the default.
 .El
 .Sh EXAMPLES
 The following line will change the default color of normal text.

Modified: stable/10/sys/amd64/conf/GENERIC
==
--- stable/10/sys/amd64/conf/GENERICMon Jul  7 14:03:30 2014
(r268365)
+++ stable/10/sys/amd64/conf/GENERICMon Jul  7 14:16:05 2014
(r268366)
@@ -176,6 +176,11 @@ device splash  # Splash screen 
and scr
 device sc
 optionsSC_PIXEL_MODE   # add support for the raster text mode
 
+# vt is the new video console driver
+device vt
+device vt_vga
+device vt_efifb
+
 device agp # support several AGP chipsets
 
 # PCCARD (PCMCIA) support

Modified: stable/10/sys/conf/files
==
--- stable/10/sys/conf/filesMon Jul  7 14:03:30 2014(r268365)
+++ stable/10/sys/conf/filesMon Jul  7 14:16:05 2014(r268366)
@@ -2535,7 +2535,7 @@ dev/vt/colors/vt_termcolors.c optional v
 dev/vt/font/vt_font_default.c  optional vt
 dev/vt/font/vt_mouse_cursor.c  optional vt
 dev/vt/hw/fb/vt_fb.c   optional vt
-dev/vt/hw/vga/vga.coptional vt vt_vga
+dev/vt/hw/vga/vt_vga.c optional vt vt_vga
 dev/vt/logo/logo_freebsd.c optional vt splash
 dev/vt/vt_buf.coptional vt
 dev/vt/vt_consolectl.c optional vt

Modified: stable/10/sys/conf/files.i386
==
--- stable/10/sys/conf/files.i386   Mon Jul  7 14:03:30 2014
(r268365)
+++ stable/10/sys/conf/files.i386   Mon Jul  7 14:16:05 2014
(r268366)
@@ -293,7 +293,6 @@ dev/viawd/viawd.c   

svn commit: r268371 - stable/10/sys/conf

2014-07-07 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jul  7 19:31:02 2014
New Revision: 268371
URL: http://svnweb.freebsd.org/changeset/base/268371

Log:
  MFC of r263873.
  
  Pointed by: Ivan Klymenko fi...@ukr.net
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/conf/files
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/files
==
--- stable/10/sys/conf/filesMon Jul  7 17:34:48 2014(r268370)
+++ stable/10/sys/conf/filesMon Jul  7 19:31:02 2014(r268371)
@@ -2534,6 +2534,7 @@ dev/vr/if_vr.coptional vr pci
 dev/vt/colors/vt_termcolors.c  optional vt
 dev/vt/font/vt_font_default.c  optional vt
 dev/vt/font/vt_mouse_cursor.c  optional vt
+dev/vt/hw/efifb/efifb.coptional vt_efifb
 dev/vt/hw/fb/vt_fb.c   optional vt
 dev/vt/hw/vga/vt_vga.c optional vt vt_vga
 dev/vt/logo/logo_freebsd.c optional vt splash
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r268372 - stable/10/sys/amd64/conf

2014-07-07 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jul  7 21:27:47 2014
New Revision: 268372
URL: http://svnweb.freebsd.org/changeset/base/268372

Log:
  Temporary disable build of vt_efifb vt(4) driver, not all parts of UEFI 
support
  here yet.
  This direct commit to STABLE-10, because HEAD already support UEFI FB.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/amd64/conf/GENERIC

Modified: stable/10/sys/amd64/conf/GENERIC
==
--- stable/10/sys/amd64/conf/GENERICMon Jul  7 19:31:02 2014
(r268371)
+++ stable/10/sys/amd64/conf/GENERICMon Jul  7 21:27:47 2014
(r268372)
@@ -179,7 +179,6 @@ options SC_PIXEL_MODE   # add support fo
 # vt is the new video console driver
 device vt
 device vt_vga
-device vt_efifb
 
 device agp # support several AGP chipsets
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r267622 - in head/sys: conf dev/vt/hw/vga

2014-06-18 Thread Aleksandr Rybalko
Author: ray
Date: Wed Jun 18 22:10:10 2014
New Revision: 267622
URL: http://svnweb.freebsd.org/changeset/base/267622

Log:
  Rename vt(4) vga module to dismiss interference with syscons(4) vga module.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/dev/vt/hw/vga/vt_vga.c
 - copied, changed from r267541, head/sys/dev/vt/hw/vga/vga.c
  head/sys/dev/vt/hw/vga/vt_vga_reg.h
 - copied unchanged from r267541, head/sys/dev/vt/hw/vga/vga_reg.h
Deleted:
  head/sys/dev/vt/hw/vga/vga.c
  head/sys/dev/vt/hw/vga/vga_reg.h
Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Jun 18 22:09:33 2014(r267621)
+++ head/sys/conf/files Wed Jun 18 22:10:10 2014(r267622)
@@ -2526,7 +2526,7 @@ dev/vt/font/vt_font_default.c optional v
 dev/vt/font/vt_mouse_cursor.c  optional vt
 dev/vt/hw/efifb/efifb.coptional vt_efifb
 dev/vt/hw/fb/vt_fb.c   optional vt
-dev/vt/hw/vga/vga.coptional vt vt_vga
+dev/vt/hw/vga/vt_vga.c optional vt vt_vga
 dev/vt/logo/logo_freebsd.c optional vt splash
 dev/vt/vt_buf.coptional vt
 dev/vt/vt_consolectl.c optional vt

Copied and modified: head/sys/dev/vt/hw/vga/vt_vga.c (from r267541, 
head/sys/dev/vt/hw/vga/vga.c)
==
--- head/sys/dev/vt/hw/vga/vga.cMon Jun 16 12:37:10 2014
(r267541, copy source)
+++ head/sys/dev/vt/hw/vga/vt_vga.c Wed Jun 18 22:10:10 2014
(r267622)
@@ -38,7 +38,7 @@ __FBSDID($FreeBSD$);
 #include sys/systm.h
 
 #include dev/vt/vt.h
-#include dev/vt/hw/vga/vga_reg.h
+#include dev/vt/hw/vga/vt_vga_reg.h
 
 #include machine/bus.h
 

Copied: head/sys/dev/vt/hw/vga/vt_vga_reg.h (from r267541, 
head/sys/dev/vt/hw/vga/vga_reg.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/vt/hw/vga/vt_vga_reg.h Wed Jun 18 22:10:10 2014
(r267622, copy of r267541, head/sys/dev/vt/hw/vga/vga_reg.h)
@@ -0,0 +1,220 @@
+/*-
+ * Copyright (c) 2005 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _DEV_VT_HW_VGA_VGA_REG_H_
+#define_DEV_VT_HW_VGA_VGA_REG_H_
+
+/*
+ * The VGA adapter uses two I/O port blocks. One of these blocks, the CRT
+ * controller registers, can be located either at 0x3B0 or at 0x3D0 in I/O
+ * port space. This allows compatibility with the monochrome adapter, which
+ * has the CRT controller registers at 0x3B0.
+ *
+ * It is assumed that compatibility with the monochrome adapter is not of
+ * interest anymore. As such, the CRT controller can be located at 0x3D0 in
+ * I/O port space unconditionally. This means that the 2 I/O blocks are
+ * always adjacent and can therefore be treated as a single logical I/O port
+ * range. In practical terms: there only has to be a single tag and handle
+ * to access all registers.
+ *
+ * The following definitions are taken from or inspired by:
+ *   Programmer's Guide to the EGA, VGA, and Super VGA Cards -- 3rd ed.,
+ * Richard F. Ferraro, Addison-Wesley, ISBN 0-201-62490-7
+ */
+
+#defineVGA_MEM_BASE0xA
+#defineVGA_MEM_SIZE0x1
+#defineVGA_REG_BASE0x3c0
+#defineVGA_REG_SIZE0x10+0x0c
+
+/* Attribute controller registers. */
+#defineVGA_AC_WRITE0x00
+#defineVGA_AC_READ 0x01
+#defineVGA_AC_PALETTE(x)   (x) /* 0 = x = 15 */
+#defineVGA_AC_PAL_SR   0x20

svn commit: r267623 - head/sys/conf

2014-06-18 Thread Aleksandr Rybalko
Author: ray
Date: Wed Jun 18 22:16:44 2014
New Revision: 267623
URL: http://svnweb.freebsd.org/changeset/base/267623

Log:
  Remove stale link to deleted vt(4) xboxfb driver.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/files.i386

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Wed Jun 18 22:10:10 2014(r267622)
+++ head/sys/conf/files.i386Wed Jun 18 22:16:44 2014(r267623)
@@ -279,7 +279,6 @@ dev/viawd/viawd.c   optional viawd
 dev/vmware/vmxnet3/if_vmx.coptional vmx
 dev/acpica/acpi_if.m   standard
 dev/acpi_support/acpi_wmi_if.m standard
-dev/vt/hw/xboxfb/xboxfb.c  optional vt_xboxfb
 dev/wbwd/wbwd.coptional wbwd
 dev/wpi/if_wpi.c   optional wpi
 dev/isci/isci.c
optional isci
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-06-18 Thread Aleksandr Rybalko
Author: ray
Date: Wed Jun 18 22:18:58 2014
New Revision: 267624
URL: http://svnweb.freebsd.org/changeset/base/267624

Log:
  syscons(4) and vt(4) can be built together now.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt.h

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hWed Jun 18 22:16:44 2014(r267623)
+++ head/sys/dev/vt/vt.hWed Jun 18 22:18:58 2014(r267624)
@@ -50,11 +50,6 @@
 #include opt_syscons.h
 #include opt_splash.h
 
-#ifdef DEV_SC
-#error Build with both syscons and vt is not supported. Please enable only \
-one 'device sc' or 'device vt'
-#endif
-
 #ifndefVT_MAXWINDOWS
 #ifdef MAXCONS
 #defineVT_MAXWINDOWS   MAXCONS
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r267625 - head/sys/dev/syscons

2014-06-18 Thread Aleksandr Rybalko
Author: ray
Date: Wed Jun 18 22:23:10 2014
New Revision: 267625
URL: http://svnweb.freebsd.org/changeset/base/267625

Log:
  Allow to disable syscons(4) if hw.syscons.disable kenv is set.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/syscons/syscons.c
  head/sys/dev/syscons/sysmouse.c

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Wed Jun 18 22:18:58 2014
(r267624)
+++ head/sys/dev/syscons/syscons.c  Wed Jun 18 22:23:10 2014
(r267625)
@@ -1589,6 +1589,11 @@ sc_cnprobe(struct consdev *cp)
 int unit;
 int flags;
 
+if (getenv(hw.syscons.disable)) {
+   cp-cn_pri = CN_DEAD;
+   return;
+}
+
 cp-cn_pri = sc_get_cons_priority(unit, flags);
 
 /* a video card is always required */

Modified: head/sys/dev/syscons/sysmouse.c
==
--- head/sys/dev/syscons/sysmouse.c Wed Jun 18 22:18:58 2014
(r267624)
+++ head/sys/dev/syscons/sysmouse.c Wed Jun 18 22:23:10 2014
(r267625)
@@ -165,6 +165,8 @@ static struct ttydevsw smdev_ttydevsw = 
 static void
 sm_attach_mouse(void *unused)
 {
+   if (getenv(hw.syscons.disable))
+   return;
sysmouse_tty = tty_alloc(smdev_ttydevsw, NULL);
tty_makedev(sysmouse_tty, NULL, sysmouse);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-06-18 Thread Aleksandr Rybalko
Author: ray
Date: Wed Jun 18 22:30:22 2014
New Revision: 267626
URL: http://svnweb.freebsd.org/changeset/base/267626

Log:
  Suspend vt(4) initialization if kern.vt.disable kenv is set.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_consolectl.c
==
--- head/sys/dev/vt/vt_consolectl.c Wed Jun 18 22:23:10 2014
(r267625)
+++ head/sys/dev/vt/vt_consolectl.c Wed Jun 18 22:30:22 2014
(r267626)
@@ -73,6 +73,8 @@ static void
 consolectl_drvinit(void *unused)
 {
 
+   if (getenv(kern.vt.disable))
+   return;
make_dev(consolectl_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
consolectl);
 }

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Wed Jun 18 22:23:10 2014(r267625)
+++ head/sys/dev/vt/vt_core.c   Wed Jun 18 22:30:22 2014(r267626)
@@ -215,6 +215,8 @@ static void
 vt_update_static(void *dummy)
 {
 
+   if (getenv(kern.vt.disable))
+   return;
if (main_vd-vd_driver != NULL)
printf(VT: running with driver \%s\.\n,
main_vd-vd_driver-vd_name);
@@ -957,6 +959,9 @@ vtterm_cnprobe(struct terminal *tm, stru
struct vt_device *vd = vw-vw_device;
struct winsize wsz;
 
+   if (getenv(kern.vt.disable))
+   return;
+
if (vd-vd_flags  VDF_INITIALIZED)
/* Initialization already done. */
return;
@@ -1991,6 +1996,9 @@ vt_upgrade(struct vt_device *vd)
struct vt_window *vw;
unsigned int i;
 
+   if (getenv(kern.vt.disable))
+   return;
+
for (i = 0; i  VT_MAXWINDOWS; i++) {
vw = vd-vd_windows[i];
if (vw == NULL) {
@@ -2056,6 +2064,9 @@ vt_allocate(struct vt_driver *drv, void 
struct vt_device *vd;
struct winsize wsz;
 
+   if (getenv(kern.vt.disable))
+   return;
+
if (main_vd-vd_driver == NULL) {
main_vd-vd_driver = drv;
printf(VT: initialize with new VT driver \%s\.\n,

Modified: head/sys/dev/vt/vt_sysmouse.c
==
--- head/sys/dev/vt/vt_sysmouse.c   Wed Jun 18 22:23:10 2014
(r267625)
+++ head/sys/dev/vt/vt_sysmouse.c   Wed Jun 18 22:30:22 2014
(r267626)
@@ -405,6 +405,8 @@ static void
 sysmouse_drvinit(void *unused)
 {
 
+   if (getenv(kern.vt.disable))
+   return;
mtx_init(sysmouse_lock, sysmouse, NULL, MTX_DEF);
cv_init(sysmouse_sleep, sysmrd);
make_dev(sysmouse_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r267538 - in stable/10/sys/dev/vt: . hw/efifb hw/fb hw/ofwfb hw/vga hw/xboxfb

2014-06-16 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jun 16 11:26:30 2014
New Revision: 267538
URL: http://svnweb.freebsd.org/changeset/base/267538

Log:
  MFC 262785 263183 264182 264999 265391 265392 265395 265397 265398 265402 
265403
  265442 265546 265680 265681 265719 265862 265864 265867 265927 266010 
266495
  266540 266835 266856 266861 266862 267007 267310.
  
  265391
Define a new method for probing vt(4) driver before attach it at early 
stage.
  265392
Create dataset for vt(4) drivers.
  265395
Set of updates to vt(4) core part.
o Declare vt(4) drivers dataset.
o Create single static structures for all early drivers.
o Add vt(4) to be by default in the kernel consoles list.
o Create one more sysinit point, to be able to initialize memory and lock
requirement of early drivers.
o Implement early drivers select. (Only best available will be selected).
o Fix one missed return (0) for VTYLOCK.
o Improve locking for cases when one driver replace another.
o Make driver replacement notification less debug-look-like.
o Minor spell fixes.
  265397
Switch fb and efifb drivers to use names and new vt(4) driver probe method.
  265398
Add vt(4) driver name for ofwfb driver.
  265402
Revert r264997 and r265026. It is not required anymore.
  265403
Switch vga drivers to use names and new vt(4) driver probe method.
  265442
Implement KDMKTONE ioctl.
  265546
Fix possible divide by zero.
  265680
No need to assign fields required and checked on probe.
  265681
Fix scrollback.
  265719
Hide debug messages under VT_DEBUG.
  265927
Update terminal sizes in any case when new vt(4) driver arrive.
(Plus remove one unused newline)
  266010
Remove extra newlines.
No functional changes.
  266495
Fix tty locking.
o Correct expected values for VT_LOCKSWITCH ioctl.
o Check current window for locked state.
  266540
Proper fix of VT_LOCKSWITCH ioctl.
  266835
Remove driver as unused.
  267007
Fix case when vt(4) started w/o driver assigned.
o Always init locks and cv ASAP.
o Initialize driver-independent parts even if driver probing fail.
o Allow to call vt_upgrade anytime, for later loaded drivers.
o New window flag VWF_READY, to track if window already initialized.
Other updates:
o Pass vd as a cookie for kbd_allocate.
o Do not blank window on driver replacement.
  
  Sponsored by: The FreeBSD Foundation

Added:
  stable/10/sys/dev/vt/hw/efifb/
 - copied from r262785, head/sys/dev/vt/hw/efifb/
Deleted:
  stable/10/sys/dev/vt/hw/xboxfb/
Modified:
  stable/10/sys/dev/vt/hw/efifb/efifb.c
  stable/10/sys/dev/vt/hw/fb/vt_early_fb.c
  stable/10/sys/dev/vt/hw/fb/vt_fb.c
  stable/10/sys/dev/vt/hw/fb/vt_fb.h
  stable/10/sys/dev/vt/hw/ofwfb/ofwfb.c
  stable/10/sys/dev/vt/hw/vga/vga.c
  stable/10/sys/dev/vt/vt.h
  stable/10/sys/dev/vt/vt_buf.c
  stable/10/sys/dev/vt/vt_consolectl.c
  stable/10/sys/dev/vt/vt_core.c
  stable/10/sys/dev/vt/vt_sysmouse.c

Modified: stable/10/sys/dev/vt/hw/efifb/efifb.c
==
--- head/sys/dev/vt/hw/efifb/efifb.cWed Mar  5 14:37:45 2014
(r262785)
+++ stable/10/sys/dev/vt/hw/efifb/efifb.c   Mon Jun 16 11:26:30 2014
(r267538)
@@ -52,42 +52,64 @@ __FBSDID($FreeBSD$);
 #include dev/vt/hw/fb/vt_fb.h
 #include dev/vt/colors/vt_termcolors.h
 
-static vd_init_t vt_efb_init;
+static vd_init_t vt_efifb_init;
+static vd_probe_t vt_efifb_probe;
 
-static struct vt_driver vt_efb_driver = {
-   .vd_init = vt_efb_init,
+static struct vt_driver vt_efifb_driver = {
+   .vd_name = efifb,
+   .vd_probe = vt_efifb_probe,
+   .vd_init = vt_efifb_init,
.vd_blank = vt_fb_blank,
.vd_bitbltchr = vt_fb_bitbltchr,
+   .vd_maskbitbltchr = vt_fb_maskbitbltchr,
/* Better than VGA, but still generic driver. */
.vd_priority = VD_PRIORITY_GENERIC + 1,
 };
 
-static struct fb_info info;
-VT_CONSDEV_DECLARE(vt_efb_driver,
-MAX(80, PIXEL_WIDTH(VT_FB_DEFAULT_WIDTH)),
-MAX(25, PIXEL_HEIGHT(VT_FB_DEFAULT_HEIGHT)), info);
+static struct fb_info local_info;
+VT_DRIVER_DECLARE(vt_efifb, vt_efifb_driver);
 
 static int
-vt_efb_init(struct vt_device *vd)
+vt_efifb_probe(struct vt_device *vd)
 {
-   int depth, d, disable, i, len;
-   struct fb_info  *info;
+   int disabled;
struct efi_fb   *efifb;
caddr_t kmdp;
 
-   info = vd-vd_softc;
+   disabled = 0;
+   TUNABLE_INT_FETCH(hw.syscons.disable, disabled);
+   if (disabled != 0)
+   return (CN_DEAD);
 
-   disable = 0;
-   TUNABLE_INT_FETCH(hw.syscons.disable, disable);
-   if (disable != 0)
+   kmdp = preload_search_by_type(elf kernel);
+   if (kmdp == NULL)
+   kmdp = preload_search_by_type(elf64 kernel);
+   efifb = (struct efi_fb *)preload_search_info(kmdp,
+   

svn commit: r267539 - stable/10

2014-06-16 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jun 16 11:42:19 2014
New Revision: 267539
URL: http://svnweb.freebsd.org/changeset/base/267539

Log:
  Record merginfo for r267538.
  
  Pointy hat to:ray
  Sponsored by: The FreeBSD Foundation

Modified:
Directory Properties:
  stable/10/   (props changed)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r267540 - in stable/10/usr.sbin: kbdcontrol vidcontrol

2014-06-16 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jun 16 11:51:00 2014
New Revision: 267540
URL: http://svnweb.freebsd.org/changeset/base/267540

Log:
  MFC: 266836, 266839
  vt(4) support for vidcontrol(1).
o Teach vidcontrol(1) how to load vt(4) font.
o Teach vidcontrol(1) to distinct which virtual terminal system is running 
now.
o Load vt(4) fonts from different location.
o Add $FreeBSD$ tag for path.h.
  vt(4) support for kbdcontrol(1).
Enable kbdcontrol(1) to use maps from vt(4) keymaps dir 
/usr/share/vt/keymaps
if vt(4) is present.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/usr.sbin/kbdcontrol/kbdcontrol.c
  stable/10/usr.sbin/kbdcontrol/path.h
  stable/10/usr.sbin/vidcontrol/path.h
  stable/10/usr.sbin/vidcontrol/vidcontrol.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/kbdcontrol/kbdcontrol.c
==
--- stable/10/usr.sbin/kbdcontrol/kbdcontrol.c  Mon Jun 16 11:42:19 2014
(r267539)
+++ stable/10/usr.sbin/kbdcontrol/kbdcontrol.c  Mon Jun 16 11:51:00 2014
(r267540)
@@ -38,6 +38,7 @@ __FBSDID($FreeBSD$);
 #include fcntl.h
 #include sys/kbio.h
 #include sys/consio.h
+#include sys/sysctl.h
 #include path.h
 #include lex.h
 
@@ -141,6 +142,17 @@ static voidset_keyrates(char *opt);
 static voidshow_kbd_info(void);
 static voidusage(void) __dead2;
 
+/* Detect presence of vt(4). */
+static int
+is_vt4(void)
+{
+
+   if (sysctlbyname(kern.vt.deadtimer, NULL, NULL, NULL, 0) == 0)
+   return (1);
+
+   return (0);
+}
+
 static char *
 nextarg(int ac, char **av, int *indp, int oc)
 {
@@ -785,10 +797,13 @@ load_keymap(char *opt, int dumponly)
FILE*fd;
int i, j;
char*name, *cp;
-   charblank[] = , keymap_path[] = KEYMAP_PATH, dotkbd[] = .kbd;
+   charblank[] = , keymap_path[] = KEYMAP_PATH;
+   charvt_keymap_path[] = VT_KEYMAP_PATH, dotkbd[] = .kbd;
char*prefix[]  = {blank, blank, keymap_path, NULL};
char*postfix[] = {blank, dotkbd, NULL};
 
+   if (is_vt4())
+   prefix[2] = vt_keymap_path;
cp = getenv(KEYMAP_PATH);
if (cp != NULL)
asprintf((prefix[0]), %s/, cp);

Modified: stable/10/usr.sbin/kbdcontrol/path.h
==
--- stable/10/usr.sbin/kbdcontrol/path.hMon Jun 16 11:42:19 2014
(r267539)
+++ stable/10/usr.sbin/kbdcontrol/path.hMon Jun 16 11:51:00 2014
(r267540)
@@ -1,4 +1,8 @@
+/* $FreeBSD$ */
+
 #define KEYMAP_PATH/usr/share/syscons/keymaps/
 #define FONT_PATH  /usr/share/syscons/fonts/
 #define SCRNMAP_PATH   /usr/share/syscons/scrnmaps/
 
+#define VT_KEYMAP_PATH /usr/share/vt/keymaps/
+#define VT_FONT_PATH   /usr/share/vt/fonts/

Modified: stable/10/usr.sbin/vidcontrol/path.h
==
--- stable/10/usr.sbin/vidcontrol/path.hMon Jun 16 11:42:19 2014
(r267539)
+++ stable/10/usr.sbin/vidcontrol/path.hMon Jun 16 11:51:00 2014
(r267540)
@@ -1,4 +1,8 @@
+/* $FreeBSD$ */
+
 #define KEYMAP_PATH/usr/share/syscons/keymaps/
 #define FONT_PATH  /usr/share/syscons/fonts/
 #define SCRNMAP_PATH   /usr/share/syscons/scrnmaps/
 
+#define VT_KEYMAP_PATH /usr/share/vt/keymaps/
+#define VT_FONT_PATH   /usr/share/vt/fonts/

Modified: stable/10/usr.sbin/vidcontrol/vidcontrol.c
==
--- stable/10/usr.sbin/vidcontrol/vidcontrol.c  Mon Jun 16 11:42:19 2014
(r267539)
+++ stable/10/usr.sbin/vidcontrol/vidcontrol.c  Mon Jun 16 11:51:00 2014
(r267540)
@@ -45,9 +45,12 @@ static const char rcsid[] =
 #include unistd.h
 #include sys/fbio.h
 #include sys/consio.h
+#include sys/endian.h
 #include sys/errno.h
+#include sys/param.h
 #include sys/types.h
 #include sys/stat.h
+#include sys/sysctl.h
 #include path.h
 #include decode.h
 
@@ -78,6 +81,15 @@ static struct {
struct video_info   video_mode_info;
 } cur_info;
 
+struct vt4font_header {
+   uint8_t magic[8];
+   uint8_t width;
+   uint8_t height;
+   uint16_tpad;
+   uint32_tglyph_count;
+   uint32_tmap_count[4];
+} __packed;
+
 static int hex = 0;
 static int vesa_cols;
 static int vesa_rows;
@@ -86,6 +98,7 @@ static intcolors_changed;
 static int video_mode_changed;
 static int normal_fore_color, normal_back_color;
 static int revers_fore_color, revers_back_color;
+static int vt4_mode = 0;
 static struct  vid_info info;
 static struct  video_info new_mode_info;
 
@@ -115,7 +128,9 @@ init(void)
if (ioctl(0, CONS_GETINFO, cur_info.console_info) == -1)
errc(1, errno, getting console information);
 
-   if (ioctl(0, GIO_SCRNMAP, 

svn commit: r267541 - in stable/10/share/vt: . fonts keymaps

2014-06-16 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jun 16 12:37:10 2014
New Revision: 267541
URL: http://svnweb.freebsd.org/changeset/base/267541

Log:
  MFC: 266838 266841 267194
Add gallant vt(4) font as an example of font loading for vt(4).
Add Ukranian vt(4) keymaps as an example.
  
  Sponsored by: The FreeBSD Foundation

Added:
  stable/10/share/vt/
 - copied from r266838, head/share/vt/
  stable/10/share/vt/fonts/gallant.fnt.uu
 - copied unchanged from r266841, head/share/vt/fonts/gallant.fnt.uu
  stable/10/share/vt/keymaps/
 - copied from r267194, head/share/vt/keymaps/
Deleted:
  stable/10/share/vt/fonts/gallant.fnt
Modified:
  stable/10/share/vt/Makefile
  stable/10/share/vt/fonts/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/vt/Makefile
==
--- head/share/vt/Makefile  Thu May 29 13:41:07 2014(r266838)
+++ stable/10/share/vt/Makefile Mon Jun 16 12:37:10 2014(r267541)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
-SUBDIR= fonts
+SUBDIR= fonts keymaps
 
 .include bsd.subdir.mk

Modified: stable/10/share/vt/fonts/Makefile
==
--- head/share/vt/fonts/MakefileThu May 29 13:41:07 2014
(r266838)
+++ stable/10/share/vt/fonts/Makefile   Mon Jun 16 12:37:10 2014
(r267541)
@@ -2,8 +2,12 @@
 
 FILES= gallant.fnt
 
-FILESDIR= ${SHAREDIR}/vt/fonts
+CLEANFILES+=   ${FILES}
 
-NO_OBJ=
+.SUFFIXES: .uu
+.uu:
+   uudecode  ${.IMPSRC}
+
+FILESDIR=  ${SHAREDIR}/vt/fonts
 
 .include bsd.prog.mk

Copied: stable/10/share/vt/fonts/gallant.fnt.uu (from r266841, 
head/share/vt/fonts/gallant.fnt.uu)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/share/vt/fonts/gallant.fnt.uu Mon Jun 16 12:37:10 2014
(r267541, copy of r266841, head/share/vt/fonts/gallant.fnt.uu)
@@ -0,0 +1,192 @@
+# $FreeBSD$
+begin 644 gallant.fnt
+M5D9.5#`P,#(,%@``OP(`
+M`8`!@```8`
+M!@```8`!@```8```8`!@```!F`8`9@!F`8`9
+M@S`#,`,P!F`?\!_P
+M#,`,P!F`8!_P'_`,P!F`8`!^`/\!FX9@9@`^
+M`!^`!\`8`9@9F!_P#^`!@```#A@1,!$P$6`.8`#``,`
+M!@`,``P``:(#(@,B!AP```!P`/@!C`,`8P`^`'@`^
+M`'`8V!AX'`88`_X!Y@```,`!X`'@```8`#``8`!``
+M``#``8`#@`,`!P```8`!@`
+M``8`!P`#``.``8``P```,``8`!P`#``.``8`!@```8`
+M!@`.``P`'``8`#\`!@!F8';@8``
+M`!F`=N!F8`8`#P```8`!@``'_@
+M?^```8`!@`
+M#```!X`!@```P```0``!_X'_@
+M```,
+M`!X`'@`,```P`#``8`!@`,``P```P`#``8`!@`
+M,``P``'``^`$8`0P##`,,`PP##`,,`PP##`,(`8
+M@!\`#@(`!@`.`!X`-@```8`!@```8`!@```8`
+M!@`_P```'P`_@'`0,``P`#``,`!@`,`!@`,`!@`,!_
+MX'_@```/@!_`(.!`8`!@`.`'P`_``.``8`!@0!@0#^`
+M'P``X`#@`6`!8`)@`F`$8`1@`/^!_X```8`!
+M@```#\`/P!``$``@`#^`,``X`!@```8$!@8`PP!^`
+M```'``P```P`#``8`!G@_`.!@8!@8!P0#^`'P``
+M`!_@/^!@0`!``,``@```8`!``$``P```(`!@`$
+M#P`1@##`,,`PP!B`#0```L`$8`PP##`,,`8@`\`
+M```/@!'`(.!@8!@8!PX#]@'F``8`#``,`!@``/```
+M```,`!X`'@`,```,`!X`'@`,
+M#```!X`#```#```!X`!@```P`
+M``0``!P``'@!X`'@`'@`'``'
+M?\!_P`!_P'_`
+M```.```!X``'@`X```
+M```/`!^`.`@P`#``,`!@`,`!@`,``P```P`#```
+M``^`/\`P8!@9R!OHR@;*!GX``,``_X`_@
+M`8`P`+``D`$8`1@!`/\`@P!`0!`8.#P
+M`/\`8(!@P#`8,!A@'^`8,!@8!@8!@8#`_X``
+M#\`08`@(`!@```8`!@```8``@`#`@$`/@```
+M``#_`'`8,!@8!@8!@8!@8!@8!@8$!A@/X`
+M`'_`,$`P0#``,``P@#^`,(`P`#``,``P(#`@?^``
+M?\`P0#!`,``P`#`/X`P@#``,``P`#``,`!X```/
+MP!!@(`@```8`!@```8?!@8!@,`88`^``/#P
+M8!@8!@8!@8'_@8!@8!@8!@8!@\/``'X`
+M``8`!@```8`!@```8`!@```8`!@`?@``?@`8`
+M!@```8`!@```8`!@```8`!@```8`!@```0`.``P`/#@88!C
+M`8`;`!X`'@`?`!N``8X!AP#@\'P`#``
+M,``P`#``,``P`#``,``P`#`@,!_X`#@#@.!P
+MX'#@66!98%E@36!.8$Y@1!$8.3P`,!P8!P('@@
+M6!,($8@1R!#($@0.!`X$!@X#``#P`1P#`(!@
+M8!@8!@8!@8`@0#!`(`/``!_@##`,`P8#!@

svn commit: r267194 - in head/share/vt: . keymaps

2014-06-06 Thread Aleksandr Rybalko
Author: ray
Date: Fri Jun  6 21:58:27 2014
New Revision: 267194
URL: http://svnweb.freebsd.org/changeset/base/267194

Log:
  Add Ukranian vt(4) keymaps as an example.
  
  Sponsored by: The FreeBSD Foundation

Added:
  head/share/vt/keymaps/
  head/share/vt/keymaps/Makefile   (contents, props changed)
  head/share/vt/keymaps/ua.kbd   (contents, props changed)
  head/share/vt/keymaps/ua.shift.alt.kbd   (contents, props changed)
Modified:
  head/share/vt/Makefile

Modified: head/share/vt/Makefile
==
--- head/share/vt/Makefile  Fri Jun  6 21:45:14 2014(r267193)
+++ head/share/vt/Makefile  Fri Jun  6 21:58:27 2014(r267194)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
-SUBDIR= fonts
+SUBDIR= fonts keymaps
 
 .include bsd.subdir.mk

Added: head/share/vt/keymaps/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/vt/keymaps/Makefile  Fri Jun  6 21:58:27 2014
(r267194)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+FILES= ua.kbd ua.shift.alt.kbd
+
+FILESDIR= ${SHAREDIR}/vt/keymaps
+
+NO_OBJ=
+
+.include bsd.prog.mk

Added: head/share/vt/keymaps/ua.kbd
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/vt/keymaps/ua.kbdFri Jun  6 21:58:27 2014
(r267194)
@@ -0,0 +1,242 @@
+# $FreeBSD$
+# alt
+# scan   cntrl  altalt   cntrl lock
+# code  base   shift  cntrl  shift  altshift  cntrl  shift state
+# --
+  000   nopnopnopnopnopnopnopnop O
+  001   escescescescescescdebug  nop O
+  002   '1''!'nopnop'1''!'nopnop O
+  003   '2''@'nulnul'2'''nulnul O
+  004   '3''#'nopnop'3''/'nopnop O
+  005   '4''$'nopnop'4''$'nopnop O
+  006   '5''%'nopnop'5'':'nopnop O
+  007   '6''^'rs rs '6'','rs rs  O
+  008   '7'''nopnop'7''.'nopnop O
+  009   '8''*'nopnop'8'';'nopnop O
+  010   '9''('nopnop'9''?'nopnop O
+  011   '0'')'nopnop'0''%'nopnop O
+  012   '-''_'ns ns '-''_'ns ns  O
+  013   '=''+'nopnop'=''+'nopnop O
+  014   bs bs deldelbs bs deldel O
+  015   ht btab   nopnopbtab   btab   nopnop O
+  016   'q''Q'dc1dc110811049dc1dc1 C
+  017   'w''W'etbetb10941062etbetb C
+  018   'e''E'enqenq10911059enqenq C
+  019   'r''R'dc2dc210821050dc2dc2 C
+  020   't''T'dc4dc410771045dc4dc4 C
+  021   'y''Y'em em 10851053em em  C
+  022   'u''U'naknak10751043naknak C
+  023   'i''I'ht ht 10961064ht ht  C
+  024   'o''O'si si 10971065si si  C
+  025   'p''P'dledle10791047dledle C
+  026   '[''{'escesc10931061escesc O
+  027   ']''}'gs gs 103110981066 O
+  028   cr cr nl nl cr cr nl nl  O
+  029   lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl   O
+  030   'a''A'sohsoh10921060sohsoh C
+  031   's''S'dc3dc31110103010991067 C
+  032   'd''D'eoteot10741042eoteot C
+  033   'f''F'ackack10721040ackack C
+  034   'g''G'belbel10871055belbel C
+  035   'h''H'bs bs 10881056bs bs  C
+  036   'j''J'nl nl 10861054nl nl  C
+  037   'k''K'vt vt 10831051vt vt  C
+  038   'l''L'ff ff 10761044ff ff  C
+  039   ';'':'nopnop10781046nopnop O
+  040   '''''nopnop1108102811011069 O
+  041   '`''~'nopnop1169116811051025 O
+  042   lshift lshift lshift lshift lshift lshift lshift lshift  O
+  043   '\''|'fs fs '\''|'fs fs  O
+  044   'z''Z'subsub11031071subsub C
+  045   'x''X'cancan10951063cancan C
+  046   'c'

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

2014-06-03 Thread Aleksandr Rybalko
Author: ray
Date: Tue Jun  3 13:33:43 2014
New Revision: 267007
URL: http://svnweb.freebsd.org/changeset/base/267007

Log:
  Fix case when vt(4) started w/o driver assigned.
  o Always init locks and cv ASAP.
  o Initialize driver-independent parts even if driver probing fail.
  o Allow to call vt_upgrade anytime, for later loaded drivers.
  o New window flag VWF_READY, to track if window already initialized.
  Other updates:
  o Pass vd as a cookie for kbd_allocate.
  o Do not blank window on driver replacement.
  
  Tested by:hselasky (RPi), emaste(VGA, EFIFB, KMS), me
  
  MFC after:7 days
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hTue Jun  3 08:08:12 2014(r267006)
+++ head/sys/dev/vt/vt.hTue Jun  3 13:33:43 2014(r267007)
@@ -259,6 +259,7 @@ struct vt_window {
 #defineVWF_CONSOLE 0x8 /* Kernel message console window. */
 #defineVWF_VTYLOCK 0x10/* Prevent window switch. */
 #defineVWF_MOUSE_HIDE  0x20/* Disable mouse events processing. */
+#defineVWF_READY   0x40/* Window fully initialized. */
 #defineVWF_SWWAIT_REL  0x1 /* Program wait for VT acquire is done. 
*/
 #defineVWF_SWWAIT_ACQ  0x2 /* Program wait for VT release is done. 
*/
pid_tvw_pid;/* Terminal holding process */

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Tue Jun  3 08:08:12 2014(r267006)
+++ head/sys/dev/vt/vt_core.c   Tue Jun  3 13:33:43 2014(r267007)
@@ -120,9 +120,10 @@ VT_SYSCTL_INT(debug, 0, vt(9) debug lev
 VT_SYSCTL_INT(deadtimer, 15, Time to wait busy process in VT_PROCESS mode);
 VT_SYSCTL_INT(suspendswitch, 1, Switch to VT0 before suspend);
 
+static struct vt_devicevt_consdev;
 static unsigned int vt_unit = 0;
 static MALLOC_DEFINE(M_VT, vt, vt device);
-struct vt_device *main_vd = NULL;
+struct vt_device *main_vd = vt_consdev;
 
 /* Boot logo. */
 extern unsigned int vt_logo_width;
@@ -214,12 +215,14 @@ static void
 vt_update_static(void *dummy)
 {
 
-   if (main_vd != NULL) {
+   if (main_vd-vd_driver != NULL)
printf(VT: running with driver \%s\.\n,
main_vd-vd_driver-vd_name);
-   mtx_init(main_vd-vd_lock, vtdev, NULL, MTX_DEF);
-   cv_init(main_vd-vd_winswitch, vtwswt);
-   }
+   else
+   printf(VT: init without driver.\n);
+
+   mtx_init(main_vd-vd_lock, vtdev, NULL, MTX_DEF);
+   cv_init(main_vd-vd_winswitch, vtwswt);
 }
 
 static void
@@ -633,11 +636,9 @@ vt_allocate_keyboard(struct vt_device *v
keyboard_t  *k0, *k;
keyboard_info_t  ki;
 
-   idx0 = kbd_allocate(kbdmux, -1, (void *)vd-vd_keyboard,
-   vt_kbdevent, vd);
-   /* XXX: kb_token lost */
+   idx0 = kbd_allocate(kbdmux, -1, vd, vt_kbdevent, vd);
vd-vd_keyboard = idx0;
-   if (idx0 != -1) {
+   if (idx0 = 0) {
DPRINTF(20, %s: kbdmux allocated, idx = %d\n, __func__, idx0);
k0 = kbd_get_keyboard(idx0);
 
@@ -657,8 +658,11 @@ vt_allocate_keyboard(struct vt_device *v
}
} else {
DPRINTF(20, %s: no kbdmux allocated\n, __func__);
-   idx0 = kbd_allocate(*, -1, (void *)vd-vd_keyboard,
-   vt_kbdevent, vd);
+   idx0 = kbd_allocate(*, -1, vd, vt_kbdevent, vd);
+   if (idx0  0) {
+   DPRINTF(10, %s: No keyboard found.\n, __func__);
+   return (-1);
+   }
}
DPRINTF(20, %s: vd_keyboard = %d\n, __func__, vd-vd_keyboard);
 
@@ -970,15 +974,14 @@ vtterm_cnprobe(struct terminal *tm, stru
if (vtdbest == NULL) {
cp-cn_pri = CN_DEAD;
vd-vd_flags |= VDF_DEAD;
-   return;
+   } else {
+   vd-vd_driver = vtdbest;
+   cp-cn_pri = vd-vd_driver-vd_init(vd);
}
 
-   vd-vd_driver = vtdbest;
-
-   cp-cn_pri = vd-vd_driver-vd_init(vd);
+   /* Check if driver's vt_init return CN_DEAD. */
if (cp-cn_pri == CN_DEAD) {
vd-vd_flags |= VDF_DEAD;
-   return;
}
 
/* Initialize any early-boot keyboard drivers */
@@ -988,6 +991,7 @@ vtterm_cnprobe(struct terminal *tm, stru
vd-vd_windows[VT_CONSWINDOW] = vw;
sprintf(cp-cn_name, ttyv%r, VT_UNIT(vw));
 
+   /* Attach default font if not in TEXTMODE. */
if (!(vd-vd_flags  VDF_TEXTMODE))
vw-vw_font = vtfont_ref(vt_font_default);
 
@@ -995,12 +999,12 @@ vtterm_cnprobe(struct terminal *tm, stru
vt_winsize(vd, vw-vw_font, wsz);

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

2014-06-03 Thread Aleksandr Rybalko
On Thu, 22 May 2014 15:10:51 +0200
Hans Petter Selasky h...@selasky.org wrote:

 On 05/21/14 22:20, Hans Petter Selasky wrote:
  On 05/12/14 21:29, Aleksandr Rybalko wrote:
  Author: ray
  Date: Mon May 12 19:29:38 2014
  New Revision: 265927
  URL: http://svnweb.freebsd.org/changeset/base/265927
 
  Log:
 Update terminal sizes in any case when new vt(4) driver arrive.
 (Plus remove one unused newline)
 
 Sponsored by:The FreeBSD Foundation
 
  Modified:
 head/sys/dev/vt/vt_core.c
 
 
  This patch causes panic when booting the RPI-B:
 
  VT: initialize with new VT driver fb.
  panic: mtx_lock() of spin mutex (null) @
  /usr/img/freebsd/sys/dev/vt/vt_core.c:2037
  KDB: enter: panic
  [ thread pid 0 tid 10 ]
  Stopped at  $d: ldrbr15, [r15, r15, ror r15]!
 
  __mtx_lock_flags() at
  vt_resize() at vt_upgrade() at
  mi_startup() at mi_startup+0x11c
 
 
  --HPS
 
 
 This patch fixes it. Not sure if it is correct.

Idea is right, but I did it another way a bit :)
Fixed in r267007.

 
 --HPS
 
  diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
  index 39b9265..d85d5e8 100644
  --- a/sys/dev/vt/vt_core.c
  +++ b/sys/dev/vt/vt_core.c
  @@ -145,6 +145,7 @@ static int vt_late_window_switch(struct vt_window *);
   static int vt_proc_alive(struct vt_window *);
   static void vt_resize(struct vt_device *);
   static void vt_update_static(void *);
  +static void vt_upgrade_static(void *);
 
   SET_DECLARE(vt_drv_set, struct vt_driver);
 
  @@ -203,23 +204,28 @@ DATA_SET(cons_set, vt_consterm_consdev);
* Right after kmem is done to allow early drivers to use locking and 
  allocate
* memory.
*/
  -SYSINIT(vt_update_static, SI_SUB_KMEM, SI_ORDER_ANY, vt_update_static,
  -vt_consdev);
  +SYSINIT(vt_init_1, SI_SUB_KMEM, SI_ORDER_ANY, vt_update_static, NULL);
   /* Delay until all devices attached, to not waste time. */
  -SYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, vt_upgrade,
  -vt_consdev);
  +SYSINIT(vt_init_2, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, 
  vt_upgrade_static, NULL);
 
   /* Initialize locks/mem depended members. */
   static void
   vt_update_static(void *dummy)
   {
  +   if (main_vd == NULL)
  +   return;
  +   printf(VT: running with driver \%s\.\n,
  +   main_vd-vd_driver-vd_name);
  +   mtx_init(main_vd-vd_lock, vtdev, NULL, MTX_DEF);
  +   cv_init(main_vd-vd_winswitch, vtwswt);
  +}
 
  -   if (main_vd != NULL) {
  -   printf(VT: running with driver \%s\.\n,
  -   main_vd-vd_driver-vd_name);
  -   mtx_init(main_vd-vd_lock, vtdev, NULL, MTX_DEF);
  -   cv_init(main_vd-vd_winswitch, vtwswt);
  -   }
  +static void
  +vt_upgrade_static(void *dummy)
  +{
  +   if (main_vd == NULL)
  +   return;
  +   vt_upgrade(main_vd);
   }
 
   static void
 
 
 
 
 


-- 
Aleksandr Rybalko r...@freebsd.org
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r266835 - head/sys/dev/vt/hw/xboxfb

2014-05-29 Thread Aleksandr Rybalko
Author: ray
Date: Thu May 29 12:29:58 2014
New Revision: 266835
URL: http://svnweb.freebsd.org/changeset/base/266835

Log:
  Remove driver as unused.
  
  MFC after:7 days
  Sponsored by: The FreeBSD Foundation

Deleted:
  head/sys/dev/vt/hw/xboxfb/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r266836 - head/usr.sbin/vidcontrol

2014-05-29 Thread Aleksandr Rybalko
Author: ray
Date: Thu May 29 13:09:48 2014
New Revision: 266836
URL: http://svnweb.freebsd.org/changeset/base/266836

Log:
  o Teach vidcontrol(1) how to load vt(4) font.
  o Teach vidcontrol(1) to distinct which virtual terminal system is running 
now.
  o Load vt(4) fonts from different location.
  o Add $FreeBSD$ tag for path.h.
  
  Tested by:Claude Buisson clbuis...@orange.fr
  
  MFC after:7 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/vidcontrol/path.h
  head/usr.sbin/vidcontrol/vidcontrol.c

Modified: head/usr.sbin/vidcontrol/path.h
==
--- head/usr.sbin/vidcontrol/path.h Thu May 29 12:29:58 2014
(r266835)
+++ head/usr.sbin/vidcontrol/path.h Thu May 29 13:09:48 2014
(r266836)
@@ -1,4 +1,8 @@
+/* $FreeBSD$ */
+
 #define KEYMAP_PATH/usr/share/syscons/keymaps/
 #define FONT_PATH  /usr/share/syscons/fonts/
 #define SCRNMAP_PATH   /usr/share/syscons/scrnmaps/
 
+#define VT_KEYMAP_PATH /usr/share/vt/keymaps/
+#define VT_FONT_PATH   /usr/share/vt/fonts/

Modified: head/usr.sbin/vidcontrol/vidcontrol.c
==
--- head/usr.sbin/vidcontrol/vidcontrol.c   Thu May 29 12:29:58 2014
(r266835)
+++ head/usr.sbin/vidcontrol/vidcontrol.c   Thu May 29 13:09:48 2014
(r266836)
@@ -45,9 +45,12 @@ static const char rcsid[] =
 #include unistd.h
 #include sys/fbio.h
 #include sys/consio.h
+#include sys/endian.h
 #include sys/errno.h
+#include sys/param.h
 #include sys/types.h
 #include sys/stat.h
+#include sys/sysctl.h
 #include path.h
 #include decode.h
 
@@ -78,6 +81,15 @@ static struct {
struct video_info   video_mode_info;
 } cur_info;
 
+struct vt4font_header {
+   uint8_t magic[8];
+   uint8_t width;
+   uint8_t height;
+   uint16_tpad;
+   uint32_tglyph_count;
+   uint32_tmap_count[4];
+} __packed;
+
 static int hex = 0;
 static int vesa_cols;
 static int vesa_rows;
@@ -86,6 +98,7 @@ static intcolors_changed;
 static int video_mode_changed;
 static int normal_fore_color, normal_back_color;
 static int revers_fore_color, revers_back_color;
+static int vt4_mode = 0;
 static struct  vid_info info;
 static struct  video_info new_mode_info;
 
@@ -115,7 +128,9 @@ init(void)
if (ioctl(0, CONS_GETINFO, cur_info.console_info) == -1)
errc(1, errno, getting console information);
 
-   if (ioctl(0, GIO_SCRNMAP, cur_info.screen_map) == -1)
+   /* vt(4) use unicode, so no screen mapping required. */
+   if (vt4_mode == 0 
+   ioctl(0, GIO_SCRNMAP, cur_info.screen_map) == -1)
errc(1, errno, getting screen map);
 
if (ioctl(0, CONS_GET, cur_info.video_mode_number) == -1)
@@ -153,7 +168,8 @@ revert(void)
fprintf(stderr, \033[=%dH, cur_info.console_info.mv_rev.fore);
fprintf(stderr, \033[=%dI, cur_info.console_info.mv_rev.back);
 
-   ioctl(0, PIO_SCRNMAP, cur_info.screen_map);
+   if (vt4_mode == 0)
+   ioctl(0, PIO_SCRNMAP, cur_info.screen_map);
 
if (cur_info.video_mode_number = M_VESA_BASE)
ioctl(0, _IO('V', cur_info.video_mode_number - M_VESA_BASE),
@@ -179,7 +195,15 @@ revert(void)
 static void
 usage(void)
 {
-   fprintf(stderr, %s\n%s\n%s\n%s\n%s\n,
+   if (vt4_mode)
+   fprintf(stderr, %s\n%s\n%s\n%s\n%s\n,
+usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [size] file],
+  [-g geometry] [-h size] [-i adapter | mode],
+  [-M char] [-m on | off] [-r foreground background],
+  [-S on | off] [-s number] [-T xterm | cons25] [-t N | off],
+  [mode] [foreground [background]] [show]);
+   else
+   fprintf(stderr, %s\n%s\n%s\n%s\n%s\n,
 usage: vidcontrol [-CdHLPpx] [-b color] [-c appearance] [-f [size] file],
   [-g geometry] [-h size] [-i adapter | mode] [-l 
screen_map],
   [-M char] [-m on | off] [-r foreground background],
@@ -188,6 +212,16 @@ usage(void)
exit(1);
 }
 
+/* Detect presence of vt(4). */
+static int
+is_vt4(void)
+{
+
+   if (sysctlbyname(kern.vt.deadtimer, NULL, NULL, NULL, 0) == 0)
+   return (1);
+
+   return (0);
+}
 
 /*
  * Retrieve the next argument from the command line (for options that require
@@ -349,6 +383,72 @@ fsize(FILE *file)
return -1;
 }
 
+static vfnt_map_t *
+load_vt4mappingtable(unsigned int nmappings, FILE *f)
+{
+   vfnt_map_t *t;
+   unsigned int i;
+
+   if (nmappings == 0)
+   return (NULL);
+
+   t = malloc(sizeof *t * nmappings);
+
+   if (fread(t, sizeof *t * nmappings, 1, f) != 1) {
+   perror(mappings);
+   exit(1);
+   }
+
+   for (i = 0; i  nmappings; i++) {
+

svn commit: r266838 - in head/share/vt: . fonts

2014-05-29 Thread Aleksandr Rybalko
Author: ray
Date: Thu May 29 13:41:07 2014
New Revision: 266838
URL: http://svnweb.freebsd.org/changeset/base/266838

Log:
  Add gallant vt(4) font as an example of font loading for vt(4).
  
  MFC after:7 days
  Sponsored by: The FreeBSD Foundation

Added:
  head/share/vt/
  head/share/vt/Makefile   (contents, props changed)
  head/share/vt/fonts/
  head/share/vt/fonts/Makefile   (contents, props changed)
  head/share/vt/fonts/gallant.fnt   (contents, props changed)

Added: head/share/vt/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/vt/Makefile  Thu May 29 13:41:07 2014(r266838)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+SUBDIR= fonts
+
+.include bsd.subdir.mk

Added: head/share/vt/fonts/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/vt/fonts/MakefileThu May 29 13:41:07 2014
(r266838)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+FILES= gallant.fnt
+
+FILESDIR= ${SHAREDIR}/vt/fonts
+
+NO_OBJ=
+
+.include bsd.prog.mk

Added: head/share/vt/fonts/gallant.fnt
==
Binary file. No diff available.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r266839 - head/usr.sbin/kbdcontrol

2014-05-29 Thread Aleksandr Rybalko
Author: ray
Date: Thu May 29 14:39:25 2014
New Revision: 266839
URL: http://svnweb.freebsd.org/changeset/base/266839

Log:
  Enable kbdcontrol(1) to use maps from vt(4) keymaps dir /usr/share/vt/keymaps
  if vt(4) is present.
  
  MFC after:7 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/kbdcontrol/kbdcontrol.c
  head/usr.sbin/kbdcontrol/path.h

Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c
==
--- head/usr.sbin/kbdcontrol/kbdcontrol.c   Thu May 29 13:41:07 2014
(r266838)
+++ head/usr.sbin/kbdcontrol/kbdcontrol.c   Thu May 29 14:39:25 2014
(r266839)
@@ -38,6 +38,7 @@ __FBSDID($FreeBSD$);
 #include fcntl.h
 #include sys/kbio.h
 #include sys/consio.h
+#include sys/sysctl.h
 #include path.h
 #include lex.h
 
@@ -141,6 +142,17 @@ static voidset_keyrates(char *opt);
 static voidshow_kbd_info(void);
 static voidusage(void) __dead2;
 
+/* Detect presence of vt(4). */
+static int
+is_vt4(void)
+{
+
+   if (sysctlbyname(kern.vt.deadtimer, NULL, NULL, NULL, 0) == 0)
+   return (1);
+
+   return (0);
+}
+
 static char *
 nextarg(int ac, char **av, int *indp, int oc)
 {
@@ -785,10 +797,13 @@ load_keymap(char *opt, int dumponly)
FILE*fd;
int i, j;
char*name, *cp;
-   charblank[] = , keymap_path[] = KEYMAP_PATH, dotkbd[] = .kbd;
+   charblank[] = , keymap_path[] = KEYMAP_PATH;
+   charvt_keymap_path[] = VT_KEYMAP_PATH, dotkbd[] = .kbd;
char*prefix[]  = {blank, blank, keymap_path, NULL};
char*postfix[] = {blank, dotkbd, NULL};
 
+   if (is_vt4())
+   prefix[2] = vt_keymap_path;
cp = getenv(KEYMAP_PATH);
if (cp != NULL)
asprintf((prefix[0]), %s/, cp);

Modified: head/usr.sbin/kbdcontrol/path.h
==
--- head/usr.sbin/kbdcontrol/path.h Thu May 29 13:41:07 2014
(r266838)
+++ head/usr.sbin/kbdcontrol/path.h Thu May 29 14:39:25 2014
(r266839)
@@ -1,4 +1,8 @@
+/* $FreeBSD$ */
+
 #define KEYMAP_PATH/usr/share/syscons/keymaps/
 #define FONT_PATH  /usr/share/syscons/fonts/
 #define SCRNMAP_PATH   /usr/share/syscons/scrnmaps/
 
+#define VT_KEYMAP_PATH /usr/share/vt/keymaps/
+#define VT_FONT_PATH   /usr/share/vt/fonts/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r266840 - head/share

2014-05-29 Thread Aleksandr Rybalko
Author: ray
Date: Thu May 29 14:42:26 2014
New Revision: 266840
URL: http://svnweb.freebsd.org/changeset/base/266840

Log:
  Revert r266838 to not store fonts as binary file.
  
  Sponsored by: The FreeBSD Foundation

Modified:
Directory Properties:
  head/share/   (props changed)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r266841 - head/share/vt/fonts

2014-05-29 Thread Aleksandr Rybalko
Author: ray
Date: Thu May 29 14:51:52 2014
New Revision: 266841
URL: http://svnweb.freebsd.org/changeset/base/266841

Log:
  Add gallant vt(4) font as an example of font loading for vt(4).
  
  MFC after:7 days
  Sponsored by: The FreeBSD Foundation

Added:
  head/share/vt/fonts/gallant.fnt.uu   (contents, props changed)
Deleted:
  head/share/vt/fonts/gallant.fnt
Modified:
  head/share/vt/fonts/Makefile

Modified: head/share/vt/fonts/Makefile
==
--- head/share/vt/fonts/MakefileThu May 29 14:42:26 2014
(r266840)
+++ head/share/vt/fonts/MakefileThu May 29 14:51:52 2014
(r266841)
@@ -2,8 +2,12 @@
 
 FILES= gallant.fnt
 
-FILESDIR= ${SHAREDIR}/vt/fonts
+CLEANFILES+=   ${FILES}
 
-NO_OBJ=
+.SUFFIXES: .uu
+.uu:
+   uudecode  ${.IMPSRC}
+
+FILESDIR=  ${SHAREDIR}/vt/fonts
 
 .include bsd.prog.mk

Added: head/share/vt/fonts/gallant.fnt.uu
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/vt/fonts/gallant.fnt.uu  Thu May 29 14:51:52 2014
(r266841)
@@ -0,0 +1,192 @@
+# $FreeBSD$
+begin 644 gallant.fnt
+M5D9.5#`P,#(,%@``OP(`
+M`8`!@```8`
+M!@```8`!@```8```8`!@```!F`8`9@!F`8`9
+M@S`#,`,P!F`?\!_P
+M#,`,P!F`8!_P'_`,P!F`8`!^`/\!FX9@9@`^
+M`!^`!\`8`9@9F!_P#^`!@```#A@1,!$P$6`.8`#``,`
+M!@`,``P``:(#(@,B!AP```!P`/@!C`,`8P`^`'@`^
+M`'`8V!AX'`88`_X!Y@```,`!X`'@```8`#``8`!``
+M``#``8`#@`,`!P```8`!@`
+M``8`!P`#``.``8``P```,``8`!P`#``.``8`!@```8`
+M!@`.``P`'``8`#\`!@!F8';@8``
+M`!F`=N!F8`8`#P```8`!@``'_@
+M?^```8`!@`
+M#```!X`!@```P```0``!_X'_@
+M```,
+M`!X`'@`,```P`#``8`!@`,``P```P`#``8`!@`
+M,``P``'``^`$8`0P##`,,`PP##`,,`PP##`,(`8
+M@!\`#@(`!@`.`!X`-@```8`!@```8`!@```8`
+M!@`_P```'P`_@'`0,``P`#``,`!@`,`!@`,`!@`,!_
+MX'_@```/@!_`(.!`8`!@`.`'P`_``.``8`!@0!@0#^`
+M'P``X`#@`6`!8`)@`F`$8`1@`/^!_X```8`!
+M@```#\`/P!``$``@`#^`,``X`!@```8$!@8`PP!^`
+M```'``P```P`#``8`!G@_`.!@8!@8!P0#^`'P``
+M`!_@/^!@0`!``,``@```8`!``$``P```(`!@`$
+M#P`1@##`,,`PP!B`#0```L`$8`PP##`,,`8@`\`
+M```/@!'`(.!@8!@8!PX#]@'F``8`#``,`!@``/```
+M```,`!X`'@`,```,`!X`'@`,
+M#```!X`#```#```!X`!@```P`
+M``0``!P``'@!X`'@`'@`'``'
+M?\!_P`!_P'_`
+M```.```!X``'@`X```
+M```/`!^`.`@P`#``,`!@`,`!@`,``P```P`#```
+M``^`/\`P8!@9R!OHR@;*!GX``,``_X`_@
+M`8`P`+``D`$8`1@!`/\`@P!`0!`8.#P
+M`/\`8(!@P#`8,!A@'^`8,!@8!@8!@8#`_X``
+M#\`08`@(`!@```8`!@```8``@`#`@$`/@```
+M``#_`'`8,!@8!@8!@8!@8!@8!@8$!A@/X`
+M`'_`,$`P0#``,``P@#^`,(`P`#``,``P(#`@?^``
+M?\`P0#!`,``P`#`/X`P@#``,``P`#``,`!X```/
+MP!!@(`@```8`!@```8?!@8!@,`88`^``/#P
+M8!@8!@8!@8'_@8!@8!@8!@8!@\/``'X`
+M``8`!@```8`!@```8`!@```8`!@`?@``?@`8`
+M!@```8`!@```8`!@```8`!@```8`!@```0`.``P`/#@88!C
+M`8`;`!X`'@`?`!N``8X!AP#@\'P`#``
+M,``P`#``,``P`#``,``P`#`@,!_X`#@#@.!P
+MX'#@66!98%E@36!.8$Y@1!$8.3P`,!P8!P('@@
+M6!,($8@1R!#($@0.!`X$!@X#``#P`1P#`(!@
+M8!@8!@8!@8`@0#!`(`/``!_@##`,`P8#!@
+M,,`W@#``,``P`#``,``P`'@```\`$`@P!@8!@
+M8!@8!@8!@,$`X0!^`#@`?`.0```_P!A@#`8,!@P`
+M?P!\`X`9P!C@'`8.#P``?X#!@8!@('``/``
+M``X$!@0!@P'^``'_@1B```8`!@```8`
+M!@```8`!@```8`'X``\'!@(`@8!@(`@8!@
+M(`@8!@('!`/\`?@`#@X!`,(`P@#`0`9`!D`
+M#``.``X`!``$``0``/[P9B!F(8@=B!W0#-`-T`[
+MP#N`8`9@!F`8``\'!@(#!`.(`8@`T`!@```L`
+M$8`1P#`0#@\`#P`@,$`8@!B`#0```8`!@`
+M``8`!@```\``#_@(,``P```8`#``,`!@```P`
+M#``8`!@@/^?`!\```8`!@```8`!@```8`!@`
+M``8`!\`'P```8`!@`#``,``8`!@`#``,``8``P`#```
+M`8``P`#```!\`'P`#``,``P`#``,``P`#``,``P`#``,
+M`'P`?`0`#@`;`#`8,``

svn commit: r266539 - head/usr.bin/lock

2014-05-22 Thread Aleksandr Rybalko
Author: ray
Date: Thu May 22 09:28:36 2014
New Revision: 266539
URL: http://svnweb.freebsd.org/changeset/base/266539

Log:
  Rollback r266496.
  Different meaning of flags for lock(1) and vidcontrol(1) confuse me.
  
  Pointy hat to:ray
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/lock/lock.c

Modified: head/usr.bin/lock/lock.c
==
--- head/usr.bin/lock/lock.cThu May 22 07:27:04 2014(r266538)
+++ head/usr.bin/lock/lock.cThu May 22 09:28:36 2014(r266539)
@@ -121,7 +121,7 @@ main(int argc, char **argv)
no_timeout = 1;
break;
case 'v':
-   vtylock = 0x2;
+   vtylock = 1;
break;
case '?':
default:
@@ -193,7 +193,7 @@ main(int argc, char **argv)
(void)tcsetattr(0, TCSADRAIN|TCSASOFT, tty);
err(1, locking vty);
}
-   vtyunlock = 0x1;
+   vtyunlock = 0x2;
}
 
/* header info */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-22 Thread Aleksandr Rybalko
Author: ray
Date: Thu May 22 09:31:18 2014
New Revision: 266540
URL: http://svnweb.freebsd.org/changeset/base/266540

Log:
  Proper fix of VT_LOCKSWITCH ioctl.
  
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Thu May 22 09:28:36 2014(r266539)
+++ head/sys/dev/vt/vt_core.c   Thu May 22 09:31:18 2014(r266540)
@@ -1815,9 +1815,9 @@ skip_thunk:
case VT_LOCKSWITCH:
/* TODO: Check current state, switching can be in progress. */
if ((*(int *)data) == 0x01)
-   vw-vw_flags = ~VWF_VTYLOCK;
-   else if ((*(int *)data) == 0x02)
vw-vw_flags |= VWF_VTYLOCK;
+   else if ((*(int *)data) == 0x02)
+   vw-vw_flags = ~VWF_VTYLOCK;
else
return (EINVAL);
return (0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-21 Thread Aleksandr Rybalko
Author: ray
Date: Wed May 21 11:15:38 2014
New Revision: 266495
URL: http://svnweb.freebsd.org/changeset/base/266495

Log:
  Fix tty locking.
  o Correct expected values for VT_LOCKSWITCH ioctl.
  o Check current window for locked state.
  
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Wed May 21 10:04:51 2014(r266494)
+++ head/sys/dev/vt/vt_core.c   Wed May 21 11:15:38 2014(r266495)
@@ -280,12 +280,12 @@ vt_proc_window_switch(struct vt_window *
struct vt_device *vd;
int ret;
 
-   if (vw-vw_flags  VWF_VTYLOCK)
-   return (EBUSY);
-
vd = vw-vw_device;
curvw = vd-vd_curwindow;
 
+   if (curvw-vw_flags  VWF_VTYLOCK)
+   return (EBUSY);
+
/* Ask current process permitions to switch away. */
if (curvw-vw_smode.mode == VT_PROCESS) {
DPRINTF(30, %s: VT_PROCESS , __func__);
@@ -1814,10 +1814,12 @@ skip_thunk:
return (0);
case VT_LOCKSWITCH:
/* TODO: Check current state, switching can be in progress. */
-   if ((*(int *)data)  0x01)
+   if ((*(int *)data) == 0x01)
+   vw-vw_flags = ~VWF_VTYLOCK;
+   else if ((*(int *)data) == 0x02)
vw-vw_flags |= VWF_VTYLOCK;
else
-   vw-vw_flags = ~VWF_VTYLOCK;
+   return (EINVAL);
return (0);
case VT_OPENQRY:
VT_LOCK(vd);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r266496 - head/usr.bin/lock

2014-05-21 Thread Aleksandr Rybalko
Author: ray
Date: Wed May 21 11:53:15 2014
New Revision: 266496
URL: http://svnweb.freebsd.org/changeset/base/266496

Log:
  Sync lock(1) on VT_LOCKSWITCH usage with syscons(4), vt(4) and vidcontrol(1).
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/lock/lock.c

Modified: head/usr.bin/lock/lock.c
==
--- head/usr.bin/lock/lock.cWed May 21 11:15:38 2014(r266495)
+++ head/usr.bin/lock/lock.cWed May 21 11:53:15 2014(r266496)
@@ -121,7 +121,7 @@ main(int argc, char **argv)
no_timeout = 1;
break;
case 'v':
-   vtylock = 1;
+   vtylock = 0x2;
break;
case '?':
default:
@@ -193,7 +193,7 @@ main(int argc, char **argv)
(void)tcsetattr(0, TCSADRAIN|TCSASOFT, tty);
err(1, locking vty);
}
-   vtyunlock = 0x2;
+   vtyunlock = 0x1;
}
 
/* header info */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r266010 - head/sys/arm/broadcom/bcm2835

2014-05-14 Thread Aleksandr Rybalko
Author: ray
Date: Wed May 14 11:15:48 2014
New Revision: 266010
URL: http://svnweb.freebsd.org/changeset/base/266010

Log:
  Remove extra newlines.
  No functional changes.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Wed May 14 09:13:33 2014
(r266009)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Wed May 14 11:15:48 2014
(r266010)
@@ -99,7 +99,6 @@ struct bcmsc_softc {
struct bcm_fb_config*   fb_config;
bus_addr_t  fb_config_phys;
struct intr_config_hook init_hook;
-
 };
 
 static int bcm_fb_probe(device_t);
@@ -167,14 +166,10 @@ bcm_fb_init(void *arg)
fb_config-xoffset, fb_config-yoffset,
fb_config-bpp);
 
-
device_printf(sc-dev, pitch %d, base 0x%08x, screen_size 
%d\n,
fb_config-pitch, fb_config-base,
fb_config-screen_size);
 
-
-
-
info = malloc(sizeof(struct fb_info), M_DEVBUF,
M_WAITOK | M_ZERO);
info-fb_name = device_get_nameunit(sc-dev);
@@ -199,8 +194,6 @@ bcm_fb_init(void *arg)
device_printf(sc-dev, Failed to attach fbd device\n);
return;
}
-
-
} else {
device_printf(sc-dev, Failed to set framebuffer info\n);
return;
@@ -273,7 +266,6 @@ fail:
return (ENXIO);
 }
 
-
 static void
 bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err)
 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-12 Thread Aleksandr Rybalko
Author: ray
Date: Mon May 12 19:29:38 2014
New Revision: 265927
URL: http://svnweb.freebsd.org/changeset/base/265927

Log:
  Update terminal sizes in any case when new vt(4) driver arrive.
  (Plus remove one unused newline)
  
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Mon May 12 19:11:39 2014(r265926)
+++ head/sys/dev/vt/vt_core.c   Mon May 12 19:29:38 2014(r265927)
@@ -1981,8 +1981,11 @@ vt_upgrade(struct vt_device *vd)
unsigned int i;
 
/* Device didn't pass vd_init() or already upgraded. */
-   if (vd-vd_flags  (VDF_ASYNC|VDF_DEAD))
+   if (vd-vd_flags  (VDF_ASYNC|VDF_DEAD)) {
+   /* Refill settings with new sizes anyway. */
+   vt_resize(vd);
return;
+   }
vd-vd_flags |= VDF_ASYNC;
 
for (i = 0; i  VT_MAXWINDOWS; i++) {
@@ -2019,7 +2022,6 @@ vt_upgrade(struct vt_device *vd)
 
/* Refill settings with new sizes. */
vt_resize(vd);
-
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265680 - head/sys/dev/vt/hw/fb

2014-05-08 Thread Aleksandr Rybalko
Author: ray
Date: Thu May  8 13:38:29 2014
New Revision: 265680
URL: http://svnweb.freebsd.org/changeset/base/265680

Log:
  No need to assign fields required and checked on probe.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/hw/fb/vt_early_fb.c

Modified: head/sys/dev/vt/hw/fb/vt_early_fb.c
==
--- head/sys/dev/vt/hw/fb/vt_early_fb.c Thu May  8 13:31:01 2014
(r265679)
+++ head/sys/dev/vt/hw/fb/vt_early_fb.c Thu May  8 13:38:29 2014
(r265680)
@@ -291,13 +291,6 @@ vt_efb_init(struct vt_device *vd)
/* Get pixel storage size. */
info-fb_bpp = info-fb_stride / info-fb_width * 8;
 
-   /*
-* Early FB driver work with static window buffer 80x25, so reduce
-* size to 640x480.
-*/
-   info-fb_width = VT_FB_DEFAULT_WIDTH;
-   info-fb_height = VT_FB_DEFAULT_HEIGHT;
-
 #ifdef FDT
vt_efb_initialize(info, node);
 #else
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-08 Thread Aleksandr Rybalko
Author: ray
Date: Thu May  8 13:46:36 2014
New Revision: 265681
URL: http://svnweb.freebsd.org/changeset/base/265681

Log:
  Fix scrollback.
  
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_buf.c
==
--- head/sys/dev/vt/vt_buf.cThu May  8 13:38:29 2014(r265680)
+++ head/sys/dev/vt/vt_buf.cThu May  8 13:46:36 2014(r265681)
@@ -448,8 +448,9 @@ vtbuf_grow(struct vt_buf *vb, const term
 
history_size = MAX(history_size, p-tp_row);
 
-   if (history_size  vb-vb_history_size || p-tp_col 
-   vb-vb_scr_size.tp_col) {
+   /* If new screen/history size bigger or buffer is VBF_STATIC. */
+   if ((history_size  vb-vb_history_size) || (p-tp_col 
+   vb-vb_scr_size.tp_col) || (vb-vb_flags  VBF_STATIC)) {
/* Allocate new buffer. */
bufsize = history_size * p-tp_col * sizeof(term_char_t);
new = malloc(bufsize, M_VTBUF, M_WAITOK | M_ZERO);

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Thu May  8 13:38:29 2014(r265680)
+++ head/sys/dev/vt/vt_core.c   Thu May  8 13:46:36 2014(r265681)
@@ -2016,6 +2016,10 @@ vt_upgrade(struct vt_device *vd)
/* Start timer when everything ready. */
callout_reset(vd-vd_timer, hz / VT_TIMERFREQ, vt_timer, vd);
VT_UNLOCK(vd);
+
+   /* Refill settings with new sizes. */
+   vt_resize(vd);
+
 }
 
 static void
@@ -2090,9 +2094,6 @@ vt_allocate(struct vt_driver *drv, void 
 
vt_upgrade(vd);
 
-   /* Refill settings with new sizes. */
-   vt_resize(vd);
-
 #ifdef DEV_SPLASH
if (vd-vd_flags  VDF_SPLASH)
vtterm_splash(vd);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-08 Thread Aleksandr Rybalko
Author: ray
Date: Thu May  8 22:52:05 2014
New Revision: 265719
URL: http://svnweb.freebsd.org/changeset/base/265719

Log:
  Hide debug messages under VT_DEBUG.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt.h
  head/sys/dev/vt/vt_consolectl.c
  head/sys/dev/vt/vt_sysmouse.c

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hThu May  8 21:12:39 2014(r265718)
+++ head/sys/dev/vt/vt.hThu May  8 22:52:05 2014(r265719)
@@ -78,7 +78,13 @@ one 'device sc' or 'device vt'
 #endif /* defined(SC_TWOBUTTON_MOUSE) || defined(VT_TWOBUTTON_MOUSE) */
 
 #defineSC_DRIVER_NAME  vt
+#ifdef VT_DEBUG
 #defineDPRINTF(_l, ...)if (vt_debug  (_l)) printf( 
__VA_ARGS__ )
+#define VT_CONSOLECTL_DEBUG
+#define VT_SYSMOUSE_DEBUG
+#else
+#defineDPRINTF(_l, ...)do {} while (0)
+#endif
 #defineISSIGVALID(sig) ((sig)  0  (sig)  NSIG)
 
 #defineVT_SYSCTL_INT(_name, _default, _descr)  
\

Modified: head/sys/dev/vt/vt_consolectl.c
==
--- head/sys/dev/vt/vt_consolectl.c Thu May  8 21:12:39 2014
(r265718)
+++ head/sys/dev/vt/vt_consolectl.c Thu May  8 22:52:05 2014
(r265719)
@@ -61,8 +61,10 @@ consolectl_ioctl(struct cdev *dev, u_lon
return (0);
}
default:
+#ifdef VT_CONSOLECTL_DEBUG
printf(consolectl: unknown ioctl: %c:%lx\n,
(char)IOCGROUP(cmd), IOCBASECMD(cmd));
+#endif
return (ENOIOCTL);
}
 }

Modified: head/sys/dev/vt/vt_sysmouse.c
==
--- head/sys/dev/vt/vt_sysmouse.c   Thu May  8 21:12:39 2014
(r265718)
+++ head/sys/dev/vt/vt_sysmouse.c   Thu May  8 22:52:05 2014
(r265719)
@@ -376,8 +376,10 @@ sysmouse_ioctl(struct cdev *dev, u_long 
case MOUSE_MOUSECHAR:
return (0);
default:
+#ifdef VT_SYSMOUSE_DEBUG
printf(sysmouse: unknown ioctl: %c:%lx\n,
(char)IOCGROUP(cmd), IOCBASECMD(cmd));
+#endif
return (ENOIOCTL);
}
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-07 Thread Aleksandr Rybalko
Author: ray
Date: Wed May  7 13:53:38 2014
New Revision: 265546
URL: http://svnweb.freebsd.org/changeset/base/265546

Log:
  Fix possible divide by zero.
  
  Spotted by:   many
  
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Wed May  7 12:48:18 2014(r265545)
+++ head/sys/dev/vt/vt_core.c   Wed May  7 13:53:38 2014(r265546)
@@ -678,6 +678,22 @@ vtterm_bell(struct terminal *tm)
 }
 
 static void
+vtterm_beep(struct terminal *tm, u_int param)
+{
+   u_int freq, period;
+
+   if ((param == 0) || ((param  0x) == 0)) {
+   vtterm_bell(tm);
+   return;
+   }
+
+   period = ((param  16)  0x) * hz / 1000;
+   freq = 1193182 / (param  0x);
+
+   sysbeep(freq, period);
+}
+
+static void
 vtterm_cursor(struct terminal *tm, const term_pos_t *p)
 {
struct vt_window *vw = tm-tm_softc;
@@ -1732,17 +1748,9 @@ skip_thunk:
td-td_frame-tf_rflags = ~PSL_IOPL;
 #endif
return (0);
-   case KDMKTONE: {/* sound the bell */
-   int freq, period;
-
-   freq = 1193182 / ((*(int*)data)  0x);
-   period = (((*(int*)data)16)  0x) * hz / 1000;
-   if(*(int*)data)
-   sysbeep(freq, period);
-   else
-   vtterm_bell(tm);
+   case KDMKTONE:  /* sound the bell */
+   vtterm_beep(tm, *(u_int *)data);
return (0);
-   }
case KIOCSOUND: /* make tone (*data) hz */
/* TODO */
return (0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-07 Thread Aleksandr Rybalko
On Wed, 7 May 2014 02:26:20 +1000 (EST)
Bruce Evans b...@optusnet.com.au wrote:

 On Tue, 6 May 2014, Matthew Fleming wrote:
 
  On Tue, May 6, 2014 at 6:52 AM, Aleksandr Rybalko r...@freebsd.org wrote:
  Log:
Implement KDMKTONE ioctl.
 
 Does it have to have to be even worse than syscons?
 
  Modified: head/sys/dev/vt/vt_core.c
  ==
  --- head/sys/dev/vt/vt_core.c   Tue May  6 13:46:36 2014(r265441)
  +++ head/sys/dev/vt/vt_core.c   Tue May  6 13:52:13 2014(r265442)
  @@ -1732,9 +1732,17 @@ skip_thunk:
  td-td_frame-tf_rflags = ~PSL_IOPL;
   #endif
  return (0);
  -   case KDMKTONE:  /* sound the bell */
  -   /* TODO */
  +   case KDMKTONE: {/* sound the bell */
  +   int freq, period;
 
 Style bugs: nested declarations, and misindented braces to make the rest
 not too ugly without using C++ declarations).  Syscons doesn't use any
 local variables here.
 
  +
  +   freq = 1193182 / ((*(int*)data)  0x);
 
 This is a period in nominal x86 i8254 timer cycles, not a frequency.
 1193182 would be a frequency.  This is very confusing.  The confusion
 is reduced a little in kbdcontrol and syscons by spelling the variable
 that is spelled 'period' here as 'duration'.
 
 The current bugs caused by this confusion seem to be:
 - the API has been broken.  The original API (from SCO?) apparently has
units of x86 timer cycles at the nominal frequency for (*(int*)data).
 - inverting the units fixed broken cases but broke working cases.  Broken
cases included:
- the default pitch of 800 Hz was actually a period of 800 x86 timer
  cycles.  Its frequency was actually 1193182 / 800 = 1493 Hz.  This
  affected the default in kbdcontrol and the kernel.
Working cases included anything that conformed to the API:
- kbdcontrol -b 1.800 used to give 800 Hz.  Now it gives 800 x86 timer
  cycles or 1493 Hz after a double inversion.
The inversion bug is more obvious at frequencies far away from
sqrt(1193182) = 1092 Hz.  800 is only moderately far away.
 - variable names are bad.  'pitch' is used for both frequencies and periods.
Variable names were not changed to match inversion of the API, though
sometimes the inversion made the variable name not so bad.
 
 syscons is better layered here.  It passes the undivided pitch
 ((*(int*)data)  0x) to sc_bell().  sc_bell() implements visual
 bell, which I use.  Even KDMKTONE gets turned into visual bell.  OTOH,
 KDMKSOUND makes a tone, which is actually always a sound.
 
 Note that the hard-coded frequency 1193182 is almost correct, although
 this is x86-specific and even x86 has a variable for the timer
 frequency.  It is part of the non-broken user API.  It is sysbeep()'s
 resposibility to convert from nominal x86 cycles to the actual hardware.
 This is easier to fix with the magic number not exposed to userland.
 Even x86 sysbeep() never bothered to do the conversion.  Conversion
 on x86 would only give a fix of a few ppm except on exotic hardware.
 
  This data comes from a user and can't be trusted.  This is a potential
  divide-by-zero.
 
 This bug has been implemented and executed before.  It was in at least
 the alpha version.  The alpha sysbeep() did an extra inversion, so the
 broken cases were reversed relative to the old i386 version, as above.
 Better yet, the inversion implemented the divide-by-zero panic, as above.
 
 I may misremember, but in unquoted parts of the diff I saw a check for
 the zero-divisor case.  This check is necessary to match the API.  0
 is an out-of-band value that must be translated to a default value.
 
 
  +   period = (((*(int*)data)16)  0x) * hz / 1000;
 
  This is signed shift which I can't recall if it's well-defined if the
  number is negative.  Using u_int would definitely be defined.
 
 Syscons does the same thing here.  The behaviour is implementation-
 defined IIRC.  In practice, negative values for the duration give a
 garbage result that is very far from negative.  E.g., a duration of
 -1 gives 0x after shifting.  This is independent of whether the
 sign bit gets shifted since the high bits are masked off.  But the
 result is garbage -- masking makes it positive.  Then scaling by hz /
 1000 makes 0x as large as possible for a duration instead of
 negative.  Not a problem.
 
 You can get worse problems from physically impossible frequencies like
 1 Hz and nearly-infinite Hz.  Not 0 or infinite Hz since 0 is translated
 or 1193182/0 is avoided in non-buggy versions.  1 Hz is physically
 impossible and not a problem.  Nearly-infinite Hz (a period of 0 or 1
 timer cycles) might damage the speaker, but in practice the speaker
 just can't keep up.  I think it averages out to not doing anything.
 
 Bruce

Hi Matthew! Hi Bruce!

Thank you very much for pointing that.
And sorry for my

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

2014-05-06 Thread Aleksandr Rybalko
On Mon, 5 May 2014 17:00:27 -0700
Steve Kargl s...@troutmask.apl.washington.edu wrote:

 On Mon, May 05, 2014 at 09:29:57PM +, Aleksandr Rybalko wrote:
  Author: ray
  Date: Mon May  5 21:29:56 2014
  New Revision: 265391
  URL: http://svnweb.freebsd.org/changeset/base/265391
  
  Log:
Define a new method for probing vt(4) driver before attach it at early 
  stage.

 
 Can you please commit a vt.4 manual page or stop referring to vt(4)
 in your commit messages?
 
 -- 
 Steve

Hi Steve,

sorry for large delay with man pages.
Currently work on manual pages in progress, with great help by wblock@.
And will come up shortly.

I'm understand how much important it is, and will try to do it ASAP.

Thanks!

WBW
-- 
Aleksandr Rybalko r...@freebsd.org
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-06 Thread Aleksandr Rybalko
Author: ray
Date: Tue May  6 13:52:13 2014
New Revision: 265442
URL: http://svnweb.freebsd.org/changeset/base/265442

Log:
  Implement KDMKTONE ioctl.
  
  Submitted by: Matthew D.Fuller fulle...@over-yonder.net (original version)
  MFC:  7 days
  PR:   kern/189170
  
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Tue May  6 13:46:36 2014(r265441)
+++ head/sys/dev/vt/vt_core.c   Tue May  6 13:52:13 2014(r265442)
@@ -1732,9 +1732,17 @@ skip_thunk:
td-td_frame-tf_rflags = ~PSL_IOPL;
 #endif
return (0);
-   case KDMKTONE:  /* sound the bell */
-   /* TODO */
+   case KDMKTONE: {/* sound the bell */
+   int freq, period;
+
+   freq = 1193182 / ((*(int*)data)  0x);
+   period = (((*(int*)data)16)  0x) * hz / 1000;
+   if(*(int*)data)
+   sysbeep(freq, period);
+   else
+   vtterm_bell(tm);
return (0);
+   }
case KIOCSOUND: /* make tone (*data) hz */
/* TODO */
return (0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-05 Thread Aleksandr Rybalko
Author: ray
Date: Mon May  5 21:29:56 2014
New Revision: 265391
URL: http://svnweb.freebsd.org/changeset/base/265391

Log:
  Define a new method for probing vt(4) driver before attach it at early stage.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt.h

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hMon May  5 20:55:37 2014(r265390)
+++ head/sys/dev/vt/vt.hMon May  5 21:29:56 2014(r265391)
@@ -277,6 +277,7 @@ struct vt_window {
  */
 
 typedef int vd_init_t(struct vt_device *vd);
+typedef int vd_probe_t(struct vt_device *vd);
 typedef void vd_postswitch_t(struct vt_device *vd);
 typedef void vd_blank_t(struct vt_device *vd, term_color_t color);
 typedef void vd_bitbltchr_t(struct vt_device *vd, const uint8_t *src,
@@ -295,7 +296,9 @@ typedef void vd_drawrect_t(struct vt_dev
 typedef void vd_setpixel_t(struct vt_device *, int, int, term_color_t);
 
 struct vt_driver {
+   char vd_name[16];
/* Console attachment. */
+   vd_probe_t  *vd_probe;
vd_init_t   *vd_init;
 
/* Drawing. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-05 Thread Aleksandr Rybalko
Author: ray
Date: Mon May  5 21:31:00 2014
New Revision: 265392
URL: http://svnweb.freebsd.org/changeset/base/265392

Log:
  Create dataset for vt(4) drivers.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt.h

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hMon May  5 21:29:56 2014(r265391)
+++ head/sys/dev/vt/vt.hMon May  5 21:31:00 2014(r265392)
@@ -394,6 +394,9 @@ TERMINAL_DECLARE_EARLY(driver ## _conste
 SYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY,  \
 vt_upgrade, driver ## _consdev)
 
+/* name argument is not used yet. */
+#define VT_DRIVER_DECLARE(name, drv) DATA_SET(vt_drv_set, drv)
+
 /*
  * Fonts.
  *
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-05 Thread Aleksandr Rybalko
Author: ray
Date: Mon May  5 21:44:53 2014
New Revision: 265395
URL: http://svnweb.freebsd.org/changeset/base/265395

Log:
  Set of updates to vt(4) core part.
  o Declare vt(4) drivers dataset.
  o Create single static structures for all early drivers.
  o Add vt(4) to be by default in the kernel consoles list.
  o Create one more sysinit point, to be able to initialize memory and lock
requirement of early drivers.
  o Implement early drivers select. (Only best available will be selected).
  o Fix one missed return (0) for VTYLOCK.
  o Improve locking for cases when one driver replace another.
  o Make driver replacement notification less debug-look-like.
  
  Minor spell fixes.
  
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Mon May  5 21:34:10 2014(r265394)
+++ head/sys/dev/vt/vt_core.c   Mon May  5 21:44:53 2014(r265395)
@@ -144,6 +144,83 @@ static int vt_window_switch(struct vt_wi
 static int vt_late_window_switch(struct vt_window *);
 static int vt_proc_alive(struct vt_window *);
 static void vt_resize(struct vt_device *);
+static void vt_update_static(void *);
+
+SET_DECLARE(vt_drv_set, struct vt_driver);
+
+#define _VTDEFH MAX(100, PIXEL_HEIGHT(VT_FB_DEFAULT_HEIGHT))
+#define _VTDEFW MAX(200, PIXEL_WIDTH(VT_FB_DEFAULT_WIDTH))
+
+static struct terminal vt_consterm;
+static struct vt_windowvt_conswindow;
+static struct vt_devicevt_consdev = {
+   .vd_driver = NULL,
+   .vd_softc = NULL,
+   .vd_flags = VDF_INVALID,
+   .vd_windows = { [VT_CONSWINDOW] =  vt_conswindow, },
+   .vd_curwindow = vt_conswindow,
+   .vd_markedwin = NULL,
+   .vd_kbstate = 0,
+};
+static term_char_t vt_constextbuf[(_VTDEFW) * (VBF_DEFAULT_HISTORY_SIZE)];
+static term_char_t *vt_constextbufrows[VBF_DEFAULT_HISTORY_SIZE];
+static struct vt_windowvt_conswindow = {
+   .vw_number = VT_CONSWINDOW,
+   .vw_flags = VWF_CONSOLE,
+   .vw_buf = {
+   .vb_buffer = vt_constextbuf,
+   .vb_rows = vt_constextbufrows,
+   .vb_history_size = VBF_DEFAULT_HISTORY_SIZE,
+   .vb_curroffset = 0,
+   .vb_roffset = 0,
+   .vb_flags = VBF_STATIC,
+   .vb_mark_start = {.tp_row = 0, .tp_col = 0,},
+   .vb_mark_end = {.tp_row = 0, .tp_col = 0,},
+   .vb_scr_size = {
+   .tp_row = _VTDEFH,
+   .tp_col = _VTDEFW,
+   },
+   },
+   .vw_device = vt_consdev,
+   .vw_terminal = vt_consterm,
+   .vw_kbdmode = K_XLATE,
+};
+static struct terminal vt_consterm = {
+   .tm_class = vt_termclass,
+   .tm_softc = vt_conswindow,
+   .tm_flags = TF_CONS,
+};
+static struct consdev vt_consterm_consdev = {
+   .cn_ops = termcn_cnops,
+   .cn_arg = vt_consterm,
+   .cn_name = ttyv0,
+};
+
+/* Add to set of consoles. */
+DATA_SET(cons_set, vt_consterm_consdev);
+
+/*
+ * Right after kmem is done to allow early drivers to use locking and allocate
+ * memory.
+ */
+SYSINIT(vt_update_static, SI_SUB_KMEM, SI_ORDER_ANY, vt_update_static,
+vt_consdev);
+/* Delay until all devices attached, to not waste time. */
+SYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, vt_upgrade,
+vt_consdev);
+
+/* Initialize locks/mem depended members. */
+static void
+vt_update_static(void *dummy)
+{
+
+   if (main_vd != NULL) {
+   printf(VT: running with driver \%s\.\n,
+   main_vd-vd_driver-vd_name);
+   mtx_init(main_vd-vd_lock, vtdev, NULL, MTX_DEF);
+   cv_init(main_vd-vd_winswitch, vtwswt);
+   }
+}
 
 static void
 vt_switch_timer(void *arg)
@@ -775,7 +852,7 @@ vt_flush(struct vt_device *vd)
if ((vd-vd_flags  (VDF_MOUSECURSOR|VDF_TEXTMODE)) ==
VDF_MOUSECURSOR) {
m = vt_default_mouse_pointer;
-   bpl = (m-w + 7)  3; /* Bytes per sorce line. */
+   bpl = (m-w + 7)  3; /* Bytes per source line. */
w = m-w;
h = m-h;
 
@@ -851,9 +928,11 @@ vtterm_splash(struct vt_device *vd)
 }
 #endif
 
+
 static void
 vtterm_cnprobe(struct terminal *tm, struct consdev *cp)
 {
+   struct vt_driver *vtd, **vtdlist, *vtdbest = NULL;
struct vt_window *vw = tm-tm_softc;
struct vt_device *vd = vw-vw_device;
struct winsize wsz;
@@ -862,6 +941,24 @@ vtterm_cnprobe(struct terminal *tm, stru
/* Initialization already done. */
return;
 
+   SET_FOREACH(vtdlist, vt_drv_set) {
+   vtd = *vtdlist;
+   if (vtd-vd_probe == NULL)
+   continue;
+   if (vtd-vd_probe(vd) == CN_DEAD)
+   continue;
+   if ((vtdbest == NULL) ||
+   

svn commit: r265397 - in head/sys/dev/vt/hw: efifb fb

2014-05-05 Thread Aleksandr Rybalko
Author: ray
Date: Mon May  5 21:48:19 2014
New Revision: 265397
URL: http://svnweb.freebsd.org/changeset/base/265397

Log:
  Switch fb and efifb drivers to use names and new vt(4) driver probe method.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/hw/efifb/efifb.c
  head/sys/dev/vt/hw/fb/vt_early_fb.c
  head/sys/dev/vt/hw/fb/vt_fb.c
  head/sys/dev/vt/hw/fb/vt_fb.h

Modified: head/sys/dev/vt/hw/efifb/efifb.c
==
--- head/sys/dev/vt/hw/efifb/efifb.cMon May  5 21:46:10 2014
(r265396)
+++ head/sys/dev/vt/hw/efifb/efifb.cMon May  5 21:48:19 2014
(r265397)
@@ -51,36 +51,58 @@ __FBSDID($FreeBSD$);
 #include dev/vt/hw/fb/vt_fb.h
 #include dev/vt/colors/vt_termcolors.h
 
-static vd_init_t vt_efb_init;
+static vd_init_t vt_efifb_init;
+static vd_probe_t vt_efifb_probe;
 
-static struct vt_driver vt_efb_driver = {
-   .vd_init = vt_efb_init,
+static struct vt_driver vt_efifb_driver = {
+   .vd_name = efifb,
+   .vd_probe = vt_efifb_probe,
+   .vd_init = vt_efifb_init,
.vd_blank = vt_fb_blank,
.vd_bitbltchr = vt_fb_bitbltchr,
+   .vd_maskbitbltchr = vt_fb_maskbitbltchr,
/* Better than VGA, but still generic driver. */
.vd_priority = VD_PRIORITY_GENERIC + 1,
 };
 
-static struct fb_info info;
-VT_CONSDEV_DECLARE(vt_efb_driver,
-MAX(80, PIXEL_WIDTH(VT_FB_DEFAULT_WIDTH)),
-MAX(25, PIXEL_HEIGHT(VT_FB_DEFAULT_HEIGHT)), info);
+static struct fb_info local_info;
+VT_DRIVER_DECLARE(vt_efifb, vt_efifb_driver);
 
 static int
-vt_efb_init(struct vt_device *vd)
+vt_efifb_probe(struct vt_device *vd)
 {
-   int depth, d, disable, i, len;
-   struct fb_info  *info;
+   int disabled;
struct efi_fb   *efifb;
caddr_t kmdp;
 
-   info = vd-vd_softc;
+   disabled = 0;
+   TUNABLE_INT_FETCH(hw.syscons.disable, disabled);
+   if (disabled != 0)
+   return (CN_DEAD);
 
-   disable = 0;
-   TUNABLE_INT_FETCH(hw.syscons.disable, disable);
-   if (disable != 0)
+   kmdp = preload_search_by_type(elf kernel);
+   if (kmdp == NULL)
+   kmdp = preload_search_by_type(elf64 kernel);
+   efifb = (struct efi_fb *)preload_search_info(kmdp,
+   MODINFO_METADATA | MODINFOMD_EFI_FB);
+   if (efifb == NULL)
return (CN_DEAD);
 
+   return (CN_INTERNAL);
+}
+
+static int
+vt_efifb_init(struct vt_device *vd)
+{
+   int depth, d, i, len;
+   struct fb_info  *info;
+   struct efi_fb   *efifb;
+   caddr_t kmdp;
+
+   info = vd-vd_softc;
+   if (info == NULL)
+   info = vd-vd_softc = (void *)local_info;
+
kmdp = preload_search_by_type(elf kernel);
if (kmdp == NULL)
kmdp = preload_search_by_type(elf64 kernel);
@@ -136,7 +158,8 @@ vt_efb_init(struct vt_device *vd)
fb_probe(info);
vt_fb_init(vd);
 
+   /* Clear the screen. */
+   vt_fb_blank(vd, TC_BLACK);
 
return (CN_INTERNAL);
 }
-

Modified: head/sys/dev/vt/hw/fb/vt_early_fb.c
==
--- head/sys/dev/vt/hw/fb/vt_early_fb.c Mon May  5 21:46:10 2014
(r265396)
+++ head/sys/dev/vt/hw/fb/vt_early_fb.c Mon May  5 21:48:19 2014
(r265397)
@@ -52,18 +52,19 @@ __FBSDID($FreeBSD$);
 #include dev/vt/colors/vt_termcolors.h
 
 static vd_init_t vt_efb_init;
+static vd_probe_t vt_efb_probe;
 
 static struct vt_driver vt_fb_early_driver = {
+   .vd_name = efb,
+   .vd_probe = vt_efb_probe,
.vd_init = vt_efb_init,
.vd_blank = vt_fb_blank,
.vd_bitbltchr = vt_fb_bitbltchr,
.vd_priority = VD_PRIORITY_GENERIC,
 };
 
-static struct fb_info info;
-VT_CONSDEV_DECLARE(vt_fb_early_driver,
-MAX(80, PIXEL_WIDTH(VT_FB_DEFAULT_WIDTH)),
-MAX(25, PIXEL_HEIGHT(VT_FB_DEFAULT_HEIGHT)), info);
+static struct fb_info local_info;
+VT_DRIVER_DECLARE(vt_efb, vt_fb_early_driver);
 
 static void
 #ifdef FDT
@@ -126,30 +127,62 @@ vt_efb_initialize(struct fb_info *info)
 }
 }
 
-static int
-vt_efb_init(struct vt_device *vd)
+static phandle_t
+vt_efb_get_fbnode()
 {
-   struct ofw_pci_register pciaddrs[8];
-   struct fb_info *info;
-   int i, len, n_pciaddrs;
phandle_t chosen, node;
ihandle_t stdout;
char type[64];
 
-   info = vd-vd_softc;
-
chosen = OF_finddevice(/chosen);
OF_getprop(chosen, stdout, stdout, sizeof(stdout));
node = OF_instance_to_package(stdout);
-   if (node == -1) {
-   /*
-* The /chosen/stdout does not exist try
-* using screen directly.
-*/
-   node = OF_finddevice(screen);
+   if (node != -1) {
+   /* The /chosen/stdout present. */
+   OF_getprop(node, device_type, type, 

svn commit: r265398 - head/sys/dev/vt/hw/ofwfb

2014-05-05 Thread Aleksandr Rybalko
Author: ray
Date: Mon May  5 21:49:31 2014
New Revision: 265398
URL: http://svnweb.freebsd.org/changeset/base/265398

Log:
  Add vt(4) driver name for ofwfb driver.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/hw/ofwfb/ofwfb.c

Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c
==
--- head/sys/dev/vt/hw/ofwfb/ofwfb.cMon May  5 21:48:19 2014
(r265397)
+++ head/sys/dev/vt/hw/ofwfb/ofwfb.cMon May  5 21:49:31 2014
(r265398)
@@ -63,6 +63,7 @@ static vd_blank_t ofwfb_blank;
 static vd_bitbltchr_t  ofwfb_bitbltchr;
 
 static const struct vt_driver vt_ofwfb_driver = {
+   .vd_name= ofwfb,
.vd_init= ofwfb_init,
.vd_blank   = ofwfb_blank,
.vd_bitbltchr   = ofwfb_bitbltchr,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265402 - head/sys/dev/vt/hw/vga

2014-05-05 Thread Aleksandr Rybalko
Author: ray
Date: Mon May  5 22:10:31 2014
New Revision: 265402
URL: http://svnweb.freebsd.org/changeset/base/265402

Log:
  Revert r264997 and r265026. It is not required anymore.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/hw/vga/vga.c

Modified: head/sys/dev/vt/hw/vga/vga.c
==
--- head/sys/dev/vt/hw/vga/vga.cMon May  5 22:03:08 2014
(r265401)
+++ head/sys/dev/vt/hw/vga/vga.cMon May  5 22:10:31 2014
(r265402)
@@ -45,10 +45,8 @@ __FBSDID($FreeBSD$);
 #if defined(__amd64__) || defined(__i386__)
 #include vm/vm.h
 #include vm/pmap.h
-#include machine/metadata.h
 #include machine/pmap.h
 #include machine/vmparam.h
-#include sys/linker.h
 #endif /* __amd64__ || __i386__ */
 
 struct vga_softc {
@@ -638,19 +636,6 @@ vga_init(struct vt_device *vd)
struct vga_softc *sc = vd-vd_softc;
int textmode = 0;
 
-#if defined(__amd64__)
-   /* Disable if EFI framebuffer present. Should be handled by priority
-* logic in vt(9), but this will do for now. XXX */
-
-   caddr_t kmdp, efifb;
-   kmdp = preload_search_by_type(elf kernel);
-   if (kmdp == NULL)
-   kmdp = preload_search_by_type(elf64 kernel);
-   efifb = preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_FB);
-   if (efifb != NULL)
-   return (CN_DEAD);
-#endif
-
 #if defined(__amd64__) || defined(__i386__)
sc-vga_fb_tag = X86_BUS_SPACE_MEM;
sc-vga_fb_handle = KERNBASE + VGA_MEM_BASE;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265403 - head/sys/dev/vt/hw/vga

2014-05-05 Thread Aleksandr Rybalko
Author: ray
Date: Mon May  5 22:12:46 2014
New Revision: 265403
URL: http://svnweb.freebsd.org/changeset/base/265403

Log:
  Switch vga drivers to use names and new vt(4) driver probe method.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/hw/vga/vga.c

Modified: head/sys/dev/vt/hw/vga/vga.c
==
--- head/sys/dev/vt/hw/vga/vga.cMon May  5 22:10:31 2014
(r265402)
+++ head/sys/dev/vt/hw/vga/vga.cMon May  5 22:12:46 2014
(r265403)
@@ -71,6 +71,7 @@ struct vga_softc {
 #defineVT_VGA_HEIGHT   480
 #defineVT_VGA_MEMSIZE  (VT_VGA_WIDTH * VT_VGA_HEIGHT / 8)
 
+static vd_probe_t  vga_probe;
 static vd_init_t   vga_init;
 static vd_blank_t  vga_blank;
 static vd_bitbltchr_t  vga_bitbltchr;
@@ -81,6 +82,8 @@ static vd_putchar_t   vga_putchar;
 static vd_postswitch_t vga_postswitch;
 
 static const struct vt_driver vt_vga_driver = {
+   .vd_name= vga,
+   .vd_probe   = vga_probe,
.vd_init= vga_init,
.vd_blank   = vga_blank,
.vd_bitbltchr   = vga_bitbltchr,
@@ -97,8 +100,7 @@ static const struct vt_driver vt_vga_dri
  * buffer is always big enough to support both.
  */
 static struct vga_softc vga_conssoftc;
-VT_CONSDEV_DECLARE(vt_vga_driver, MAX(80, PIXEL_WIDTH(VT_VGA_WIDTH)),
-MAX(25, PIXEL_HEIGHT(VT_VGA_HEIGHT)), vga_conssoftc);
+VT_DRIVER_DECLARE(vt_vga, vt_vga_driver);
 
 static inline void
 vga_setcolor(struct vt_device *vd, term_color_t color)
@@ -631,10 +633,22 @@ vga_initialize(struct vt_device *vd, int
 }
 
 static int
+vga_probe(struct vt_device *vd)
+{
+
+   return (CN_INTERNAL);
+}
+
+static int
 vga_init(struct vt_device *vd)
 {
-   struct vga_softc *sc = vd-vd_softc;
-   int textmode = 0;
+   struct vga_softc *sc;
+   int textmode;
+
+   if (vd-vd_softc == NULL)
+   vd-vd_softc = (void *)vga_conssoftc;
+   sc = vd-vd_softc;
+   textmode = 0;
 
 #if defined(__amd64__) || defined(__i386__)
sc-vga_fb_tag = X86_BUS_SPACE_MEM;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r264997 - head/sys/dev/vt/hw/vga

2014-04-27 Thread Aleksandr Rybalko
On Sun, 27 Apr 2014 02:19:53 + (UTC)
Nathan Whitehorn nwhiteh...@freebsd.org wrote:

 Author: nwhitehorn
 Date: Sun Apr 27 02:19:53 2014
 New Revision: 264997
 URL: http://svnweb.freebsd.org/changeset/base/264997
 
 Log:
   Disable vga if EFI framebuffer present. vt(9) should handle this
 internally based on efifb's higher priority, but it doesn't, and this
 at least lets us build a kernel that boots on both BIOS and EFI
 systems for now.
 
 Modified:
   head/sys/dev/vt/hw/vga/vga.c
 
 Modified: head/sys/dev/vt/hw/vga/vga.c
 ==
 --- head/sys/dev/vt/hw/vga/vga.c  Sun Apr 27 01:15:10
 2014  (r264996) +++ head/sys/dev/vt/hw/vga/vga.c  Sun Apr
 27 02:19:53 2014  (r264997) @@ -45,8 +45,10 @@ __FBSDID
 ($FreeBSD$);
  #if defined(__amd64__) || defined(__i386__)
  #include vm/vm.h
  #include vm/pmap.h
 +#include machine/metadata.h
  #include machine/pmap.h
  #include machine/vmparam.h
 +#include sys/linker.h
  #endif /* __amd64__ || __i386__ */
  
  struct vga_softc {
 @@ -637,6 +639,19 @@ vga_init(struct vt_device *vd)
   int textmode = 0;
  
  #if defined(__amd64__) || defined(__i386__)
 + /* Disable if EFI framebuffer present. Should be handled by
 priority
 +  * logic in vt(9), but this will do for now. XXX */
 +
 + caddr_t kmdp, efifb;
 + kmdp = preload_search_by_type(elf kernel);
 + if (kmdp == NULL)
 + kmdp = preload_search_by_type(elf64 kernel);
 + efifb = preload_search_info(kmdp, MODINFO_METADATA |
 MODINFOMD_EFI_FB);
 + if (efifb != NULL)
 + return (CN_DEAD);
 +#endif
 +
 +#if defined(__amd64__) || defined(__i386__)
   sc-vga_fb_tag = X86_BUS_SPACE_MEM;
   sc-vga_fb_handle = KERNBASE + VGA_MEM_BASE;
   sc-vga_reg_tag = X86_BUS_SPACE_IO;
 

I have patch for that, but it require testing:
http://people.freebsd.org/~ray/newcons/vt_early_select.patch

WBW
-- 
Aleksandr Rybalko r...@freebsd.org
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264611 - stable/10/sys/dev/vt

2014-04-17 Thread Aleksandr Rybalko
Author: ray
Date: Thu Apr 17 14:18:30 2014
New Revision: 264611
URL: http://svnweb.freebsd.org/changeset/base/264611

Log:
  MFC r264258
  
  Fix cursor color in reverse video mode.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/dev/vt/vt_core.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/vt/vt_core.c
==
--- stable/10/sys/dev/vt/vt_core.c  Thu Apr 17 14:16:02 2014
(r264610)
+++ stable/10/sys/dev/vt/vt_core.c  Thu Apr 17 14:18:30 2014
(r264611)
@@ -652,24 +652,26 @@ static inline void
 vt_determine_colors(term_char_t c, int cursor,
 term_color_t *fg, term_color_t *bg)
 {
+   term_color_t tmp;
+   int invert;
+
+   invert = 0;
 
*fg = TCHAR_FGCOLOR(c);
if (TCHAR_FORMAT(c)  TF_BOLD)
*fg = TCOLOR_LIGHT(*fg);
*bg = TCHAR_BGCOLOR(c);
 
-   if (TCHAR_FORMAT(c)  TF_REVERSE) {
-   term_color_t tmp;
+   if (TCHAR_FORMAT(c)  TF_REVERSE)
+   invert ^= 1;
+   if (cursor)
+   invert ^= 1;
 
+   if (invert) {
tmp = *fg;
*fg = *bg;
*bg = tmp;
}
-
-   if (cursor) {
-   *fg = *bg;
-   *bg = TC_WHITE;
-   }
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264612 - stable/9/sys/dev/vt

2014-04-17 Thread Aleksandr Rybalko
Author: ray
Date: Thu Apr 17 14:19:32 2014
New Revision: 264612
URL: http://svnweb.freebsd.org/changeset/base/264612

Log:
  MFC r264258
  
  Fix cursor color in reverse video mode.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/9/sys/dev/vt/vt_core.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/vt/vt_core.c
==
--- stable/9/sys/dev/vt/vt_core.c   Thu Apr 17 14:18:30 2014
(r264611)
+++ stable/9/sys/dev/vt/vt_core.c   Thu Apr 17 14:19:32 2014
(r264612)
@@ -652,24 +652,26 @@ static inline void
 vt_determine_colors(term_char_t c, int cursor,
 term_color_t *fg, term_color_t *bg)
 {
+   term_color_t tmp;
+   int invert;
+
+   invert = 0;
 
*fg = TCHAR_FGCOLOR(c);
if (TCHAR_FORMAT(c)  TF_BOLD)
*fg = TCOLOR_LIGHT(*fg);
*bg = TCHAR_BGCOLOR(c);
 
-   if (TCHAR_FORMAT(c)  TF_REVERSE) {
-   term_color_t tmp;
+   if (TCHAR_FORMAT(c)  TF_REVERSE)
+   invert ^= 1;
+   if (cursor)
+   invert ^= 1;
 
+   if (invert) {
tmp = *fg;
*fg = *bg;
*bg = tmp;
}
-
-   if (cursor) {
-   *fg = *bg;
-   *bg = TC_WHITE;
-   }
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264455 - in stable/10/sys: dev/vt kern

2014-04-14 Thread Aleksandr Rybalko
Author: ray
Date: Mon Apr 14 12:40:37 2014
New Revision: 264455
URL: http://svnweb.freebsd.org/changeset/base/264455

Log:
  MFC 264242,264244,264259
  
  Fix panic on load new driver while vt(4) is in VGA textmode.
  o Mute terminal while vt(4) driver change in progress.
  o Reset VDF_TEXTMODE before init new driver.
  o Assign default font, if new driver is not in TEXTMODE.
  o Do not update screen while driver changing.
  o Unmute terminal when done with driver replacement.
  o Move init fonts to early point.
  o Minor cleanup.
  o Do not fill screen, while muted. (kern/subr_terminal.c)
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/dev/vt/vt_core.c
  stable/10/sys/kern/subr_terminal.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/vt/vt_core.c
==
--- stable/10/sys/dev/vt/vt_core.c  Mon Apr 14 09:36:15 2014
(r264454)
+++ stable/10/sys/dev/vt/vt_core.c  Mon Apr 14 12:40:37 2014
(r264455)
@@ -705,8 +705,8 @@ vt_bitblt_char(struct vt_device *vd, str
 static void
 vt_flush(struct vt_device *vd)
 {
-   struct vt_window *vw = vd-vd_curwindow;
-   struct vt_font *vf = vw-vw_font;
+   struct vt_window *vw;
+   struct vt_font *vf;
struct vt_bufmask tmask;
unsigned int row, col;
term_rect_t tarea;
@@ -717,6 +717,13 @@ vt_flush(struct vt_device *vd)
int bpl, h, w;
 #endif
 
+   vw = vd-vd_curwindow;
+   if (vw == NULL)
+   return;
+   vf = vw-vw_font;
+   if (((vd-vd_flags  VDF_TEXTMODE) == 0)  (vf == NULL))
+   return;
+
if (vd-vd_flags  VDF_SPLASH || vw-vw_flags  VWF_BUSY)
return;
 
@@ -794,6 +801,7 @@ vt_timer(void *arg)
vd = arg;
/* Update screen if required. */
vt_flush(vd);
+
/* Schedule for next update. */
callout_schedule(vd-vd_timer, hz / VT_TIMERFREQ);
 }
@@ -1882,6 +1890,7 @@ vt_upgrade(struct vt_device *vd)
vt_window_switch, vw, SHUTDOWN_PRI_DEFAULT);
}
terminal_maketty(vw-vw_terminal, v%r, VT_UNIT(vw));
+
}
if (vd-vd_curwindow == NULL)
vd-vd_curwindow = vd-vd_windows[VT_CONSWINDOW];
@@ -1902,6 +1911,9 @@ vt_resize(struct vt_device *vd)
 
for (i = 0; i  VT_MAXWINDOWS; i++) {
vw = vd-vd_windows[i];
+   /* Assign default font to window, if not textmode. */
+   if (!(vd-vd_flags  VDF_TEXTMODE)  vw-vw_font == NULL)
+   vw-vw_font = vtfont_ref(vt_font_default);
/* Resize terminal windows */
vt_change_font(vw, vw-vw_font);
}
@@ -1933,9 +1945,21 @@ vt_allocate(struct vt_driver *drv, void 
if (drv-vd_maskbitbltchr == NULL)
drv-vd_maskbitbltchr = drv-vd_bitbltchr;
 
-   /* Stop vt_flush periodic task. */
-   if (vd-vd_curwindow != NULL)
+   if (vd-vd_flags  VDF_ASYNC) {
+   /* Stop vt_flush periodic task. */
callout_drain(vd-vd_timer);
+   /*
+* Mute current terminal until we done. vt_change_font (called
+* from vt_resize) will unmute it.
+*/
+   terminal_mute(vd-vd_curwindow-vw_terminal, 1);
+   }
+
+   /*
+* Reset VDF_TEXTMODE flag, driver who require that flag (vt_vga) will
+* set it.
+*/
+   vd-vd_flags = ~VDF_TEXTMODE;
 
vd-vd_driver = drv;
vd-vd_softc = softc;
@@ -1951,8 +1975,10 @@ vt_allocate(struct vt_driver *drv, void 
vtterm_splash(vd);
 #endif
 
-   if (vd-vd_curwindow != NULL)
+   if (vd-vd_flags  VDF_ASYNC) {
+   terminal_mute(vd-vd_curwindow-vw_terminal, 0);
callout_schedule(vd-vd_timer, hz / VT_TIMERFREQ);
+   }
 
termcn_cnregister(vd-vd_windows[VT_CONSWINDOW]-vw_terminal);
 

Modified: stable/10/sys/kern/subr_terminal.c
==
--- stable/10/sys/kern/subr_terminal.c  Mon Apr 14 09:36:15 2014
(r264454)
+++ stable/10/sys/kern/subr_terminal.c  Mon Apr 14 12:40:37 2014
(r264455)
@@ -208,7 +208,7 @@ terminal_set_winsize_blank(struct termin
teken_set_winsize(tm-tm_emulator, r.tr_end);
TERMINAL_UNLOCK(tm);
 
-   if (blank != 0)
+   if ((blank != 0)  !(tm-tm_flags  TF_MUTE))
tm-tm_class-tc_fill(tm, r, TCHAR_CREATE((teken_char_t)' ',
default_message));
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264456 - in stable/9/sys: dev/vt kern

2014-04-14 Thread Aleksandr Rybalko
Author: ray
Date: Mon Apr 14 12:49:18 2014
New Revision: 264456
URL: http://svnweb.freebsd.org/changeset/base/264456

Log:
  MFC 264242,264244,264259
  
  Fix panic on load new driver while vt(4) is in VGA textmode.
  o Mute terminal while vt(4) driver change in progress.
  o Reset VDF_TEXTMODE before init new driver.
  o Assign default font, if new driver is not in TEXTMODE.
  o Do not update screen while driver changing.
  o Unmute terminal when done with driver replacement.
  o Move init fonts to early point.
  o Minor cleanup.
  o Do not fill screen, while muted. (kern/subr_terminal.c)
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/9/sys/dev/vt/vt_core.c
  stable/9/sys/kern/subr_terminal.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/vt/vt_core.c
==
--- stable/9/sys/dev/vt/vt_core.c   Mon Apr 14 12:40:37 2014
(r264455)
+++ stable/9/sys/dev/vt/vt_core.c   Mon Apr 14 12:49:18 2014
(r264456)
@@ -705,8 +705,8 @@ vt_bitblt_char(struct vt_device *vd, str
 static void
 vt_flush(struct vt_device *vd)
 {
-   struct vt_window *vw = vd-vd_curwindow;
-   struct vt_font *vf = vw-vw_font;
+   struct vt_window *vw;
+   struct vt_font *vf;
struct vt_bufmask tmask;
unsigned int row, col;
term_rect_t tarea;
@@ -717,6 +717,13 @@ vt_flush(struct vt_device *vd)
int bpl, h, w;
 #endif
 
+   vw = vd-vd_curwindow;
+   if (vw == NULL)
+   return;
+   vf = vw-vw_font;
+   if (((vd-vd_flags  VDF_TEXTMODE) == 0)  (vf == NULL))
+   return;
+
if (vd-vd_flags  VDF_SPLASH || vw-vw_flags  VWF_BUSY)
return;
 
@@ -794,6 +801,7 @@ vt_timer(void *arg)
vd = arg;
/* Update screen if required. */
vt_flush(vd);
+
/* Schedule for next update. */
callout_schedule(vd-vd_timer, hz / VT_TIMERFREQ);
 }
@@ -1882,6 +1890,7 @@ vt_upgrade(struct vt_device *vd)
vt_window_switch, vw, SHUTDOWN_PRI_DEFAULT);
}
terminal_maketty(vw-vw_terminal, v%r, VT_UNIT(vw));
+
}
if (vd-vd_curwindow == NULL)
vd-vd_curwindow = vd-vd_windows[VT_CONSWINDOW];
@@ -1902,6 +1911,9 @@ vt_resize(struct vt_device *vd)
 
for (i = 0; i  VT_MAXWINDOWS; i++) {
vw = vd-vd_windows[i];
+   /* Assign default font to window, if not textmode. */
+   if (!(vd-vd_flags  VDF_TEXTMODE)  vw-vw_font == NULL)
+   vw-vw_font = vtfont_ref(vt_font_default);
/* Resize terminal windows */
vt_change_font(vw, vw-vw_font);
}
@@ -1933,9 +1945,21 @@ vt_allocate(struct vt_driver *drv, void 
if (drv-vd_maskbitbltchr == NULL)
drv-vd_maskbitbltchr = drv-vd_bitbltchr;
 
-   /* Stop vt_flush periodic task. */
-   if (vd-vd_curwindow != NULL)
+   if (vd-vd_flags  VDF_ASYNC) {
+   /* Stop vt_flush periodic task. */
callout_drain(vd-vd_timer);
+   /*
+* Mute current terminal until we done. vt_change_font (called
+* from vt_resize) will unmute it.
+*/
+   terminal_mute(vd-vd_curwindow-vw_terminal, 1);
+   }
+
+   /*
+* Reset VDF_TEXTMODE flag, driver who require that flag (vt_vga) will
+* set it.
+*/
+   vd-vd_flags = ~VDF_TEXTMODE;
 
vd-vd_driver = drv;
vd-vd_softc = softc;
@@ -1951,8 +1975,10 @@ vt_allocate(struct vt_driver *drv, void 
vtterm_splash(vd);
 #endif
 
-   if (vd-vd_curwindow != NULL)
+   if (vd-vd_flags  VDF_ASYNC) {
+   terminal_mute(vd-vd_curwindow-vw_terminal, 0);
callout_schedule(vd-vd_timer, hz / VT_TIMERFREQ);
+   }
 
termcn_cnregister(vd-vd_windows[VT_CONSWINDOW]-vw_terminal);
 

Modified: stable/9/sys/kern/subr_terminal.c
==
--- stable/9/sys/kern/subr_terminal.c   Mon Apr 14 12:40:37 2014
(r264455)
+++ stable/9/sys/kern/subr_terminal.c   Mon Apr 14 12:49:18 2014
(r264456)
@@ -208,7 +208,7 @@ terminal_set_winsize_blank(struct termin
teken_set_winsize(tm-tm_emulator, r.tr_end);
TERMINAL_UNLOCK(tm);
 
-   if (blank != 0)
+   if ((blank != 0)  !(tm-tm_flags  TF_MUTE))
tm-tm_class-tc_fill(tm, r, TCHAR_CREATE((teken_char_t)' ',
default_message));
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-04-08 Thread Aleksandr Rybalko
Author: ray
Date: Tue Apr  8 14:14:25 2014
New Revision: 264258
URL: http://svnweb.freebsd.org/changeset/base/264258

Log:
  Fix cursor color in reverse video mode.
  
  PR:   kern/188196
  Submitted by: Claude Buisson clbuis...@orange.fr (original version)
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Tue Apr  8 07:32:32 2014(r264257)
+++ head/sys/dev/vt/vt_core.c   Tue Apr  8 14:14:25 2014(r264258)
@@ -652,24 +652,26 @@ static inline void
 vt_determine_colors(term_char_t c, int cursor,
 term_color_t *fg, term_color_t *bg)
 {
+   term_color_t tmp;
+   int invert;
+
+   invert = 0;
 
*fg = TCHAR_FGCOLOR(c);
if (TCHAR_FORMAT(c)  TF_BOLD)
*fg = TCOLOR_LIGHT(*fg);
*bg = TCHAR_BGCOLOR(c);
 
-   if (TCHAR_FORMAT(c)  TF_REVERSE) {
-   term_color_t tmp;
+   if (TCHAR_FORMAT(c)  TF_REVERSE)
+   invert ^= 1;
+   if (cursor)
+   invert ^= 1;
 
+   if (invert) {
tmp = *fg;
*fg = *bg;
*bg = tmp;
}
-
-   if (cursor) {
-   *fg = *bg;
-   *bg = TC_WHITE;
-   }
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-04-08 Thread Aleksandr Rybalko
Author: ray
Date: Tue Apr  8 14:18:39 2014
New Revision: 264259
URL: http://svnweb.freebsd.org/changeset/base/264259

Log:
  Update to fix at r264244.
  o Unmute terminal when done with driver replacement.
  o Move init fonts to early point.
  o Minor cleanup.
  
  MFC after:6 days
  X-MFC-with:   r264244 r264242
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Tue Apr  8 14:14:25 2014(r264258)
+++ head/sys/dev/vt/vt_core.c   Tue Apr  8 14:18:39 2014(r264259)
@@ -720,9 +720,11 @@ vt_flush(struct vt_device *vd)
 #endif
 
vw = vd-vd_curwindow;
-   if (vw == NULL) return;
+   if (vw == NULL)
+   return;
vf = vw-vw_font;
-   if ((vf == NULL)  !(vd-vd_flags  VDF_TEXTMODE)) return;
+   if (((vd-vd_flags  VDF_TEXTMODE) == 0)  (vf == NULL))
+   return;
 
if (vd-vd_flags  VDF_SPLASH || vw-vw_flags  VWF_BUSY)
return;
@@ -1891,9 +1893,6 @@ vt_upgrade(struct vt_device *vd)
}
terminal_maketty(vw-vw_terminal, v%r, VT_UNIT(vw));
 
-   /* Assign default font to window, if not textmode. */
-   if (!(vd-vd_flags  VDF_TEXTMODE)  vw-vw_font == NULL)
-   vw-vw_font = vtfont_ref(vt_font_default);
}
if (vd-vd_curwindow == NULL)
vd-vd_curwindow = vd-vd_windows[VT_CONSWINDOW];
@@ -1914,6 +1913,9 @@ vt_resize(struct vt_device *vd)
 
for (i = 0; i  VT_MAXWINDOWS; i++) {
vw = vd-vd_windows[i];
+   /* Assign default font to window, if not textmode. */
+   if (!(vd-vd_flags  VDF_TEXTMODE)  vw-vw_font == NULL)
+   vw-vw_font = vtfont_ref(vt_font_default);
/* Resize terminal windows */
vt_change_font(vw, vw-vw_font);
}
@@ -1975,8 +1977,10 @@ vt_allocate(struct vt_driver *drv, void 
vtterm_splash(vd);
 #endif
 
-   if (vd-vd_flags  VDF_ASYNC)
+   if (vd-vd_flags  VDF_ASYNC) {
+   terminal_mute(vd-vd_curwindow-vw_terminal, 0);
callout_schedule(vd-vd_timer, hz / VT_TIMERFREQ);
+   }
 
termcn_cnregister(vd-vd_windows[VT_CONSWINDOW]-vw_terminal);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264242 - head/sys/kern

2014-04-07 Thread Aleksandr Rybalko
Author: ray
Date: Mon Apr  7 22:37:13 2014
New Revision: 264242
URL: http://svnweb.freebsd.org/changeset/base/264242

Log:
  Do not fill screen, while muted.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/subr_terminal.c

Modified: head/sys/kern/subr_terminal.c
==
--- head/sys/kern/subr_terminal.c   Mon Apr  7 21:28:21 2014
(r264241)
+++ head/sys/kern/subr_terminal.c   Mon Apr  7 22:37:13 2014
(r264242)
@@ -208,7 +208,7 @@ terminal_set_winsize_blank(struct termin
teken_set_winsize(tm-tm_emulator, r.tr_end);
TERMINAL_UNLOCK(tm);
 
-   if (blank != 0)
+   if ((blank != 0)  !(tm-tm_flags  TF_MUTE))
tm-tm_class-tc_fill(tm, r, TCHAR_CREATE((teken_char_t)' ',
default_message));
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-04-07 Thread Aleksandr Rybalko
Author: ray
Date: Mon Apr  7 22:49:41 2014
New Revision: 264244
URL: http://svnweb.freebsd.org/changeset/base/264244

Log:
  Fix panic on load new driver while vt(4) is in VGA textmode.
  o Mute terminal while vt(4) driver change in progress.
  o Reset VDF_TEXTMODE before init new driver.
  o Assign default font, if new driver is not in TEXTMODE.
  o Do not update screen while driver changing.
  
  Resolved by:  adrian
  Reported by:  tyler
  MFC after:7 days
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Mon Apr  7 22:40:29 2014(r264243)
+++ head/sys/dev/vt/vt_core.c   Mon Apr  7 22:49:41 2014(r264244)
@@ -705,8 +705,8 @@ vt_bitblt_char(struct vt_device *vd, str
 static void
 vt_flush(struct vt_device *vd)
 {
-   struct vt_window *vw = vd-vd_curwindow;
-   struct vt_font *vf = vw-vw_font;
+   struct vt_window *vw;
+   struct vt_font *vf;
struct vt_bufmask tmask;
unsigned int row, col;
term_rect_t tarea;
@@ -717,6 +717,11 @@ vt_flush(struct vt_device *vd)
int bpl, h, w;
 #endif
 
+   vw = vd-vd_curwindow;
+   if (vw == NULL) return;
+   vf = vw-vw_font;
+   if ((vf == NULL)  !(vd-vd_flags  VDF_TEXTMODE)) return;
+
if (vd-vd_flags  VDF_SPLASH || vw-vw_flags  VWF_BUSY)
return;
 
@@ -794,6 +799,7 @@ vt_timer(void *arg)
vd = arg;
/* Update screen if required. */
vt_flush(vd);
+
/* Schedule for next update. */
callout_schedule(vd-vd_timer, hz / VT_TIMERFREQ);
 }
@@ -1882,6 +1888,10 @@ vt_upgrade(struct vt_device *vd)
vt_window_switch, vw, SHUTDOWN_PRI_DEFAULT);
}
terminal_maketty(vw-vw_terminal, v%r, VT_UNIT(vw));
+
+   /* Assign default font to window, if not textmode. */
+   if (!(vd-vd_flags  VDF_TEXTMODE)  vw-vw_font == NULL)
+   vw-vw_font = vtfont_ref(vt_font_default);
}
if (vd-vd_curwindow == NULL)
vd-vd_curwindow = vd-vd_windows[VT_CONSWINDOW];
@@ -1933,9 +1943,21 @@ vt_allocate(struct vt_driver *drv, void 
if (drv-vd_maskbitbltchr == NULL)
drv-vd_maskbitbltchr = drv-vd_bitbltchr;
 
-   /* Stop vt_flush periodic task. */
-   if (vd-vd_curwindow != NULL)
+   if (vd-vd_flags  VDF_ASYNC) {
+   /* Stop vt_flush periodic task. */
callout_drain(vd-vd_timer);
+   /*
+* Mute current terminal until we done. vt_change_font (called
+* from vt_resize) will unmute it.
+*/
+   terminal_mute(vd-vd_curwindow-vw_terminal, 1);
+   }
+
+   /*
+* Reset VDF_TEXTMODE flag, driver who require that flag (vt_vga) will
+* set it.
+*/
+   vd-vd_flags = ~VDF_TEXTMODE;
 
vd-vd_driver = drv;
vd-vd_softc = softc;
@@ -1951,7 +1973,7 @@ vt_allocate(struct vt_driver *drv, void 
vtterm_splash(vd);
 #endif
 
-   if (vd-vd_curwindow != NULL)
+   if (vd-vd_flags  VDF_ASYNC)
callout_schedule(vd-vd_timer, hz / VT_TIMERFREQ);
 
termcn_cnregister(vd-vd_windows[VT_CONSWINDOW]-vw_terminal);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264112 - in stable/10/sys/dev/vt: . hw/vga

2014-04-04 Thread Aleksandr Rybalko
Author: ray
Date: Fri Apr  4 11:17:49 2014
New Revision: 264112
URL: http://svnweb.freebsd.org/changeset/base/264112

Log:
  MFC r263885
  
  o Add new vd_driver method to do bitblt with mask, named vd_maskbitbltchr.
  o Move vd_bitbltchr vga's driver method to vd_maskbitbltchr.
  o Implement new vd_bitbltchr method for vga driver. (It do single write for 8
pixels, have to be a bit faster).
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/dev/vt/hw/vga/vga.c
  stable/10/sys/dev/vt/vt.h
  stable/10/sys/dev/vt/vt_core.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/vt/hw/vga/vga.c
==
--- stable/10/sys/dev/vt/hw/vga/vga.c   Fri Apr  4 10:33:59 2014
(r264111)
+++ stable/10/sys/dev/vt/hw/vga/vga.c   Fri Apr  4 11:17:49 2014
(r264112)
@@ -74,6 +74,7 @@ struct vga_softc {
 static vd_init_t   vga_init;
 static vd_blank_t  vga_blank;
 static vd_bitbltchr_t  vga_bitbltchr;
+static vd_maskbitbltchr_t vga_maskbitbltchr;
 static vd_drawrect_t   vga_drawrect;
 static vd_setpixel_t   vga_setpixel;
 static vd_putchar_tvga_putchar;
@@ -83,6 +84,7 @@ static const struct vt_driver vt_vga_dri
.vd_init= vga_init,
.vd_blank   = vga_blank,
.vd_bitbltchr   = vga_bitbltchr,
+   .vd_maskbitbltchr = vga_maskbitbltchr,
.vd_drawrect= vga_drawrect,
.vd_setpixel= vga_setpixel,
.vd_putchar = vga_putchar,
@@ -204,6 +206,34 @@ vga_bitbltchr(struct vt_device *vd, cons
 int bpl, vt_axis_t top, vt_axis_t left, unsigned int width,
 unsigned int height, term_color_t fg, term_color_t bg)
 {
+   u_long dst, ldst;
+   int w;
+
+   /* Don't try to put off screen pixels */
+   if (((left + width)  VT_VGA_WIDTH) || ((top + height) 
+   VT_VGA_HEIGHT))
+   return;
+
+   dst = (VT_VGA_WIDTH * top + left) / 8;
+
+   for (; height  0; height--) {
+   ldst = dst;
+   for (w = width; w  0; w -= 8) {
+   vga_bitblt_put(vd, ldst, fg, *src);
+   vga_bitblt_put(vd, ldst, bg, ~*src);
+   ldst++;
+   src++;
+   }
+   dst += VT_VGA_WIDTH / 8;
+   }
+}
+
+/* Bitblt with mask support. Slow. */
+static void
+vga_maskbitbltchr(struct vt_device *vd, const uint8_t *src, const uint8_t 
*mask,
+int bpl, vt_axis_t top, vt_axis_t left, unsigned int width,
+unsigned int height, term_color_t fg, term_color_t bg)
+{
struct vga_softc *sc = vd-vd_softc;
u_long dst;
uint8_t shift;

Modified: stable/10/sys/dev/vt/vt.h
==
--- stable/10/sys/dev/vt/vt.h   Fri Apr  4 10:33:59 2014(r264111)
+++ stable/10/sys/dev/vt/vt.h   Fri Apr  4 11:17:49 2014(r264112)
@@ -282,6 +282,9 @@ typedef void vd_blank_t(struct vt_device
 typedef void vd_bitbltchr_t(struct vt_device *vd, const uint8_t *src,
 const uint8_t *mask, int bpl, vt_axis_t top, vt_axis_t left,
 unsigned int width, unsigned int height, term_color_t fg, term_color_t bg);
+typedef void vd_maskbitbltchr_t(struct vt_device *vd, const uint8_t *src,
+const uint8_t *mask, int bpl, vt_axis_t top, vt_axis_t left,
+unsigned int width, unsigned int height, term_color_t fg, term_color_t bg);
 typedef void vd_putchar_t(struct vt_device *vd, term_char_t,
 vt_axis_t top, vt_axis_t left, term_color_t fg, term_color_t bg);
 typedef int vd_fb_ioctl_t(struct vt_device *, u_long, caddr_t, struct thread 
*);
@@ -298,6 +301,7 @@ struct vt_driver {
/* Drawing. */
vd_blank_t  *vd_blank;
vd_bitbltchr_t  *vd_bitbltchr;
+   vd_maskbitbltchr_t *vd_maskbitbltchr;
vd_drawrect_t   *vd_drawrect;
vd_setpixel_t   *vd_setpixel;
 

Modified: stable/10/sys/dev/vt/vt_core.c
==
--- stable/10/sys/dev/vt/vt_core.c  Fri Apr  4 10:33:59 2014
(r264111)
+++ stable/10/sys/dev/vt/vt_core.c  Fri Apr  4 11:17:49 2014
(r264112)
@@ -775,7 +775,7 @@ vt_flush(struct vt_device *vd)
if ((vd-vd_my + m-h)  (size.tp_row * vf-vf_height))
h = (size.tp_row * vf-vf_height) - vd-vd_my - 1;
 
-   vd-vd_driver-vd_bitbltchr(vd, m-map, m-mask, bpl,
+   vd-vd_driver-vd_maskbitbltchr(vd, m-map, m-mask, bpl,
vd-vd_offset.tp_row + vd-vd_my,
vd-vd_offset.tp_col + vd-vd_mx,
w, h, TC_WHITE, TC_BLACK);
@@ -1930,6 +1930,8 @@ vt_allocate(struct vt_driver *drv, void 
printf(%s: Replace existing VT driver.\n, __func__);
}
vd = main_vd;
+   if (drv-vd_maskbitbltchr == NULL)
+   drv-vd_maskbitbltchr = drv-vd_bitbltchr;
 
/* Stop 

svn commit: r264113 - in stable/9/sys/dev/vt: . hw/vga

2014-04-04 Thread Aleksandr Rybalko
Author: ray
Date: Fri Apr  4 11:19:02 2014
New Revision: 264113
URL: http://svnweb.freebsd.org/changeset/base/264113

Log:
  MFC r263885
  
  o Add new vd_driver method to do bitblt with mask, named vd_maskbitbltchr.
  o Move vd_bitbltchr vga's driver method to vd_maskbitbltchr.
  o Implement new vd_bitbltchr method for vga driver. (It do single write for 8
pixels, have to be a bit faster).
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/9/sys/dev/vt/hw/vga/vga.c
  stable/9/sys/dev/vt/vt.h
  stable/9/sys/dev/vt/vt_core.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/vt/hw/vga/vga.c
==
--- stable/9/sys/dev/vt/hw/vga/vga.cFri Apr  4 11:17:49 2014
(r264112)
+++ stable/9/sys/dev/vt/hw/vga/vga.cFri Apr  4 11:19:02 2014
(r264113)
@@ -74,6 +74,7 @@ struct vga_softc {
 static vd_init_t   vga_init;
 static vd_blank_t  vga_blank;
 static vd_bitbltchr_t  vga_bitbltchr;
+static vd_maskbitbltchr_t vga_maskbitbltchr;
 static vd_drawrect_t   vga_drawrect;
 static vd_setpixel_t   vga_setpixel;
 static vd_putchar_tvga_putchar;
@@ -83,6 +84,7 @@ static const struct vt_driver vt_vga_dri
.vd_init= vga_init,
.vd_blank   = vga_blank,
.vd_bitbltchr   = vga_bitbltchr,
+   .vd_maskbitbltchr = vga_maskbitbltchr,
.vd_drawrect= vga_drawrect,
.vd_setpixel= vga_setpixel,
.vd_putchar = vga_putchar,
@@ -204,6 +206,34 @@ vga_bitbltchr(struct vt_device *vd, cons
 int bpl, vt_axis_t top, vt_axis_t left, unsigned int width,
 unsigned int height, term_color_t fg, term_color_t bg)
 {
+   u_long dst, ldst;
+   int w;
+
+   /* Don't try to put off screen pixels */
+   if (((left + width)  VT_VGA_WIDTH) || ((top + height) 
+   VT_VGA_HEIGHT))
+   return;
+
+   dst = (VT_VGA_WIDTH * top + left) / 8;
+
+   for (; height  0; height--) {
+   ldst = dst;
+   for (w = width; w  0; w -= 8) {
+   vga_bitblt_put(vd, ldst, fg, *src);
+   vga_bitblt_put(vd, ldst, bg, ~*src);
+   ldst++;
+   src++;
+   }
+   dst += VT_VGA_WIDTH / 8;
+   }
+}
+
+/* Bitblt with mask support. Slow. */
+static void
+vga_maskbitbltchr(struct vt_device *vd, const uint8_t *src, const uint8_t 
*mask,
+int bpl, vt_axis_t top, vt_axis_t left, unsigned int width,
+unsigned int height, term_color_t fg, term_color_t bg)
+{
struct vga_softc *sc = vd-vd_softc;
u_long dst;
uint8_t shift;

Modified: stable/9/sys/dev/vt/vt.h
==
--- stable/9/sys/dev/vt/vt.hFri Apr  4 11:17:49 2014(r264112)
+++ stable/9/sys/dev/vt/vt.hFri Apr  4 11:19:02 2014(r264113)
@@ -282,6 +282,9 @@ typedef void vd_blank_t(struct vt_device
 typedef void vd_bitbltchr_t(struct vt_device *vd, const uint8_t *src,
 const uint8_t *mask, int bpl, vt_axis_t top, vt_axis_t left,
 unsigned int width, unsigned int height, term_color_t fg, term_color_t bg);
+typedef void vd_maskbitbltchr_t(struct vt_device *vd, const uint8_t *src,
+const uint8_t *mask, int bpl, vt_axis_t top, vt_axis_t left,
+unsigned int width, unsigned int height, term_color_t fg, term_color_t bg);
 typedef void vd_putchar_t(struct vt_device *vd, term_char_t,
 vt_axis_t top, vt_axis_t left, term_color_t fg, term_color_t bg);
 typedef int vd_fb_ioctl_t(struct vt_device *, u_long, caddr_t, struct thread 
*);
@@ -298,6 +301,7 @@ struct vt_driver {
/* Drawing. */
vd_blank_t  *vd_blank;
vd_bitbltchr_t  *vd_bitbltchr;
+   vd_maskbitbltchr_t *vd_maskbitbltchr;
vd_drawrect_t   *vd_drawrect;
vd_setpixel_t   *vd_setpixel;
 

Modified: stable/9/sys/dev/vt/vt_core.c
==
--- stable/9/sys/dev/vt/vt_core.c   Fri Apr  4 11:17:49 2014
(r264112)
+++ stable/9/sys/dev/vt/vt_core.c   Fri Apr  4 11:19:02 2014
(r264113)
@@ -775,7 +775,7 @@ vt_flush(struct vt_device *vd)
if ((vd-vd_my + m-h)  (size.tp_row * vf-vf_height))
h = (size.tp_row * vf-vf_height) - vd-vd_my - 1;
 
-   vd-vd_driver-vd_bitbltchr(vd, m-map, m-mask, bpl,
+   vd-vd_driver-vd_maskbitbltchr(vd, m-map, m-mask, bpl,
vd-vd_offset.tp_row + vd-vd_my,
vd-vd_offset.tp_col + vd-vd_mx,
w, h, TC_WHITE, TC_BLACK);
@@ -1930,6 +1930,8 @@ vt_allocate(struct vt_driver *drv, void 
printf(%s: Replace existing VT driver.\n, __func__);
}
vd = main_vd;
+   if (drv-vd_maskbitbltchr == NULL)
+   drv-vd_maskbitbltchr = 

svn commit: r264071 - stable/10/sys/dev/vt

2014-04-03 Thread Aleksandr Rybalko
Author: ray
Date: Thu Apr  3 11:59:04 2014
New Revision: 264071
URL: http://svnweb.freebsd.org/changeset/base/264071

Log:
  MFC r263809
  
  Fix crash on resume in vt(9).
  Statically allocated terminal window have not initialized callout handler, so 
we
  have to initialize it even for existing window if it is console window.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/dev/vt/vt_core.c

Modified: stable/10/sys/dev/vt/vt_core.c
==
--- stable/10/sys/dev/vt/vt_core.c  Thu Apr  3 08:16:45 2014
(r264070)
+++ stable/10/sys/dev/vt/vt_core.c  Thu Apr  3 11:59:04 2014
(r264071)
@@ -1872,6 +1872,9 @@ vt_upgrade(struct vt_device *vd)
if (vw == NULL) {
/* New window. */
vw = vt_allocate_window(vd, i);
+   } else if (vw-vw_flags  VWF_CONSOLE) {
+   /* For existing console window. */
+   callout_init(vw-vw_proc_dead_timer, 0);
}
if (i == VT_CONSWINDOW) {
/* Console window. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264072 - stable/9/sys/dev/vt

2014-04-03 Thread Aleksandr Rybalko
Author: ray
Date: Thu Apr  3 12:03:30 2014
New Revision: 264072
URL: http://svnweb.freebsd.org/changeset/base/264072

Log:
  MFC r263809
  
  Fix crash on resume in vt(9).
  Statically allocated terminal window have not initialized callout handler, so 
we
  have to initialize it even for existing window if it is console window.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/9/sys/dev/vt/vt_core.c

Modified: stable/9/sys/dev/vt/vt_core.c
==
--- stable/9/sys/dev/vt/vt_core.c   Thu Apr  3 11:59:04 2014
(r264071)
+++ stable/9/sys/dev/vt/vt_core.c   Thu Apr  3 12:03:30 2014
(r264072)
@@ -1872,6 +1872,9 @@ vt_upgrade(struct vt_device *vd)
if (vw == NULL) {
/* New window. */
vw = vt_allocate_window(vd, i);
+   } else if (vw-vw_flags  VWF_CONSOLE) {
+   /* For existing console window. */
+   callout_init(vw-vw_proc_dead_timer, 0);
}
if (i == VT_CONSWINDOW) {
/* Console window. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r263885 - in head/sys/dev/vt: . hw/vga

2014-03-30 Thread Aleksandr Rybalko
On Sun, 30 Mar 2014 07:04:44 +
Alexey Dokuchaev da...@freebsd.org wrote:

 On Sun, Mar 30, 2014 at 12:35:23AM +0200, Aleksandr Rybalko wrote:
  vt(4) have to use bitblt like method which is able to do masked
  write, since mouse cursor have to left visible characters under
  itself. But masked bitblt quite expensive due to read from
  framebuffer to apply mask or due to VGA graphics mode problem
  (described here [1], lot of small read and writes which can't be
  well optimized).
  
  Characters can be drown with simple (not masked) method, so
  vd_bitbltchr used most frequently.
  Mouse cursor only one (at least vt(4) can care about one :) ). And
  currently mouse support only single consumer for masked method.
 
 I've always wondered why FreeBSD *ever* had this ugly
 look-we-can-make-it- like-in-wind0ze mouse pointer on the console.
 I've been always building kernel with SC_ALT_MOUSE_IMAGE; I'm really
 hoping (if this nonsense has to stay) there will be an option to
 completely disable it and all related code paths when vt(4)
 eventually replaces syscons(4).
 
 ./danfe

its name SC_NO_CUTPASTE for both syscons(4) and vt(4).

-- 
Aleksandr Rybalko r...@freebsd.org
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r263885 - in head/sys/dev/vt: . hw/vga

2014-03-29 Thread Aleksandr Rybalko
On Sat, 29 Mar 2014 09:18:03 -0700
Nathan Whitehorn nwhiteh...@freebsd.org wrote:

 On 03/28/14 15:04, Aleksandr Rybalko wrote:
  Author: ray
  Date: Fri Mar 28 22:04:27 2014
  New Revision: 263885
  URL: http://svnweb.freebsd.org/changeset/base/263885
 
  Log:
 o Add new vd_driver method to do bitblt with mask, named
  vd_maskbitbltchr. o Move vd_bitbltchr vga's driver method to
  vd_maskbitbltchr. o Implement new vd_bitbltchr method for vga
  driver. (It do single write for 8 pixels, have to be a bit faster).
 
 
 Can you describe what this does? From the commit message, it sounds
 like it might repair vt performance on cards with 8-bit framebuffers 
 generally, but I can't figure out the code.
 -Nathan
 

Hi Nathan!

np, it is result of our discussion with jhibbits@.

vt(4) have to use bitblt like method which is able to do masked write,
since mouse cursor have to left visible characters under itself.
But masked bitblt quite expensive due to read from framebuffer to apply
mask or due to VGA graphics mode problem (described here [1], lot of
small read and writes which can't be well optimized).

Characters can be drown with simple (not masked) method, so vd_bitbltchr
used most frequently.
Mouse cursor only one (at least vt(4) can care about one :) ). And
currently mouse support only single consumer for masked method.

I did both methods have same set of arguments, to not reimplement
vd_bitbltchr method for all drivers. And driver can implement only
vd_bitbltchr or both. W/o vd_maskbitbltchr, vd_bitbltchr will be used.

Currently only one driver implement both methods, it is vt_vga.
Its not masked method do write 8 pixels at once, but masked method
continue to use 1 bit at once.

Other drivers (f.e. vt_ofwfb) in TODO list.

Thanks!

[1]http://lists.freebsd.org/pipermail/freebsd-arch/2014-March/015108.html

WBW
-- 
Aleksandr Rybalko r...@freebsd.org
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r263873 - head/sys/conf

2014-03-28 Thread Aleksandr Rybalko
Author: ray
Date: Fri Mar 28 12:50:39 2014
New Revision: 263873
URL: http://svnweb.freebsd.org/changeset/base/263873

Log:
  Enable to build UEFI framebuffer driver for vt(4).
  It can be enabled by device vt_efifb in kernel config.
  
  Requested by: emaste
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri Mar 28 11:46:54 2014(r263872)
+++ head/sys/conf/files Fri Mar 28 12:50:39 2014(r263873)
@@ -2471,6 +2471,7 @@ dev/vr/if_vr.coptional vr pci
 dev/vt/colors/vt_termcolors.c  optional vt
 dev/vt/font/vt_font_default.c  optional vt
 dev/vt/font/vt_mouse_cursor.c  optional vt
+dev/vt/hw/efifb/efifb.coptional vt_efifb
 dev/vt/hw/fb/vt_fb.c   optional vt
 dev/vt/hw/vga/vga.coptional vt vt_vga
 dev/vt/logo/logo_freebsd.c optional vt splash
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


  1   2   3   >