Index: [thread] [date] [subject] [author]
  From: Aki M Laukkanen <amlaukka@cc.helsinki.fi>
  To  : ggi-develop@eskimo.com
  Date: Thu, 24 Jun 1999 16:52:05 +0300 (EET DST)

HERMES integration (take 2)

Now that I found some time to work with LibGGI again I'm attaching an
updated patch of the HERMES stuff.

Changes:
 o _ggi_set_hermes_palette takes two additional arguments: start and len. 
 o the crossblit stuff is moved out from stubs to default/linear_xx 
   directories.

In addition I did some benchmarks but these cover only two cases of
the many possible. The tests were done with a test application of
mine which rendered a graphical effect to a 8-bit memory visual and
crossblitted it.

1024x768x24 (display-x) on PII/450:

no hermes:
Name                     |Time (ms)|Times
-------------------------+---------+-----
ggiFlush                 |   71.141|  155
ggiCrossBlit             |   18.561|  155
[the rest omitted]

hermes:
Name                     |Time (ms)|Times
-------------------------+---------+-----
ggiFlush                 |   71.807|  222
ggiCrossBlit             |   22.225|  222

This shows a moderate speed enhancement with ggiCrossBlit(). It 
doesn't show in the framerate though. I think upgrading to 2.2.x 
with its MTRR support would take the ggiFlush() time down. Unfortunately
this is my work machine and I have no root privileges.

800x600x8 (display-fbdev) on Pentium (classic)/133:

no hermes:
Name                     |Time (ms)|Times
-------------------------+---------+-----
ggiFlush                 |    0.011|   98
ggiCrossBlit             |   17.536|   98

hermes:
Name                     |Time (ms)|Times
-------------------------+---------+-----
ggiFlush                 |    0.011|  171
ggiCrossBlit             |   17.504|  171

Not much difference here because both visuals have the same pixelformat.

800x600x16 (display-x) on Pentium (classic)/133

no hermes:
Name                     |Time (ms)|Times
-------------------------+---------+-----
ggiFlush                 |   35.042|  200
ggiCrossBlit             |   64.162|  200

hermes:
Name                     |Time (ms)|Times
-------------------------+---------+-----
ggiFlush                 |   35.000|  105
ggiCrossBlit             |   23.969|  105

On a slower machine HERMES shows its speed (LibGGI compiled with
-O2 -fomit-frame-pointer -mpentium arguments to egcs 1.1.2). The
difference in framerate is clearly visible. 


diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/acconfig.h libggi-HERMES/acconfig.h
--- libggi-2.0b2.1/acconfig.h	Sun May  9 03:16:23 1999
+++ libggi-HERMES/acconfig.h	Fri Jun 18 20:31:53 1999
@@ -13,6 +13,9 @@
 /* Define to use run-time debugging */
 #undef DEBUG
 
+/* Define when compiling with HERMES */
+#undef USE_HERMES
+
 /* Define if you have the <ncurses.h> header file.  */
 #undef HAVE_NCURSES_H
 
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/config.h.in libggi-HERMES/config.h.in
--- libggi-2.0b2.1/config.h.in	Sun May  9 03:17:12 1999
+++ libggi-HERMES/config.h.in	Fri Jun 18 20:35:30 1999
@@ -64,6 +64,9 @@
 /* Define to use run-time debugging */
 #undef DEBUG
 
+/* Define when compiling with HERMES */
+#undef USE_HERMES
+
 /* Define if you have the <ncurses.h> header file.  */
 #undef HAVE_NCURSES_H
 
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/configure.in libggi-HERMES/configure.in
--- libggi-2.0b2.1/configure.in	Fri May 14 21:59:24 1999
+++ libggi-HERMES/configure.in	Fri Jun 18 20:38:00 1999
@@ -21,7 +21,11 @@
 use_debug="yes"
 
 use_threads="no"
+
+use_hermes="no"
+
 THREADLIBS=""
+HERMESLIBS=""
 
 sublib_libs=""
 dynload_libs="-lgii -lgg"
@@ -156,6 +160,16 @@
 [  --disable-debug         don't build with run-time debugging (speed freaks)],
 use_debug=$enableval)
 
+AC_ARG_WITH(hermes,
+[  --with-hermes[=DIR]     use the HERMES pixel format conversion library],
+use_hermes="yes"
+if test $withval != "yes"; then
+  CFLAGS="$CFLAGS -I$withval/include"
+  CPPFLAGS="$CPPFLAGS -I$withval/include"
+  LDFLAGS="$LDFLAGS -L$withval/lib"
+fi)
+
+
 GGI_EXTRA_PATHS
 
 
