pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/x11/mlterm Various fixes for wscons framebuffer:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2d5c9d58ac1d
branches:  trunk
changeset: 336798:2d5c9d58ac1d
user:      rin <rin%pkgsrc.org@localhost>
date:      Wed Jul 24 02:39:57 2019 +0000

description:
Various fixes for wscons framebuffer:

- Fix support for fbi_fboffset != 0
- Fix SEGV when using 8-bpp display on LP64 machine
- Add better handling for 24-bpp display

The problems have already been reported upstream:

https://bitbucket.org/arakiken/mlterm/pull-requests/5/fix-for-wscons-framebuffer/diff

Bump PKGREVISION.

diffstat:

 x11/mlterm/Makefile                                          |   4 +-
 x11/mlterm/distinfo                                          |   8 +-
 x11/mlterm/patches/patch-uitoolkit_fb_ui.h                   |  17 ++
 x11/mlterm/patches/patch-uitoolkit_fb_ui__display.c          |  33 ++++
 x11/mlterm/patches/patch-uitoolkit_fb_ui__display__freebsd.c |  27 +++
 x11/mlterm/patches/patch-uitoolkit_fb_ui__display__linux.c   |  27 +++
 x11/mlterm/patches/patch-uitoolkit_fb_ui__display__wscons.c  |  99 ++++++++++++
 x11/mlterm/patches/patch-uitoolkit_fb_ui__display__x68kgrf.c |  27 +++
 8 files changed, 239 insertions(+), 3 deletions(-)

diffs (287 lines):

diff -r 02a827fb1660 -r 2d5c9d58ac1d x11/mlterm/Makefile
--- a/x11/mlterm/Makefile       Tue Jul 23 22:58:46 2019 +0000
+++ b/x11/mlterm/Makefile       Wed Jul 24 02:39:57 2019 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.149 2019/07/21 22:26:02 wiz Exp $
+# $NetBSD: Makefile,v 1.150 2019/07/24 02:39:57 rin Exp $
 
 DISTNAME=      mlterm-3.8.8
-PKGREVISION=   2
+PKGREVISION=   3
 CATEGORIES=    x11
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=mlterm/}
 
diff -r 02a827fb1660 -r 2d5c9d58ac1d x11/mlterm/distinfo
--- a/x11/mlterm/distinfo       Tue Jul 23 22:58:46 2019 +0000
+++ b/x11/mlterm/distinfo       Wed Jul 24 02:39:57 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.77 2019/06/22 04:27:54 tsutsui Exp $
+$NetBSD: distinfo,v 1.78 2019/07/24 02:39:57 rin Exp $
 
 SHA1 (mlterm-3.8.8.tar.gz) = 54f40fa50214656ab70f592d5d58805b1dfdc1c6
 RMD160 (mlterm-3.8.8.tar.gz) = 9a7675a86999541b57742099a5e9eac8a539b580
@@ -6,4 +6,10 @@
 Size (mlterm-3.8.8.tar.gz) = 4035215 bytes
 SHA1 (patch-configure) = e95b426f028c9bcb9895e69bb85ce8450f78a8c8
 SHA1 (patch-etc_font-fb) = 03f0b2ecee20ef3201c8e4ce17f03ac90f657b00
+SHA1 (patch-uitoolkit_fb_ui.h) = 1178048c2c2354546c470b8c2199973507048447
+SHA1 (patch-uitoolkit_fb_ui__display.c) = 673a6621c3fe159b9beb4aa62286db02446415a9
+SHA1 (patch-uitoolkit_fb_ui__display__freebsd.c) = ea2a4bfb869c2eec510235a6f09d6356dff4c6d8
+SHA1 (patch-uitoolkit_fb_ui__display__linux.c) = 379572a5e66ffffb295ba34b00dfbb4dd237c818
+SHA1 (patch-uitoolkit_fb_ui__display__wscons.c) = 703958ee742834beddbb55927f2222d8eb01ed2e
+SHA1 (patch-uitoolkit_fb_ui__display__x68kgrf.c) = 3fadc190ecf3defc2527b77fa0b668cfb4cf2ab4
 SHA1 (patch-uitoolkit_ui__event__source.c) = 4cf872768491bc8da5fc080cfd3a50969324a162
