From patchwork Wed May 6 14:48:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrik Jakobsson X-Patchwork-Id: 6350191 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 72F44BEEE5 for ; Wed, 6 May 2015 14:47:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4AF2620306 for ; Wed, 6 May 2015 14:47:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B12D320328 for ; Wed, 6 May 2015 14:47:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7E976E6C9; Wed, 6 May 2015 07:47:40 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id A10BB6E6CC for ; Wed, 6 May 2015 07:47:39 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 06 May 2015 07:47:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,379,1427785200"; d="scan'208";a="706137231" Received: from rpjakobs-thinkcentre-e73.isw.intel.com ([10.237.180.146]) by fmsmga001.fm.intel.com with ESMTP; 06 May 2015 07:47:38 -0700 From: Patrik Jakobsson To: strace-devel@lists.sourceforge.net Date: Wed, 6 May 2015 16:48:03 +0200 Message-Id: <1430923683-17741-3-git-send-email-patrik.jakobsson@linux.intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1430923683-17741-1-git-send-email-patrik.jakobsson@linux.intel.com> References: <1430923683-17741-1-git-send-email-patrik.jakobsson@linux.intel.com> Cc: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [RFC 2/2] strace/drm: Print args for most common i915 ioctls X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, 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 Signed-off-by: Patrik Jakobsson --- drm_i915.c | 235 +++++++++++++++++++++++++++++++++++++++++++++ xlat/drm_i915_getparams.in | 28 ++++++ xlat/drm_i915_setparams.in | 4 + 3 files changed, 267 insertions(+) create mode 100644 xlat/drm_i915_getparams.in create mode 100644 xlat/drm_i915_setparams.in diff --git a/drm_i915.c b/drm_i915.c index 860e22b..a93f01f 100644 --- a/drm_i915.c +++ b/drm_i915.c @@ -33,11 +33,246 @@ #include #include #include "xlat/drm_i915_ioctls.h" +#include "xlat/drm_i915_getparams.h" +#include "xlat/drm_i915_setparams.h" + +static int i915_getparam(struct tcb *tcp, const unsigned int code, long arg) +{ + struct drm_i915_getparam param; + int value; + + if (entering(tcp) || umove(tcp, arg, ¶m)) + return 0; + if (umove(tcp, (long)param.value, &value)) + return 0; + + tprintf(", {param="); + printxval(drm_i915_getparams, param.param, "I915_PARAM_???"); + tprintf(", value="); + switch (param.param) { + case I915_PARAM_CHIPSET_ID: + tprintf("0x%04x", value); + break; + default: + tprintf("%d", value); + } + tprintf("}"); + + return 1; +} + +static int i915_setparam(struct tcb *tcp, const unsigned int code, long arg) +{ + struct drm_i915_setparam param; + + if (exiting(tcp) || umove(tcp, arg, ¶m)) + return 0; + + tprintf(", {param="); + printxval(drm_i915_setparams, param.param, "I915_PARAM_???"); + tprintf(", value=%d}", param.value); + + return 1; +} + +static int i915_gem_execbuffer2(struct tcb *tcp, const unsigned int code, + long arg) +{ + struct drm_i915_gem_execbuffer2 eb; + + if (exiting(tcp) || umove(tcp, arg, &eb)) + return 0; + + tprintf(", {buffers_ptr=%p, buffer_count=%u, " + "batch_start_offset=%x, batch_len=%u, DR1=%u, DR4=%u, " + "num_cliprects=%u, cliprects_ptr=%p, flags=0x%Lx}", + (void *)eb.buffers_ptr, eb.buffer_count, eb.batch_start_offset, + eb.batch_len, eb.DR1, eb.DR4, eb.num_cliprects, + (void *)eb.cliprects_ptr, eb.flags); + + return 1; +} + +static int i915_gem_busy(struct tcb *tcp, const unsigned int code, long arg) +{ + struct drm_i915_gem_busy busy; + + if (entering(tcp) || umove(tcp, arg, &busy)) + return 0; + + tprintf(", {handle=%u, busy=%c, ring=%u}", + busy.handle, (busy.busy & 0x1) ? 'Y' : 'N', (busy.busy >> 16)); + + return 1; +} + +static int i915_gem_create(struct tcb *tcp, const unsigned int code, long arg) +{ + struct drm_i915_gem_create create; + + if (entering(tcp) || umove(tcp, arg, &create)) + return 0; + + tprintf(", {size=%Lu, handle=%u}", create.size, create.handle); + + return 1; +} + +static int i915_gem_pread(struct tcb *tcp, const unsigned int code, long arg) +{ + struct drm_i915_gem_pread pr; + + if (exiting(tcp) || umove(tcp, arg, &pr)) + return 0; + + tprintf(", {handle=%u, offset=%Lu, size=%Lu, data_ptr=%p}", + pr.handle, pr.offset, pr.size, (void *)pr.data_ptr); + + return 1; +} + +static int i915_gem_pwrite(struct tcb *tcp, const unsigned int code, long arg) +{ + struct drm_i915_gem_pwrite pw; + + if (exiting(tcp) || umove(tcp, arg, &pw)) + return 0; + + tprintf(", {handle=%u, offset=%Lu, size=%Lu, data_ptr=%p}", + pw.handle, pw.offset, pw.size, (void *)pw.data_ptr); + + return 1; +} + +static int i915_gem_mmap(struct tcb *tcp, const unsigned int code, long arg) +{ + struct drm_i915_gem_mmap mmap; + + if (entering(tcp) || umove(tcp, arg, &mmap)) + return 0; + + tprintf(", {handle=%u, offset=%Lu, size=%Lu, addr_ptr=%p}", + mmap.handle, mmap.offset, mmap.size, (void *)mmap.addr_ptr); + + return 1; +} + +static int i915_gem_mmap_gtt(struct tcb *tcp, const unsigned int code, long arg) +{ + struct drm_i915_gem_mmap_gtt mmap; + + if (entering(tcp) || umove(tcp, arg, &mmap)) + return 0; + + tprintf(", {handle=%u, offset=%Lu}", mmap.handle, mmap.offset); + + return 1; +} + +static int i915_gem_set_domain(struct tcb *tcp, const unsigned int code, + long arg) +{ + struct drm_i915_gem_set_domain dom; + + if (entering(tcp) || umove(tcp, arg, &dom)) + return 0; + + tprintf(", {handle=%u, read_domains=%x, write_domain=%x}", + dom.handle, dom.read_domains, dom.write_domain); + + return 1; +} + +static int i915_gem_madvise(struct tcb *tcp, const unsigned int code, long arg) +{ + struct drm_i915_gem_madvise madv; + + if (entering(tcp) || umove(tcp, arg, &madv)) + return 0; + + tprintf(", {handle=%u, madv=%u, retained=%u}", + madv.handle, madv.madv, madv.retained); + + return 1; +} + +static int i915_gem_get_tiling(struct tcb *tcp, const unsigned int code, + long arg) +{ + struct drm_i915_gem_get_tiling tiling; + + if (entering(tcp) || umove(tcp, arg, &tiling)) + return 0; + + tprintf(", {handle=%u, tiling_mode=%u, swizzle_mode=%u}", + tiling.handle, tiling.tiling_mode, tiling.swizzle_mode); + + return 1; +} + +static int i915_gem_set_tiling(struct tcb *tcp, const unsigned int code, + long arg) +{ + struct drm_i915_gem_set_tiling tiling; + + if (entering(tcp) || umove(tcp, arg, &tiling)) + return 0; + + tprintf(", {handle=%u, tiling_mode=%u, stride=%u, swizzle_mode=%u}", + tiling.handle, tiling.tiling_mode, tiling.stride, + tiling.swizzle_mode); + + return 1; +} + +static int i915_gem_userptr(struct tcb *tcp, const unsigned int code, long arg) +{ + struct drm_i915_gem_userptr uptr; + + if (entering(tcp) || umove(tcp, arg, &uptr)) + return 0; + + tprintf(", {user_ptr=%p, user_size=%Lu, flags=0x%x, handle=%u}", + (void *)uptr.user_ptr, uptr.user_size, uptr.flags, uptr.handle); + + return 1; +} int drm_i915_ioctl(struct tcb *tcp, const unsigned int code, long arg) { if (entering(tcp)) printxval(drm_i915_ioctls, code, "I915_IOCTL_???"); + switch (code) { + case DRM_IOCTL_I915_GETPARAM: + return i915_getparam(tcp, code, arg); + case DRM_IOCTL_I915_SETPARAM: + return i915_setparam(tcp, code, arg); + case DRM_IOCTL_I915_GEM_EXECBUFFER2: + return i915_gem_execbuffer2(tcp, code, arg); + case DRM_IOCTL_I915_GEM_BUSY: + return i915_gem_busy(tcp, code, arg); + case DRM_IOCTL_I915_GEM_CREATE: + return i915_gem_create(tcp, code, arg); + case DRM_IOCTL_I915_GEM_PREAD: + return i915_gem_pread(tcp, code, arg); + case DRM_IOCTL_I915_GEM_PWRITE: + return i915_gem_pwrite(tcp, code, arg); + case DRM_IOCTL_I915_GEM_MMAP: + return i915_gem_mmap(tcp, code, arg); + case DRM_IOCTL_I915_GEM_MMAP_GTT: + return i915_gem_mmap_gtt(tcp, code, arg); + case DRM_IOCTL_I915_GEM_SET_DOMAIN: + return i915_gem_set_domain(tcp, code, arg); + case DRM_IOCTL_I915_GEM_MADVISE: + return i915_gem_madvise(tcp, code, arg); + case DRM_IOCTL_I915_GEM_GET_TILING: + return i915_gem_get_tiling(tcp, code, arg); + case DRM_IOCTL_I915_GEM_SET_TILING: + return i915_gem_set_tiling(tcp, code, arg); + case DRM_IOCTL_I915_GEM_USERPTR: + return i915_gem_userptr(tcp, code, arg); + } + return 0; } diff --git a/xlat/drm_i915_getparams.in b/xlat/drm_i915_getparams.in new file mode 100644 index 0000000..15275cb --- /dev/null +++ b/xlat/drm_i915_getparams.in @@ -0,0 +1,28 @@ +I915_PARAM_IRQ_ACTIVE +I915_PARAM_ALLOW_BATCHBUFFER +I915_PARAM_LAST_DISPATCH +I915_PARAM_CHIPSET_ID +I915_PARAM_HAS_GEM +I915_PARAM_NUM_FENCES_AVAIL +I915_PARAM_HAS_OVERLAY +I915_PARAM_HAS_PAGEFLIPPING +I915_PARAM_HAS_EXECBUF2 +I915_PARAM_HAS_BSD +I915_PARAM_HAS_BLT +I915_PARAM_HAS_RELAXED_FENCING +I915_PARAM_HAS_COHERENT_RINGS +I915_PARAM_HAS_EXEC_CONSTANTS +I915_PARAM_HAS_RELAXED_DELTA +I915_PARAM_HAS_GEN7_SOL_RESET +I915_PARAM_HAS_LLC +I915_PARAM_HAS_ALIASING_PPGTT +I915_PARAM_HAS_WAIT_TIMEOUT +I915_PARAM_HAS_SEMAPHORES +I915_PARAM_HAS_PRIME_VMAP_FLUSH +I915_PARAM_HAS_VEBOX +I915_PARAM_HAS_SECURE_BATCHES +I915_PARAM_HAS_PINNED_BATCHES +I915_PARAM_HAS_EXEC_NO_RELOC +I915_PARAM_HAS_EXEC_HANDLE_LUT +I915_PARAM_HAS_WT +I915_PARAM_CMD_PARSER_VERSION diff --git a/xlat/drm_i915_setparams.in b/xlat/drm_i915_setparams.in new file mode 100644 index 0000000..d93d2ea --- /dev/null +++ b/xlat/drm_i915_setparams.in @@ -0,0 +1,4 @@ +I915_SETPARAM_USE_MI_BATCHBUFFER_START +I915_SETPARAM_TEX_LRU_LOG_GRANULARITY +I915_SETPARAM_ALLOW_BATCHBUFFER +I915_SETPARAM_NUM_USED_FENCES