summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt7
-rw-r--r--Makefile533
-rw-r--r--bench.c613
-rw-r--r--bench.xml.in112
-rw-r--r--plugin.info1
-rw-r--r--src/bench.cpp411
-rw-r--r--src/bench.h104
-rw-r--r--src/bench_tex.h (renamed from bench_tex.h)0
8 files changed, 576 insertions, 1205 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8de7836..a52a82e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,6 @@
-include (CompizFusion)
+find_package (Compiz REQUIRED)
+
+include (CompizPlugin)
+
+compiz_plugin (bench PLUGINDEPS composite opengl)
-compiz_fusion_plugin (bench)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index d9a07cf..0000000
--- a/Makefile
+++ /dev/null
@@ -1,533 +0,0 @@
-##
-#
-# Compiz plugin Makefile
-#
-# Copyright : (C) 2007 by Dennis Kasprzyk
-# E-mail : onestone@deltatauchi.de
-#
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-##
-
-# plugin.info file contents
-#
-# PLUGIN = foo
-# PKG_DEP = pango
-# LDFLAGS_ADD = -lGLU
-# CFLAGS_ADD = -I/usr/include/foo
-# CHK_HEADERS = compiz-cube.h
-#
-
-#load config file
-
-ECHO = `which echo`
-
-# default color settings
-color := $(shell if [ $$TERM = "dumb" ]; then $(ECHO) "no"; else $(ECHO) "yes"; fi)
-
-ifeq ($(shell if [ -f plugin.info ]; then $(ECHO) -n "found"; fi ),found)
-include plugin.info
-else
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\033[1;31m[ERROR]\033[0m \"plugin.info\" file not found"; \
- else \
- $(ECHO) "[ERROR] \"plugin.info\" file not found"; \
- fi;))
-endif
-
-ifneq ($(shell if pkg-config --exists compiz; then $(ECHO) -n "found"; fi ),found)
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m Compiz not installed"; \
- else \
- $(ECHO) -n "[ERROR] Compiz not installed"; \
- fi))
-endif
-
-
-ifneq ($(shell if [ -n "$(PKG_DEP)" ]; then if pkg-config --exists $(PKG_DEP); then $(ECHO) -n "found"; fi; \
- else $(ECHO) -n "found"; fi ),found)
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m "; \
- else \
- $(ECHO) -n "[ERROR] "; \
- fi; \
- pkg-config --print-errors --short-errors --errors-to-stdout $(PKG_DEP); ))
-endif
-
-
-ifeq ($(BUILD_GLOBAL),true)
- PREFIX = $(shell pkg-config --variable=prefix compiz)
- CLIBDIR = $(shell pkg-config --variable=libdir compiz)
- CINCDIR = $(shell pkg-config --variable=includedir compiz)
- PKGDIR = $(CLIBDIR)/pkgconfig
- DESTDIR = $(shell pkg-config --variable=libdir compiz)/compiz
- XMLDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
- IMAGEDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
- DATADIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
-else
- DESTDIR = $(HOME)/.compiz/plugins
- XMLDIR = $(HOME)/.compiz/metadata
- IMAGEDIR = $(HOME)/.compiz/images
- DATADIR = $(HOME)/.compiz/data
-endif
-
-BUILDDIR = build
-
-CC = gcc
-CPP = g++
-LIBTOOL = libtool
-INSTALL = install
-
-BCOP = `pkg-config --variable=bin bcop`
-
-CFLAGS = -g -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing `pkg-config --cflags $(PKG_DEP) compiz ` $(CFLAGS_ADD)
-LDFLAGS = `pkg-config --libs $(PKG_DEP) compiz ` $(LDFLAGS_ADD)
-
-DEFINES = -DIMAGEDIR=\"$(IMAGEDIR)\" -DDATADIR=\"$(DATADIR)\"
-
-POFILEDIR = $(shell if [ -n "$(PODIR)" ]; then $(ECHO) $(PODIR); else $(ECHO) ./po;fi )
-
-COMPIZ_HEADERS = compiz.h compiz-core.h
-COMPIZ_INC = $(shell pkg-config --variable=includedir compiz)/compiz/
-
-is-bcop-target := $(shell if [ -e $(PLUGIN).xml.in ]; then cat $(PLUGIN).xml.in | grep "useBcop=\"true\""; \
- else if [ -e $(PLUGIN).xml ]; then cat $(PLUGIN).xml | grep "useBcop=\"true\""; fi; fi)
-
-trans-target := $(shell if [ -e $(PLUGIN).xml.in -o -e $(PLUGIN).xml ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml;fi )
-
-bcop-target := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml; fi )
-bcop-target-src := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN)_options.c; fi )
-bcop-target-hdr := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN)_options.h; fi )
-
-gen-schemas := $(shell if [ \( -e $(PLUGIN).xml.in -o -e $(PLUGIN).xml \) -a -n "`pkg-config --variable=xsltdir compiz-gconf`" ]; then $(ECHO) true; fi )
-schema-target := $(shell if [ -n "$(gen-schemas)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml; fi )
-schema-output := $(shell if [ -n "$(gen-schemas)" ]; then $(ECHO) $(BUILDDIR)/compiz-$(PLUGIN).schema; fi )
-
-ifeq ($(BUILD_GLOBAL),true)
- pkg-target := $(shell if [ -e compiz-$(PLUGIN).pc.in -a -n "$(PREFIX)" -a -d "$(PREFIX)" ]; then $(ECHO) "$(BUILDDIR)/compiz-$(PLUGIN).pc"; fi )
- hdr-install-target := $(shell if [ -e compiz-$(PLUGIN).pc.in -a -n "$(PREFIX)" -a -d "$(PREFIX)" -a -e compiz-$(PLUGIN).h ]; then $(ECHO) "compiz-$(PLUGIN).h"; fi )
-endif
-
-# find all the object files
-
-c-objs := $(patsubst %.c,%.lo,$(shell find -name '*.c' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
-c-objs += $(patsubst %.cpp,%.lo,$(shell find -name '*.cpp' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
-c-objs += $(patsubst %.cxx,%.lo,$(shell find -name '*.cxx' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
-c-objs := $(filter-out $(bcop-target-src:.c=.lo),$(c-objs))
-
-h-files := $(shell find -name '*.h' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///')
-h-files += $(bcop-target-hdr)
-h-files += $(foreach file,$(COMPIZ_HEADERS) $(CHK_HEADERS),$(shell $(ECHO) -n "$(COMPIZ_INC)$(file)"))
-
-all-c-objs := $(addprefix $(BUILDDIR)/,$(c-objs))
-all-c-objs += $(bcop-target-src:.c=.lo)
-
-# additional files
-
-data-files := $(shell find data/ -name '*' -type f 2> /dev/null | sed -e 's/data\///')
-image-files := $(shell find images/ -name '*' -type f 2> /dev/null | sed -e 's/images\///')
-
-# system include path parameter, -isystem doesn't work on old gcc's
-inc-path-param = $(shell if [ -z "`gcc --version | head -n 1 | grep ' 3'`" ]; then $(ECHO) "-isystem"; else $(ECHO) "-I"; fi)
-
-# Tests
-ifeq ($(shell if [ -n "$(is-bcop-target)" -a -z "$(BCOP)" ]; then $(ECHO) -n "error"; fi ),error)
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m BCOP not installed but is needed to build plugin"; \
- else \
- $(ECHO) -n "[ERROR] BCOP not installed but is needed to build plugin"; \
- fi))
-endif
-
-ifeq ($(shell if [ "x$(BUILD_GLOBAL)" != "xtrue" -a -e compiz-$(PLUGIN).pc.in ]; then $(ECHO) -n "warn"; fi ),warn)
-$(warning $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[WARNING]\033[0m This plugin might be needed by other plugins. Install it with \"BUILD_GLOBAL=true sudo make install\" "; \
- else \
- $(ECHO) -n "[WARNING] This plugin might be needed by other plugins. Install it with \"BUILD_GLOBAL=true sudo make install\""; \
- fi))
-endif
-
-#
-# Do it.
-#
-
-.PHONY: $(BUILDDIR) build-dir trans-target bcop-build pkg-creation schema-creation c-build-objs c-link-plugin
-
-all: $(BUILDDIR) build-dir trans-target bcop-build pkg-creation schema-creation c-build-objs c-link-plugin
-
-trans-build: $(trans-target)
-
-bcop-build: $(bcop-target-hdr) $(bcop-target-src)
-
-schema-creation: $(schema-output)
-
-c-build-objs: $(all-c-objs)
-
-c-link-plugin: $(BUILDDIR)/lib$(PLUGIN).la
-
-pkg-creation: $(pkg-target)
-
-#
-# Create build directory
-#
-
-$(BUILDDIR) :
- @mkdir -p $(BUILDDIR)
-
-$(DESTDIR) :
- @mkdir -p $(DESTDIR)
-
-#
-# fallback if xml.in doesn't exists
-#
-$(BUILDDIR)/%.xml: %.xml
- @cp $< $@
-
-#
-# Translating
-#
-$(BUILDDIR)/%.xml: %.xml.in
- @if [ -d $(POFILEDIR) ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mtranslate \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "translate $< -> $@"; \
- fi; \
- intltool-merge -x -u $(POFILEDIR) $< $@ > /dev/null; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mtranslate : \033[34m$< -> $@\033[0m"; \
- fi; \
- else \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mconvert \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "convert $< -> $@"; \
- fi; \
- cat $< | sed -e 's;<_;<;g' -e 's;</_;</;g' > $@; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mconvert : \033[34m$< -> $@\033[0m"; \
- fi; \
- fi
-
-#
-# BCOP'ing
-
-$(BUILDDIR)/%_options.h: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mbcop'ing \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "bcop'ing $< -> $@"; \
- fi
- @$(BCOP) --header=$@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mbcop'ing : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%_options.c: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mbcop'ing \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "bcop'ing $< -> $@"; \
- fi
- @$(BCOP) --source=$@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mbcop'ing : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Schema generation
-
-$(BUILDDIR)/compiz-%.schema: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mschema'ing\033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "schema'ing $< -> $@"; \
- fi
- @xsltproc `pkg-config --variable=xsltdir compiz-gconf`/schemas.xslt $< > $@
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mschema : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# pkg config file generation
-
-$(BUILDDIR)/compiz-%.pc: compiz-%.pc.in
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mpkgconfig \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "pkgconfig $< -> $@"; \
- fi
- @COMPIZREQUIRES=`cat $(PKGDIR)/compiz.pc | grep Requires | sed -e 's;Requires: ;;g'`; \
- COMPIZCFLAGS=`cat $(PKGDIR)/compiz.pc | grep Cflags | sed -e 's;Cflags: ;;g'`; \
- sed -e 's;@prefix@;$(PREFIX);g' -e 's;\@libdir@;$(CLIBDIR);g' \
- -e 's;@includedir@;$(CINCDIR);g' -e 's;\@VERSION@;0.0.1;g' \
- -e "s;@COMPIZ_REQUIRES@;$$COMPIZREQUIRES;g" \
- -e "s;@COMPIZ_CFLAGS@;$$COMPIZCFLAGS;g" $< > $@;
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mpkgconfig : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Compiling
-#
-
-$(BUILDDIR)/%.lo: %.c $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CC) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%.lo: $(BUILDDIR)/%.c $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CC) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%.lo: %.cpp $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%.lo: %.cxx $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Linking
-#
-
-cxx-rpath-prefix := -Wl,-rpath,
-
-$(BUILDDIR)/lib$(PLUGIN).la: $(all-c-objs)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mlinking \033[0m: \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "linking : $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=link $(CC) $(LDFLAGS) -rpath $(DESTDIR) -o $@ $(all-c-objs)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mlinking : \033[34m$@\033[0m"; \
- fi
-
-
-clean:
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mremoving \033[0m: \033[0;31m./$(BUILDDIR)\033[0m"; \
- else \
- $(ECHO) "removing : ./$(BUILDDIR)"; \
- fi
- @rm -rf $(BUILDDIR)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mremoving : \033[34m./$(BUILDDIR)\033[0m"; \
- fi
-
-
-install: $(DESTDIR) all
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- else \
- $(ECHO) "install : $(DESTDIR)/lib$(PLUGIN).so"; \
- fi
- @mkdir -p $(DESTDIR)
- @$(INSTALL) $(BUILDDIR)/.libs/lib$(PLUGIN).so $(DESTDIR)/lib$(PLUGIN).so
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- fi
- @if [ -e $(BUILDDIR)/$(PLUGIN).xml ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- else \
- $(ECHO) "install : $(XMLDIR)/$(PLUGIN).xml"; \
- fi; \
- mkdir -p $(XMLDIR); \
- $(INSTALL) $(BUILDDIR)/$(PLUGIN).xml $(XMLDIR)/$(PLUGIN).xml; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- fi; \
- fi
- @if [ -n "$(hdr-install-target)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- else \
- $(ECHO) "install : $(CINCDIR)/compiz/$(hdr-install-target)"; \
- fi; \
- $(INSTALL) --mode=u=rw,go=r,a-s $(hdr-install-target) $(CINCDIR)/compiz/$(hdr-install-target); \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(pkg-target)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- else \
- $(ECHO) "install : $(PKGDIR)/compiz-$(PLUGIN).pc"; \
- fi; \
- $(INSTALL) --mode=u=rw,go=r,a-s $(pkg-target) $(PKGDIR)/compiz-$(PLUGIN).pc; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- fi; \
- fi
- @if [ -n "$(schema-output)" -a -e "$(schema-output)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(schema-output)\033[0m"; \
- else \
- $(ECHO) "install : $(schema-output)"; \
- fi; \
- if [ "x$(USER)" = "xroot" ]; then \
- GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
- gconftool-2 --makefile-install-rule $(schema-output) > /dev/null; \
- else \
- gconftool-2 --install-schema-file=$(schema-output) > /dev/null; \
- fi; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(schema-output)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(data-files)" ]; then \
- mkdir -p $(DATADIR); \
- for FILE in $(data-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "install : $(DATADIR)/$$FILE"; \
- fi; \
- FILEDIR="$(DATADIR)/`dirname "$$FILE"`"; \
- mkdir -p "$$FILEDIR"; \
- $(INSTALL) --mode=u=rw,go=r,a-s data/$$FILE $(DATADIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
- @if [ -n "$(image-files)" ]; then \
- mkdir -p $(IMAGEDIR); \
- for FILE in $(image-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "install : $(IMAGEDIR)/$$FILE"; \
- fi; \
- FILEDIR="$(IMAGEDIR)/`dirname "$$FILE"`"; \
- mkdir -p "$$FILEDIR"; \
- $(INSTALL) --mode=u=rw,go=r,a-s images/$$FILE $(IMAGEDIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
-
-uninstall:
- @if [ -e $(DESTDIR)/lib$(PLUGIN).so ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- else \
- $(ECHO) "uninstall : $(DESTDIR)/lib$(PLUGIN).so"; \
- fi; \
- rm -f $(DESTDIR)/lib$(PLUGIN).so; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- fi; \
- fi
- @if [ -e $(XMLDIR)/$(PLUGIN).xml ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- else \
- $(ECHO) "uninstall : $(XMLDIR)/$(PLUGIN).xml"; \
- fi; \
- rm -f $(XMLDIR)/$(PLUGIN).xml; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- fi; \
- fi
- @if [ -n "$(hdr-install-target)" -a -e $(CINCDIR)/compiz/$(hdr-install-target) ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- else \
- $(ECHO) "uninstall : $(CINCDIR)/compiz/$(hdr-install-target)"; \
- fi; \
- rm -f $(CINCDIR)/compiz/$(hdr-install-target); \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(pkg-target)" -a -e $(PKGDIR)/compiz-$(PLUGIN).pc ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- else \
- $(ECHO) "uninstall : $(PKGDIR)/compiz-$(PLUGIN).pc"; \
- fi; \
- rm -f $(PKGDIR)/compiz-$(PLUGIN).pc; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- fi; \
- fi
- @if [ -n "$(schema-output)" -a -e "$(schema-output)" -a 'x$(USER)' = 'xroot' ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(schema-output)\033[0m"; \
- else \
- $(ECHO) "uninstall : $(schema-output)"; \
- fi; \
- GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
- gconftool-2 --makefile-uninstall-rule $(schema-output) > /dev/null; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(schema-output)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(data-files)" ]; then \
- for FILE in $(data-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "uninstall : $(DATADIR)/$$FILE"; \
- fi; \
- rm -f $(DATADIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
- @if [ -n "$(image-files)" ]; then \
- for FILE in $(image-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "uninstall : $(IMAGEDIR)/$$FILE"; \
- fi; \
- rm -f $(IMAGEDIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
diff --git a/bench.c b/bench.c
deleted file mode 100644
index 829bfa4..0000000
--- a/bench.c
+++ /dev/null
@@ -1,613 +0,0 @@
-/**
- *
- * Compiz benchmark plugin
- *
- * bench.c
- *
- * Copyright : (C) 2006 by Dennis Kasprzyk
- * E-mail : onestone@beryl-project.org
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- **/
-
-#include <compiz-core.h>
-
-#include "bench_tex.h"
-#include "bench_options.h"
-
-#define GET_BENCH_DISPLAY(d) \
- ((BenchDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
-
-#define BENCH_DISPLAY(d) \
- BenchDisplay *bd = GET_BENCH_DISPLAY (d)
-
-#define GET_BENCH_SCREEN(s, bd) \
- ((BenchScreen *) (s)->base.privates[(bd)->screenPrivateIndex].ptr)
-
-#define BENCH_SCREEN(s) \
- BenchScreen *bs = GET_BENCH_SCREEN (s, GET_BENCH_DISPLAY (s->display))
-
-#define TIMEVALDIFF(tv1, tv2) \
- (((tv1)->tv_sec == (tv2)->tv_sec || (tv1)->tv_usec >= (tv2)->tv_usec) ? \
- ((((tv1)->tv_sec - (tv2)->tv_sec) * 1000000) + \
- ((tv1)->tv_usec - (tv2)->tv_usec)) / 1000 : \
- ((((tv1)->tv_sec - 1 - (tv2)->tv_sec) * 1000000) + \
- (1000000 + (tv1)->tv_usec - (tv2)->tv_usec)) / 1000)
-
-#define TIMEVALDIFFU(tv1, tv2) \
- (((tv1)->tv_sec == (tv2)->tv_sec || (tv1)->tv_usec >= (tv2)->tv_usec) ? \
- ((((tv1)->tv_sec - (tv2)->tv_sec) * 1000000) + \
- ((tv1)->tv_usec - (tv2)->tv_usec)): \
- ((((tv1)->tv_sec - 1 - (tv2)->tv_sec) * 1000000) + \
- (1000000 + (tv1)->tv_usec - (tv2)->tv_usec)))
-
-#ifdef GL_DEBUG
-
-static GLenum gl_error;
-
-#define GLERR gl_error=glGetError(); if (gl_error != GL_NO_ERROR) { fprintf (stderr,"GL error 0x%X has occured at %s:%d\n",gl_error,__FILE__,__LINE__); }
-#else
-#define GLERR
-#endif
-
-static int displayPrivateIndex = 0;
-
-typedef struct _BenchDisplay
-{
- int screenPrivateIndex;
- Bool active;
-}
-BenchDisplay;
-
-typedef struct _BenchScreen
-{
- GLuint dList;
- float rrVal;
- float fps;
- float alpha;
-
- struct timeval initTime;
- struct timeval lastRedraw;
-
- float ctime;
- float frames;
-
- GLuint numTex[10];
- GLuint backTex;
-
- PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- PaintOutputProc paintOutput;
-}
-BenchScreen;
-
-static void
-benchPreparePaintScreen (CompScreen *s,
- int ms)
-{
- BENCH_SCREEN (s);
- BENCH_DISPLAY (s->display);
-
- float nRrVal;
- float ratio = 0.05;
- int timediff;
-
- struct timeval now;
-
- gettimeofday (&now, 0);
-
- timediff = TIMEVALDIFF (&now, &bs->lastRedraw);
-
- nRrVal = MIN (1.1, (float) s->optimalRedrawTime / (float) timediff);
-
- bs->rrVal = (bs->rrVal * (1.0 - ratio) ) + (nRrVal * ratio);
-
- bs->fps = (bs->fps * (1.0 - ratio) ) +
- (1000000.0 / TIMEVALDIFFU (&now, &bs->lastRedraw) * ratio);
-
- bs->lastRedraw = now;
-
- if (benchGetOutputConsole (s->display) && bd->active)
- {
- bs->frames++;
- bs->ctime += timediff;
-
- if (bs->ctime >
- benchGetConsoleUpdateTime (s->display) * 1000)
- {
- printf ("[BENCH] : %.0f frames in %.1f seconds = %.3f FPS\n",
- bs->frames, bs->ctime / 1000.0,
- bs->frames / (bs->ctime / 1000.0) );
- bs->frames = 0;
- bs->ctime = 0;
- }
- }
-
- UNWRAP (bs, s, preparePaintScreen);
- (*s->preparePaintScreen) (s, (bs->alpha > 0.0) ? timediff : ms);
- WRAP (bs, s, preparePaintScreen, benchPreparePaintScreen);
-
- if (bd->active)
- bs->alpha += timediff / 1000.0;
- else
- bs->alpha -= timediff / 1000.0;
-
- bs->alpha = MIN (1.0, MAX (0.0, bs->alpha) );
-}
-
-static void
-benchDonePaintScreen (CompScreen *s)
-{
- BENCH_SCREEN (s);
- BENCH_DISPLAY (s->display);
-
- if (bs->alpha > 0.0)
- {
- damageScreen (s);
- glFlush();
- XSync (s->display->display, FALSE);
-
- if (benchGetDisableLimiter (s->display) )
- {
- s->lastRedraw = bs->initTime;
- s->timeMult = 0;
- }
-
- if (!bd->active)
- s->timeMult = 0;
- }
-
- UNWRAP (bs, s, donePaintScreen);
- (*s->donePaintScreen) (s);
- WRAP (bs, s, donePaintScreen, benchDonePaintScreen);
-}
-
-static Bool
-benchPaintOutput (CompScreen *s,
- const ScreenPaintAttrib *sa,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask)
-{
-
- Bool status, isSet;
- unsigned int fps;
- CompTransform sTransform = *transform;
-
- BENCH_SCREEN (s);
-
- UNWRAP (bs, s, paintOutput);
- status = (*s->paintOutput) (s, sa, transform, region, output, mask);
- WRAP (bs, s, paintOutput, benchPaintOutput);
-
- if (bs->alpha <= 0.0
- || !benchGetOutputScreen (s->display) )
- return status;
-
- glGetError();
- glPushAttrib (GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT);
- GLERR;
-
- transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
-
- glPushMatrix ();
- glLoadMatrixf (sTransform.m);
-
- glEnable (GL_BLEND);
- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glColor4f (1.0, 1.0, 1.0, bs->alpha);
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- glTranslatef (benchGetPositionX (s->display),
- benchGetPositionY (s->display), 0);
-
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, bs->backTex);
-
- glBegin (GL_QUADS);
- glTexCoord2f (0, 0);
- glVertex2f (0, 0);
- glTexCoord2f (0, 1);
- glVertex2f (0, 256);
- glTexCoord2f (1, 1);
- glVertex2f (512, 256);
- glTexCoord2f (1, 0);
- glVertex2f (512, 0);
- glEnd();
-
- glBindTexture (GL_TEXTURE_2D, 0);
- glDisable (GL_TEXTURE_2D);
-
- glTranslatef (53, 83, 0);
-
- float rrVal = MIN (1.0, MAX (0.0, bs->rrVal) );
-
- if (rrVal < 0.5)
- {
- glBegin (GL_QUADS);
- glColor4f (1.0, 0.0, 0.0, bs->alpha);
- glVertex2f (0.0, 0.0);
- glVertex2f (0.0, 25.0);
- glColor4f (1.0, rrVal * 2.0, 0.0, bs->alpha);
- glVertex2f (330.0 * rrVal, 25.0);
- glVertex2f (330.0 * rrVal, 0.0);
- glEnd();
- }
- else
- {
- glBegin (GL_QUADS);
- glColor4f (1.0, 0.0, 0.0, bs->alpha);
- glVertex2f (0.0, 0.0);
- glVertex2f (0.0, 25.0);
- glColor4f (1.0, 1.0, 0.0, bs->alpha);
- glVertex2f (165.0, 25.0);
- glVertex2f (165.0, 0.0);
- glEnd();
-
- glBegin (GL_QUADS);
- glColor4f (1.0, 1.0, 0.0, bs->alpha);
- glVertex2f (165.0, 0.0);
- glVertex2f (165.0, 25.0);
- glColor4f (1.0 - ( (rrVal - 0.5) * 2.0), 1.0, 0.0, bs->alpha);
- glVertex2f (165.0 + 330.0 * (rrVal - 0.5), 25.0);
- glVertex2f (165.0 + 330.0 * (rrVal - 0.5), 0.0);
- glEnd();
- }
-
- glColor4f (0.0, 0.0, 0.0, bs->alpha);
- glCallList (bs->dList);
- glTranslatef (72, 45, 0);
-
- float red;
-
- if (bs->fps > 30.0)
- red = 0.0;
- else
- red = 1.0;
-
- if (bs->fps <= 30.0 && bs->fps > 20.0)
- red = 1.0 - ( (bs->fps - 20.0) / 10.0);
-
- glColor4f (red, 0.0, 0.0, bs->alpha);
- glEnable (GL_TEXTURE_2D);
-
- isSet = FALSE;
-
- fps = (bs->fps * 100.0);
- fps = MIN (999999, fps);
-
- if (fps >= 100000)
- {
- glBindTexture (GL_TEXTURE_2D, bs->numTex[fps / 100000]);
- glCallList (bs->dList + 1);
- isSet = TRUE;
- }
-
- fps %= 100000;
-
- glTranslatef (12, 0, 0);
-
- if (fps >= 10000 || isSet)
- {
- glBindTexture (GL_TEXTURE_2D, bs->numTex[fps / 10000]);
- glCallList (bs->dList + 1);
- isSet = TRUE;
- }
-
- fps %= 10000;
-
- glTranslatef (12, 0, 0);
-
- if (fps >= 1000 || isSet)
- {
- glBindTexture (GL_TEXTURE_2D, bs->numTex[fps / 1000]);
- glCallList (bs->dList + 1);
- }
-
- fps %= 1000;
-
- glTranslatef (12, 0, 0);
-
- glBindTexture (GL_TEXTURE_2D, bs->numTex[fps / 100]);
- glCallList (bs->dList + 1);
- fps %= 100;
-
- glTranslatef (19, 0, 0);
-
- glBindTexture (GL_TEXTURE_2D, bs->numTex[fps / 10]);
- glCallList (bs->dList + 1);
- fps %= 10;
-
- glTranslatef (12, 0, 0);
-
- glBindTexture (GL_TEXTURE_2D, bs->numTex[fps]);
- glCallList (bs->dList + 1);
-
- glBindTexture (GL_TEXTURE_2D, 0);
- glDisable (GL_TEXTURE_2D);
-
- glPopMatrix();
-
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glColor4f (1.0, 1.0, 1.0, 1.0);
-
- glPopAttrib();
- glGetError();
-
- return status;
-}
-
-static Bool
-benchInitScreen (CompPlugin *p,
- CompScreen *s)
-{
- int i;
-
- BENCH_DISPLAY (s->display);
-
- BenchScreen *bs = (BenchScreen *) calloc (1, sizeof (BenchScreen) );
-
- s->base.privates[bd->screenPrivateIndex].ptr = bs;
-
- WRAP (bs, s, paintOutput, benchPaintOutput);
- WRAP (bs, s, preparePaintScreen, benchPreparePaintScreen);
- WRAP (bs, s, donePaintScreen, benchDonePaintScreen);
-
- glGenTextures (10, bs->numTex);
- glGenTextures (1, &bs->backTex);
-
- glGetError();
-
- glEnable (GL_TEXTURE_2D);
-
- bs->alpha = 0;
- bs->ctime = 0;
- bs->frames = 0;
-
- for (i = 0; i < 10; i++)
- {
- //Bind the texture
- glBindTexture (GL_TEXTURE_2D, bs->numTex[i]);
-
- //Load the parameters
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-
- glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 16, 32, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, number_data[i]);
- GLERR;
- }
-
- glBindTexture (GL_TEXTURE_2D, bs->backTex);
-
- //Load the parameters
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-
- glTexImage2D (GL_TEXTURE_2D, 0, 4, 512, 256, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, image_data);
- GLERR;
-
- glBindTexture (GL_TEXTURE_2D, 0);
- glDisable (GL_TEXTURE_2D);
-
- bs->dList = glGenLists (2);
- glNewList (bs->dList, GL_COMPILE);
-
- glLineWidth (2.0);
-
- glBegin (GL_LINE_LOOP);
- glVertex2f (0, 0);
- glVertex2f (0, 25);
- glVertex2f (330, 25);
- glVertex2f (330, 0);
- glEnd();
-
- glLineWidth (1.0);
-
- glBegin (GL_LINES);
-
- for (i = 33; i < 330; i += 33)
- {
- glVertex2f (i, 15);
- glVertex2f (i, 25);
- }
-
- for (i = 16; i < 330; i += 33)
- {
- glVertex2f (i, 20);
- glVertex2f (i, 25);
- }
-
- glEnd();
-
- glEndList();
-
- glNewList (bs->dList + 1, GL_COMPILE);
- glBegin (GL_QUADS);
- glTexCoord2f (0, 0);
- glVertex2f (0, 0);
- glTexCoord2f (0, 1);
- glVertex2f (0, 32);
- glTexCoord2f (1, 1);
- glVertex2f (16, 32);
- glTexCoord2f (1, 0);
- glVertex2f (16, 0);
- glEnd();
- glEndList();
-
- gettimeofday (&bs->initTime, 0);
- gettimeofday (&bs->lastRedraw, 0);
-
- return TRUE;
-}
-
-
-static void
-benchFiniScreen (CompPlugin *p,
- CompScreen *s)
-{
-
- BENCH_SCREEN (s);
- glDeleteLists (bs->dList, 2);
-
- glDeleteTextures (10, bs->numTex);
- glDeleteTextures (1, &bs->backTex);
-
- //Restore the original function
- UNWRAP (bs, s, paintOutput);
- UNWRAP (bs, s, preparePaintScreen);
- UNWRAP (bs, s, donePaintScreen);
-
- //Free the pointer
- free (bs);
-}
-
-static Bool
-benchInitiate (CompDisplay *d,
- CompAction *ac,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
-
- BENCH_DISPLAY (d);
- bd->active = !bd->active;
- bd->active &= benchGetOutputScreen (d) || benchGetOutputConsole (d);
- s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "root", 0));
-
- if (s)
- {
- BENCH_SCREEN (s);
- damageScreen (s);
- bs->ctime = 0;
- bs->frames = 0;
- }
-
- return FALSE;
-}
-
-static Bool
-benchInitDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- //Generate a bench display
- BenchDisplay *bd;
-
- if (!checkPluginABI ("core", CORE_ABIVERSION))
- return FALSE;
-
- bd = (BenchDisplay *) malloc (sizeof (BenchDisplay));
-
- if (!bd)
- return FALSE;
-
- //Allocate a private index
- bd->screenPrivateIndex = allocateScreenPrivateIndex (d);
- //Check if its valid
-
- if (bd->screenPrivateIndex < 0)
- {
- //Its invalid so free memory and return
- free (bd);
- return FALSE;
- }
-
- benchSetInitiateKeyInitiate (d, benchInitiate);
-
- bd->active = FALSE;
- //Record the display
- d->base.privates[displayPrivateIndex].ptr = bd;
- return TRUE;
-}
-
-static void
-benchFiniDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- BENCH_DISPLAY (d);
- //Free the private index
- freeScreenPrivateIndex (d, bd->screenPrivateIndex);
- //Free the pointer
- free (bd);
-}
-
-
-
-static Bool
-benchInit (CompPlugin * p)
-{
- displayPrivateIndex = allocateDisplayPrivateIndex();
-
- if (displayPrivateIndex < 0)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-benchFini (CompPlugin * p)
-{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
-}
-
-static CompBool
-benchInitObject (CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) 0, /* InitCore */
- (InitPluginObjectProc) benchInitDisplay,
- (InitPluginObjectProc) benchInitScreen
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-}
-
-static void
-benchFiniObject (CompPlugin *p,
- CompObject *o)
-{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) 0, /* FiniCore */
- (FiniPluginObjectProc) benchFiniDisplay,
- (FiniPluginObjectProc) benchFiniScreen
- };
-
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
-}
-
-CompPluginVTable benchVTable = {
- "bench",
- 0,
- benchInit,
- benchFini,
- benchInitObject,
- benchFiniObject,
- 0,
- 0
-};
-
-CompPluginVTable *
-getCompPluginInfo (void)
-{
- return &benchVTable;
-}
diff --git a/bench.xml.in b/bench.xml.in
index b0101a8..2279ef1 100644
--- a/bench.xml.in
+++ b/bench.xml.in
@@ -1,60 +1,60 @@
<?xml version="1.0"?>
<compiz>
- <plugin name="bench" useBcop="true">
- <_short>Benchmark</_short>
- <_long>A simple benchmark plugin</_long>
+ <plugin name="bench" useBcop="true">
+ <_short>Benchmark</_short>
+ <_long>A simple benchmark plugin</_long>
<category>Extras</category>
- <display>
- <group>
- <_short>Main</_short>
- <option name="initiate_key" type="key">
- <_short>Initiate</_short>
- <_long>Start benchmark</_long>
- <default>&lt;Super&gt;F12</default>
- </option>
- <option name="disable_limiter" type="bool">
- <_short>Disable limiter</_short>
- <_long>Disable Compiz integrated FPS limiter</_long>
- <default>true</default>
- </option>
- <subgroup>
- <_short>Screen Output</_short>
- <option name="output_screen" type="bool">
- <_short>Enable</_short>
- <_long>Display FPS on screen</_long>
- <default>true</default>
- </option>
- <option name="position_x" type="int">
- <_short>X position</_short>
- <_long>X Position of benchmark window</_long>
- <default>0</default>
- <min>0</min>
- <max>4096</max>
- </option>
- <option name="position_y" type="int">
- <_short>Y position</_short>
- <_long>Y Position of benchmark window</_long>
- <default>0</default>
- <min>0</min>
- <max>4096</max>
- </option>
- </subgroup>
- <subgroup>
- <_short>Console Output</_short>
- <option name="output_console" type="bool">
- <_short>Enable</_short>
- <_long>Print FPS to console</_long>
- <default>false</default>
- </option>
- <option name="console_update_time" type="int">
- <_short>Update time</_short>
- <_long>Console output update time</_long>
- <default>5</default>
- <min>1</min>
- <max>60</max>
- </option>
- </subgroup>
- </group>
- </display>
- </plugin>
+ <options>
+ <group>
+ <_short>Main</_short>
+ <option name="initiate_key" type="key">
+ <_short>Initiate</_short>
+ <_long>Start benchmark</_long>
+ <default>&lt;Super&gt;F12</default>
+ </option>
+ <option name="disable_limiter" type="bool">
+ <_short>Disable limiter</_short>
+ <_long>Disable Compiz integrated FPS limiter</_long>
+ <default>true</default>
+ </option>
+ <subgroup>
+ <_short>Screen Output</_short>
+ <option name="output_screen" type="bool">
+ <_short>Enable</_short>
+ <_long>Display FPS on screen</_long>
+ <default>true</default>
+ </option>
+ <option name="position_x" type="int">
+ <_short>X position</_short>
+ <_long>X Position of benchmark window</_long>
+ <default>0</default>
+ <min>0</min>
+ <max>4096</max>
+ </option>
+ <option name="position_y" type="int">
+ <_short>Y position</_short>
+ <_long>Y Position of benchmark window</_long>
+ <default>0</default>
+ <min>0</min>
+ <max>4096</max>
+ </option>
+ </subgroup>
+ <subgroup>
+ <_short>Console Output</_short>
+ <option name="output_console" type="bool">
+ <_short>Enable</_short>
+ <_long>Print FPS to console</_long>
+ <default>false</default>
+ </option>
+ <option name="console_update_time" type="int">
+ <_short>Update time</_short>
+ <_long>Console output update time</_long>
+ <default>5</default>
+ <min>1</min>
+ <max>60</max>
+ </option>
+ </subgroup>
+ </group>
+ </options>
+ </plugin>
</compiz>
diff --git a/plugin.info b/plugin.info
deleted file mode 100644
index 3d1df6b..0000000
--- a/plugin.info
+++ /dev/null
@@ -1 +0,0 @@
-PLUGIN = bench
diff --git a/src/bench.cpp b/src/bench.cpp
new file mode 100644
index 0000000..fdb2bf3
--- /dev/null
+++ b/src/bench.cpp
@@ -0,0 +1,411 @@
+/**
+ *
+ * Compiz benchmark plugin
+ *
+ * bench.c
+ *
+ * Copyright : (C) 2006 by Dennis Kasprzyk
+ * E-mail : onestone@beryl-project.org
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ **/
+
+#include "bench.h"
+
+COMPIZ_PLUGIN_20090315 (bench, BenchPluginVTable)
+
+void
+BenchScreen::preparePaint (int msSinceLastPaint)
+{
+ float nRrVal;
+ float ratio = 0.05;
+ int timediff;
+
+ struct timeval now;
+
+ gettimeofday (&now, 0);
+
+ timediff = TIMEVALDIFF (&now, &mLastRedraw);
+
+ nRrVal = MIN (1.1,
+ (float) cScreen->optimalRedrawTime () / (float) timediff);
+
+ mRrVal = (mRrVal * (1.0 - ratio) ) + (nRrVal * ratio);
+
+ mFps = (mFps * (1.0 - ratio) ) +
+ (1000000.0 / TIMEVALDIFFU (&now, &mLastRedraw) * ratio);
+
+ mLastRedraw = now;
+
+ if (optionGetOutputConsole () && mActive)
+ {
+ mFrames++;
+ mCtime += timediff;
+
+ if (mCtime > optionGetConsoleUpdateTime () * 1000)
+ {
+ printf ("[BENCH] : %.0f frames in %.1f seconds = %.3f FPS\n",
+ mFrames, mCtime / 1000.0,
+ mFrames / (mCtime / 1000.0) );
+ mFrames = 0;
+ mCtime = 0;
+ }
+ }
+
+ cScreen->preparePaint ((mAlpha > 0.0) ? timediff : msSinceLastPaint);
+
+ if (mActive)
+ mAlpha += timediff / 1000.0;
+ else
+ mAlpha -= timediff / 1000.0;
+
+ mAlpha = MIN (1.0, MAX (0.0, mAlpha) );
+}
+
+void
+BenchScreen::donePaint ()
+{
+ if (mAlpha > 0.0)
+ {
+ cScreen->damageScreen ();
+ glFlush();
+ XSync (::screen->dpy (), false);
+
+ if (optionGetDisableLimiter ())
+ {
+ cScreen->setLastRedraw (mInitTime);
+ cScreen->resetTimeMult ();
+ }
+
+ if (!mActive)
+ cScreen->resetTimeMult ();
+ }
+
+ cScreen->donePaint ();
+}
+
+bool
+BenchScreen::glPaintOutput (const GLScreenPaintAttrib &sAttrib,
+ const GLMatrix &transform,
+ const CompRegion &region,
+ CompOutput *output,
+ unsigned int mask)
+{
+ bool status;
+ bool isSet;
+ unsigned int fps;
+ GLMatrix sTransform (transform);
+
+ status = gScreen->glPaintOutput (sAttrib, transform, region, output, mask);
+
+ if (mAlpha <= 0.0 || !optionGetOutputScreen ())
+ return status;
+
+ glGetError();
+ glPushAttrib (GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT);
+ GLERR;
+
+ sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+
+ glPushMatrix ();
+ glLoadMatrixf (sTransform.getMatrix ());
+
+ glEnable (GL_BLEND);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glColor4f (1.0, 1.0, 1.0, mAlpha);
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ glTranslatef (optionGetPositionX (), optionGetPositionY (), 0);
+
+ glEnable (GL_TEXTURE_2D);
+ glBindTexture (GL_TEXTURE_2D, mBackTex);
+
+ glBegin (GL_QUADS);
+ glTexCoord2f (0, 0);
+ glVertex2f (0, 0);
+ glTexCoord2f (0, 1);
+ glVertex2f (0, 256);
+ glTexCoord2f (1, 1);
+ glVertex2f (512, 256);
+ glTexCoord2f (1, 0);
+ glVertex2f (512, 0);
+ glEnd();
+
+ glBindTexture (GL_TEXTURE_2D, 0);
+ glDisable (GL_TEXTURE_2D);
+
+ glTranslatef (53, 83, 0);
+
+ float rrVal = MIN (1.0, MAX (0.0, mRrVal) );
+
+ if (rrVal < 0.5)
+ {
+ glBegin (GL_QUADS);
+ glColor4f (1.0, 0.0, 0.0, mAlpha);
+ glVertex2f (0.0, 0.0);
+ glVertex2f (0.0, 25.0);
+ glColor4f (1.0, rrVal * 2.0, 0.0, mAlpha);
+ glVertex2f (330.0 * rrVal, 25.0);
+ glVertex2f (330.0 * rrVal, 0.0);
+ glEnd();
+ }
+ else
+ {
+ glBegin (GL_QUADS);
+ glColor4f (1.0, 0.0, 0.0, mAlpha);
+ glVertex2f (0.0, 0.0);
+ glVertex2f (0.0, 25.0);
+ glColor4f (1.0, 1.0, 0.0, mAlpha);
+ glVertex2f (165.0, 25.0);
+ glVertex2f (165.0, 0.0);
+ glEnd();
+
+ glBegin (GL_QUADS);
+ glColor4f (1.0, 1.0, 0.0, mAlpha);
+ glVertex2f (165.0, 0.0);
+ glVertex2f (165.0, 25.0);
+ glColor4f (1.0 - ( (rrVal - 0.5) * 2.0), 1.0, 0.0, mAlpha);
+ glVertex2f (165.0 + 330.0 * (rrVal - 0.5), 25.0);
+ glVertex2f (165.0 + 330.0 * (rrVal - 0.5), 0.0);
+ glEnd();
+ }
+
+ glColor4f (0.0, 0.0, 0.0, mAlpha);
+ glCallList (mDList);
+ glTranslatef (72, 45, 0);
+
+ float red;
+
+ if (mFps > 30.0)
+ red = 0.0;
+ else
+ red = 1.0;
+
+ if (mFps <= 30.0 && mFps > 20.0)
+ red = 1.0 - ( (mFps - 20.0) / 10.0);
+
+ glColor4f (red, 0.0, 0.0, mAlpha);
+ glEnable (GL_TEXTURE_2D);
+
+ isSet = false;
+
+ fps = (mFps * 100.0);
+ fps = MIN (999999, fps);
+
+ if (fps >= 100000)
+ {
+ glBindTexture (GL_TEXTURE_2D, mNumTex[fps / 100000]);
+ glCallList (mDList + 1);
+ isSet = true;
+ }
+
+ fps %= 100000;
+
+ glTranslatef (12, 0, 0);
+
+ if (fps >= 10000 || isSet)
+ {
+ glBindTexture (GL_TEXTURE_2D, mNumTex[fps / 10000]);
+ glCallList (mDList + 1);
+ isSet = true;
+ }
+
+ fps %= 10000;
+
+ glTranslatef (12, 0, 0);
+
+ if (fps >= 1000 || isSet)
+ {
+ glBindTexture (GL_TEXTURE_2D, mNumTex[fps / 1000]);
+ glCallList (mDList + 1);
+ }
+
+ fps %= 1000;
+
+ glTranslatef (12, 0, 0);
+
+ glBindTexture (GL_TEXTURE_2D, mNumTex[fps / 100]);
+ glCallList (mDList + 1);
+ fps %= 100;
+
+ glTranslatef (19, 0, 0);
+
+ glBindTexture (GL_TEXTURE_2D, mNumTex[fps / 10]);
+ glCallList (mDList + 1);
+ fps %= 10;
+
+ glTranslatef (12, 0, 0);
+
+ glBindTexture (GL_TEXTURE_2D, mNumTex[fps]);
+ glCallList (mDList + 1);
+
+ glBindTexture (GL_TEXTURE_2D, 0);
+ glDisable (GL_TEXTURE_2D);
+
+ glPopMatrix();
+
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+
+ glColor4f (1.0, 1.0, 1.0, 1.0);
+
+ glPopAttrib();
+ glGetError();
+
+ return status;
+}
+
+BenchScreen::BenchScreen (CompScreen *screen) :
+ PluginClassHandler<BenchScreen, CompScreen> (screen),
+ cScreen (CompositeScreen::get (screen)),
+ gScreen (GLScreen::get (screen)),
+ mAlpha (0),
+ mCtime (0),
+ mFrames (0),
+ mActive (false)
+{
+ optionSetInitiateKeyInitiate (boost::bind (&BenchScreen::initiate, this,
+ _3));
+
+ CompositeScreenInterface::setHandler (cScreen, false);
+ GLScreenInterface::setHandler (gScreen, false);
+
+ glGenTextures (10, mNumTex);
+ glGenTextures (1, &mBackTex);
+
+ glGetError();
+
+ glEnable (GL_TEXTURE_2D);
+
+ for (int i = 0; i < 10; i++)
+ {
+ //Bind the texture
+ glBindTexture (GL_TEXTURE_2D, mNumTex[i]);
+
+ //Load the parameters
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+
+ glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 16, 32, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, number_data[i]);
+ GLERR;
+ }
+
+ glBindTexture (GL_TEXTURE_2D, mBackTex);
+
+ //Load the parameters
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+
+ glTexImage2D (GL_TEXTURE_2D, 0, 4, 512, 256, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, image_data);
+ GLERR;
+
+ glBindTexture (GL_TEXTURE_2D, 0);
+ glDisable (GL_TEXTURE_2D);
+
+ mDList = glGenLists (2);
+ glNewList (mDList, GL_COMPILE);
+
+ glLineWidth (2.0);
+
+ glBegin (GL_LINE_LOOP);
+ glVertex2f (0, 0);
+ glVertex2f (0, 25);
+ glVertex2f (330, 25);
+ glVertex2f (330, 0);
+ glEnd();
+
+ glLineWidth (1.0);
+
+ glBegin (GL_LINES);
+
+ for (int i = 33; i < 330; i += 33)
+ {
+ glVertex2f (i, 15);
+ glVertex2f (i, 25);
+ }
+
+ for (int i = 16; i < 330; i += 33)
+ {
+ glVertex2f (i, 20);
+ glVertex2f (i, 25);
+ }
+
+ glEnd();
+
+ glEndList();
+
+ glNewList (mDList + 1, GL_COMPILE);
+ glBegin (GL_QUADS);
+ glTexCoord2f (0, 0);
+ glVertex2f (0, 0);
+ glTexCoord2f (0, 1);
+ glVertex2f (0, 32);
+ glTexCoord2f (1, 1);
+ glVertex2f (16, 32);
+ glTexCoord2f (1, 0);
+ glVertex2f (16, 0);
+ glEnd();
+ glEndList();
+
+ gettimeofday (&mInitTime, 0);
+ gettimeofday (&mLastRedraw, 0);
+}
+
+BenchScreen::~BenchScreen ()
+{
+ glDeleteLists (mDList, 2);
+
+ glDeleteTextures (10, mNumTex);
+ glDeleteTextures (1, &mBackTex);
+}
+
+bool
+BenchScreen::initiate (CompOption::Vector &options)
+{
+ mActive = !mActive;
+ mActive &= optionGetOutputScreen () || optionGetOutputConsole ();
+
+ Window xid;
+
+ xid = CompOption::getIntOptionNamed (options, "root");
+
+ if (xid != ::screen->root ())
+ return false;
+
+ cScreen->preparePaintSetEnabled (this, mActive);
+ cScreen->donePaintSetEnabled (this, mActive);
+ gScreen->glPaintOutputSetEnabled (this, mActive);
+
+ cScreen->damageScreen ();
+ mCtime = 0;
+ mFrames = 0;
+
+ return false;
+}
+
+bool
+BenchPluginVTable::init ()
+{
+ if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) |
+ !CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) |
+ !CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
+ return false;
+
+ return true;
+}
+
diff --git a/src/bench.h b/src/bench.h
new file mode 100644
index 0000000..032f871
--- /dev/null
+++ b/src/bench.h
@@ -0,0 +1,104 @@
+/**
+ *
+ * Compiz benchmark plugin
+ *
+ * bench.c
+ *
+ * Copyright : (C) 2006 by Dennis Kasprzyk
+ * E-mail : onestone@beryl-project.org
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ **/
+
+#include <core/core.h>
+#include <core/pluginclasshandler.h>
+
+#include <composite/composite.h>
+#include <opengl/opengl.h>
+
+#include <sys/time.h>
+
+#include "bench_tex.h"
+#include "bench_options.h"
+
+/*
+#define TIMEVALDIFF(tv1, tv2) \
+ (((tv1)->tv_sec == (tv2)->tv_sec || (tv1)->tv_usec >= (tv2)->tv_usec) ? \
+ ((((tv1)->tv_sec - (tv2)->tv_sec) * 1000000) + \
+ ((tv1)->tv_usec - (tv2)->tv_usec)) / 1000 : \
+ ((((tv1)->tv_sec - 1 - (tv2)->tv_sec) * 1000000) + \
+ (1000000 + (tv1)->tv_usec - (tv2)->tv_usec)) / 1000)
+*/
+#define TIMEVALDIFFU(tv1, tv2) \
+ (((tv1)->tv_sec == (tv2)->tv_sec || (tv1)->tv_usec >= (tv2)->tv_usec) ? \
+ ((((tv1)->tv_sec - (tv2)->tv_sec) * 1000000) + \
+ ((tv1)->tv_usec - (tv2)->tv_usec)): \
+ ((((tv1)->tv_sec - 1 - (tv2)->tv_sec) * 1000000) + \
+ (1000000 + (tv1)->tv_usec - (tv2)->tv_usec)))
+
+#ifdef GL_DEBUG
+
+static GLenum gl_error;
+
+#define GLERR gl_error=glGetError(); if (gl_error != GL_NO_ERROR) { fprintf (stderr,"GL error 0x%X has occured at %s:%d\n",gl_error,__FILE__,__LINE__); }
+#else
+#define GLERR
+#endif
+
+class BenchScreen :
+ public CompositeScreenInterface,
+ public GLScreenInterface,
+ public PluginClassHandler<BenchScreen, CompScreen>,
+ public BenchOptions
+{
+ public:
+ BenchScreen (CompScreen *screen);
+ ~BenchScreen ();
+
+ CompositeScreen *cScreen;
+ GLScreen *gScreen;
+
+ GLuint mDList;
+ float mRrVal;
+ float mFps;
+ float mAlpha;
+
+ struct timeval mInitTime;
+ struct timeval mLastRedraw;
+
+ float mCtime;
+ float mFrames;
+
+ GLuint mNumTex[10];
+ GLuint mBackTex;
+
+ bool mActive;
+
+ bool initiate (CompOption::Vector &options);
+
+ void preparePaint (int msSinceLastPaint);
+ void donePaint ();
+
+ bool glPaintOutput (const GLScreenPaintAttrib &,
+ const GLMatrix &, const CompRegion &,
+ CompOutput *, unsigned int);
+};
+
+class BenchPluginVTable :
+ public CompPlugin::VTableForScreen<BenchScreen>
+{
+ public:
+
+ bool init ();
+};
+
diff --git a/bench_tex.h b/src/bench_tex.h
index 0d95c65..0d95c65 100644
--- a/bench_tex.h
+++ b/src/bench_tex.h