Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jan 2015 00:25:15 +0000 (UTC)
From:      Shaun Amott <shaun@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r377968 - in head/emulators/x49gp: . files
Message-ID:  <201501270025.t0R0PF5M064015@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: shaun
Date: Tue Jan 27 00:25:14 2015
New Revision: 377968
URL: https://svnweb.freebsd.org/changeset/ports/377968
QAT: https://qat.redports.org/buildarchive/r377968/

Log:
  - Fix build.
  - Add (optional) patch to bring grayscale support to the calculator.

Added:
  head/emulators/x49gp/files/grayscale.diff   (contents, props changed)
Modified:
  head/emulators/x49gp/Makefile

Modified: head/emulators/x49gp/Makefile
==============================================================================
--- head/emulators/x49gp/Makefile	Tue Jan 27 00:09:20 2015	(r377967)
+++ head/emulators/x49gp/Makefile	Tue Jan 27 00:25:14 2015	(r377968)
@@ -31,7 +31,10 @@ OPTIONS_SINGLE_FIRMWARE=FIRMWARE_215 FIR
 FIRMWARE_215_DESC=	Calculator ROM firmware version 2.15
 FIRMWARE_209_DESC=	Calculator ROM firmware version 2.09
 
-OPTIONS_DEFAULT=FIRMWARE_215
+OPTIONS_DEFINE=	GRAYSCALE
+GRAYSCALE_DESC=	Apply patch for grayscale support
+
+OPTIONS_DEFAULT=FIRMWARE_215 GRAYSCALE
 
 SUB_FILES=	hp50g.sh
 
@@ -43,6 +46,10 @@ MAKE_ENV+=	DEBUGB=1
 
 MAKE_ARGS+=CC="${CC}"
 
+.if ${PORT_OPTIONS:MGRAYSCALE}
+EXTRA_PATCHES+=	${FILESDIR}/grayscale.diff
+.endif
+
 .if ${PORT_OPTIONS:MFIRMWARE_215H3} || ${PORT_OPTIONS:MFIRMWARE_215}
 MAKE_ARGS+=FIRMWARE=4950_215.bin
 DISTFILES+=hp4950v215.zip
@@ -70,7 +77,7 @@ do-configure:
 	cd ${WRKSRC}/qemu/qemu-git && ./configure-small --extra-cflags=-DX49GP --cc="${CC}"
 
 do-build:
-	cd ${WRKSRC} && ${MAKE_CMD} ${MAKE_ARGS}
+	cd ${WRKSRC} && ${SETENV} -u MAKELEVEL -u MAKEFLAGS ${MAKE_CMD} ${MAKE_ARGS}
 
 do-install:
 	@${MKDIR} ${STAGEDIR}${DATADIR}

