From patchwork Sun Mar 23 14:18:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 3879181 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 73EDA9F2B6 for ; Sun, 23 Mar 2014 14:19:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46C722018E for ; Sun, 23 Mar 2014 14:19:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E7DF3201F4 for ; Sun, 23 Mar 2014 14:19:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 91EFF6E6BD; Sun, 23 Mar 2014 07:19:48 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ee0-f46.google.com (mail-ee0-f46.google.com [74.125.83.46]) by gabe.freedesktop.org (Postfix) with ESMTP id C6E246E67C for ; Sun, 23 Mar 2014 07:19:45 -0700 (PDT) Received: by mail-ee0-f46.google.com with SMTP id t10so3453323eei.5 for ; Sun, 23 Mar 2014 07:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=Cu+Jp/Lzag/FjmEmVjwQzzrD9JaXi0X2h3OKaNZn0RI=; b=Sgdn+g1e9pG7DL2mUXI+XR0ucbEq+lfpo4TeXl1rExkgx0Uexld6TqZZSBcFcPKpdh QFkNiU4CwXg/AMbnMz2zyL4vRE0A/fDR5TwdiX4w8t+21pBqKBH8yuni/SMDbNW657NR SK0+E9uZfDQTE7xcRdHRGm1AFwh+0gAEvd5EY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=Cu+Jp/Lzag/FjmEmVjwQzzrD9JaXi0X2h3OKaNZn0RI=; b=essn7raCqGqzMTDtI3mVWyveQtmxZJtUoj96u5fCxAXBAAoxwg+WCzyLx9YgH5PyTE 7JCD5QLUZc/LD9aElmW7Hh2BJYD3bRgzzyGIEjFQqwfHdVqziyjBpFLp0pYqE1JXzWn8 AGlaElNRFkP8U2StAs/fWylRDDZg8p4bBQ82bUurYqwkzBmKNgxj8zREUdJ+xQafExR+ skEhliKE+1SucIV1ZCLr3gt1q/q8dwLvPhL1BK2yGCcbjoc/2I9XGoWyjiorhUumtnsS E2IjheO8P6sejnBuh143/VnrK6XhvxpUizGhMIwS4FxVSCQfCTdcQ6Xcuzzj06q73IBD mbCw== X-Gm-Message-State: ALoCoQlHfeMZRnfvUKh7Ty36R9zH4lTg0qmrKl6YK/NEbXGOLHtM9zeyR47UabwxjMR3wPJSjKH2 X-Received: by 10.14.198.197 with SMTP id v45mr59202171een.9.1395584385081; Sun, 23 Mar 2014 07:19:45 -0700 (PDT) Received: from phenom.ffwll.local (84-73-67-144.dclient.hispeed.ch. [84.73.67.144]) by mx.google.com with ESMTPSA id cb5sm26392589eeb.18.2014.03.23.07.19.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Mar 2014 07:19:44 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Sun, 23 Mar 2014 15:18:57 +0100 Message-Id: <1395584342-11812-24-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1395584342-11812-1-git-send-email-daniel.vetter@ffwll.ch> References: <1395584342-11812-1-git-send-email-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 23/28] lib: extract igt_aux.[hc] X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP And shovel all the various helpers in there. Also move igt_set_vt_graphics_mode to igt_kms.h since the function is implemented in igt_kms.c. And it fits better. I kinda missed this in the prep work. Signed-off-by: Daniel Vetter --- lib/Makefile.sources | 2 + lib/drmtest.c | 188 ------------------------- lib/drmtest.h | 36 +---- lib/igt_aux.c | 249 +++++++++++++++++++++++++++++++++ lib/igt_aux.h | 67 +++++++++ lib/igt_core.c | 1 + lib/igt_kms.c | 1 + lib/igt_kms.h | 3 + lib/intel_os.c | 2 +- lib/rendercopy_gen8.c | 7 +- tests/drv_suspend.c | 5 +- tests/eviction_common.c | 1 + tests/gem_caching.c | 5 +- tests/gem_concurrent_blit.c | 5 +- tests/gem_cpu_reloc.c | 5 +- tests/gem_cs_prefetch.c | 5 +- tests/gem_cs_tlb.c | 5 +- tests/gem_ctx_exec.c | 6 +- tests/gem_evict_alignment.c | 5 +- tests/gem_fd_exhaustion.c | 2 + tests/gem_fenced_exec_thrash.c | 1 + tests/gem_linear_blits.c | 7 +- tests/gem_partial_pwrite_pread.c | 7 +- tests/gem_persistent_relocs.c | 7 +- tests/gem_pin.c | 5 +- tests/gem_pread_after_blit.c | 7 +- tests/gem_reloc_vs_gpu.c | 7 +- tests/gem_render_copy.c | 5 +- tests/gem_render_linear_blits.c | 5 +- tests/gem_render_tiled_blits.c | 5 +- tests/gem_reset_stats.c | 3 +- tests/gem_ringfill.c | 6 +- tests/gem_seqno_wrap.c | 1 + tests/gem_stress.c | 5 +- tests/gem_tiled_blits.c | 7 +- tests/gem_tiled_fence_blits.c | 5 +- tests/gem_tiled_partial_pwrite_pread.c | 7 +- tests/gem_tiled_pread_pwrite.c | 5 +- tests/gem_tiled_swapping.c | 5 +- tests/gem_wait_render_timeout.c | 5 +- tests/gem_write_read_ring_switch.c | 7 +- tests/igt_fork_helper.c | 1 + tests/kms_flip.c | 1 + 43 files changed, 443 insertions(+), 271 deletions(-) create mode 100644 lib/igt_aux.c create mode 100644 lib/igt_aux.h diff --git a/lib/Makefile.sources b/lib/Makefile.sources index 3e2a4b5b9c55..4e83d3118ea9 100644 --- a/lib/Makefile.sources +++ b/lib/Makefile.sources @@ -10,6 +10,8 @@ libintel_tools_la_SOURCES = \ igt_debugfs.h \ igt_display.c \ igt_display.h \ + igt_aux.c \ + igt_aux.h \ instdone.c \ instdone.h \ intel_batchbuffer.c \ diff --git a/lib/drmtest.c b/lib/drmtest.c index 9fcd221be450..8bb64f0cbf8b 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -277,191 +277,3 @@ int drm_open_any_render(void) return fd; } - -/* signal interrupt helpers */ -static struct igt_helper_process signal_helper; -long long int sig_stat; -static void __attribute__((noreturn)) signal_helper_process(pid_t pid) -{ - /* Interrupt the parent process at 500Hz, just to be annoying */ - while (1) { - usleep(1000 * 1000 / 500); - if (kill(pid, SIGUSR1)) /* Parent has died, so must we. */ - exit(0); - } -} - -static void sig_handler(int i) -{ - sig_stat++; -} - -void igt_fork_signal_helper(void) -{ - if (igt_only_list_subtests()) - return; - - signal(SIGUSR1, sig_handler); - - igt_fork_helper(&signal_helper) { - signal_helper_process(getppid()); - } -} - -void igt_stop_signal_helper(void) -{ - if (igt_only_list_subtests()) - return; - - igt_stop_helper(&signal_helper); - - sig_stat = 0; -} - -bool igt_env_set(const char *env_var, bool default_value) -{ - char *val; - - val = getenv(env_var); - if (!val) - return default_value; - - return atoi(val) != 0; -} - -bool igt_aub_dump_enabled(void) -{ - static int dump_aub = -1; - - if (dump_aub == -1) - dump_aub = igt_env_set("IGT_DUMP_AUB", false); - - return dump_aub; -} - -/* other helpers */ -void igt_exchange_int(void *array, unsigned i, unsigned j) -{ - int *int_arr, tmp; - int_arr = array; - - tmp = int_arr[i]; - int_arr[i] = int_arr[j]; - int_arr[j] = tmp; -} - -void igt_permute_array(void *array, unsigned size, - void (*exchange_func)(void *array, - unsigned i, - unsigned j)) -{ - int i; - - for (i = size - 1; i > 1; i--) { - /* yes, not perfectly uniform, who cares */ - long l = random() % (i +1); - if (i != l) - exchange_func(array, i, l); - } -} - -void igt_progress(const char *header, uint64_t i, uint64_t total) -{ - int divider = 200; - - if (!isatty(fileno(stderr))) - return; - - if (i+1 >= total) { - fprintf(stderr, "\r%s100%%\n", header); - return; - } - - if (total / 200 == 0) - divider = 1; - - /* only bother updating about every 0.5% */ - if (i % (total / divider) == 0 || i+1 >= total) { - fprintf(stderr, "\r%s%3llu%%", header, - (long long unsigned) i * 100 / total); - } -} - -/* mappable aperture trasher helper */ -drm_intel_bo **trash_bos; -int num_trash_bos; - -void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr) -{ - int i; - - num_trash_bos = gem_mappable_aperture_size() / (1024*1024); - - trash_bos = malloc(num_trash_bos * sizeof(drm_intel_bo *)); - igt_assert(trash_bos); - - for (i = 0; i < num_trash_bos; i++) - trash_bos[i] = drm_intel_bo_alloc(bufmgr, "trash bo", 1024*1024, 4096); -} - -void igt_trash_aperture(void) -{ - int i; - uint8_t *gtt_ptr; - - for (i = 0; i < num_trash_bos; i++) { - drm_intel_gem_bo_map_gtt(trash_bos[i]); - gtt_ptr = trash_bos[i]->virtual; - *gtt_ptr = 0; - drm_intel_gem_bo_unmap_gtt(trash_bos[i]); - } -} - -void igt_cleanup_aperture_trashers(void) -{ - int i; - - for (i = 0; i < num_trash_bos; i++) - drm_intel_bo_unreference(trash_bos[i]); - - free(trash_bos); -} - -void igt_system_suspend_autoresume(void) -{ - int ret; - - /* FIXME: Simulation doesn't like suspend/resume, and not even a lighter - * approach using /sys/power/pm_test to just test our driver's callbacks - * seems to fare better. We need to investigate what's going on. */ - igt_skip_on_simulation(); - - ret = system("rtcwake -s 30 -m mem"); - igt_assert(ret == 0); -} - -void igt_drop_root(void) -{ - igt_assert(getuid() == 0); - - igt_assert(setgid(2) == 0); - igt_assert(setuid(2) == 0); - - igt_assert(getgid() == 2); - igt_assert(getuid() == 2); -} - -void igt_wait_for_keypress(void) -{ - struct termios oldt, newt; - - if (!isatty(STDIN_FILENO)) - return; - - tcgetattr ( STDIN_FILENO, &oldt ); - newt = oldt; - newt.c_lflag &= ~( ICANON | ECHO ); - tcsetattr ( STDIN_FILENO, TCSANOW, &newt ); - getchar(); - tcsetattr ( STDIN_FILENO, TCSANOW, &oldt ); -} diff --git a/lib/drmtest.h b/lib/drmtest.h index 0985109b5247..631627cceb30 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -34,7 +34,8 @@ #include #include -#include + +#include "intel_batchbuffer.h" #ifdef ANDROID #ifndef HAVE_MMAP64 @@ -55,40 +56,7 @@ int drm_open_any_render(void); void gem_quiescent_gpu(int fd); -/* generally useful helpers */ -void igt_fork_signal_helper(void); -void igt_stop_signal_helper(void); -void igt_exchange_int(void *array, unsigned i, unsigned j); -void igt_permute_array(void *array, unsigned size, - void (*exchange_func)(void *array, - unsigned i, - unsigned j)); -void igt_progress(const char *header, uint64_t i, uint64_t total); -bool igt_env_set(const char *env_var, bool default_value); - -bool igt_aub_dump_enabled(void); - -/* helpers based upon the libdrm buffer manager */ -void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr); -void igt_trash_aperture(void); -void igt_cleanup_aperture_trashers(void); - #define do_or_die(x) igt_assert((x) == 0) #define do_ioctl(fd, ptr, sz) igt_assert(drmIoctl((fd), (ptr), (sz)) == 0) -/* set vt into graphics mode, required to prevent fbcon from interfering */ -void igt_set_vt_graphics_mode(void); - -/* suspend and auto-resume system */ -void igt_system_suspend_autoresume(void); - -/* dropping priviledges */ -void igt_drop_root(void); - -void igt_wait_for_keypress(void); - -/* sysinfo cross-arch wrappers from intel_os.c */ -uint64_t intel_get_total_ram_mb(void); -uint64_t intel_get_total_swap_mb(void); - #endif /* DRMTEST_H */ diff --git a/lib/igt_aux.c b/lib/igt_aux.c new file mode 100644 index 000000000000..fff5f0e89387 --- /dev/null +++ b/lib/igt_aux.c @@ -0,0 +1,249 @@ +/* + * Copyright © 2007, 2011, 2013, 2014 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: + * Eric Anholt + * Daniel Vetter + * + */ + +#ifndef ANDROID +#define _GNU_SOURCE +#else +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "drmtest.h" +#include "i915_drm.h" +#include "intel_chipset.h" +#include "igt_aux.h" +#include "igt_debugfs.h" +#include "../version.h" +#include "config.h" +#include "intel_reg.h" +#include "ioctl_wrappers.h" + + + +/* signal interrupt helpers */ +static struct igt_helper_process signal_helper; +long long int sig_stat; +static void __attribute__((noreturn)) signal_helper_process(pid_t pid) +{ + /* Interrupt the parent process at 500Hz, just to be annoying */ + while (1) { + usleep(1000 * 1000 / 500); + if (kill(pid, SIGUSR1)) /* Parent has died, so must we. */ + exit(0); + } +} + +static void sig_handler(int i) +{ + sig_stat++; +} + +void igt_fork_signal_helper(void) +{ + if (igt_only_list_subtests()) + return; + + signal(SIGUSR1, sig_handler); + + igt_fork_helper(&signal_helper) { + signal_helper_process(getppid()); + } +} + +void igt_stop_signal_helper(void) +{ + if (igt_only_list_subtests()) + return; + + igt_stop_helper(&signal_helper); + + sig_stat = 0; +} + +bool igt_env_set(const char *env_var, bool default_value) +{ + char *val; + + val = getenv(env_var); + if (!val) + return default_value; + + return atoi(val) != 0; +} + +bool igt_aub_dump_enabled(void) +{ + static int dump_aub = -1; + + if (dump_aub == -1) + dump_aub = igt_env_set("IGT_DUMP_AUB", false); + + return dump_aub; +} + +/* other helpers */ +void igt_exchange_int(void *array, unsigned i, unsigned j) +{ + int *int_arr, tmp; + int_arr = array; + + tmp = int_arr[i]; + int_arr[i] = int_arr[j]; + int_arr[j] = tmp; +} + +void igt_permute_array(void *array, unsigned size, + void (*exchange_func)(void *array, + unsigned i, + unsigned j)) +{ + int i; + + for (i = size - 1; i > 1; i--) { + /* yes, not perfectly uniform, who cares */ + long l = random() % (i +1); + if (i != l) + exchange_func(array, i, l); + } +} + +void igt_progress(const char *header, uint64_t i, uint64_t total) +{ + int divider = 200; + + if (!isatty(fileno(stderr))) + return; + + if (i+1 >= total) { + fprintf(stderr, "\r%s100%%\n", header); + return; + } + + if (total / 200 == 0) + divider = 1; + + /* only bother updating about every 0.5% */ + if (i % (total / divider) == 0 || i+1 >= total) { + fprintf(stderr, "\r%s%3llu%%", header, + (long long unsigned) i * 100 / total); + } +} + +/* mappable aperture trasher helper */ +drm_intel_bo **trash_bos; +int num_trash_bos; + +void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr) +{ + int i; + + num_trash_bos = gem_mappable_aperture_size() / (1024*1024); + + trash_bos = malloc(num_trash_bos * sizeof(drm_intel_bo *)); + igt_assert(trash_bos); + + for (i = 0; i < num_trash_bos; i++) + trash_bos[i] = drm_intel_bo_alloc(bufmgr, "trash bo", 1024*1024, 4096); +} + +void igt_trash_aperture(void) +{ + int i; + uint8_t *gtt_ptr; + + for (i = 0; i < num_trash_bos; i++) { + drm_intel_gem_bo_map_gtt(trash_bos[i]); + gtt_ptr = trash_bos[i]->virtual; + *gtt_ptr = 0; + drm_intel_gem_bo_unmap_gtt(trash_bos[i]); + } +} + +void igt_cleanup_aperture_trashers(void) +{ + int i; + + for (i = 0; i < num_trash_bos; i++) + drm_intel_bo_unreference(trash_bos[i]); + + free(trash_bos); +} + +void igt_system_suspend_autoresume(void) +{ + int ret; + + /* FIXME: Simulation doesn't like suspend/resume, and not even a lighter + * approach using /sys/power/pm_test to just test our driver's callbacks + * seems to fare better. We need to investigate what's going on. */ + igt_skip_on_simulation(); + + ret = system("rtcwake -s 30 -m mem"); + igt_assert(ret == 0); +} + +void igt_drop_root(void) +{ + igt_assert(getuid() == 0); + + igt_assert(setgid(2) == 0); + igt_assert(setuid(2) == 0); + + igt_assert(getgid() == 2); + igt_assert(getuid() == 2); +} + +void igt_wait_for_keypress(void) +{ + struct termios oldt, newt; + + if (!isatty(STDIN_FILENO)) + return; + + tcgetattr ( STDIN_FILENO, &oldt ); + newt = oldt; + newt.c_lflag &= ~( ICANON | ECHO ); + tcsetattr ( STDIN_FILENO, TCSANOW, &newt ); + getchar(); + tcsetattr ( STDIN_FILENO, TCSANOW, &oldt ); +} diff --git a/lib/igt_aux.h b/lib/igt_aux.h new file mode 100644 index 000000000000..eb6371280c1b --- /dev/null +++ b/lib/igt_aux.h @@ -0,0 +1,67 @@ +/* + * Copyright © 2014 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 + * + */ + +#ifndef IGT_AUX_H +#define IGT_AUX_H + +#include + +/* auxialiary igt helpers from igt_aux.c */ +/* generally useful helpers */ +void igt_fork_signal_helper(void); +void igt_stop_signal_helper(void); +void igt_exchange_int(void *array, unsigned i, unsigned j); +void igt_permute_array(void *array, unsigned size, + void (*exchange_func)(void *array, + unsigned i, + unsigned j)); +void igt_progress(const char *header, uint64_t i, uint64_t total); +bool igt_env_set(const char *env_var, bool default_value); + +bool igt_aub_dump_enabled(void); + +/* helpers based upon the libdrm buffer manager */ +void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr); +void igt_trash_aperture(void); +void igt_cleanup_aperture_trashers(void); + +/* suspend and auto-resume system */ +void igt_system_suspend_autoresume(void); + +/* dropping priviledges */ +void igt_drop_root(void); + +void igt_wait_for_keypress(void); + +/* sysinfo cross-arch wrappers from intel_os.c */ + +/* These are separate to allow easier testing when porting, see the comment at + * the bottom of intel_os.c. */ +uint64_t intel_get_total_ram_mb(void); +uint64_t intel_get_total_swap_mb(void); + +#endif /* IGT_AUX_H */ diff --git a/lib/igt_core.c b/lib/igt_core.c index cd094c431e3d..ed631f167b44 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -58,6 +58,7 @@ #include "config.h" #include "igt_core.h" +#include "igt_aux.h" /** * SECTION:igt_core diff --git a/lib/igt_kms.c b/lib/igt_kms.c index f74f7070d040..5b7aca713505 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -38,6 +38,7 @@ #include "drmtest.h" #include "igt_kms.h" +#include "igt_aux.h" #include "ioctl_wrappers.h" /* helpers to create nice-looking framebuffers */ diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 95735e8ffdd7..19c2649c91d2 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -164,6 +164,9 @@ struct igt_display { igt_pipe_t pipes[I915_MAX_PIPES]; }; +/* set vt into graphics mode, required to prevent fbcon from interfering */ +void igt_set_vt_graphics_mode(void); + void igt_display_init(igt_display_t *display, int drm_fd); void igt_display_fini(igt_display_t *display); int igt_display_commit(igt_display_t *display); diff --git a/lib/intel_os.c b/lib/intel_os.c index 14dda1474d5d..3a7397aa986a 100644 --- a/lib/intel_os.c +++ b/lib/intel_os.c @@ -48,8 +48,8 @@ #endif #include "intel_io.h" -#include "i915_drm.h" #include "drmtest.h" +#include "igt_aux.h" uint64_t intel_get_total_ram_mb(void) diff --git a/lib/rendercopy_gen8.c b/lib/rendercopy_gen8.c index 02333cfd8461..e846376665e9 100644 --- a/lib/rendercopy_gen8.c +++ b/lib/rendercopy_gen8.c @@ -10,8 +10,10 @@ #include #include #include -#include "drm.h" -#include "i915_drm.h" + +#include +#include + #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" @@ -19,6 +21,7 @@ #include "rendercopy.h" #include "gen8_render.h" #include "intel_reg.h" +#include "igt_aux.h" #include diff --git a/tests/drv_suspend.c b/tests/drv_suspend.c index ed393af40d13..506ae16e8440 100644 --- a/tests/drv_suspend.c +++ b/tests/drv_suspend.c @@ -34,10 +34,13 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "igt_debugfs.h" +#include "igt_aux.h" #define OBJECT_SIZE (16*1024*1024) diff --git a/tests/eviction_common.c b/tests/eviction_common.c index d1c4798af8e1..2d8e60ad08ef 100644 --- a/tests/eviction_common.c +++ b/tests/eviction_common.c @@ -30,6 +30,7 @@ #include #include "drmtest.h" +#include "igt_aux.h" struct igt_eviction_test_ops { diff --git a/tests/gem_caching.c b/tests/gem_caching.c index 3d51f2617737..9a6a2944da7d 100644 --- a/tests/gem_caching.c +++ b/tests/gem_caching.c @@ -34,13 +34,16 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_io.h" #include "intel_chipset.h" +#include "igt_aux.h" /* * Testcase: snoop consistency when touching partial cachelines diff --git a/tests/gem_concurrent_blit.c b/tests/gem_concurrent_blit.c index 03acf89c0c90..6a89aac5d06c 100644 --- a/tests/gem_concurrent_blit.c +++ b/tests/gem_concurrent_blit.c @@ -44,13 +44,16 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_io.h" #include "intel_chipset.h" +#include "igt_aux.h" static void prw_set_bo(drm_intel_bo *bo, uint32_t val, int width, int height) diff --git a/tests/gem_cpu_reloc.c b/tests/gem_cpu_reloc.c index e0276e7f9a78..c22f9eb7a211 100644 --- a/tests/gem_cpu_reloc.c +++ b/tests/gem_cpu_reloc.c @@ -53,13 +53,16 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_io.h" #include "intel_chipset.h" +#include "igt_aux.h" static uint32_t use_blt; diff --git a/tests/gem_cs_prefetch.c b/tests/gem_cs_prefetch.c index ffa80f36fca1..63f4e9b9732c 100644 --- a/tests/gem_cs_prefetch.c +++ b/tests/gem_cs_prefetch.c @@ -43,13 +43,16 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_io.h" #include "intel_chipset.h" +#include "igt_aux.h" static drm_intel_bufmgr *bufmgr; struct intel_batchbuffer *batch; diff --git a/tests/gem_cs_tlb.c b/tests/gem_cs_tlb.c index 8f7bc61cd40b..b1c50584ef10 100644 --- a/tests/gem_cs_tlb.c +++ b/tests/gem_cs_tlb.c @@ -46,10 +46,13 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_io.h" +#include "igt_aux.h" #define LOCAL_I915_EXEC_VEBOX (4<<0) #define BATCH_SIZE (1024*1024) diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c index 3afa7652c8e9..9eddd9252355 100644 --- a/tests/gem_ctx_exec.c +++ b/tests/gem_ctx_exec.c @@ -40,9 +40,12 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" +#include "igt_aux.h" struct local_drm_i915_gem_context_destroy { __u32 ctx_id; @@ -56,6 +59,7 @@ static void context_destroy(int fd, uint32_t ctx_id) struct local_drm_i915_gem_context_destroy destroy; destroy.ctx_id = ctx_id; do_ioctl(fd, CONTEXT_DESTROY_IOCTL, &destroy); +#include "igt_aux.h" } /* Copied from gem_exec_nop.c */ diff --git a/tests/gem_evict_alignment.c b/tests/gem_evict_alignment.c index 46da5ba1fcd4..c019b1891ffa 100644 --- a/tests/gem_evict_alignment.c +++ b/tests/gem_evict_alignment.c @@ -41,10 +41,13 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_chipset.h" +#include "igt_aux.h" #define HEIGHT 256 #define WIDTH 1024 diff --git a/tests/gem_fd_exhaustion.c b/tests/gem_fd_exhaustion.c index 7d865d4278cc..6032dd2788e7 100644 --- a/tests/gem_fd_exhaustion.c +++ b/tests/gem_fd_exhaustion.c @@ -31,8 +31,10 @@ #include #include #include + #include "drmtest.h" #include "ioctl_wrappers.h" +#include "igt_aux.h" #define FD_ARR_SZ 100 diff --git a/tests/gem_fenced_exec_thrash.c b/tests/gem_fenced_exec_thrash.c index 3194e340cf2c..42b7841dfd15 100644 --- a/tests/gem_fenced_exec_thrash.c +++ b/tests/gem_fenced_exec_thrash.c @@ -41,6 +41,7 @@ #include "drmtest.h" #include "intel_chipset.h" #include "intel_io.h" +#include "igt_aux.h" #define WIDTH 1024 #define HEIGHT 1024 diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c index 1b6742288220..a0ca2b1f6239 100644 --- a/tests/gem_linear_blits.c +++ b/tests/gem_linear_blits.c @@ -41,13 +41,14 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "intel_chipset.h" #include "drmtest.h" -#include "intel_bufmgr.h" -#include "intel_batchbuffer.h" #include "intel_io.h" +#include "igt_aux.h" #define WIDTH 512 #define HEIGHT 512 diff --git a/tests/gem_partial_pwrite_pread.c b/tests/gem_partial_pwrite_pread.c index a43a2b645fa0..dc72f550570b 100644 --- a/tests/gem_partial_pwrite_pread.c +++ b/tests/gem_partial_pwrite_pread.c @@ -33,13 +33,14 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_chipset.h" -#include "intel_bufmgr.h" -#include "intel_batchbuffer.h" #include "intel_io.h" +#include "igt_aux.h" /* * Testcase: pwrite/pread consistency when touching partial cachelines diff --git a/tests/gem_persistent_relocs.c b/tests/gem_persistent_relocs.c index 1795160bcd1b..8b5a62efc158 100644 --- a/tests/gem_persistent_relocs.c +++ b/tests/gem_persistent_relocs.c @@ -36,14 +36,15 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" -#include "intel_bufmgr.h" #include "intel_chipset.h" -#include "intel_batchbuffer.h" #include "intel_io.h" #include "igt_debugfs.h" +#include "igt_aux.h" /* * Testcase: Persistent relocations as used by uxa/libva diff --git a/tests/gem_pin.c b/tests/gem_pin.c index 9572d2886748..91e1456a1c1c 100644 --- a/tests/gem_pin.c +++ b/tests/gem_pin.c @@ -35,11 +35,14 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_chipset.h" #include "intel_io.h" +#include "igt_aux.h" #define COPY_BLT_CMD (2<<29|0x53<<22|0x6) #define BLT_WRITE_ALPHA (1<<21) diff --git a/tests/gem_pread_after_blit.c b/tests/gem_pread_after_blit.c index 6c3f8227e9ee..4c87a382f762 100644 --- a/tests/gem_pread_after_blit.c +++ b/tests/gem_pread_after_blit.c @@ -42,13 +42,14 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_chipset.h" -#include "intel_bufmgr.h" -#include "intel_batchbuffer.h" #include "intel_io.h" +#include "igt_aux.h" static drm_intel_bufmgr *bufmgr; struct intel_batchbuffer *batch; diff --git a/tests/gem_reloc_vs_gpu.c b/tests/gem_reloc_vs_gpu.c index 8e8018762597..271f4f6731a5 100644 --- a/tests/gem_reloc_vs_gpu.c +++ b/tests/gem_reloc_vs_gpu.c @@ -36,14 +36,15 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" -#include "intel_bufmgr.h" -#include "intel_batchbuffer.h" #include "intel_chipset.h" #include "intel_io.h" #include "igt_debugfs.h" +#include "igt_aux.h" /* * Testcase: Kernel relocations vs. gpu races diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c index 86ae64385351..331b7ce5c6a2 100644 --- a/tests/gem_render_copy.c +++ b/tests/gem_render_copy.c @@ -42,13 +42,16 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_io.h" #include "intel_chipset.h" +#include "igt_aux.h" #define WIDTH 512 #define STRIDE (WIDTH*4) diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c index 14a3ae7e7a41..a7121d0df26a 100644 --- a/tests/gem_render_linear_blits.c +++ b/tests/gem_render_linear_blits.c @@ -47,13 +47,16 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_io.h" #include "intel_chipset.h" +#include "igt_aux.h" #define WIDTH 512 #define STRIDE (WIDTH*4) diff --git a/tests/gem_render_tiled_blits.c b/tests/gem_render_tiled_blits.c index bee063fcc179..05c71b2aec05 100644 --- a/tests/gem_render_tiled_blits.c +++ b/tests/gem_render_tiled_blits.c @@ -43,13 +43,16 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_io.h" #include "intel_chipset.h" +#include "igt_aux.h" #define WIDTH 512 #define STRIDE (WIDTH*4) diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c index a6d4edc72323..28679e771c7b 100644 --- a/tests/gem_reset_stats.c +++ b/tests/gem_reset_stats.c @@ -43,10 +43,9 @@ #include "ioctl_wrappers.h" #include "drmtest.h" #include "igt_debugfs.h" -#include "intel_bufmgr.h" #include "intel_chipset.h" -#include "intel_batchbuffer.h" #include "intel_io.h" +#include "igt_aux.h" #define RS_NO_ERROR 0 #define RS_BATCH_ACTIVE (1 << 0) diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c index 88c8a8eeef69..6e91d8091b78 100644 --- a/tests/gem_ringfill.c +++ b/tests/gem_ringfill.c @@ -41,13 +41,13 @@ #include #include -#include "drm.h" +#include + #include "ioctl_wrappers.h" #include "drmtest.h" -#include "intel_bufmgr.h" #include "intel_chipset.h" -#include "intel_batchbuffer.h" #include "intel_io.h" +#include "igt_aux.h" struct bo { const char *ring; diff --git a/tests/gem_seqno_wrap.c b/tests/gem_seqno_wrap.c index a557c9857ed4..5e32fd600129 100644 --- a/tests/gem_seqno_wrap.c +++ b/tests/gem_seqno_wrap.c @@ -46,6 +46,7 @@ #include "ioctl_wrappers.h" #include "drmtest.h" #include "igt_core.h" +#include "igt_aux.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_io.h" diff --git a/tests/gem_stress.c b/tests/gem_stress.c index bf3cde762142..4cbe8f4568d7 100644 --- a/tests/gem_stress.c +++ b/tests/gem_stress.c @@ -59,13 +59,16 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_io.h" #include "intel_chipset.h" +#include "igt_aux.h" #define CMD_POLY_STIPPLE_OFFSET 0x7906 diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c index 09be42efea2f..1f609ce7eff4 100644 --- a/tests/gem_tiled_blits.c +++ b/tests/gem_tiled_blits.c @@ -49,13 +49,14 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" -#include "intel_bufmgr.h" -#include "intel_batchbuffer.h" #include "intel_chipset.h" #include "intel_io.h" +#include "igt_aux.h" static drm_intel_bufmgr *bufmgr; struct intel_batchbuffer *batch; diff --git a/tests/gem_tiled_fence_blits.c b/tests/gem_tiled_fence_blits.c index 7cefca0b3afa..244b69076a05 100644 --- a/tests/gem_tiled_fence_blits.c +++ b/tests/gem_tiled_fence_blits.c @@ -49,13 +49,16 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_io.h" #include "intel_chipset.h" +#include "igt_aux.h" static drm_intel_bufmgr *bufmgr; struct intel_batchbuffer *batch; diff --git a/tests/gem_tiled_partial_pwrite_pread.c b/tests/gem_tiled_partial_pwrite_pread.c index 26fc145da8d1..40ade1fcd4d2 100644 --- a/tests/gem_tiled_partial_pwrite_pread.c +++ b/tests/gem_tiled_partial_pwrite_pread.c @@ -33,13 +33,14 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" -#include "intel_bufmgr.h" #include "intel_chipset.h" -#include "intel_batchbuffer.h" #include "intel_io.h" +#include "igt_aux.h" /* * Testcase: pwrite/pread consistency when touching partial cachelines diff --git a/tests/gem_tiled_pread_pwrite.c b/tests/gem_tiled_pread_pwrite.c index 08176f3d700d..b6d9d6273edb 100644 --- a/tests/gem_tiled_pread_pwrite.c +++ b/tests/gem_tiled_pread_pwrite.c @@ -53,10 +53,13 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_io.h" +#include "igt_aux.h" #define WIDTH 512 #define HEIGHT 512 diff --git a/tests/gem_tiled_swapping.c b/tests/gem_tiled_swapping.c index fd9b40f3285c..747236450d0f 100644 --- a/tests/gem_tiled_swapping.c +++ b/tests/gem_tiled_swapping.c @@ -53,10 +53,13 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_io.h" +#include "igt_aux.h" #define WIDTH 512 #define HEIGHT 512 diff --git a/tests/gem_wait_render_timeout.c b/tests/gem_wait_render_timeout.c index b0b77adc0c38..9f4e8a1dcaf5 100644 --- a/tests/gem_wait_render_timeout.c +++ b/tests/gem_wait_render_timeout.c @@ -37,13 +37,16 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_io.h" #include "intel_chipset.h" +#include "igt_aux.h" #define MSEC_PER_SEC 1000L #define USEC_PER_MSEC 1000L diff --git a/tests/gem_write_read_ring_switch.c b/tests/gem_write_read_ring_switch.c index f19a7bef6e48..76e1c2afa6db 100644 --- a/tests/gem_write_read_ring_switch.c +++ b/tests/gem_write_read_ring_switch.c @@ -33,14 +33,15 @@ #include #include #include -#include "drm.h" + +#include + #include "ioctl_wrappers.h" #include "drmtest.h" -#include "intel_bufmgr.h" -#include "intel_batchbuffer.h" #include "intel_chipset.h" #include "intel_io.h" #include "i830_reg.h" +#include "igt_aux.h" #define LOCAL_I915_EXEC_VEBOX (4<<0) diff --git a/tests/igt_fork_helper.c b/tests/igt_fork_helper.c index a66ecde41d75..b4cf27eb5a47 100644 --- a/tests/igt_fork_helper.c +++ b/tests/igt_fork_helper.c @@ -26,6 +26,7 @@ */ #include "drmtest.h" +#include "igt_aux.h" int main(int argc, char **argv) { diff --git a/tests/kms_flip.c b/tests/kms_flip.c index d5292e8924e1..7ba165687c21 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -43,6 +43,7 @@ #include "intel_chipset.h" #include "intel_batchbuffer.h" #include "igt_kms.h" +#include "igt_aux.h" #define TEST_DPMS (1 << 0) #define TEST_WITH_DUMMY_BCS (1 << 1)