diff -r 02a827fb1660 -r 2d5c9d58ac1d x11/mlterm/patches/patch-uitoolkit_fb_ui.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/mlterm/patches/patch-uitoolkit_fb_ui.h        Wed Jul 24 02:39:57 2019 +0000
@@ -0,0 +1,17 @@
+$ NetBSD $
+
+- Fix support for fbi_fboffset != 0
+
+Reported upstream:
+https://bitbucket.org/arakiken/mlterm/pull-requests/5/fix-for-wscons-framebuffer/diff
+
+--- uitoolkit/fb/ui.h  2019-07-24 10:51:04.187713603 +0900
++++ ../mlterm.patched/uitoolkit/fb/ui.h        2019-07-24 09:59:19.091595937 +0900
+@@ -44,6 +44,7 @@ typedef struct {
+ 
+   int fb_fd;
+   unsigned char *fb;
++  unsigned char *fb_base;
+   size_t smem_len;
+   unsigned int line_length;
+   unsigned int xoffset;
diff -r 02a827fb1660 -r 2d5c9d58ac1d x11/mlterm/patches/patch-uitoolkit_fb_ui__display.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/mlterm/patches/patch-uitoolkit_fb_ui__display.c       Wed Jul 24 02:39:57 2019 +0000
@@ -0,0 +1,33 @@
+$ NetBSD $
+
+- Fix support for fbi_fboffset != 0
+- Fix SEGV when using 8-bpp display on LP64 machine
+
+Reported upstream:
+https://bitbucket.org/arakiken/mlterm/pull-requests/5/fix-for-wscons-framebuffer/diff
+
+--- uitoolkit/fb/ui_display.c  2019-07-24 10:51:04.212256656 +0900
++++ ../mlterm.patched/uitoolkit/fb/ui_display.c        2019-07-24 10:27:19.883218709 +0900
+@@ -214,7 +214,7 @@ static inline ui_window_t *get_window(in
+ }
+ 
+ static inline u_char *get_fb(int x, int y) {
+-  return _display.fb + (_display.yoffset + y) * _display.line_length +
++  return _display.fb_base + (_display.yoffset + y) * _display.line_length +
+          (_display.xoffset + x) * _display.bytes_per_pixel / _display.pixels_per_byte;
+ }
+ 
+@@ -2170,8 +2170,11 @@ int ui_cmap_get_closest_color(u_long *cl
+   }
+ 
+   if ((linear_search_max = CMAP_SIZE(_display.cmap)) == 256) {
+-    if ((linear_search_max = vt_get_closest_256_color(closest, &min, red, green, blue,
+-                                                      COLOR_DISTANCE_THRESHOLD)) == 0) {
++    vt_color_t tmp;
++    linear_search_max = vt_get_closest_256_color(&tmp, &min, red, green, blue,
++                                                 COLOR_DISTANCE_THRESHOLD);
++    *closest = tmp; /* XXX needs for LP64 */
++    if (linear_search_max == 0) {
+       goto end;
+     }
+   }
diff -r 02a827fb1660 -r 2d5c9d58ac1d x11/mlterm/patches/patch-uitoolkit_fb_ui__display__freebsd.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/mlterm/patches/patch-uitoolkit_fb_ui__display__freebsd.c      Wed Jul 24 02:39:57 2019 +0000
@@ -0,0 +1,27 @@
+$ NetBSD $
+
+- Fix support for fbi_fboffset != 0
+
+Reported upstream:
+https://bitbucket.org/arakiken/mlterm/pull-requests/5/fix-for-wscons-framebuffer/diff
+
+--- uitoolkit/fb/ui_display_freebsd.c  2019-07-24 10:51:04.208029557 +0900
++++ ../mlterm.patched/uitoolkit/fb/ui_display_freebsd.c        2019-07-24 10:37:10.728676339 +0900
+@@ -64,7 +64,7 @@ static int open_display(u_int depth) {
+   ioctl(_display.fb_fd, FBIO_ADPINFO, &vainfo);
+   ioctl(_display.fb_fd, FBIO_GETDISPSTART, &vstart);
+ 
+-  if ((_display.fb = mmap(NULL, (_display.smem_len = vainfo.va_window_size), PROT_WRITE | PROT_READ,
++  if ((_display.fb = _display.fb_base = mmap(NULL, (_display.smem_len = vainfo.va_window_size), PROT_WRITE | PROT_READ,
+                           MAP_SHARED, _display.fb_fd, (off_t)0)) == MAP_FAILED) {
+     bl_error_printf("Retry another mode of resolution and depth.\n");
+ 
+@@ -209,7 +209,7 @@ static int open_display(u_int depth) {
+ error:
+   if (_display.fb) {
+     munmap(_display.fb, _display.smem_len);
+-    _display.fb = NULL;
++    _display.fb = _display.fb_base = NULL;
+   }
+ 
+   close(_display.fb_fd);
diff -r 02a827fb1660 -r 2d5c9d58ac1d x11/mlterm/patches/patch-uitoolkit_fb_ui__display__linux.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/mlterm/patches/patch-uitoolkit_fb_ui__display__linux.c        Wed Jul 24 02:39:57 2019 +0000
@@ -0,0 +1,27 @@
+$ NetBSD $
+
+- Fix support for fbi_fboffset != 0
+
+Reported upstream:
+https://bitbucket.org/arakiken/mlterm/pull-requests/5/fix-for-wscons-framebuffer/diff
+
+--- uitoolkit/fb/ui_display_linux.c    2019-07-24 10:51:04.215385175 +0900
++++ ../mlterm.patched/uitoolkit/fb/ui_display_linux.c  2019-07-24 09:59:19.092709670 +0900
+@@ -265,7 +265,7 @@ static int open_display(u_int depth) {
+     _display.pixels_per_byte = 1;
+   }
+ 
+-  if ((_display.fb = mmap(NULL, (_display.smem_len = finfo.smem_len), PROT_WRITE | PROT_READ,
++  if ((_display.fb = _display.fb_base = mmap(NULL, (_display.smem_len = finfo.smem_len), PROT_WRITE | PROT_READ,
+                           MAP_SHARED, _display.fb_fd, (off_t)0)) == MAP_FAILED) {
+     goto error;
+   }
+@@ -349,7 +349,7 @@ static int open_display(u_int depth) {
+ error:
+   if (_display.fb) {
+     munmap(_display.fb, _display.smem_len);
+-    _display.fb = NULL;
++    _display.fb = _display.fb_base = NULL;
+   }
+ 
+   close(_display.fb_fd);
diff -r 02a827fb1660 -r 2d5c9d58ac1d x11/mlterm/patches/patch-uitoolkit_fb_ui__display__wscons.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/mlterm/patches/patch-uitoolkit_fb_ui__display__wscons.c       Wed Jul 24 02:39:57 2019 +0000
@@ -0,0 +1,99 @@
+$ NetBSD $
+
+- Fix support for fbi_fboffset != 0
+- Fix SEGV when using 8-bpp display on LP64 machine
+- Add better handling for 24-bpp display
+
+Reported upstream:
+https://bitbucket.org/arakiken/mlterm/pull-requests/5/fix-for-wscons-framebuffer/diff
+
+--- uitoolkit/fb/ui_display_wscons.c   2019-07-24 10:51:04.210666890 +0900
++++ ../mlterm.patched/uitoolkit/fb/ui_display_wscons.c 2019-07-24 10:31:06.733563761 +0900
+@@ -260,6 +260,7 @@ static int open_display(u_int depth /* u
+ #ifdef WSDISPLAYIO_GET_FBINFO
+   struct wsdisplayio_fbinfo vinfo2;
+ #endif
++  int fboffset;
+   int mode;
+   int wstype;
+   struct rgb_info rgbinfos[] = {
+@@ -323,15 +324,26 @@ static int open_display(u_int depth /* u
+   if (ioctl(_display.fb_fd, WSDISPLAYIO_GET_FBINFO, &vinfo2) == 0) {
+     vinfo.width = vinfo2.fbi_width;
+     vinfo.height = vinfo2.fbi_height;
+-    vinfo.depth = vinfo2.fbi_bitsperpixel;
++    if (vinfo2.fbi_bitsperpixel == 32 &&
++        vinfo2.fbi_subtype.fbi_rgbmasks.alpha_size == 0) {
++      vinfo.depth = 24;
++    } else {
++      vinfo.depth = vinfo2.fbi_bitsperpixel;
++    }
+     vinfo.cmsize = vinfo2.fbi_subtype.fbi_cmapinfo.cmap_entries;
+ 
+-    /* XXX fbi_fboffset is regarded as multiple of fbi_stride */
+-    _display.yoffset = vinfo2.fbi_fboffset / vinfo2.fbi_stride;
++    fboffset = vinfo2.fbi_fboffset;
+   } else
+ #endif
+-      if (ioctl(_display.fb_fd, WSDISPLAYIO_GINFO, &vinfo) == 0) {
+-    _display.yoffset = 0;
++  if (ioctl(_display.fb_fd, WSDISPLAYIO_GINFO, &vinfo) == 0) {
++#ifdef WSDISPLAY_TYPE_LUNA
++    if (wstype == WSDISPLAY_TYPE_LUNA) {
++      fboffset = 8;
++    } else
++#endif
++    {
++      fboffset = 0;
++    }
+   } else {
+ #ifdef DEBUG
+     bl_debug_printf(BL_DEBUG_TAG " WSDISPLAYIO_GTYPE and WSDISPLAYIO_GET_FBINFO failed.\n");
+@@ -341,6 +353,7 @@ static int open_display(u_int depth /* u
+   }
+ 
+   _display.xoffset = 0;
++  _display.yoffset = 0;
+ 
+   _display.width = _disp.width = vinfo.width;
+   _display.height = _disp.height = vinfo.height;
+@@ -403,7 +416,7 @@ static int open_display(u_int depth /* u
+   if (wstype == WSDISPLAY_TYPE_LUNA && (_disp.depth == 4 || _disp.depth == 8)) {
+     u_int plane;
+ 
+-    _display.smem_len = 0x40000 * _disp.depth;
++    _display.smem_len = (fboffset + 0x40000) * _disp.depth;
+ 
+     for (plane = 0; plane < _disp.depth; plane++) {
+       _display.plane_offset[plane] = 0x40000 * plane;
+@@ -411,7 +424,7 @@ static int open_display(u_int depth /* u
+   } else
+ #endif
+   {
+-    _display.smem_len = _display.line_length * _display.height;
++    _display.smem_len = fboffset + _display.line_length * _display.height;
+   }
+ 
+   if ((_display.fb = mmap(NULL, _display.smem_len, PROT_WRITE | PROT_READ, MAP_SHARED,
+@@ -421,11 +434,7 @@ static int open_display(u_int depth /* u
+     goto error;
+   }
+ 
+-#ifdef WSDISPLAY_TYPE_LUNA
+-  if (wstype == WSDISPLAY_TYPE_LUNA) {
+-    _display.fb += 8;
+-  }
+-#endif
++  _display.fb_base = _display.fb + fboffset;
+ 
+   if (_disp.depth < 15) {
+     if (vinfo.depth >= 2 && _disp.depth == 1) {
+@@ -630,7 +639,7 @@ static int open_display(u_int depth /* u
+ error:
+   if (_display.fb) {
+     munmap(_display.fb, _display.smem_len);
+-    _display.fb = NULL;
++    _display.fb = _display.fb_base = NULL;
+   }
+ 
+   close(_display.fb_fd);
diff -r 02a827fb1660 -r 2d5c9d58ac1d x11/mlterm/patches/patch-uitoolkit_fb_ui__display__x68kgrf.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/mlterm/patches/patch-uitoolkit_fb_ui__display__x68kgrf.c      Wed Jul 24 02:39:57 2019 +0000
@@ -0,0 +1,27 @@
+$ NetBSD $
+
+- Fix support for fbi_fboffset != 0
+
+Reported upstream:
+https://bitbucket.org/arakiken/mlterm/pull-requests/5/fix-for-wscons-framebuffer/diff
+
+--- uitoolkit/fb/ui_display_x68kgrf.c  2019-07-24 10:51:04.212502056 +0900
++++ ../mlterm.patched/uitoolkit/fb/ui_display_x68kgrf.c        2019-07-24 10:01:35.627124287 +0900
+@@ -173,7 +173,7 @@ static int open_display(u_int depth) {
+ 
+   _display.smem_len = vinfo.gd_fbsize + vinfo.gd_regsize;
+ 
+-  if ((_display.fb = mmap(NULL, _display.smem_len, PROT_WRITE | PROT_READ, MAP_FILE | MAP_SHARED,
++  if ((_display.fb = _display.fb_base = mmap(NULL, _display.smem_len, PROT_WRITE | PROT_READ, MAP_FILE | MAP_SHARED,
+                           _display.fb_fd, (off_t)0)) == MAP_FAILED) {
+     bl_error_printf("Retry another mode of resolution and depth.\n");
+ 
+@@ -339,7 +339,7 @@ error:
+   if (_display.fb) {
+     setup_reg(reg, &orig_reg);
+     munmap(_display.fb, _display.smem_len);
+-    _display.fb = NULL;
++    _display.fb = _display.fb_base = NULL;
+   }
+ 
+   close(_display.fb_fd);



Home | Main Index | Thread Index | Old Index