Added: head/emulators/x49gp/files/grayscale.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/x49gp/files/grayscale.diff	Tue Jan 27 00:25:14 2015	(r377968)
@@ -0,0 +1,203 @@
+Index: include/x49gp_ui.h
+===================================================================
+--- include/x49gp_ui.h	(revision 11)
++++ include/x49gp_ui.h	(working copy)
+@@ -15,6 +15,22 @@
+ 	UI_COLOR_SILVER,
+ 	UI_COLOR_ORANGE,
+ 	UI_COLOR_BLUE,
++	UI_COLOR_GRAYSCALE_0,
++	UI_COLOR_GRAYSCALE_1,
++	UI_COLOR_GRAYSCALE_2,
++	UI_COLOR_GRAYSCALE_3,
++	UI_COLOR_GRAYSCALE_4,
++	UI_COLOR_GRAYSCALE_5,
++	UI_COLOR_GRAYSCALE_6,
++	UI_COLOR_GRAYSCALE_7,
++	UI_COLOR_GRAYSCALE_8,
++	UI_COLOR_GRAYSCALE_9,
++	UI_COLOR_GRAYSCALE_10,
++	UI_COLOR_GRAYSCALE_11,
++	UI_COLOR_GRAYSCALE_12,
++	UI_COLOR_GRAYSCALE_13,
++	UI_COLOR_GRAYSCALE_14,
++	UI_COLOR_GRAYSCALE_15,
+ 	UI_COLOR_MAX
+ } x49gp_ui_color_t;
+ 
+Index: s3c2410_lcd.c
+===================================================================
+--- s3c2410_lcd.c	(revision 11)
++++ s3c2410_lcd.c	(working copy)
+@@ -94,6 +94,32 @@
+ 	}
+ }
+ 
++static int
++x49gp_get_pixel_color(s3c2410_lcd_t *lcd, int x, int y)
++{
++	uint32_t bank, addr, data, offset, pixel_offset;
++	int bits_per_pixel = lcd->lcdcon5 > 2 ? 1 : 4 >> lcd->lcdcon5;
++
++	bank = (lcd->lcdsaddr1 << 1) & 0x7fc00000;
++	addr = bank | ((lcd->lcdsaddr1 << 1) & 0x003ffffe);
++
++	pixel_offset = (160 * y + x) * bits_per_pixel;
++	offset = (pixel_offset >> 3) & 0xfffffffc;
++
++	data = ldl_phys(addr + offset);
++	data >>= pixel_offset & 31;
++	data &= (1 << bits_per_pixel) - 1;
++
++	switch (bits_per_pixel) {
++		case 1:
++			return 15 * data;
++		case 2:
++			return 15 & (lcd->bluelut >> (2 * data));
++		default:
++			return data;
++	}
++}
++
+ void
+ x49gp_lcd_update(x49gp_t *x49gp)
+ {
+@@ -100,8 +126,7 @@
+ 	x49gp_ui_t *ui = x49gp->ui;
+ 	s3c2410_lcd_t *lcd = x49gp->s3c2410_lcd;
+ 	GdkRectangle rect;
+-	uint32_t bank, addr, offset, data;
+-	int row, i, b, x, y;
++	int color, x, y;
+ 
+ 	if (!(lcd->lcdcon1 & 1)) {
+ 		gdk_draw_drawable(ui->lcd_pixmap, ui->window->style->bg_gc[0],
+@@ -111,70 +136,45 @@
+ 		goto done;
+ 	}
+ 
+-	bank = (lcd->lcdsaddr1 << 1) & 0x7fc00000;
+-	addr = bank | ((lcd->lcdsaddr1 << 1) & 0x003ffffe);
+-
+ 	gdk_draw_drawable(ui->lcd_pixmap, ui->window->style->bg_gc[0],
+ 			  ui->bg_pixmap,
+ 			  ui->lcd_x_offset, ui->lcd_y_offset,
+ 			  0, 0, ui->lcd_width, ui->lcd_height);
+ 
+-	data = ldl_phys(addr + 16);
+-	if (data & (1 << 3)) {
+-		gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_io_gc, TRUE,
+-				   236, 0, 15, 12);
+-	}
+-	data = ldl_phys(addr + 36);
+-	if (data & (1 << 3)) {
+-		gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_left_gc, TRUE,
+-				   11, 0, 15, 12);
+-	}
+-	data = ldl_phys(addr + 56);
+-	if (data & (1 << 3)) {
+-		gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_right_gc, TRUE,
+-				   56, 0, 15, 12);
+-	}
+-	data = ldl_phys(addr + 76);
+-	if (data & (1 << 3)) {
+-		gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_alpha_gc, TRUE,
+-				   101, 0, 15, 12);
+-	}
+-	data = ldl_phys(addr + 96);
+-	if (data & (1 << 3)) {
+-		gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_battery_gc, TRUE,
+-				   146, 0, 15, 12);
+-	}
+-	data = ldl_phys(addr + 116);
+-	if (data & (1 << 3)) {
+-		gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_busy_gc, TRUE,
+-				   191, 0, 15, 12);
+-	}
++	color = x49gp_get_pixel_color(lcd, 131, 0);
++	gdk_gc_set_rgb_fg_color(ui->ann_io_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color]));
++	gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_io_gc, TRUE, 236, 0, 15, 12);
+ 
+-	offset = 0;
+-	for (row = 0; row < ui->lcd_height / 2; row++) {
+-		y = 2 * row;
+-		x = 0;
+-		for (i = 0; i < 5; i++) {
+-			data = ldl_phys(addr + offset);
+-			offset += sizeof(uint32_t);
++	color = x49gp_get_pixel_color(lcd, 131, 1);
++	gdk_gc_set_rgb_fg_color(ui->ann_left_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color]));
++	gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_left_gc, TRUE, 11, 0, 15, 12);
+ 
+-			for (b = 0; b < 32; b++) {
+-				if (data & (1 << b)) {
+-					gdk_draw_rectangle(ui->lcd_pixmap,
+-							   ui->window->style->fg_gc[0],
+-							   TRUE, x, y + ui->lcd_top_margin, 2, 2);
+-				}
+-				x += 2;
++	color = x49gp_get_pixel_color(lcd, 131, 2);
++	gdk_gc_set_rgb_fg_color(ui->ann_right_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color]));
++	gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_right_gc, TRUE, 56, 0, 15, 12);
+ 
+-				if (x >= ui->lcd_width) {
+-					break;
+-				}
+-			}
++	color = x49gp_get_pixel_color(lcd, 131, 3);
++	gdk_gc_set_rgb_fg_color(ui->ann_alpha_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color]));
++	gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_alpha_gc, TRUE, 101, 0, 15, 12);
++
++	color = x49gp_get_pixel_color(lcd, 131, 4);
++	gdk_gc_set_rgb_fg_color(ui->ann_battery_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color]));
++	gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_battery_gc, TRUE, 146, 0, 15, 12);
++
++	color = x49gp_get_pixel_color(lcd, 131, 5);
++	gdk_gc_set_rgb_fg_color(ui->ann_busy_gc, &(ui->colors[UI_COLOR_GRAYSCALE_0 + color]));
++	gdk_draw_rectangle(ui->lcd_pixmap, ui->ann_busy_gc, TRUE, 191, 0, 15, 12);
++
++	for (y = 0; y < (ui->lcd_height - ui->lcd_top_margin) / 2; y++) {
++		for (x = 0; x < ui->lcd_width / 2; x++) {
++			color = x49gp_get_pixel_color(lcd, x, y);
++			gdk_gc_set_rgb_fg_color(ui->window->style->fg_gc[0],
++								  &(ui->colors[UI_COLOR_GRAYSCALE_0 + color]));
++			gdk_draw_rectangle(ui->lcd_pixmap, ui->window->style->fg_gc[0], TRUE,
++							   2 * x, 2 * y + ui->lcd_top_margin, 2, 2);
+ 		}
+ 	}
+ 
+-	addr = bank | ((lcd->lcdsaddr2 << 1) & 0x003ffffe);
+-
+ done:
+ 	rect.x = 0;
+ 	rect.y = 0;
+Index: ui.c
+===================================================================
+--- ui.c	(revision 11)
++++ ui.c	(working copy)
+@@ -2285,7 +2285,24 @@
+ 	x49gp_ui_color_init(&ui->colors[UI_COLOR_ORANGE], 0xc0, 0x6e, 0x60);
+ 	x49gp_ui_color_init(&ui->colors[UI_COLOR_BLUE], 0x40, 0x60, 0xa4);
+ 
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_0], 0xab, 0xd2, 0xb4);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_1], 0xa0, 0xc4, 0xa8);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_2], 0x94, 0xb6, 0x9c);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_3], 0x89, 0xa8, 0x90);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_4], 0x7d, 0x9a, 0x84);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_5], 0x72, 0x8c, 0x78);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_6], 0x67, 0x7e, 0x6c);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_7], 0x5b, 0x70, 0x60);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_8], 0x50, 0x62, 0x54);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_9], 0x44, 0x54, 0x48);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_10], 0x39, 0x46, 0x3c);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_11], 0x2e, 0x38, 0x30);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_12], 0x22, 0x2a, 0x24);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_13], 0x17, 0x1c, 0x18);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_14], 0x0b, 0x03, 0x0c);
++	x49gp_ui_color_init(&ui->colors[UI_COLOR_GRAYSCALE_15], 0x00, 0x00, 0x00);
+ 
++
+ 	ui->lcd_canvas = gtk_drawing_area_new();
+ 	gtk_drawing_area_size(GTK_DRAWING_AREA(ui->lcd_canvas),
+ 			      ui->lcd_width, ui->lcd_height);
+



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501270025.t0R0PF5M064015>