@@ -294,6 +308,23 @@
   fi
 fi
 
+have_hermes="no"
+if test "x$use_hermes" != "xno"; then
+  AC_MSG_CHECKING(for HERMES library)
+  TMP_SAVE_LIBS=$LIBS
+  LIBS="$LIBS -lHermes"
+  AC_TRY_LINK([
+#include <Hermes/Hermes.h>
+],[
+Hermes_Init()
+],
+    have_hermes="yes"
+    AC_MSG_RESULT(yes),
+    use_hermes="no"
+    AC_MSG_RESULT(no)
+  LIBS=$TMP_SAVE_LIBS)
+fi
+
 if test "x$build_aa_target" != "xno"; then
   AC_CHECK_HEADER(aalib.h,
 	AC_CHECK_LIB(aa, aa_autoinit, foo=bar, build_aa_target="no"),
@@ -630,6 +661,7 @@
 
 AC_SUBST(DLLEXT)
 AC_SUBST(THREADLIBS)
+AC_SUBST(HERMESLIBS)
 AC_SUBST(sublib_libs)
 AC_SUBST(dynload_libs)
 
@@ -668,6 +700,11 @@
 
 if test "x$use_debug" = "xyes"; then
   AC_DEFINE(DEBUG)
+fi
+
+if test "x$use_hermes" = "xyes"; then
+  AC_DEFINE(USE_HERMES)
+  HERMESLIBS="-lHermes"
 fi
 
 AM_CONFIG_HEADER(config.h)
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/default/linear_16/crossblit.c libggi-HERMES/default/linear_16/crossblit.c
--- libggi-2.0b2.1/default/linear_16/crossblit.c	Thu Apr  1 02:12:11 1999
+++ libggi-HERMES/default/linear_16/crossblit.c	Thu Jun 24 14:21:11 1999
@@ -31,6 +31,9 @@
 #include <string.h>
 #include <ggi/internal/ggi-dl.h>
 
+#ifdef USE_HERMES
+#include <Hermes/Hermes.h>
+#endif /* USE_HERMES */
 
 #define DOSHIFT(val, shift)  \
 	(((shift) >= 0) ? (val) << (shift) : (val) >> -(shift))
@@ -310,12 +313,24 @@
 	   and that the destination pixelformat is sane.
 	 */
 	if (src->r_frame && src->r_frame->layout == dst->w_frame->layout) {
-		uint32 srcformat
-			= src->r_frame->buffer.plb.pixelformat->stdformat;
-		uint32 dstformat
-			= dst->w_frame->buffer.plb.pixelformat->stdformat;
+		uint32 srcformat, dstformat;
 
 		PREPARE_FB(src);
+#ifdef USE_HERMES
+		if (src->curformat.indexed != 0x7f && dst->curformat.indexed != 0x7f
+		    && Hermes_ConverterRequest(dst->conv_inst, &src->curformat, &dst->curformat)) {
+			if (src->curformat.indexed == 1)
+				Hermes_ConverterPalette(dst->conv_inst, src->pal_inst, dst->pal_inst);
+
+			if (Hermes_ConverterCopy(dst->conv_inst, LIBGGI_CURREAD(src), sx, sy,
+						 w, h, LIBGGI_FB_R_STRIDE(src), LIBGGI_CURWRITE(dst),
+						 dx, dy, w, h, LIBGGI_FB_W_STRIDE(dst)))
+				return 0;
+		}
+#endif /* USE_HERMES */
+
+		srcformat = src->r_frame->buffer.plb.pixelformat->stdformat;
+		dstformat = dst->w_frame->buffer.plb.pixelformat->stdformat;
 
 		if (dstformat != 0) {
 			if (srcformat == GGI_DB_STD_8a8i8 && w * h > 256 ) {
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/default/linear_24/crossblit.c libggi-HERMES/default/linear_24/crossblit.c
--- libggi-2.0b2.1/default/linear_24/crossblit.c	Thu Apr  1 02:12:11 1999
+++ libggi-HERMES/default/linear_24/crossblit.c	Thu Jun 24 14:38:52 1999
@@ -31,6 +31,9 @@
 #include <string.h>
 #include <ggi/internal/ggi-dl.h>
 
+#ifdef USE_HERMES
+#include <Hermes/Hermes.h>
+#endif /* USE_HERMES */
 
 #define DOSHIFT(val, shift)  \
 	(((shift) >= 0) ? (val) << (shift) : (val) >> -(shift))
@@ -338,12 +341,24 @@
 	   and that the destination pixelformat is sane.
 	 */
 	if (src->r_frame && src->r_frame->layout == dst->w_frame->layout) {
-		uint32 srcformat
-			= src->r_frame->buffer.plb.pixelformat->stdformat;
-		uint32 dstformat
-			= dst->w_frame->buffer.plb.pixelformat->stdformat;
+		uint32 srcformat, dstformat;
 
 		PREPARE_FB(src);
+#ifdef USE_HERMES
+		if (src->curformat.indexed != 0x7f && dst->curformat.indexed != 0x7f
+		    && Hermes_ConverterRequest(dst->conv_inst, &src->curformat, &dst->curformat)) {
+			if (src->curformat.indexed == 1)
+				Hermes_ConverterPalette(dst->conv_inst, src->pal_inst, dst->pal_inst);
+
+			if (Hermes_ConverterCopy(dst->conv_inst, LIBGGI_CURREAD(src), sx, sy,
+						 w, h, LIBGGI_FB_R_STRIDE(src), LIBGGI_CURWRITE(dst),
+						 dx, dy, w, h, LIBGGI_FB_W_STRIDE(dst)))
+				return 0;
+		}
+#endif /* USE_HERMES */
+
+		srcformat = src->r_frame->buffer.plb.pixelformat->stdformat;
+		dstformat = dst->w_frame->buffer.plb.pixelformat->stdformat;
 
 		if (dstformat != 0) {
 			if (srcformat == GGI_DB_STD_8a8i8 && w * h > 256 ) {
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/default/linear_32/crossblit.c libggi-HERMES/default/linear_32/crossblit.c
--- libggi-2.0b2.1/default/linear_32/crossblit.c	Thu Apr  1 02:12:12 1999
+++ libggi-HERMES/default/linear_32/crossblit.c	Thu Jun 24 14:40:53 1999
@@ -31,6 +31,9 @@
 #include <string.h>
 #include <ggi/internal/ggi-dl.h>
 
+#ifdef USE_HERMES
+#include <Hermes/Hermes.h>
+#endif /* USE_HERMES */
 
 #define DOSHIFT(val, shift)  \
 	(((shift) >= 0) ? (val) << (shift) : (val) >> -(shift))
@@ -314,12 +317,24 @@
 	   and that the destination pixelformat is sane.
 	 */
 	if (src->r_frame && src->r_frame->layout == dst->w_frame->layout) {
-		uint32 srcformat
-			= src->r_frame->buffer.plb.pixelformat->stdformat;
-		uint32 dstformat
-			= dst->w_frame->buffer.plb.pixelformat->stdformat;
+		uint32 srcformat, dstformat;
 
 		PREPARE_FB(src);
+#ifdef USE_HERMES
+		if (src->curformat.indexed != 0x7f && dst->curformat.indexed != 0x7f
+		    && Hermes_ConverterRequest(dst->conv_inst, &src->curformat, &dst->curformat)) {
+			if (src->curformat.indexed == 1)
+				Hermes_ConverterPalette(dst->conv_inst, src->pal_inst, dst->pal_inst);
+
+			if (Hermes_ConverterCopy(dst->conv_inst, LIBGGI_CURREAD(src), sx, sy,
+						 w, h, LIBGGI_FB_R_STRIDE(src), LIBGGI_CURWRITE(dst),
+						 dx, dy, w, h, LIBGGI_FB_W_STRIDE(dst)))
+				return 0;
+		}
+#endif /* USE_HERMES */
+
+		srcformat = src->r_frame->buffer.plb.pixelformat->stdformat;
+		dstformat = dst->w_frame->buffer.plb.pixelformat->stdformat;
 
 		if (dstformat != 0) {
 			if (srcformat == GGI_DB_STD_8a8i8 && w * h > 256 ) {
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/default/linear_8/crossblit.c libggi-HERMES/default/linear_8/crossblit.c
--- libggi-2.0b2.1/default/linear_8/crossblit.c	Thu Apr  1 02:12:12 1999
+++ libggi-HERMES/default/linear_8/crossblit.c	Thu Jun 24 14:20:18 1999
@@ -31,6 +31,9 @@
 #include <string.h>
 #include <ggi/internal/ggi-dl.h>
 
+#ifdef USE_HERMES
+#include <Hermes/Hermes.h>
+#endif /* USE_HERMES */
 
 /* Default fallback */
 static inline void
@@ -156,13 +159,25 @@
 	 */
 	if (src->r_frame && src->r_frame->layout == dst->w_frame->layout &&
 	    dst->w_frame->buffer.plb.pixelformat->stdformat != 0) {
-		uint32 srcformat
-			= src->r_frame->buffer.plb.pixelformat->stdformat;
-		uint32 dstformat
-			= dst->w_frame->buffer.plb.pixelformat->stdformat;
-		int pixels = w*h;
+		uint32 srcformat, dstformat;
+		int pixels;
 
 		PREPARE_FB(src);
+#ifdef USE_HERMES
+		if (src->curformat.indexed != 0x7f && dst->curformat.indexed != 0x7f
+		    && Hermes_ConverterRequest(dst->conv_inst, &src->curformat, &dst->curformat)) {
+			Hermes_ConverterPalette(dst->conv_inst, src->pal_inst, dst->pal_inst);
+
+			if (Hermes_ConverterCopy(dst->conv_inst, LIBGGI_CURREAD(src), sx, sy,
+						 w, h, LIBGGI_FB_R_STRIDE(src), LIBGGI_CURWRITE(dst),
+						 dx, dy, w, h, LIBGGI_FB_W_STRIDE(dst)))
+				return 0;
+		}
+#endif /* USE_HERMES */
+
+		srcformat = src->r_frame->buffer.plb.pixelformat->stdformat;
+		dstformat = dst->w_frame->buffer.plb.pixelformat->stdformat;
+		pixels = w*h;
 
 		/* These are the accelerated cases. If neither suits then
 		 * fall back to the default.
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/ggi/Makefile.am libggi-HERMES/ggi/Makefile.am
--- libggi-2.0b2.1/ggi/Makefile.am	Thu Apr  1 03:38:55 1999
+++ libggi-HERMES/ggi/Makefile.am	Sun Jun 20 16:48:38 1999
@@ -5,6 +5,6 @@
 libggi_la_SOURCES = db.c dl.c events.c gc.c init.c internal.c mode.c stubs.c \
 		visual.c unix.c
 libggi_la_LDFLAGS = ${extra_libraries} -version-info 2:0
-libggi_la_LIBADD = -lgii -lgg
+libggi_la_LIBADD = -lgii -lgg ${HERMESLIBS}
 
 EXTRA_DIST = EXPSYMS
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/ggi/init.c libggi-HERMES/ggi/init.c
--- libggi-2.0b2.1/ggi/init.c	Fri Mar 19 02:16:13 1999
+++ libggi-HERMES/ggi/init.c	Sun Jun 20 17:19:50 1999
@@ -35,6 +35,10 @@
 #include <ggi/internal/internal.h>
 #include <ggi/gg.h>
 
+#ifdef USE_HERMES
+#include <Hermes/Hermes.h>
+#endif /* USE_HERMES */
+
 /* Global variables */
 uint32                _ggiDebugState = 0;
 int                   _ggiDebugSync = 0;
@@ -72,6 +76,14 @@
 		return err;
 	}
 
+#ifdef USE_HERMES
+	err = Hermes_Init();
+	if (!err) {
+		fprintf(stderr, "LibGGI: unable to initialize HERMES\n");
+		return GGI_EUNKNOWN;
+	}
+#endif /* USE_HERMES */
+
 	if ((_ggiVisuals.mutex = ggLockCreate()) == NULL) {
 		fprintf(stderr, "LibGGI: unable to initialize core mutex.\n");
 		giiExit();
@@ -140,6 +152,9 @@
 	}
 
 	ggFreeConfig(_ggiConfigHandle);
+#ifdef USE_HERMES
+	Hermes_Done();
+#endif /* USE_HERMES */
 	giiExit();
 	_ggiLibIsUp = 0;
 
@@ -341,6 +356,22 @@
 			return NULL;
 		}
 	}
+
+#ifdef USE_HERMES
+	vis->conv_inst = Hermes_ConverterInstance(HERMES_CONVERT_NORMAL);
+	if (!vis->conv_inst) {
+		GGIDPRINT_CORE("Cannot get a HERMES converter instance\n");
+		ggiClose(vis);
+		return NULL;
+	}
+
+	vis->pal_inst = Hermes_PaletteInstance();
+	if (!vis->pal_inst) {
+		GGIDPRINT_CORE("Cannot get a HERMES palette instance\n");
+		ggiClose(vis);
+		return NULL;
+	}
+#endif /* USE_HERMES */
 	
 	return vis;
 }
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/ggi/internal.c libggi-HERMES/ggi/internal.c
--- libggi-2.0b2.1/ggi/internal.c	Mon May 17 10:39:46 1999
+++ libggi-HERMES/ggi/internal.c	Thu Jun 24 14:08:14 1999
@@ -27,6 +27,34 @@
 
 #include <ggi/internal/internal.h>
 
+#ifdef USE_HERMES
+#include <Hermes/Hermes.h>
+
+void _ggi_set_hermes_palette(ggi_visual *vis, int start, int len)
+{
+	ggi_color *src;
+	int32 *iter;
+
+	iter = Hermes_PaletteGet(vis->pal_inst) + start;
+	if (!iter) 
+		return;
+
+	src = vis->palette + start;
+	if (!src)
+		return;
+
+	GGIDPRINT_COLOR("Setting HERMES palette: %d:%d\n", start, len);
+
+	while (len--) {
+		*iter = (src->r & 0xff00) << 8;
+		*iter |= (src->g & 0xff00);
+		*iter++ |= src->b >> 8;
+		src++;
+	}
+	
+	Hermes_PaletteInvalidateCache(vis->pal_inst);
+}
+#endif /* USE_HERMES */
 
 int _ggi_mask2shift(uint32 mask)
 {
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/ggi/mode.c libggi-HERMES/ggi/mode.c
--- libggi-2.0b2.1/ggi/mode.c	Wed Feb 17 02:10:58 1999
+++ libggi-HERMES/ggi/mode.c	Thu Jun 24 14:11:05 1999
@@ -33,6 +33,9 @@
 
 #include <ggi/internal/internal.h>
 
+#ifdef USE_HERMES
+#include <Hermes/Hermes.h>
+#endif /* USE_HERMES */
 
 /* Static variables */
 static ggi_mode _ggiDefaultMode =
@@ -126,6 +129,41 @@
 		col.b = 0;
 		ggiSetGCForeground(vis, ggiMapColor(vis, &col));
 		ggiSetGCBackground(vis, ggiMapColor(vis, &col));
+
+#ifdef USE_HERMES
+		GGIDPRINT_CORE("ggiSetMode: Initializing HermesFormat\n");
+
+		memset(&vis->curformat, 0, sizeof (vis->curformat));
+
+		switch (GT_SCHEME(tm->graphtype)) {
+		case GT_PALETTE:
+		case GT_STATIC_PALETTE:
+			_ggi_set_hermes_palette(vis, 0, 1 << GT_DEPTH(tm->graphtype));
+			vis->curformat.indexed = 1;
+			break;
+		case GT_GREYSCALE: /* FIXME: must emulate with a fake palette */
+			vis->curformat.indexed = 1;
+			break;
+		case GT_TRUECOLOR:
+			vis->curformat.r = LIBGGI_PIXFMT(vis)->red_mask;
+			vis->curformat.g = LIBGGI_PIXFMT(vis)->green_mask;
+			vis->curformat.b = LIBGGI_PIXFMT(vis)->blue_mask;
+			vis->curformat.a = LIBGGI_PIXFMT(vis)->alpha_mask;
+			break;
+		case GT_TEXT:
+		default:
+			/* a flag to remind us not to touch these */
+			vis->curformat.indexed = 0x7f;
+			break;
+		}
+
+		vis->curformat.bits = LIBGGI_PIXFMT(vis)->size;
+
+		/* reverse endian and other flags */
+		if (LIBGGI_PIXFMT(vis)->flags)
+			vis->curformat.indexed = 0x7f;
+#endif /* USE_HERMES */
+
 		/* Clear frames to black */
 		for (i = 0; i < tm->frames; i++) {
 			GGIDPRINT_CORE("ggiSetMode: SetWriteFrame %d\n", i);
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/ggi/stubs.c libggi-HERMES/ggi/stubs.c
--- libggi-2.0b2.1/ggi/stubs.c	Fri May  7 00:40:45 1999
+++ libggi-HERMES/ggi/stubs.c	Thu Jun 24 14:15:03 1999
@@ -29,6 +29,10 @@
 
 #undef putc
 
+#ifdef USE_HERMES
+#include <Hermes/Hermes.h>
+#endif /* USE_HERMES */
+
 /************** Mode info ****************/
 
 int ggiSetFlags(ggi_visual *vis,ggi_flags flags)
@@ -102,7 +106,14 @@
 /* Palette, colors, etc...
  */
 int ggiSetPalette(ggi_visual *vis,int s,int len,ggi_color *cmap)
-{ return vis->opcolor->setpalvec(vis,s,len,cmap); }
+{ 
+	int err = vis->opcolor->setpalvec(vis,s,len,cmap); 
+#ifdef USE_HERMES
+	if (err >= 0)
+		_ggi_set_hermes_palette(vis, s, len);
+#endif /* USE_HERMES */	
+	return err;
+}
 
 int ggiGetPalette(ggi_visual *vis,int s,int len,ggi_color *cmap)
 { return vis->opcolor->getpalvec(vis,s,len,cmap); }
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/ggi/visual.c libggi-HERMES/ggi/visual.c
--- libggi-2.0b2.1/ggi/visual.c	Tue Mar 23 02:11:50 1999
+++ libggi-HERMES/ggi/visual.c	Sun Jun 20 17:20:15 1999
@@ -29,6 +29,10 @@
 
 #include <ggi/internal/internal.h>
 
+#ifdef USE_HERMES
+#include <Hermes/Hermes.h>
+#endif /* USE_HERMES */
+
 /*
 ******************************************************************************
  Default functions for op-structs
@@ -269,6 +273,14 @@
 	vis->palette = NULL;
 	vis->input = NULL;
 
+#ifdef USE_HERMES
+	vis->conv_inst = 0;
+	vis->pal_inst = 0;
+	vis->curformat.r = vis->curformat.g = vis->curformat.b = vis->curformat.a = 0;
+	vis->curformat.bits = 0;
+	vis->curformat.indexed = 0xff;
+#endif /* USE_HERMES */
+
 	_ggiZapMode(vis,~0);
 
 	return vis;
@@ -281,6 +293,10 @@
 		vis->input=NULL;
 	}
 	_ggiCloseDL(vis,~0);
+#ifdef USE_HERMES
+	Hermes_PaletteReturn(vis->pal_inst);
+	Hermes_ConverterReturn(vis->conv_inst);
+#endif /* USE_HERMES */
 	free(vis->opdisplay);
 	free(vis->opcolor);
 	free(vis->opdraw);
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/include/ggi/internal/internal.h libggi-HERMES/include/ggi/internal/internal.h
--- libggi-2.0b2.1/include/ggi/internal/internal.h	Thu Apr  1 18:24:27 1999
+++ libggi-HERMES/include/ggi/internal/internal.h	Thu Jun 24 15:01:39 1999
@@ -76,6 +76,9 @@
 void _ggi_build_palette(ggi_color *pal, int num);
 void _ggi_smart_match_palettes(ggi_color *pal, int size,
                                ggi_color *ref_pal, int ref_size);
+#ifdef USE_HERMES
+void _ggi_set_hermes_palette(ggi_visual *vis, int start, int len);
+#endif /* USE_HERMES */
 
 /* mode.c */
 void _ggiSetDefaultMode(const char *str);
diff -urN --exclude=Makefile.in --exclude=configure --exclude=Makefile --exclude=*~ libggi-2.0b2.1/include/ggi/internal/structs.h libggi-HERMES/include/ggi/internal/structs.h
--- libggi-2.0b2.1/include/ggi/internal/structs.h	Thu Apr  1 18:30:29 1999
+++ libggi-HERMES/include/ggi/internal/structs.h	Sat Jun 19 14:50:58 1999
@@ -42,6 +42,12 @@
 
 #include <ggi/internal/dltypes.h>
 
+#ifdef USE_HERMES
+#include <ggi/internal/internal.h>
+
+#include <Hermes/Hermes.h>
+#endif /* USE_HERMES */
+
 #define GGI_VERSION_DLL	1
 
 /* Create a OP version number from the library and structure revisions
@@ -195,6 +201,11 @@
 	ggi_db_list 	 *app_dbs;	/* List of public DBs */
 	ggi_db_list	 *priv_dbs;	/* List of private DBs */
 	ggi_dlhandle_l	 *dlhandle;	/* Handles to dynamic libs */
+#ifdef USE_HERMES
+	HermesHandle	 conv_inst;	/* returned by Hermes_ConverterInstance() */
+	HermesHandle	 pal_inst;	/* returned by Hermes_PaletteInstance() */
+	HermesFormat	 curformat;	/* Current mode for HERMES */ 
+#endif /* USE_HERMES */
 
 	/* Extension stuff */
 	ggi_dlhandle_l	 *extlib;	/* Dynamic libs from extensions */


-- 
D.

Index: [thread] [date] [subject] [author]