Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2016 08:55:31 +0000 (UTC)
From:      =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r294783 - in stable/10: share/man/man4 sys/dev/syscons/plasma sys/modules/syscons sys/modules/syscons/plasma
Message-ID:  <201601260855.u0Q8tVCX047200@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Tue Jan 26 08:55:31 2016
New Revision: 294783
URL: https://svnweb.freebsd.org/changeset/base/294783

Log:
  MFH (r293034, r29304): plasma screensaver

Added:
  stable/10/sys/dev/syscons/plasma/
     - copied from r293034, head/sys/dev/syscons/plasma/
  stable/10/sys/modules/syscons/plasma/
     - copied from r293034, head/sys/modules/syscons/plasma/
Modified:
  stable/10/share/man/man4/splash.4
  stable/10/sys/dev/syscons/plasma/fp16.c
  stable/10/sys/dev/syscons/plasma/fp16.h
  stable/10/sys/dev/syscons/plasma/plasma_saver.c
  stable/10/sys/modules/syscons/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/splash.4
==============================================================================
--- stable/10/share/man/man4/splash.4	Tue Jan 26 08:49:44 2016	(r294782)
+++ stable/10/share/man/man4/splash.4	Tue Jan 26 08:55:31 2016	(r294783)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 29, 2010
+.Dd December 31, 2015
 .Dt SPLASH 4
 .Os
 .Sh NAME
@@ -130,6 +130,8 @@ the screen will also be powered off.
 Animated graphical
 .Fx
 logo.
+.It Pa plasma_saver.ko
+Draws an animated interference pattern.
 .It Pa rain_saver.ko
 Draws a shower on the screen.
 .It Pa snake_saver.ko
@@ -282,6 +284,14 @@ based on the
 code, with some additional inspiration from the
 .Pa daemon_saver
 code.
+The
+.Pa logo_saver ,
+.Pa plasma_saver ,
+.Pa rain_saver
+and
+.Pa warp_saver
+modules were written by
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
 .Sh CAVEATS
 Both the splash screen and the screen saver work with
 .Xr syscons 4

Modified: stable/10/sys/dev/syscons/plasma/fp16.c
==============================================================================
--- head/sys/dev/syscons/plasma/fp16.c	Fri Jan  1 04:04:40 2016	(r293034)
+++ stable/10/sys/dev/syscons/plasma/fp16.c	Tue Jan 26 08:55:31 2016	(r294783)
@@ -71,42 +71,66 @@ fp16_sqrt(fp16_t x)
 	return (y);
 }
 
