From 0208372e56d8eceac8d42b7ffd193c748a867280 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 24 Mar 2017 17:35:21 -0400 Subject: misc/fbdump: Updated for version 0.4.2, new maintainer. Signed-off-by: B. Watson Signed-off-by: David Spencer --- misc/fbdump/README | 11 ++++- misc/fbdump/fbdump.1 | 94 ++++++++++++++++++++++++++++++++++++++++++ misc/fbdump/fbdump.SlackBuild | 49 ++++++++++++++++------ misc/fbdump/fbdump.info | 4 +- misc/fbdump/fbdump.rst | 78 +++++++++++++++++++++++++++++++++++ misc/fbdump/fflush_stdout.diff | 11 +++++ 6 files changed, 231 insertions(+), 16 deletions(-) create mode 100644 misc/fbdump/fbdump.1 create mode 100644 misc/fbdump/fbdump.rst create mode 100644 misc/fbdump/fflush_stdout.diff (limited to 'misc/fbdump') diff --git a/misc/fbdump/README b/misc/fbdump/README index 1840f20592..c7cd539bb1 100644 --- a/misc/fbdump/README +++ b/misc/fbdump/README @@ -1,8 +1,15 @@ +fbdump (captures the visible portion of framebuffer to stdout) + fbdump is a simple tool that captures the contents of the visible portion of the Linux framebuffer device and writes it to the standard output as a PPM file. In other words, it takes a screenshot of anything running on the framebuffer. It currently has fairly complete support for packed-pixel framebuffer types and also works with the VGA16 framebuffer driver. -To get a popular image format, issue a command like -'fbdump | pnmtopng > shot.png' +To get a popular image format, issue a command like: + + fbdump | pnmtopng > shot.png + +Note: fbdump is rather slow on modern systems with high-resolution +framebuffers at 32-bit color depth. On the maintainer's system, it takes +8 seconds to dump a 1920x1080x32 framebuffer. Be patient. diff --git a/misc/fbdump/fbdump.1 b/misc/fbdump/fbdump.1 new file mode 100644 index 0000000000..dfe262ea46 --- /dev/null +++ b/misc/fbdump/fbdump.1 @@ -0,0 +1,94 @@ +.\" Man page generated from reStructuredText. +. +.TH FBDUMP 1 "2017-03-24" "0.4.2" "SlackBuilds.org" +.SH NAME +fbdump \- Dumps the contents of the framebuffer to stdout as a PPM file +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" RST source for fbdump(1) man page. Convert with: +. +.\" rst2man.py fbdump.rst > fbdump.1 +. +.\" rst2man.py comes from the SBo development/docutils package. +. +.\" converting from pod: +. +.\" s/B<\([^>]*\)>/**\1**/g +. +.\" s/I<\([^>]*\)>/*\1*/g +. +.SH SYNOPSIS +.sp +fbdump [\fI\-fb \fP] [\fI\-vt \fP] [\fI\-delay \fP] +.SH DESCRIPTION +.sp +fbdump is a simple tool that captures the contents of the visible portion +of the Linux framebuffer device and writes it to the standard output as +a PPM file. In other words, it takes a screenshot of anything running on +the framebuffer. It currently has fairly complete support for packed\-pixel +framebuffer types and also works with the VGA16 framebuffer driver. +.SH OPTIONS +.INDENT 0.0 +.TP +.B \fB\-fb\fP \fIdevice\fP +Path to the framebuffer device to dump. Default: \fI/dev/fb0\fP\&. +.TP +.B \fB\-vt\fP \fIterminal\fP +Bring virtual terminal number \fIterminal\fP to the foreground before dumping. +Default: dump current foreground terminal. +.TP +.B \fB\-delay\fP \fIsec\fP +Wait \fIsec\fP seconds before dumping. Default: dump immediately. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Display usage and exit. +.UNINDENT +.SH EXAMPLES +.sp +To dump the framebuffer as a PNG image: +.INDENT 0.0 +.INDENT 3.5 +fbdump | pnmtopng > grab.png +.UNINDENT +.UNINDENT +.SH COPYRIGHT +.sp +See the file /usr/doc/fbdump\-0.4.2/COPYING for license information. +.SH AUTHORS +.sp +fbdump was written by Richard Drummond <\fI\%evilrich@rcdrummond.net\fP>. +.sp +This man page written for the SlackBuilds.org project +by B. Watson, and is licensed under the WTFPL. +.SH SEE ALSO +.sp +The fbdump homepage: \fI\%http://www.rcdrummond.net/fbdump/\fP +.\" Generated by docutils manpage writer. +. diff --git a/misc/fbdump/fbdump.SlackBuild b/misc/fbdump/fbdump.SlackBuild index d267206d8b..37847bb764 100644 --- a/misc/fbdump/fbdump.SlackBuild +++ b/misc/fbdump/fbdump.SlackBuild @@ -2,9 +2,11 @@ # Slackware build script for fbdump -# Ryan P.C. McQuen | Everett, WA | ryanpcmcquen@member.fsf.org +# Previously maintained by: +# Ryan P.C. McQuen | Everett, WA | -# Copyright 2010 Binh Nguyen +# Original author: +# Copyright 2010 Binh Nguyen # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -24,14 +26,30 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Now maintained by B. Watson (yalhcru@gmail.com) + +# 20170324 bkw: +# - take over maintenance. +# - fix major bug: output was being truncated, producing invalid ppm files! +# - add man page. +# - i486=>i586. +# - minor script updates. +# - update README. +# - BUILD=2. + +# TODO: see if there's a way to make fbdump faster. It's taking 8 sec +# to dump a 1920x1080x32bit framebuffer, and that's a pretty common +# framebuffer format these days. Compiling with lots of optimizations +# doesn't seem to help (even switching from gcc to clang). + PRGNAM=fbdump VERSION=${VERSION:-0.4.2} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) ARCH=i486 ;; + i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac @@ -42,14 +60,14 @@ TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} -if [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mtune=i686" +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then - SLKCFLAGS="-O2 -fPIC" + SLKCFLAGS="-O3 -fPIC -funroll-loops -fvectorize" LIBDIRSUFFIX="64" else SLKCFLAGS="-O2" @@ -71,6 +89,12 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +# 20170324 bkw: maybe returning from main() used to cause stdout to +# be flushed, back when fbdump was new... but these days we need to +# explicitly flush the buffer, or the output file is truncated. +patch -p1 < $CWD/fflush_stdout.diff + +CC=clang \ CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ @@ -84,14 +108,15 @@ CFLAGS="$SLKCFLAGS" \ --build=$ARCH-slackware-linux make -make install DESTDIR=$PKG +make install-strip DESTDIR=$PKG -find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ - | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +# man page written for this build, based on --help output and +# text from the homepage. +mkdir -p $PKG/usr/man/man1 +gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a AUTHORS COPYING ChangeLog INSTALL NEWS README TODO \ - $PKG/usr/doc/$PRGNAM-$VERSION +cp -a AUTHORS C* NEWS README TODO $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install diff --git a/misc/fbdump/fbdump.info b/misc/fbdump/fbdump.info index c76009b5b9..790bce43a3 100644 --- a/misc/fbdump/fbdump.info +++ b/misc/fbdump/fbdump.info @@ -6,5 +6,5 @@ MD5SUM="85ae97c0800a2caf2b04ad7764e3915b" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="Ryan P.C. McQuen" -EMAIL="ryanpcmcquen@member.fsf.org" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" diff --git a/misc/fbdump/fbdump.rst b/misc/fbdump/fbdump.rst new file mode 100644 index 0000000000..0b61bb6ec9 --- /dev/null +++ b/misc/fbdump/fbdump.rst @@ -0,0 +1,78 @@ +.. RST source for fbdump(1) man page. Convert with: +.. rst2man.py fbdump.rst > fbdump.1 +.. rst2man.py comes from the SBo development/docutils package. + +.. |version| replace:: 0.4.2 +.. |date| date:: + +.. converting from pod: +.. s/B<\([^>]*\)>/**\1**/g +.. s/I<\([^>]*\)>/*\1*/g + +====== +fbdump +====== + +------------------------------------------------------------- +Dumps the contents of the framebuffer to stdout as a PPM file +------------------------------------------------------------- + +:Manual section: 1 +:Manual group: SlackBuilds.org +:Date: |date| +:Version: |version| + +SYNOPSIS +======== + +fbdump [*-fb *] [*-vt *] [*-delay *] + +DESCRIPTION +=========== + +fbdump is a simple tool that captures the contents of the visible portion +of the Linux framebuffer device and writes it to the standard output as +a PPM file. In other words, it takes a screenshot of anything running on +the framebuffer. It currently has fairly complete support for packed-pixel +framebuffer types and also works with the VGA16 framebuffer driver. + +OPTIONS +======= + +**-fb** *device* + Path to the framebuffer device to dump. Default: */dev/fb0*. + +**-vt** *terminal* + Bring virtual terminal number *terminal* to the foreground before dumping. + Default: dump current foreground terminal. + +**-delay** *sec* + Wait *sec* seconds before dumping. Default: dump immediately. + +--help + Display usage and exit. + +EXAMPLES +======== + +To dump the framebuffer as a PNG image: + + fbdump | pnmtopng > grab.png + +COPYRIGHT +========= + +See the file /usr/doc/fbdump-|version|/COPYING for license information. + +AUTHORS +======= + +fbdump was written by Richard Drummond . + +This man page written for the SlackBuilds.org project +by B. Watson, and is licensed under the WTFPL. + +SEE ALSO +======== + +The fbdump homepage: http://www.rcdrummond.net/fbdump/ diff --git a/misc/fbdump/fflush_stdout.diff b/misc/fbdump/fflush_stdout.diff new file mode 100644 index 0000000000..cfd4bea51c --- /dev/null +++ b/misc/fbdump/fflush_stdout.diff @@ -0,0 +1,11 @@ +diff -Naur fbdump-0.4.2/src/surface.c fbdump-0.4.2.patched/src/surface.c +--- fbdump-0.4.2/src/surface.c 2007-03-02 22:13:50.000000000 -0500 ++++ fbdump-0.4.2.patched/src/surface.c 2017-03-24 16:54:08.538269897 -0400 +@@ -49,6 +49,7 @@ + + /* Write out the converted pixels to the stream. */ + fwrite( buf, width * 3, 1, stream ); ++ fflush(stream); + + /* And get a ptr to the next row. */ + rowptr += s->modulo; -- cgit v1.2.3