aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/plasma-kmod/Makefile9
-rw-r--r--graphics/plasma-kmod/files/patch-plasma_saver.c115
-rw-r--r--graphics/plasma-kmod/files/patch-plasma_saver.h56
3 files changed, 172 insertions, 8 deletions
diff --git a/graphics/plasma-kmod/Makefile b/graphics/plasma-kmod/Makefile
index 2b6272e5095c..fcd775951ece 100644
--- a/graphics/plasma-kmod/Makefile
+++ b/graphics/plasma-kmod/Makefile
@@ -7,7 +7,7 @@
PORTNAME= plasma
PORTVERSION= 0.1
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= graphics kld
MASTER_SITES= SF/futurebsd/futurebsd/${PORTNAME}
PKGNAMESUFFIX= -kmod
@@ -17,13 +17,6 @@ COMMENT= A plasma-effect screensaver kernel module
.include <bsd.port.pre.mk>
-.if ${ARCH} == "amd64"
-BROKEN= Does not configure
-.endif
-.if ${OSVERSION} >= 800000
-BROKEN= Does not build
-.endif
-
.if !exists(${SRC_BASE}/sys/dev/syscons/syscons.h)
IGNORE= requires kernel source (in ${SRC_BASE}) to build
.endif
diff --git a/graphics/plasma-kmod/files/patch-plasma_saver.c b/graphics/plasma-kmod/files/patch-plasma_saver.c
new file mode 100644
index 000000000000..69bc3c854f32
--- /dev/null
+++ b/graphics/plasma-kmod/files/patch-plasma_saver.c
@@ -0,0 +1,115 @@
+--- plasma_saver.c.orig 2001-01-24 12:03:23.000000000 -0500
++++ plasma_saver.c 2012-04-18 17:51:10.000000000 -0400
+@@ -52,7 +52,7 @@
+ #define SCR_W 320
+ #define SCR_H 200
+ #define PLAS_S 128 /* Plasma is 128x128 */
+-#define WAVEMOD 1.3 /* Shrink/stretch factor for sine wave.
++#define WAVEMOD 1300 /* Shrink/stretch factor for sine wave.
+ Effectively controls the 'speed' */
+
+ /* Miscellaneous global variables */
+@@ -61,11 +61,18 @@
+ static char xbuffer[SCR_W];
+ static char ybuffer[SCR_H];
+
+-static float angle[5];
+-static float anglebak[3];
++static int64_t angle[5];
++static int64_t anglebak[3];
+
+-static float
+-aprsin(float theta)
++static __inline int64_t
++fdiv(int64_t a, int64_t b)
++{
++
++ return (a / b + ((a % b * 2) >= b));
++}
++
++static __inline int64_t
++aprsin(int64_t theta)
+ /*
+ * An evil, evil approximation of sin(x). It computes the sin
+ * value by first standardising the input into the range
+@@ -86,11 +93,11 @@
+ }
+
+ if(theta > TWO_PI)
+- theta -= (float)((int)(theta/TWO_PI)*TWO_PI);
++ theta %= TWO_PI;
+
+ /* theta now > 0, < 2pi, look up in table */
+
+- apos = (int)((theta/TWO_PI)*90.0);
++ apos = fdiv(fdiv(theta * SCALE, TWO_PI) * 90, SCALE);
+ return((neg) ? -aprsinv[apos] : aprsinv[apos]);
+ }
+
+@@ -100,7 +107,11 @@
+ video_info_t info;
+
+ /* Console capable of running 320x200x256? */
++#if __FreeBSD_version < 800000
+ if(get_mode_info(adp, M_VGA_CG320, &info)) {
++#else
++ if (vidd_get_info(adp, M_VGA_CG320, &info)) {
++#endif
+ log(LOG_NOTICE, "plasma_saver: the console does not support M_VGA_CG320\n");
+ return(ENODEV);
+ }
+@@ -123,14 +134,15 @@
+ anglebak[2] = angle[2];
+ for (i=0; i<PLAS_S; i++)
+ {
+- xbuffer[i] = 16*aprsin(angle[0]) + 8*aprsin(angle[1])
+- + 4*aprsin(angle[2]);
+- angle[0] += 2*PI/PLAS_S;
+- angle[1] += 4*PI/PLAS_S;
+- angle[2] += 8*PI/PLAS_S;
+- angle[3] += 2*PI/PLAS_S;
+- angle[4] += 4*PI/PLAS_S;
+- ybuffer[i] = 16*aprsin(angle[3]) + 8*aprsin(angle[4]);
++ xbuffer[i] = fdiv(16 * aprsin(angle[0]) +
++ 8 * aprsin(angle[1]) + 4 * aprsin(angle[2]), SCALE);
++ angle[0] += fdiv(2 * PI, PLAS_S);
++ angle[1] += fdiv(4 * PI, PLAS_S);
++ angle[2] += fdiv(8 * PI, PLAS_S);
++ angle[3] += fdiv(2 * PI, PLAS_S);
++ angle[4] += fdiv(4 * PI, PLAS_S);
++ ybuffer[i] = fdiv(16 * aprsin(angle[3]) +
++ 8 * aprsin(angle[4]), SCALE);
+ }
+ for(i=0; i<PLAS_S; i++)
+ {
+@@ -144,11 +156,11 @@
+ buffer[((i+45)*SCR_W) + (j+96)] = 128 +
+ ybuffer[i] + xbuffer[j];
+ }
+- angle[0] = anglebak[0] - ((2*PI/SCR_W)*WAVEMOD);
+- angle[1] = anglebak[1] + ((6*PI/SCR_W)*WAVEMOD);
+- angle[2] = anglebak[2] + ((4*PI/SCR_W)*WAVEMOD);
+- angle[3] = anglebak[0] + ((6*PI/SCR_W)*WAVEMOD);
+- angle[4] = anglebak[1] + ((10*PI/SCR_W)*WAVEMOD);
++ angle[0] = anglebak[0] - fdiv(fdiv(2 * PI, SCR_W) * WAVEMOD, 1000);
++ angle[1] = anglebak[1] + fdiv(fdiv(6 * PI, SCR_W) * WAVEMOD, 1000);
++ angle[2] = anglebak[2] + fdiv(fdiv(4 * PI, SCR_W) * WAVEMOD, 1000);
++ angle[3] = anglebak[0] + fdiv(fdiv(6 * PI, SCR_W) * WAVEMOD, 1000);
++ angle[4] = anglebak[1] + fdiv(fdiv(10 * PI, SCR_W) * WAVEMOD, 1000);
+ }
+
+ static int
+@@ -156,8 +168,13 @@
+ {
+ if(blank) {
+ if(blanked <= 0) {
++#if __FreeBSD_version < 800000
+ set_video_mode(adp, M_VGA_CG320);
+ load_palette(adp, plasma_pal);
++#else
++ vidd_set_mode(adp, M_VGA_CG320);
++ vidd_load_palette(adp, plasma_pal);
++#endif
+ blanked++;
+ video = (u_char *)adp->va_window;
+ /* Zero various stuff */
diff --git a/graphics/plasma-kmod/files/patch-plasma_saver.h b/graphics/plasma-kmod/files/patch-plasma_saver.h
new file mode 100644
index 000000000000..72b6508eeece
--- /dev/null
+++ b/graphics/plasma-kmod/files/patch-plasma_saver.h
@@ -0,0 +1,56 @@
+--- plasma_saver.h.orig 2001-01-24 11:57:49.000000000 -0500
++++ plasma_saver.h 2012-04-18 17:24:25.000000000 -0400
+@@ -29,30 +29,32 @@
+ * $FreeBSD$
+ */
+
+-#define PI 3.14159265358979323846
+-#define TWO_PI 6.28318530717958647692
++#define SCALE 1000000000LL
++#define PI 3141592654LL
++#define TWO_PI 6283185307LL
+
+ /* Precomputed values of sin(x), 0<=x<=TWO_PI */
+
+-float aprsinv[] = { 0.0000, 0.0698, 0.1392, 0.2079, 0.2756,
+- 0.3420, 0.4067, 0.4695, 0.5299, 0.5878,
+- 0.6428, 0.6947, 0.7431, 0.7880, 0.8290,
+- 0.8660, 0.8988, 0.9272, 0.9511, 0.9703,
+- 0.9848, 0.9945, 0.9994, 0.9994, 0.9945,
+- 0.9848, 0.9703, 0.9511, 0.9272, 0.8988,
+- 0.8660, 0.8290, 0.7880, 0.7431, 0.6947,
+- 0.6428, 0.5878, 0.5299, 0.4695, 0.4067,
+- 0.3420, 0.2756, 0.2079, 0.1392, 0.0698,
+- 0.0000, -0.0698, -0.1392, -0.2079, -0.2756,
+- -0.3420,-0.4067, -0.4695, -0.5299, -0.5878,
+- -0.6428,-0.6947, -0.7431, -0.7880, -0.8290,
+- -0.8660,-0.8988, -0.9272, -0.9511, -0.9703,
+- -0.9848,-0.9945, -0.9994, -0.9994, -0.9945,
+- -0.9848,-0.9703, -0.9511, -0.9272, -0.8988,
+- -0.8660,-0.8290, -0.7880, -0.7431, -0.6947,
+- -0.6428,-0.5878, -0.5299, -0.4695, -0.4067,
+- -0.3420,-0.2756, -0.2079, -0.1392, -0.0698
+- };
++int aprsinv[] = {
++ 0, 69756474, 139173101, 207911691, 275637356,
++ 342020143, 406736643, 469471563, 529919264, 587785252,
++ 642787610, 694658370, 743144825, 788010754, 829037573,
++ 866025404, 898794046, 927183855, 951056516, 970295726,
++ 984807753, 994521895, 999390827, 999390827, 994521895,
++ 984807753, 970295726, 951056516, 927183855, 898794046,
++ 866025404, 829037573, 788010754, 743144825, 694658370,
++ 642787610, 587785252, 529919264, 469471563, 406736643,
++ 342020143, 275637356, 207911691, 139173101, 69756474,
++ 0, -69756474, -139173101, -207911691, -275637356,
++ -342020143, -406736643, -469471563, -529919264, -587785252,
++ -642787610, -694658370, -743144825, -788010754, -829037573,
++ -866025404, -898794046, -927183855, -951056516, -970295726,
++ -984807753, -994521895, -999390827, -999390827, -994521895,
++ -984807753, -970295726, -951056516, -927183855, -898794046,
++ -866025404, -829037573, -788010754, -743144825, -694658370,
++ -642787610, -587785252, -529919264, -469471563, -406736643,
++ -342020143, -275637356, -207911691, -139173101, -69756474
++};
+
+ u_char plasma_pal[768] = {
+ 0, 0, 0,