--- intel-gpu-tools-1.2.orig/autogen.sh +++ intel-gpu-tools-1.2/autogen.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd $srcdir + +autoreconf -v --install || exit 1 +cd $ORIGDIR || exit $? + +$srcdir/configure --enable-maintainer-mode "$@" --- intel-gpu-tools-1.2.orig/tests/ZZ_hangman +++ intel-gpu-tools-1.2/tests/ZZ_hangman @@ -0,0 +1,62 @@ +#!/bin/sh +# +# Testcase: Simulate gpu hang +# +# This check uses the stop_rings facility to exercise the gpu hang code. +# by reading /sys/kernel/debug/dri/0/i915_emon_status too quickly +# + +if [ -d /debug/dri ] ; then + debugfs_path=/debug_dri +fi + +if [ -d /sys/kernel/debug/dri ] ; then + debugfs_path=/sys/kernel/debug/dri +fi + +cur_path=`pwd` +i915_path=x +for dir in `ls $debugfs_path` ; do + if [ -f $debugfs_path/$dir/i915_error_state ] ; then + i915_path=$debugfs_path/$dir + break + fi +done + +if [ $i915_path = "x" ] ; then + echo i915 debugfs path not found. + exit 1 +fi + +cd $i915_path + +if [ ! -f i915_ring_stop ] ; then + echo "kernel doesn't support ring stopping" + exit 77 +fi + +if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then + echo "gpu hang dectected" + exit 1 +fi + +# stop rings +echo 0xf > i915_ring_stop + +# need to run it twice, otherwise there are no waiters +$cur_path/gem_exec_nop > /dev/null 2>&1 & +$cur_path/gem_exec_nop > /dev/null 2>&1 & + +sleep 10 + +if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then + echo "gpu hang correctly dectected" +else + echo "gpu hang not dectected" + exit 2 +fi + +# clear error state +echo 0 > i915_ring_stop + +exit 0 --- intel-gpu-tools-1.2.orig/tests/gem_hangcheck_forcewake.c +++ intel-gpu-tools-1.2/tests/gem_hangcheck_forcewake.c @@ -0,0 +1,127 @@ +/* + * Copyright © 2011 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Daniel Vetter + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "drm.h" +#include "i915_drm.h" +#include "drmtest.h" +#include "intel_bufmgr.h" +#include "intel_batchbuffer.h" +#include "intel_gpu_tools.h" + +/* + * Testcase: Provoke the hangcheck timer on an otherwise idle system + * + * This tries to hit forcewake locking bugs when the hangcheck runs. Somehow we + * often luck out and the hangcheck runs while someone else is already holding + * the dev->struct_mutex. + * + * It's imperative that nothing else runs while this test runs, i.e. kill your X + * session, please. + */ + +static drm_intel_bufmgr *bufmgr; +struct intel_batchbuffer *batch; + +uint32_t blob[2048*2048]; + +#define MAX_BLT_SIZE 128 +int main(int argc, char **argv) +{ + drm_intel_bo *bo = NULL; + uint32_t tiling_mode = I915_TILING_X; + unsigned long pitch, act_size; + int fd, i, devid; + + memset(blob, 'A', sizeof(blob)); + + fd = drm_open_any(); + + bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); + drm_intel_bufmgr_gem_enable_reuse(bufmgr); + devid = intel_get_drm_devid(fd); + batch = intel_batchbuffer_alloc(bufmgr, devid); + + act_size = 2048; + printf("filling ring\n"); + drm_intel_bo_unreference(bo); + bo = drm_intel_bo_alloc_tiled(bufmgr, "tiled bo", act_size, act_size, + 4, &tiling_mode, &pitch, 0); + + drm_intel_bo_subdata(bo, 0, act_size*act_size*4, blob); + + if (IS_965(devid)) + pitch /= 4; + + for (i = 0; i < 10000; i++) { + BEGIN_BATCH(8); + OUT_BATCH(XY_SRC_COPY_BLT_CMD | + XY_SRC_COPY_BLT_WRITE_ALPHA | + XY_SRC_COPY_BLT_WRITE_RGB | + XY_SRC_COPY_BLT_SRC_TILED | + XY_SRC_COPY_BLT_DST_TILED); + OUT_BATCH((3 << 24) | /* 32 bits */ + (0xcc << 16) | /* copy ROP */ + pitch); + OUT_BATCH(0 << 16 | 1024); + OUT_BATCH((2048) << 16 | (2048)); + OUT_RELOC_FENCED(bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0); + OUT_BATCH(0 << 16 | 0); + OUT_BATCH(pitch); + OUT_RELOC_FENCED(bo, I915_GEM_DOMAIN_RENDER, 0, 0); + ADVANCE_BATCH(); + + if (IS_GEN6(devid) || IS_GEN7(devid)) { + BEGIN_BATCH(3); + OUT_BATCH(XY_SETUP_CLIP_BLT_CMD); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + } + } + + printf("waiting\n"); + sleep(10); + + printf("done waiting, check dmesg\n"); + drm_intel_bo_unreference(bo); + + intel_batchbuffer_free(batch); + drm_intel_bufmgr_destroy(bufmgr); + + close(fd); + + return 0; +} --- intel-gpu-tools-1.2.orig/debian/rules +++ intel-gpu-tools-1.2/debian/rules @@ -0,0 +1,22 @@ +#!/usr/bin/make -f + +# Disable test suite: +override_dh_auto_test: + echo 'Test suite disabled (does not perform a build check).' + +# Install in debian/tmp to retain control through dh_install: +override_dh_auto_install: + dh_auto_install --destdir=debian/tmp + +# Forget no-one: +override_dh_install: + cd debian/tmp/usr/bin && mv forcewaked intel_forcewaked + dh_install --fail-missing + +%: + dh $@ --with quilt,autoreconf --builddirectory=build/ + +# For maintainer use only, generate a tarball: +gentarball: UV=$(shell dpkg-parsechangelog|awk '/^Version:/ {print $$2}'|sed 's/-.*$$//') +gentarball: + git archive --format=tar upstream-unstable --prefix=$(SOURCE)-$(UV)/ | gzip -9 > ../$(SOURCE)_$(UV).orig.tar.gz --- intel-gpu-tools-1.2.orig/debian/control +++ intel-gpu-tools-1.2/debian/control @@ -0,0 +1,29 @@ +Source: intel-gpu-tools +Section: x11 +Priority: optional +Maintainer: Debian X Strike Force +Uploaders: Eric Anholt , Tormod Volden , Cyril Brulebois +Build-Depends: + debhelper (>= 8), + dh-autoreconf, + quilt, + pkg-config, + libpciaccess-dev (>= 0.10), + libdrm-dev, + libdrm-intel1 (>= 2.4.23), + xutils-dev (>= 1:7.6+6), +Standards-Version: 3.9.2 +Homepage: http://www.intellinuxgraphics.org/ +Vcs-Git: git://git.debian.org/git/pkg-xorg/app/intel-gpu-tools.git +Vcs-Browser: http://git.debian.org/?p=pkg-xorg/app/intel-gpu-tools.git + +Package: intel-gpu-tools +Architecture: any +Depends: + ${shlibs:Depends}, + ${misc:Depends}, +Conflicts: xserver-xorg-video-intel (<< 2.9.1) +Description: tools for debugging the Intel graphics driver + intel-gpu-tools is a package of tools for debugging the Intel graphics driver, + including a GPU hang dumping program, performance monitor, and performance + microbenchmarks for regression testing the DRM. --- intel-gpu-tools-1.2.orig/debian/README.Debian +++ intel-gpu-tools-1.2/debian/README.Debian @@ -0,0 +1,7 @@ +intel-gpu-tools for Debian +-------------------------- + +The upstream code includes regression tests for the DRM using automake's +make check system. Those are not included in this package. + + -- Eric Anholt Tue, 19 May 2009 18:23:16 -0700 --- intel-gpu-tools-1.2.orig/debian/watch +++ intel-gpu-tools-1.2/debian/watch @@ -0,0 +1,3 @@ +#git=git://anongit.freedesktop.org/app/intel-gpu-tools +version=3 +http://xorg.freedesktop.org/archive/individual/app/intel-gpu-tools-(.*)\.tar\.gz --- intel-gpu-tools-1.2.orig/debian/copyright +++ intel-gpu-tools-1.2/debian/copyright @@ -0,0 +1,70 @@ +This package was debianized by Eric Anholt on +Tue, 19 May 2009 15:00:52 -0700. + +It was downloaded from http://xorg.freedesktop.org/archive/individual/app/ + +Upstream Authors: + + Eric Anholt + Jesse Barnes + Keith Whitwell + Carl Worth + +Copyright: + + Copyright © 2005 Adam Jackson + Copyright © 2007-2009 Intel Corporation + Copyright 1998-1999, 2006 Tungsten Graphics, Inc., Cedar Park, Texas. + +License: +The code is covered by the MIT license. Most of it is under the common form +that just says "authors and copyright holders": + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + +Some of the code is also under the MIT license but specifically mentions +Tungsten Graphics: + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sub license, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +The Debian packaging is: + + Copyright (C) 2009 Eric Anholt + +and is licensed under the GPL version 3, +see `/usr/share/common-licenses/GPL-3'. --- intel-gpu-tools-1.2.orig/debian/intel-gpu-tools.install +++ intel-gpu-tools-1.2/debian/intel-gpu-tools.install @@ -0,0 +1,2 @@ +usr/bin +usr/share/man --- intel-gpu-tools-1.2.orig/debian/docs +++ intel-gpu-tools-1.2/debian/docs @@ -0,0 +1 @@ +README --- intel-gpu-tools-1.2.orig/debian/changelog +++ intel-gpu-tools-1.2/debian/changelog @@ -0,0 +1,61 @@ +intel-gpu-tools (1.2-1) unstable; urgency=low + + * New upstream release + * Add 10-Revert-tests-make-testdisplay-non-optional.patch to + avoid unnecessary build deps for the unshipped testdisplay + * Add 20-Revert-Fix-pthread-compiler-flags-to-work-on-Solaris.patch + to build on current xorg-macros + * Add 30-Revert-add-sprite-demo-from-Armin-Reese.patch because + it requires newer libdrm than ours + * Rename forcewaked to intel_forcewaked (upstream post-release fix) + + -- Tormod Volden Tue, 28 Feb 2012 23:13:05 +0100 + +intel-gpu-tools (1.1-1) unstable; urgency=low + + [ Cyril Brulebois ] + * New upstream release. (Closes: #621721) + - Fixes intel_gpu_top MMIO issue. (Closes: #655672) + * Make the Debian X Strike Force maintain the package; keeping Eric, + Tormod, and myself as Uploaders. + * Wrap Build-Depends/Depends. + * Bump libdrm-intel1 build-dep. + * Update watch file: + - Add a reference to upstream git repository. + - Switch from tar.bz2 to tar.gz, the former isn't supported by the 1.0 + source format. + * Switch to dh: + - Switch debhelper build-dep and compat to 8. + - Use dh-autoreconf and quilt as in other X packages. + - Use --fail-missing and .install accordingly. + * Disable test suite, "make test" checks GPU/drm, not the build + + [ Bryce Harrington ] + * control: Add Conflicts with xserver-xorg-video-intel < 2.9.1 due to + intel_reg_dumper. (LP: #591203) + * Add build dependency on xutils-dev to fix FTBFS. + * rules: Add gentarball target to make it easier to update to new git + snapshots when needed. + * Add 100_drmtest_exit_not_abort.patch to avoid SIGABRT when running + benchmarks as non-root. + + [ Tormod Volden ] + * control: Add Vcs links + * Bump Standards-Version to 3.9.2 (no changes needed) + + -- Cyril Brulebois Sat, 11 Feb 2012 18:09:34 +0100 + +intel-gpu-tools (1.0.2-1) unstable; urgency=low + + * New upstream version 1.0.2 + * debian/control: Bump to Standards-Version 3.8.3 (no changes needed) + * debian/control: Build-dep on libdrm-intel1 >= 2.4.6 + * debian/control: Add myself as uploader + + -- Tormod Volden Thu, 19 Nov 2009 19:03:26 +0100 + +intel-gpu-tools (1.0.1-1) unstable; urgency=low + + * Initial release (Closes: #529553) + + -- Eric Anholt Fri, 04 Sep 2009 11:51:02 -0700 --- intel-gpu-tools-1.2.orig/debian/compat +++ intel-gpu-tools-1.2/debian/compat @@ -0,0 +1 @@ +8 --- intel-gpu-tools-1.2.orig/debian/patches/100_drmtest_exit_not_abort.patch +++ intel-gpu-tools-1.2/debian/patches/100_drmtest_exit_not_abort.patch @@ -0,0 +1,43 @@ +From 73af5dcd1d361543a79189456e66b951bc4c9cb3 Mon Sep 17 00:00:00 2001 +From: Bryce Harrington +Date: Tue, 24 Jan 2012 19:35:28 -0800 +Subject: [PATCH intel-gpu-tools 1/1] drmtest: exit() rather than abort() for simple usage errors. + +When the benchmarks are run as non-root, they terminate since they can't +read the drm files. However, by terminating with abort(), this raises +SIGABRT which has the side effect of triggering crash reporting +utilities (e.g. apport). As a result we've been accumulating bug +reports about it. + +As the code is displaying a unique error message prior to termination, +it should be discoverable enough where in the code the failure occurs, +so an exit(1) should be sufficient for termination. + +Signed-off-by: Bryce Harrington +--- + lib/drmtest.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/drmtest.c b/lib/drmtest.c +index fc40ad1..5ebd6d6 100644 +--- a/lib/drmtest.c ++++ b/lib/drmtest.c +@@ -65,7 +65,7 @@ int drm_open_any(void) + close(fd); + } + fprintf(stderr, "failed to open any drm device. retry as root?\n"); +- abort(); ++ exit(1); + } + + +@@ -108,5 +108,5 @@ int drm_open_any_master(void) + return fd; + } + fprintf(stderr, "Couldn't find an un-controlled DRM device\n"); +- abort(); ++ exit(1); + } +-- +1.7.4.1 + --- intel-gpu-tools-1.2.orig/debian/patches/20-Revert-Fix-pthread-compiler-flags-to-work-on-Solaris.patch +++ intel-gpu-tools-1.2/debian/patches/20-Revert-Fix-pthread-compiler-flags-to-work-on-Solaris.patch @@ -0,0 +1,81 @@ +From 3f9062f847598e56a2d46b3b1ee53a75a545531d Mon Sep 17 00:00:00 2001 +From: Tormod Volden +Date: Thu, 16 Feb 2012 23:01:24 +0100 +Subject: [PATCH] Revert "Fix pthread compiler flags to work on Solaris and + with Studio compiler" + +This reverts commit 504c4fa94f109338ef90a7e07b21bfafa67b8d4e. + +Conflicts: + + configure.ac +--- + configure.ac | 11 +++-------- + tests/Makefile.am | 2 +- + tests/gem_fence_thrash.c | 2 +- + 3 files changed, 5 insertions(+), 10 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 94d54a6..0b92cb7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -30,7 +30,6 @@ AC_CONFIG_SRCDIR([Makefile.am]) + AC_CONFIG_HEADERS([config.h]) + AC_CONFIG_MACRO_DIR([m4]) + AC_CONFIG_AUX_DIR([build-aux]) +-AC_USE_SYSTEM_EXTENSIONS + + AM_INIT_AUTOMAKE([foreign dist-bzip2]) + AM_PATH_PYTHON([3],, [:]) +@@ -47,10 +46,10 @@ AC_CHECK_FUNCS([swapctl]) + AC_DISABLE_STATIC + AC_PROG_LIBTOOL + +-# Require X.Org macros 1.16 or later for XORG_TESTSET_CFLAG ++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS + m4_ifndef([XORG_MACROS_VERSION], +- [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])]) +-XORG_MACROS_VERSION(1.16) ++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) ++XORG_MACROS_VERSION(1.8) + XORG_DEFAULT_OPTIONS + + PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.31 libdrm]) +@@ -105,10 +104,6 @@ fi + AM_CONDITIONAL(BUILD_SHADER_DEBUGGER, [test "x$BUILD_SHADER_DEBUGGER" != xno]) + # ----------------------------------------------------------------------------- + +-# To build multithread code, gcc uses -pthread, Solaris Studio cc uses -mt +-XORG_TESTSET_CFLAG([THREAD_CFLAGS], [-pthread], [-mt]) +-AC_SUBST([THREAD_CFLAGS]) +- + AC_CONFIG_FILES([ + Makefile + benchmarks/Makefile +diff --git a/tests/Makefile.am b/tests/Makefile.am +index a1573b7..46770b2 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -103,5 +103,5 @@ TESTS_progs += testdisplay + LDADD += $(CAIRO_LIBS) $(LIBUDEV_LIBS) $(GLIB_LIBS) + AM_CFLAGS += $(CAIRO_CFLAGS) $(LIBUDEV_CFLAGS) $(GLIB_CFLAGS) + +-gem_fence_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS) ++gem_fence_thrash_CFLAGS = $(AM_CFLAGS) -pthread + gem_fence_thrash_LDADD = $(LDADD) -lpthread +diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c +index 2065ac6..11a3eb8 100644 +--- a/tests/gem_fence_thrash.c ++++ b/tests/gem_fence_thrash.c +@@ -26,7 +26,7 @@ + * + */ + +-#include "config.h" ++#define _GNU_SOURCE + + #include + #include +-- +1.7.9 + --- intel-gpu-tools-1.2.orig/debian/patches/10-Revert-tests-make-testdisplay-non-optional.patch +++ intel-gpu-tools-1.2/debian/patches/10-Revert-tests-make-testdisplay-non-optional.patch @@ -0,0 +1,73 @@ +From b47f44bdf2660e414e466182d081769accc0eeb7 Mon Sep 17 00:00:00 2001 +From: Tormod Volden +Date: Thu, 16 Feb 2012 22:47:06 +0100 +Subject: [PATCH] Revert "tests: make testdisplay non-optional" + +This reverts commit 08ccec1ec77a92ec1aa766c8571a0a7a2e6541f8. + +Upstream does not want to ship testdisplay in 1.2 so make +building it optional again to avoid unnecessary build-deps. + +Conflicts: + + configure.ac + tests/Makefile.am +--- + configure.ac | 22 ++++++++++++++++------ + tests/Makefile.am | 6 ++++++ + 2 files changed, 22 insertions(+), 6 deletions(-) + +Index: intel-gpu-tools/configure.ac +=================================================================== +--- intel-gpu-tools.orig/configure.ac 2012-02-17 00:06:52.000000000 +0100 ++++ intel-gpu-tools/configure.ac 2012-02-17 00:07:35.000000000 +0100 +@@ -56,13 +56,23 @@ + PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.31 libdrm]) + PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) + +-# for testdisplay +-PKG_CHECK_MODULES(CAIRO, cairo) +-PKG_CHECK_MODULES(LIBUDEV, [libudev], [udev=yes], [udev=no]) +-if test x"$udev" = xyes; then +- AC_DEFINE(HAVE_UDEV,1,[Enable udev-based monitor hotplug detection]) ++PKG_CHECK_MODULES(CAIRO, cairo, [HAVE_CAIRO=yes], [HAVE_CAIRO=no]) ++if test "x$HAVE_CAIRO" = xyes; then ++ AC_DEFINE(HAVE_CAIRO, 1, [Have cairo support]) + fi +-PKG_CHECK_MODULES(GLIB, glib-2.0) ++AM_CONDITIONAL(HAVE_CAIRO, [test "x$HAVE_CAIRO" = xyes]) ++ ++PKG_CHECK_MODULES(LIBUDEV, libudev, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no]) ++if test "x$HAVE_LIBUDEV" = xyes; then ++ AC_DEFINE(HAVE_LIBUDEV, 1, [Have libudev support]) ++fi ++AM_CONDITIONAL(HAVE_LIBUDEV, [test "x$HAVE_LIBUDEV" = xyes]) ++ ++PKG_CHECK_MODULES(GLIB, glib-2.0, [HAVE_GLIB=yes], [HAVE_GLIB=no]) ++if test "x$HAVE_GLIB" = xyes; then ++ AC_DEFINE(HAVE_GLIB, 1, [Have glib support]) ++fi ++AM_CONDITIONAL(HAVE_GLIB, [test "x$HAVE_GLIB" = xyes]) + + # ----------------------------------------------------------------------------- + # Configuration options +Index: intel-gpu-tools/tests/Makefile.am +=================================================================== +--- intel-gpu-tools.orig/tests/Makefile.am 2012-02-17 00:06:52.000000000 +0100 ++++ intel-gpu-tools/tests/Makefile.am 2012-02-17 00:08:03.000000000 +0100 +@@ -93,15 +93,5 @@ + -I$(srcdir)/../lib + LDADD = ../lib/libintel_tools.la $(PCIACCESS_LIBS) $(DRM_LIBS) + +-testdisplay_SOURCES = \ +- testdisplay.c \ +- testdisplay.h \ +- testdisplay_hotplug.c \ +- $(NULL) +- +-TESTS_progs += testdisplay +-LDADD += $(CAIRO_LIBS) $(LIBUDEV_LIBS) $(GLIB_LIBS) +-AM_CFLAGS += $(CAIRO_CFLAGS) $(LIBUDEV_CFLAGS) $(GLIB_CFLAGS) +- + gem_fence_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS) + gem_fence_thrash_LDADD = $(LDADD) -lpthread --- intel-gpu-tools-1.2.orig/debian/patches/series +++ intel-gpu-tools-1.2/debian/patches/series @@ -0,0 +1,4 @@ +100_drmtest_exit_not_abort.patch +10-Revert-tests-make-testdisplay-non-optional.patch +20-Revert-Fix-pthread-compiler-flags-to-work-on-Solaris.patch +30-Revert-add-sprite-demo-from-Armin-Reese.patch --- intel-gpu-tools-1.2.orig/debian/patches/30-Revert-add-sprite-demo-from-Armin-Reese.patch +++ intel-gpu-tools-1.2/debian/patches/30-Revert-add-sprite-demo-from-Armin-Reese.patch @@ -0,0 +1,1296 @@ +From 6a803dac55c9019efc11bd86657f2d9d999ef0ba Mon Sep 17 00:00:00 2001 +From: Tormod Volden +Date: Thu, 16 Feb 2012 23:09:51 +0100 +Subject: [PATCH] Revert "add sprite demo from Armin Reese" + +This reverts commit 6fe3884bc97b7c9ad5cdcbc9144cb7319341eb75. +--- + Makefile.am | 2 +- + configure.ac | 3 +- + demos/.gitignore | 1 - + demos/Makefile.am | 7 - + demos/sprite_on.c | 1222 ----------------------------------------------------- + tests/.gitignore | 1 - + 6 files changed, 2 insertions(+), 1234 deletions(-) + delete mode 100644 demos/.gitignore + delete mode 100644 demos/Makefile.am + delete mode 100644 demos/sprite_on.c + +diff --git a/Makefile.am b/Makefile.am +index 6cd724c..e049e3c 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -19,7 +19,7 @@ + # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-SUBDIRS = lib man tools scripts tests benchmarks demos ++SUBDIRS = lib man tools scripts tests benchmarks + + if BUILD_SHADER_DEBUGGER + SUBDIRS += debugger +diff --git a/configure.ac b/configure.ac +index 94d54a6..3298c1c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -53,7 +53,7 @@ m4_ifndef([XORG_MACROS_VERSION], + XORG_MACROS_VERSION(1.16) + XORG_DEFAULT_OPTIONS + +-PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.31 libdrm]) ++PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.30 libdrm]) + PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) + + # for testdisplay +@@ -112,7 +112,6 @@ AC_SUBST([THREAD_CFLAGS]) + AC_CONFIG_FILES([ + Makefile + benchmarks/Makefile +- demos/Makefile + lib/Makefile + man/Makefile + scripts/Makefile +diff --git a/demos/Makefile.am b/demos/Makefile.am +deleted file mode 100644 +index 8af9704..0000000 +--- a/demos/Makefile.am ++++ /dev/null +@@ -1,7 +0,0 @@ +-bin_PROGRAMS = \ +- sprite_on \ +- $(NULL) +- +-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib +-AM_CFLAGS = $(DRM_CFLAGS) $(PCIACCESS_CFLAGS) $(CWARNFLAGS) +-LDADD = $(top_builddir)/lib/libintel_tools.la $(DRM_LIBS) $(PCIACCESS_LIBS) +diff --git a/demos/sprite_on.c b/demos/sprite_on.c +deleted file mode 100644 +index 79fe678..0000000 +--- a/demos/sprite_on.c ++++ /dev/null +@@ -1,1222 +0,0 @@ +-/* +- * Copyright 2012 Corporation +- * +- * Author: +- * Armin Reese +- * +- * Permission is hereby granted, free of charge, to any person obtaining a +- * copy of this software and associated documentation files (the "Software"), +- * to deal in the Software without restriction, including without limitation +- * the rights to use, copy, modify, merge, publish, distribute, sublicense, +- * and/or sell copies of the Software, and to permit persons to whom the +- * Software is furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +- * IN THE SOFTWARE. +- */ +- +-/* +- * This program is intended for testing sprite functionality. +- */ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include "xf86drm.h" +-#include "xf86drmMode.h" +-#include "i915_drm.h" +- +-#if defined(DRM_IOCTL_MODE_ADDFB2) && defined(DRM_I915_SET_SPRITE_COLORKEY) +-#define TEST_PLANES 1 +-#include "drm_fourcc.h" +-#endif +- +-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +- +-struct type_name +-{ +- int type; +- char *name; +-}; +- +-#define type_name_fn(res) \ +-static char * res##_str(int type) { \ +- unsigned int i; \ +- for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \ +- if (res##_names[i].type == type) \ +- return res##_names[i].name; \ +- } \ +- return "(invalid)"; \ +-} +- +-struct type_name encoder_type_names[] = { +- { DRM_MODE_ENCODER_NONE, "none" }, +- { DRM_MODE_ENCODER_DAC, "DAC" }, +- { DRM_MODE_ENCODER_TMDS, "TMDS" }, +- { DRM_MODE_ENCODER_LVDS, "LVDS" }, +- { DRM_MODE_ENCODER_TVDAC, "TVDAC" }, +-}; +- +-type_name_fn(encoder_type) +- +-struct type_name connector_status_names[] = { +- { DRM_MODE_CONNECTED, "connected" }, +- { DRM_MODE_DISCONNECTED, "disconnected" }, +- { DRM_MODE_UNKNOWNCONNECTION, "unknown" }, +-}; +- +-type_name_fn(connector_status) +- +-struct type_name connector_type_names[] = { +- { DRM_MODE_CONNECTOR_Unknown, "unknown" }, +- { DRM_MODE_CONNECTOR_VGA, "VGA" }, +- { DRM_MODE_CONNECTOR_DVII, "DVI-I" }, +- { DRM_MODE_CONNECTOR_DVID, "DVI-D" }, +- { DRM_MODE_CONNECTOR_DVIA, "DVI-A" }, +- { DRM_MODE_CONNECTOR_Composite, "composite" }, +- { DRM_MODE_CONNECTOR_SVIDEO, "s-video" }, +- { DRM_MODE_CONNECTOR_LVDS, "LVDS" }, +- { DRM_MODE_CONNECTOR_Component, "component" }, +- { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN" }, +- { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort" }, +- { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" }, +- { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" }, +- { DRM_MODE_CONNECTOR_TV, "TV" }, +- { DRM_MODE_CONNECTOR_eDP, "Embedded DisplayPort" }, +-}; +- +-type_name_fn(connector_type) +- +-/* +- * Mode setting with the kernel interfaces is a bit of a chore. +- * First you have to find the connector in question and make sure the +- * requested mode is available. +- * Then you need to find the encoder attached to that connector so you +- * can bind it with a free crtc. +- */ +-struct connector +-{ +- uint32_t id; +- int mode_valid; +- drmModeModeInfo mode; +- drmModeEncoder *encoder; +- drmModeConnector *connector; +- int crtc; +- int pipe; +-}; +- +-//***************************************************************************** +-// +-// usage +-// +-//***************************************************************************** +-static void dump_mode( +- drmModeModeInfo *mode) +-{ +- printf(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d\n", +- mode->name, +- mode->vrefresh, +- mode->hdisplay, +- mode->hsync_start, +- mode->hsync_end, +- mode->htotal, +- mode->vdisplay, +- mode->vsync_start, +- mode->vsync_end, +- mode->vtotal, +- mode->flags, +- mode->type, +- mode->clock); +-} +- +-//***************************************************************************** +-// +-// dump_connectors +-// +-//***************************************************************************** +-static void dump_connectors( +- int gfx_fd, +- drmModeRes *resources) +-{ +- int i, j; +- +- printf("Connectors:\n"); +- printf("id\tencoder\tstatus\t\ttype\tsize (mm)\tmodes\n"); +- for (i = 0; i < resources->count_connectors; i++) { +- drmModeConnector *connector; +- +- connector = drmModeGetConnector(gfx_fd, resources->connectors[i]); +- if (!connector) { +- printf("could not get connector %i: %s\n", +- resources->connectors[i], strerror(errno)); +- continue; +- } +- +- printf("%d\t%d\t%s\t%s\t%dx%d\t\t%d\n", +- connector->connector_id, +- connector->encoder_id, +- connector_status_str(connector->connection), +- connector_type_str(connector->connector_type), +- connector->mmWidth, connector->mmHeight, +- connector->count_modes); +- +- if (!connector->count_modes) +- continue; +- +- printf(" modes:\n"); +- printf(" name refresh (Hz) hdisp hss hse htot vdisp " +- "vss vse vtot flags type clock\n"); +- for (j = 0; j < connector->count_modes; j++) +- dump_mode(&connector->modes[j]); +- +- drmModeFreeConnector(connector); +- } +- printf("\n"); +-} +- +-//***************************************************************************** +-// +-// dump_crtcs +-// +-//***************************************************************************** +-static void dump_crtcs( +- int gfx_fd, +- drmModeRes *resources) +-{ +- int i; +- +- printf("CRTCs:\n"); +- printf("id\tfb\tpos\tsize\n"); +- for (i = 0; i < resources->count_crtcs; i++) { +- drmModeCrtc *crtc; +- +- crtc = drmModeGetCrtc(gfx_fd, resources->crtcs[i]); +- if (!crtc) { +- printf("could not get crtc %i: %s\n", +- resources->crtcs[i], +- strerror(errno)); +- continue; +- } +- printf("%d\t%d\t(%d,%d)\t(%dx%d)\n", +- crtc->crtc_id, +- crtc->buffer_id, +- crtc->x, crtc->y, +- crtc->width, crtc->height); +- dump_mode(&crtc->mode); +- +- drmModeFreeCrtc(crtc); +- } +- printf("\n"); +-} +- +-//***************************************************************************** +-// +-// dump_planes +-// +-//***************************************************************************** +-static void dump_planes( +- int gfx_fd, +- drmModeRes *resources) +-{ +- drmModePlaneRes *plane_resources; +- drmModePlane *ovr; +- int i; +- +- plane_resources = drmModeGetPlaneResources(gfx_fd); +- if (!plane_resources) { +- printf("drmModeGetPlaneResources failed: %s\n", +- strerror(errno)); +- return; +- } +- +- printf("Planes:\n"); +- printf("id\tcrtc\tfb\tCRTC x,y\tx,y\tgamma size\n"); +- for (i = 0; i < plane_resources->count_planes; i++) { +- ovr = drmModeGetPlane(gfx_fd, plane_resources->planes[i]); +- if (!ovr) { +- printf("drmModeGetPlane failed: %s\n", +- strerror(errno)); +- continue; +- } +- +- printf("%d\t%d\t%d\t%d,%d\t\t%d,%d\t%d\n", +- ovr->plane_id, ovr->crtc_id, ovr->fb_id, +- ovr->crtc_x, ovr->crtc_y, ovr->x, ovr->y, +- ovr->gamma_size); +- +- drmModeFreePlane(ovr); +- } +- printf("\n"); +- +- return; +-} +- +-//***************************************************************************** +-// +-// connector_find_preferred_mode +-// +-//***************************************************************************** +-static void connector_find_preferred_mode( +- int gfx_fd, +- drmModeRes *gfx_resources, +- struct connector *c) +-{ +- drmModeConnector *connector; +- drmModeEncoder *encoder = NULL; +- int i, j; +- +- /* First, find the connector & mode */ +- c->mode_valid = 0; +- connector = drmModeGetConnector(gfx_fd, c->id); +- if (!connector) { +- printf("could not get connector %d: %s\n", +- c->id, +- strerror(errno)); +- drmModeFreeConnector(connector); +- return; +- } +- +- if (connector->connection != DRM_MODE_CONNECTED) { +- drmModeFreeConnector(connector); +- return; +- } +- +- if (!connector->count_modes) { +- printf("connector %d has no modes\n", +- c->id); +- drmModeFreeConnector(connector); +- return; +- } +- +- if (connector->connector_id != c->id) { +- printf("connector id doesn't match (%d != %d)\n", +- connector->connector_id, +- c->id); +- drmModeFreeConnector(connector); +- return; +- } +- +- for (j = 0; j < connector->count_modes; j++) { +- c->mode = connector->modes[j]; +- if (c->mode.type & DRM_MODE_TYPE_PREFERRED) { +- c->mode_valid = 1; +- break; +- } +- } +- +- if (!c->mode_valid) { +- if (connector->count_modes > 0) { +- /* use the first mode as test mode */ +- c->mode = connector->modes[0]; +- c->mode_valid = 1; +- } else { +- printf("failed to find any modes on connector %d\n", +- c->id); +- return; +- } +- } +- +- /* Now get the encoder */ +- for (i = 0; i < connector->count_encoders; i++) { +- encoder = drmModeGetEncoder(gfx_fd, connector->encoders[i]); +- +- if (!encoder) { +- printf("could not get encoder %i: %s\n", +- gfx_resources->encoders[i], +- strerror(errno)); +- drmModeFreeEncoder(encoder); +- continue; +- } +- +- break; +- } +- +- c->encoder = encoder; +- +- if (i == gfx_resources->count_encoders) { +- printf("failed to find encoder\n"); +- c->mode_valid = 0; +- return; +- } +- +- /* Find first CRTC not in use */ +- for (i = 0; i < gfx_resources->count_crtcs; i++) { +- if (gfx_resources->crtcs[i] && (c->encoder->possible_crtcs & (1<crtc = gfx_resources->crtcs[i]; +- c->pipe = i; +- +- gfx_resources->crtcs[i] = 0; +- +- c->connector = connector; +-} +- +-//***************************************************************************** +-// +-// gem_create +-// +-//***************************************************************************** +-static uint32_t gem_create(int fd, int size) +-{ +- struct drm_i915_gem_create create; +- +- create.handle = 0; +- create.size = (size + 4095) & -4096; +- (void)drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); +- +- return create.handle; +-} +- +-//***************************************************************************** +-// +-// gem_mmap +-// +-//***************************************************************************** +-static void *gem_mmap(int fd, uint32_t handle, int size, int prot) +-{ +- struct drm_i915_gem_mmap_gtt mmap_arg; +- void *ptr; +- +- mmap_arg.handle = handle; +- if (drmIoctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg)) +- return NULL; +- +- ptr = mmap(0, size, prot, MAP_SHARED, fd, mmap_arg.offset); +- if (ptr == MAP_FAILED) +- ptr = NULL; +- +- return ptr; +-} +- +-//***************************************************************************** +-// +-// gem_close +-// +-//***************************************************************************** +-static void gem_close(int fd, uint32_t handle) +-{ +- struct drm_gem_close close_st; +- +- close_st.handle = handle; +- (void)drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &close_st); +-} +- +-//***************************************************************************** +-// +-// connector_find_plane +-// +-//***************************************************************************** +-static int connector_find_plane(int gfx_fd, struct connector *c) +-{ +- drmModePlaneRes *plane_resources; +- drmModePlane *ovr; +- uint32_t id = 0; +- int i; +- +- plane_resources = drmModeGetPlaneResources(gfx_fd); +- if (!plane_resources) { +- printf("drmModeGetPlaneResources failed: %s\n", +- strerror(errno)); +- return 0; +- } +- +- for (i = 0; i < plane_resources->count_planes; i++) { +- ovr = drmModeGetPlane(gfx_fd, plane_resources->planes[i]); +- if (!ovr) { +- printf("drmModeGetPlane failed: %s\n", +- strerror(errno)); +- continue; +- } +- +- if (ovr->possible_crtcs & (1 << c->pipe)) { +- id = ovr->plane_id; +- drmModeFreePlane(ovr); +- break; +- } +- drmModeFreePlane(ovr); +- } +- +- return id; +-} +- +-//***************************************************************************** +-// +-// disable_planes +-// +-//***************************************************************************** +-static void disable_planes( +- int gfx_fd) +-{ +- struct connector *connectors; +- drmModeRes *resources; +- int c; +- +- resources = drmModeGetResources(gfx_fd); +- if (!resources) { +- printf("drmModeGetResources failed: %s\n", +- strerror(errno)); +- return; +- } +- +- connectors = calloc(resources->count_connectors, +- sizeof(struct connector)); +- if (!connectors) +- return; +- +- /* Find any connected displays */ +- for (c = 0; c < resources->count_connectors; c++) { +- uint32_t sprite_plane_id; +- +- sprite_plane_id = connector_find_plane(gfx_fd, &connectors[c]); +- if (!sprite_plane_id) { +- printf("failed to find plane for crtc\n"); +- return; +- } +- if (drmModeSetPlane(gfx_fd, sprite_plane_id, connectors[c].crtc, 0, 0, 0, +- 0, 0, 0, 0, 0, 0, 0)) { +- printf("failed to disable plane: %s\n", +- strerror(errno)); +- return; +- } +- } +- drmModeFreeResources(resources); +- return; +-} +- +-//***************************************************************************** +-// +-// prepare_primary_surface +-// +-//***************************************************************************** +-static int prepare_primary_surface( +- int fd, +- int prim_width, +- int prim_height, +- uint32_t *prim_handle, +- uint32_t *prim_stride, +- uint32_t *prim_size, +- int tiled) +-{ +- uint32_t bytes_per_pixel = sizeof(uint32_t); +- uint32_t *prim_fb_ptr; +- struct drm_i915_gem_set_tiling set_tiling; +- +- if (bytes_per_pixel != sizeof(uint32_t)) { +- printf("Bad bytes_per_pixel for primary surface: %d\n", +- bytes_per_pixel); +- return -EINVAL; +- } +- +- if (tiled) { +- int v; +- +- /* Round the tiling up to the next power-of-two and the +- * region up to the next pot fence size so that this works +- * on all generations. +- * +- * This can still fail if the framebuffer is too large to +- * be tiled. But then that failure is expected. +- */ +- +- v = prim_width * bytes_per_pixel; +- for (*prim_stride = 512; *prim_stride < v; *prim_stride *= 2) +- ; +- +- v = *prim_stride * prim_height; +- for (*prim_size = 1024*1024; *prim_size < v; *prim_size *= 2) +- ; +- } else { +- /* Scan-out has a 64 byte alignment restriction */ +- *prim_stride = (prim_width * bytes_per_pixel + 63) & ~63; +- *prim_size = *prim_stride * prim_height; +- } +- +- *prim_handle = gem_create(fd, *prim_size); +- +- if (tiled) { +- set_tiling.handle = *prim_handle; +- set_tiling.tiling_mode = I915_TILING_X; +- set_tiling.stride = *prim_stride; +- if (ioctl(fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling)) { +- printf("Set tiling failed: %s (stride=%d, size=%d)\n", +- strerror(errno), *prim_stride, *prim_size); +- return -1; +- } +- } +- +- prim_fb_ptr = gem_mmap(fd, +- *prim_handle, *prim_size, +- PROT_READ | PROT_WRITE); +- +- if (prim_fb_ptr != NULL) { +- // Write primary surface with gray background +- memset(prim_fb_ptr, 0x3f, *prim_size); +- munmap(prim_fb_ptr, *prim_size); +- } +- +- return 0; +-} +- +-//***************************************************************************** +-// +-// fill_sprite +-// +-//***************************************************************************** +-static void fill_sprite( +- int sprite_width, +- int sprite_height, +- int sprite_stride, +- int sprite_index, +- void *sprite_fb_ptr) +-{ +- __u32 *pLinePat0, +- *pLinePat1, +- *pLinePtr; +- int i, +- line; +- int stripe_width; +- +- stripe_width = ((sprite_width > 64) && +- (sprite_height > 64)) ? (sprite_index + 1) * 8 : +- (sprite_index + 1) * 2; +- +- // Note: sprite_stride is in bytes. pLinePat0 and pLinePat1 +- // are both __u32 pointers +- pLinePat0 = sprite_fb_ptr; +- pLinePat1 = pLinePat0 + (stripe_width * (sprite_stride / sizeof(*pLinePat0))); +- +- for (i = 0; i < sprite_width; i++) { +- *(pLinePat0 + i) = ((i / stripe_width) & 0x1) ? 0 : ~0; +- *(pLinePat1 + i) = ~(*(pLinePat0 + i)); +- } +- +- for (line = 1; line < sprite_height; line++) { +- if (line == stripe_width) { +- continue; +- } +- +- pLinePtr = ((line / stripe_width) & 0x1) ? pLinePat1 : pLinePat0; +- memcpy( pLinePat0 + ((sprite_stride / sizeof(*pLinePat0)) * line), +- pLinePtr, +- sprite_width * sizeof(*pLinePat0)); +- } +- +- return; +-} +- +-//***************************************************************************** +-// +-// prepare_sprite_surfaces +-// +-//***************************************************************************** +-static int prepare_sprite_surfaces( +- int fd, +- int sprite_width, +- int sprite_height, +- uint32_t num_surfaces, +- uint32_t *sprite_handles, +- uint32_t *sprite_stride, +- uint32_t *sprite_size, +- int tiled) +-{ +- uint32_t bytes_per_pixel = sizeof(uint32_t); +- uint32_t *sprite_fb_ptr; +- struct drm_i915_gem_set_tiling set_tiling; +- int i; +- +- if (bytes_per_pixel != sizeof(uint32_t)) { +- printf("Bad bytes_per_pixel for sprite: %d\n", bytes_per_pixel); +- return -EINVAL; +- } +- +- if (tiled) { +- int v; +- +- /* Round the tiling up to the next power-of-two and the +- * region up to the next pot fence size so that this works +- * on all generations. +- * +- * This can still fail if the framebuffer is too large to +- * be tiled. But then that failure is expected. +- */ +- +- v = sprite_width * bytes_per_pixel; +- for (*sprite_stride = 512; *sprite_stride < v; *sprite_stride *= 2) +- ; +- +- v = *sprite_stride * sprite_height; +- for (*sprite_size = 1024*1024; *sprite_size < v; *sprite_size *= 2) +- ; +- } else { +- /* Scan-out has a 64 byte alignment restriction */ +- *sprite_stride = (sprite_width * bytes_per_pixel + 63) & ~63; +- *sprite_size = *sprite_stride * sprite_height; +- } +- +- for (i = 0; i < num_surfaces; i++) { +- // Create the sprite surface +- sprite_handles[i] = gem_create(fd, *sprite_size); +- +- if (tiled) { +- set_tiling.handle = sprite_handles[i]; +- set_tiling.tiling_mode = I915_TILING_X; +- set_tiling.stride = *sprite_stride; +- if (ioctl(fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling)) { +- printf("Set tiling failed: %s (stride=%d, size=%d)\n", +- strerror(errno), *sprite_stride, *sprite_size); +- return -1; +- } +- } +- +- // Get pointer to the surface +- sprite_fb_ptr = gem_mmap(fd, +- sprite_handles[i], *sprite_size, +- PROT_READ | PROT_WRITE); +- +- if (sprite_fb_ptr != NULL) { +- // Fill with checkerboard pattern +- fill_sprite( +- sprite_width, +- sprite_height, +- *sprite_stride, +- i, sprite_fb_ptr); +- +- munmap(sprite_fb_ptr, *sprite_size); +- } else { +- i--; +- while (i >= 0) { +- gem_close(fd, sprite_handles[i]); +- i--; +- } +- } +- } +- +- return 0; +-} +- +-//***************************************************************************** +-// +-// ricochet +-// +-//***************************************************************************** +-static void ricochet( +- int tiled, +- int sprite_w, +- int sprite_h, +- int out_w, +- int out_h, +- int dump_info) +-{ +- int ret; +- int gfx_fd; +- int keep_moving; +- const int num_surfaces = 3; +- uint32_t sprite_handles[num_surfaces]; +- uint32_t sprite_fb_id[num_surfaces]; +- int sprite_x; +- int sprite_y; +- uint32_t sprite_stride; +- uint32_t sprite_size; +- uint32_t handles[4], +- pitches[4], +- offsets[4]; /* we only use [0] */ +- uint32_t prim_width, +- prim_height, +- prim_handle, +- prim_stride, +- prim_size, +- prim_fb_id; +- struct drm_intel_sprite_colorkey set; +- struct connector curr_connector; +- drmModeRes *gfx_resources; +- struct termios orig_term, +- curr_term; +- int c_index; +- int sprite_index; +- unsigned int sprite_plane_id; +- uint32_t plane_flags = 0; +- int delta_x, +- delta_y; +- struct timeval stTimeVal; +- long long currTime, +- prevFlipTime, +- prevMoveTime, +- deltaFlipTime, +- deltaMoveTime, +- SleepTime; +- char key; +- +- // Open up I915 graphics device +- gfx_fd = drmOpen("i915", NULL); +- if (gfx_fd < 0) { +- printf("Failed to load i915 driver: %s\n", strerror(errno)); +- return; +- } +- +- // Obtain pointer to struct containing graphics resources +- gfx_resources = drmModeGetResources(gfx_fd); +- if (!gfx_resources) { +- printf("drmModeGetResources failed: %s\n", strerror(errno)); +- return; +- } +- +- if (dump_info != 0) { +- dump_connectors(gfx_fd, gfx_resources); +- dump_crtcs(gfx_fd, gfx_resources); +- dump_planes(gfx_fd, gfx_resources); +- } +- +- // Save previous terminal settings +- if (tcgetattr( 0, &orig_term) != 0) { +- printf("tcgetattr failure: %s\n", +- strerror(errno)); +- return; +- } +- +- // Set up input to return characters immediately +- curr_term = orig_term; +- curr_term.c_lflag &= ~(ICANON | ECHO | ECHONL); +- curr_term.c_cc[VMIN] = 0; // No minimum number of characters +- curr_term.c_cc[VTIME] = 0 ; // Return immediately, even if +- // nothing has been entered. +- if (tcsetattr( 0, TCSANOW, &curr_term) != 0) { +- printf("tcgetattr failure: %s\n", +- strerror(errno)); +- return; +- } +- +- // Cycle through all connectors and display the flying sprite +- // where there are displays attached and the hardware will support it. +- for (c_index = 0; c_index < gfx_resources->count_connectors; c_index++) { +- curr_connector.id = gfx_resources->connectors[c_index]; +- +- // Find the native (preferred) display mode +- connector_find_preferred_mode(gfx_fd, gfx_resources, &curr_connector); +- if (curr_connector.mode_valid == 0) { +- printf("No valid preferred mode detected\n"); +- goto out; +- } +- +- // Determine if sprite hardware is available on pipe +- // associated with this connector. +- sprite_plane_id = connector_find_plane(gfx_fd, &curr_connector); +- if (!sprite_plane_id) { +- printf("Failed to find sprite plane on crtc\n"); +- goto out; +- } +- +- // Width and height of preferred mode +- prim_width = curr_connector.mode.hdisplay; +- prim_height = curr_connector.mode.vdisplay; +- +- // Allocate and fill memory for primary surface +- ret = prepare_primary_surface( +- gfx_fd, +- prim_width, +- prim_height, +- &prim_handle, +- &prim_stride, +- &prim_size, +- tiled); +- if (ret != 0) { +- printf("Failed to add primary fb (%dx%d): %s\n", +- prim_width, prim_height, strerror(errno)); +- goto out; +- } +- +- // Add the primary surface framebuffer +- ret = drmModeAddFB( +- gfx_fd, +- prim_width, +- prim_height, +- 24, 32, +- prim_stride, +- prim_handle, +- &prim_fb_id); +- gem_close(gfx_fd, prim_handle); +- +- if (ret != 0) { +- printf("Failed to add primary fb (%dx%d): %s\n", +- prim_width, prim_height, strerror(errno)); +- goto out; +- } +- +- // Allocate and fill sprite surfaces +- ret = prepare_sprite_surfaces( +- gfx_fd, +- sprite_w, +- sprite_h, +- num_surfaces, +- &sprite_handles[0], +- &sprite_stride, +- &sprite_size, +- tiled); +- if (ret != 0) { +- printf("Preparation of sprite surfaces failed %dx%d\n", +- sprite_w, sprite_h); +- goto out; +- } +- +- // Add the sprite framebuffers +- for (sprite_index = 0; sprite_index < num_surfaces; sprite_index++) { +- handles[0] = sprite_handles[sprite_index]; +- handles[1] = handles[0]; +- handles[2] = handles[0]; +- handles[3] = handles[0]; +- pitches[0] = sprite_stride; +- pitches[1] = sprite_stride; +- pitches[2] = sprite_stride; +- pitches[3] = sprite_stride; +- memset(offsets, 0, sizeof(offsets)); +- +- ret = drmModeAddFB2( +- gfx_fd, +- sprite_w, sprite_h, DRM_FORMAT_XRGB8888, +- handles, pitches, offsets, &sprite_fb_id[sprite_index], +- plane_flags); +- gem_close(gfx_fd, sprite_handles[sprite_index]); +- +- if (ret) { +- printf("Failed to add sprite fb (%dx%d): %s\n", +- sprite_w, sprite_h, strerror(errno)); +- +- sprite_index--; +- while (sprite_index >= 0) { +- drmModeRmFB(gfx_fd, sprite_fb_id[sprite_index]); +- sprite_index--; +- } +- goto out; +- } +- } +- +- if (dump_info != 0) { +- printf("Displayed Mode Connector struct:\n" +- " .id = %d\n" +- " .mode_valid = %d\n" +- " .crtc = %d\n" +- " .pipe = %d\n" +- " drmModeModeInfo ...\n" +- " .name = %s\n" +- " .type = %d\n" +- " .flags = %08x\n" +- " drmModeEncoder ...\n" +- " .encoder_id = %d\n" +- " .encoder_type = %d\n" +- " .crtc_id = %d\n" +- " .possible_crtcs = %d\n" +- " .possible_clones = %d\n" +- " drmModeConnector ...\n" +- " .connector_id = %d\n" +- " .encoder_id = %d\n" +- " .connector_type = %d\n" +- " .connector_type_id = %d\n\n", +- curr_connector.id, +- curr_connector.mode_valid, +- curr_connector.crtc, +- curr_connector.pipe, +- curr_connector.mode.name, +- curr_connector.mode.type, +- curr_connector.mode.flags, +- curr_connector.encoder->encoder_id, +- curr_connector.encoder->encoder_type, +- curr_connector.encoder->crtc_id, +- curr_connector.encoder->possible_crtcs, +- curr_connector.encoder->possible_clones, +- curr_connector.connector->connector_id, +- curr_connector.connector->encoder_id, +- curr_connector.connector->connector_type, +- curr_connector.connector->connector_type_id); +- +- printf("Sprite surface dimensions = %dx%d\n" +- "Sprite output dimensions = %dx%d\n" +- "Press any key to continue >\n", +- sprite_w, +- sprite_h, +- out_w, +- out_h); +- +- // Wait for a key-press +- while( read(0, &key, 1) == 0); +- // Purge unread characters +- tcflush(0, TCIFLUSH); +- } +- +- // Set up the primary display mode +- ret = drmModeSetCrtc( +- gfx_fd, +- curr_connector.crtc, +- prim_fb_id, +- 0, 0, +- &curr_connector.id, +- 1, +- &curr_connector.mode); +- if (ret != 0) +- { +- printf("Failed to set mode (%dx%d@%dHz): %s\n", +- prim_width, prim_height, curr_connector.mode.vrefresh, +- strerror(errno)); +- continue; +- } +- +- // Set the sprite colorkey state +- set.plane_id = sprite_plane_id; +- set.min_value = 0; +- set.max_value = 0; +- set.flags = I915_SET_COLORKEY_NONE; +- ret = drmCommandWrite(gfx_fd, DRM_I915_SET_SPRITE_COLORKEY, &set, +- sizeof(set)); +- +- // Set up sprite output dimensions, initial position, etc. +- if (out_w > prim_width / 2) +- out_w = prim_width / 2; +- if (out_h > prim_height / 2) +- out_h - prim_height / 2; +- +- delta_x = 3; +- delta_y = 4; +- sprite_x = (prim_width / 2) - (out_w / 2); +- sprite_y = (prim_height / 2) - (out_h / 2); +- +- currTime = 0; +- prevFlipTime = 0; // Will force immediate sprite flip +- prevMoveTime = 0; // Will force immediate sprite move +- deltaFlipTime = 500000; // Flip sprite surface every 1/2 second +- deltaMoveTime = 100000; // Move sprite every 100 ms +- sprite_index = num_surfaces - 1; +- keep_moving = 1; +- +- // Bounce sprite off the walls +- while (keep_moving) { +- // Obtain system time in usec. +- if (gettimeofday( &stTimeVal, NULL ) != 0) { +- printf("gettimeofday error: %s\n", +- strerror(errno)); +- } else { +- currTime = ((long long)stTimeVal.tv_sec * 1000000) + stTimeVal.tv_usec; +- } +- +- // Check if it's time to flip the sprite surface +- if (currTime - prevFlipTime > deltaFlipTime) { +- sprite_index = (sprite_index + 1) % num_surfaces; +- +- prevFlipTime = currTime; +- } +- +- // Move the sprite on the screen and flip +- // the surface if the index has changed +- if (drmModeSetPlane( +- gfx_fd, +- sprite_plane_id, +- curr_connector.crtc, +- sprite_fb_id[sprite_index], +- plane_flags, +- sprite_x, sprite_y, +- out_w, out_h, +- 0, 0, +- sprite_w, sprite_h)) { +- printf("Failed to enable sprite plane: %s\n", +- strerror(errno)); +- } +- +- // Check if it's time to move the sprite surface +- if (currTime - prevMoveTime > deltaMoveTime) { +- +- // Compute the next position for sprite +- sprite_x += delta_x; +- sprite_y += delta_y; +- if (sprite_x < 0) { +- sprite_x = 0; +- delta_x = -delta_x; +- } +- else if (sprite_x > prim_width - out_w) { +- sprite_x = prim_width - out_w; +- delta_x = -delta_x; +- } +- +- if (sprite_y < 0) { +- sprite_y = 0; +- delta_y = -delta_y; +- } +- else if (sprite_y > prim_height - out_h) { +- sprite_y = prim_height - out_h; +- delta_y = -delta_y; +- } +- +- prevMoveTime = currTime; +- } +- +- // Fetch a key from input (non-blocking) +- if (read(0, &key, 1) == 1) { +- switch (key) { +- case 'q': // Kill the program +- case 'Q': +- goto out; +- break; +- case 's': // Slow down sprite movement; +- deltaMoveTime = (deltaMoveTime * 100) / 90; +- if (deltaMoveTime > 800000) { +- deltaMoveTime = 800000; +- } +- break; +- case 'S': // Speed up sprite movement; +- deltaMoveTime = (deltaMoveTime * 100) / 110; +- if (deltaMoveTime < 2000) { +- deltaMoveTime = 2000; +- } +- break; +- case 'f': // Slow down sprite flipping; +- deltaFlipTime = (deltaFlipTime * 100) / 90; +- if (deltaFlipTime > 1000000) { +- deltaFlipTime = 1000000; +- } +- break; +- case 'F': // Speed up sprite flipping; +- deltaFlipTime = (deltaFlipTime * 100) / 110; +- if (deltaFlipTime < 20000) { +- deltaFlipTime = 20000; +- } +- break; +- case 'n': // Next connector +- case 'N': +- keep_moving = 0; +- break; +- default: +- break; +- } +- +- // Purge unread characters +- tcflush(0, TCIFLUSH); +- } +- +- // Wait for min of flip or move deltas +- SleepTime = (deltaFlipTime < deltaMoveTime) ? +- deltaFlipTime : deltaMoveTime; +- usleep(SleepTime); +- } +- } +- +-out: +- // Purge unread characters +- tcflush(0, TCIFLUSH); +- // Restore previous terminal settings +- if (tcsetattr( 0, TCSANOW, &orig_term) != 0) { +- printf("tcgetattr failure: %s\n", +- strerror(errno)); +- return; +- } +- +- drmModeFreeResources(gfx_resources); +-} +- +-//***************************************************************************** +-// +-// usage +-// +-//***************************************************************************** +-static void usage(char *name) +-{ +- printf("usage: %s -s x [-dhto]\n" +- "\t-d\t[optional] dump mode information\n" +- "\t-h\t[optional] output help message\n" +- "\t-t\t[optional] enable tiling\n" +- "\t-o\t[optional] x\n\n" +- "Keyboard control for sprite movement and flip rate ...\n" +- "\t'q' or 'Q' - Quit the program\n" +- "\t'n' or 'N' - Switch to next display\n" +- "\t's' - Slow sprite movement\n" +- "\t'S' - Speed up sprite movement\n" +- "\t'f' - Slow sprite surface flipping\n" +- "\t'F' - Speed up sprite surface flipping\n", +- name); +-} +- +-//***************************************************************************** +-// +-// main +-// +-//***************************************************************************** +-int main(int argc, char **argv) +-{ +- int c; +- int test_overlay = 0, +- enable_tiling = 0, +- dump_info = 0; +- int plane_width = 0, +- plane_height = 0, +- out_width = 0, +- out_height = 0; +- static char optstr[] = "ds:o:th"; +- +- opterr = 0; +- while ((c = getopt(argc, argv, optstr)) != -1) { +- switch (c) { +- case 'd': // Dump information +- dump_info = 1; +- break; +- case 't': // Tiling enable +- enable_tiling = 1; +- break; +- case 's': // Surface dimensions +- if (sscanf(optarg, "%dx%d", +- &plane_width, &plane_height) != 2) +- usage(argv[0]); +- test_overlay = 1; +- break; +- case 'o': // Output dimensions +- if (sscanf(optarg, "%dx%d", +- &out_width, &out_height) != 2) +- usage(argv[0]); +- break; +- default: +- printf("unknown option %c\n", c); +- /* fall through */ +- case 'h': // Help! +- usage(argv[0]); +- goto out; +- } +- } +- +- if (test_overlay) { +- if (out_width < (plane_width / 2)) { +- out_width = plane_width; +- } +- +- if (out_height < (plane_height / 2)) { +- out_height = plane_height; +- } +- +- ricochet(enable_tiling, +- plane_width, +- plane_height, +- out_width, +- out_height, +- dump_info); +- } else { +- printf("Sprite dimensions are required:\n"); +- usage(argv[0]); +- } +- +-out: +- exit(0); +-} +- +-- +1.7.9 + --- intel-gpu-tools-1.2.orig/man/intel_reg_snapshot.man +++ intel-gpu-tools-1.2/man/intel_reg_snapshot.man @@ -0,0 +1,15 @@ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH intel_reg_snapshot __appmansuffix__ __xorgversion__ +.SH NAME +intel_reg_snapshot \- Take a GPU register snapshot +.SH SYNOPSIS +.B intel_reg_snapshot +.SH DESCRIPTION +.B intel_reg_snapshot +takes a snapshot of the registers of an Intel GPU, and writes it to standard +output. These files can be inspected later with the +.B intel_reg_dumper +tool. +.SH SEE ALSO +.BR intel_reg_dumper(1)