-static fp16_t fp16_cos_table[256] = {
-	65536,	65534,	65531,	65524,	65516,	65505,	65491,	65475,
-	65457,	65436,	65412,	65386,	65358,	65327,	65294,	65258,
-	65220,	65179,	65136,	65091,	65043,	64992,	64939,	64884,
-	64826,	64766,	64703,	64638,	64571,	64501,	64428,	64353,
-	64276,	64197,	64115,	64030,	63943,	63854,	63762,	63668,
-	63571,	63473,	63371,	63268,	63162,	63053,	62942,	62829,
-	62714,	62596,	62475,	62353,	62228,	62100,	61971,	61839,
-	61705,	61568,	61429,	61288,	61144,	60998,	60850,	60700,
-	60547,	60392,	60235,	60075,	59913,	59749,	59583,	59414,
-	59243,	59070,	58895,	58718,	58538,	58356,	58172,	57986,
-	57797,	57606,	57414,	57219,	57022,	56822,	56621,	56417,
-	56212,	56004,	55794,	55582,	55368,	55152,	54933,	54713,
-	54491,	54266,	54040,	53811,	53581,	53348,	53114,	52877,
-	52639,	52398,	52155,	51911,	51665,	51416,	51166,	50914,
-	50660,	50403,	50146,	49886,	49624,	49360,	49095,	48828,
-	48558,	48288,	48015,	47740,	47464,	47186,	46906,	46624,
-	46340,	46055,	45768,	45480,	45189,	44897,	44603,	44308,
-	44011,	43712,	43412,	43110,	42806,	42501,	42194,	41885,
-	41575,	41263,	40950,	40636,	40319,	40002,	39682,	39362,
-	39039,	38716,	38390,	38064,	37736,	37406,	37075,	36743,
-	36409,	36074,	35738,	35400,	35061,	34721,	34379,	34036,
-	33692,	33346,	32999,	32651,	32302,	31952,	31600,	31247,
-	30893,	30538,	30181,	29824,	29465,	29105,	28745,	28383,
-	28020,	27656,	27291,	26925,	26557,	26189,	25820,	25450,
-	25079,	24707,	24334,	23960,	23586,	23210,	22833,	22456,
-	22078,	21699,	21319,	20938,	20557,	20175,	19792,	19408,
-	19024,	18638,	18253,	17866,	17479,	17091,	16702,	16313,
-	15923,	15533,	15142,	14751,	14359,	13966,	13573,	13179,
-	12785,	12390,	11995,	11600,	11204,	10807,	10410,	10013,
-	 9616,	 9218,	 8819,	 8421,	 8022,	 7623,	 7223,	 6823,
-	 6423,	 6023,	 5622,	 5222,	 4821,	 4420,	 4018,	 3617,
-	 3215,	 2814,	 2412,	 2010,	 1608,	 1206,	  804,	  402,
+static fp16_t fp16_sin_table[256] = {
+	    0,	  402,	  804,	 1206,	 1608,	 2010,	 2412,	 2814,
+	 3215,	 3617,	 4018,	 4420,	 4821,	 5222,	 5622,	 6023,
+	 6423,	 6823,	 7223,	 7623,	 8022,	 8421,	 8819,	 9218,
+	 9616,	10013,	10410,	10807,	11204,	11600,	11995,	12390,
+	12785,	13179,	13573,	13966,	14359,	14751,	15142,	15533,
+	15923,	16313,	16702,	17091,	17479,	17866,	18253,	18638,
+	19024,	19408,	19792,	20175,	20557,	20938,	21319,	21699,
+	22078,	22456,	22833,	23210,	23586,	23960,	24334,	24707,
+	25079,	25450,	25820,	26189,	26557,	26925,	27291,	27656,
+	28020,	28383,	28745,	29105,	29465,	29824,	30181,	30538,
+	30893,	31247,	31600,	31952,	32302,	32651,	32999,	33346,
+	33692,	34036,	34379,	34721,	35061,	35400,	35738,	36074,
+	36409,	36743,	37075,	37406,	37736,	38064,	38390,	38716,
+	39039,	39362,	39682,	40002,	40319,	40636,	40950,	41263,
+	41575,	41885,	42194,	42501,	42806,	43110,	43412,	43712,
+	44011,	44308,	44603,	44897,	45189,	45480,	45768,	46055,
+	46340,	46624,	46906,	47186,	47464,	47740,	48015,	48288,
+	48558,	48828,	49095,	49360,	49624,	49886,	50146,	50403,
+	50660,	50914,	51166,	51416,	51665,	51911,	52155,	52398,
+	52639,	52877,	53114,	53348,	53581,	53811,	54040,	54266,
+	54491,	54713,	54933,	55152,	55368,	55582,	55794,	56004,
+	56212,	56417,	56621,	56822,	57022,	57219,	57414,	57606,
+	57797,	57986,	58172,	58356,	58538,	58718,	58895,	59070,
+	59243,	59414,	59583,	59749,	59913,	60075,	60235,	60392,
+	60547,	60700,	60850,	60998,	61144,	61288,	61429,	61568,
+	61705,	61839,	61971,	62100,	62228,	62353,	62475,	62596,
+	62714,	62829,	62942,	63053,	63162,	63268,	63371,	63473,
+	63571,	63668,	63762,	63854,	63943,	64030,	64115,	64197,
+	64276,	64353,	64428,	64501,	64571,	64638,	64703,	64766,
+	64826,	64884,	64939,	64992,	65043,	65091,	65136,	65179,
+	65220,	65258,	65294,	65327,	65358,	65386,	65412,	65436,
+	65457,	65475,	65491,	65505,	65516,	65524,	65531,	65534,
 };
 
 /*
+ * Compute the sine of theta.
+ */
+fp16_t
+fp16_sin(fp16_t theta)
+{
+	unsigned int i;
+
+	i = 1024 * (theta % FP16_2PI) / FP16_2PI;
+	switch (i / 256) {
+	case 0:
+		return (fp16_sin_table[i % 256]);
+	case 1:
+		return (fp16_sin_table[255 - i % 256]);
+	case 2:
+		return (-fp16_sin_table[i % 256]);
+	case 3:
+		return (-fp16_sin_table[255 - i % 256]);
+	default:
+		/* inconceivable! */
+		return (0);
+	}
+}
+
+/*
  * Compute the cosine of theta.
  */
 fp16_t
@@ -117,13 +141,13 @@ fp16_cos(fp16_t theta)
 	i = 1024 * (theta % FP16_2PI) / FP16_2PI;
 	switch (i / 256) {
 	case 0:
-		return (fp16_cos_table[i % 256]);
+		return (fp16_sin_table[255 - i % 256]);
 	case 1:
-		return (-fp16_cos_table[255 - i % 256]);
+		return (-fp16_sin_table[i % 256]);
 	case 2:
-		return (-fp16_cos_table[i % 256]);
+		return (-fp16_sin_table[255 - i % 256]);
 	case 3:
-		return (fp16_cos_table[255 - i % 256]);
+		return (fp16_sin_table[i % 256]);
 	default:
 		/* inconceivable! */
 		return (0);

Modified: stable/10/sys/dev/syscons/plasma/fp16.h
==============================================================================
--- head/sys/dev/syscons/plasma/fp16.h	Fri Jan  1 04:04:40 2016	(r293034)
+++ stable/10/sys/dev/syscons/plasma/fp16.h	Tue Jan 26 08:55:31 2016	(r294783)
@@ -78,7 +78,8 @@ fp16_t fp16_sqrt(fp16_t);
 #define FP16_PI_2	 102943
 #define FP16_PI_4	  51471
 
-/* cosine */
+/* sine and cosine */
+fp16_t fp16_sin(fp16_t);
 fp16_t fp16_cos(fp16_t);
 
 #endif

Modified: stable/10/sys/dev/syscons/plasma/plasma_saver.c
==============================================================================
--- head/sys/dev/syscons/plasma/plasma_saver.c	Fri Jan  1 04:04:40 2016	(r293034)
+++ stable/10/sys/dev/syscons/plasma/plasma_saver.c	Tue Jan 26 08:55:31 2016	(r294783)
@@ -104,7 +104,7 @@ plasma_update(video_adapter_t *adp)
 				sqd = ItoFP16(dx * dx + dy * dy);
 				d = fp16_sqrt(sqd);
 				/* divide by 4 to stretch out the pattern */
-				m = fp16_add(m, fp16_cos(d / 4));
+				m = fp16_sub(m, fp16_cos(d / 4));
 			}
 			/*
 			 * m is now in the range +/- FOCI, but we need a

Modified: stable/10/sys/modules/syscons/Makefile
==============================================================================
--- stable/10/sys/modules/syscons/Makefile	Tue Jan 26 08:49:44 2016	(r294782)
+++ stable/10/sys/modules/syscons/Makefile	Tue Jan 26 08:55:31 2016	(r294783)
@@ -9,6 +9,7 @@ SUBDIR=	${_apm} \
 	${_fire} \
 	green \
 	${_logo} \
+	${_plasma} \
 	${_rain} \
 	${_snake} \
 	${_star} \
@@ -25,6 +26,7 @@ _daemon=	daemon
 _dragon=	dragon
 _fire=		fire
 _logo=		logo
+_plasma=	plasma
 _rain=		rain
 _snake=		snake
 _star=		star



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