From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 66D53E65D2C for ; Fri, 22 Nov 2024 07:29:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 217E710EAE4; Fri, 22 Nov 2024 07:29:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="nf/vn08b"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 195E410EAE4 for ; Fri, 22 Nov 2024 07:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732260570; x=1763796570; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3KqekiatYEIE4alpPgjVQP4pbQhcsEewCH5RlMYpQoI=; b=nf/vn08btKjBRJuqpDwmEq6ATS7bvOdvS29jVKg+4yBYeoCnEqyQ0zbL VoZHvQRYOzPIg0nUwwa0XYgj5o51yl5SB0m6/47/UpZ4VzQ699/C0u3/S 7TmTLMTc/O7qhmiEoE/pF2934epza8X4U1EuxzTNuAG3jC9OW0TKn30nn mrypKLclTa7vMNt7q0ekAlPhqrl+r/DRRbRNA7N+U2EkSgNO0YaFszTEk 3ZZfHnWfN8lbboK6Dj+o5igoT5J6TDzegi4vf0Jd9C3aOa8hq9Zb+AVt2 Q/2/Kc2CucRiwZkURRZ1Oyc5+6P/GUbbbMCunhn7YAFYpOY57y6cu6lWO A==; X-CSE-ConnectionGUID: pIOA1aJqR8C2PYzWIBknYw== X-CSE-MsgGUID: 5K4kY7cxSdSNqHPKAqvUtg== X-IronPort-AV: E=McAfee;i="6700,10204,11263"; a="32558921" X-IronPort-AV: E=Sophos;i="6.12,175,1728975600"; d="scan'208";a="32558921" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2024 23:29:30 -0800 X-CSE-ConnectionGUID: TT4ksRieTDyN1990WTjY/w== X-CSE-MsgGUID: sCoA6q6WRqGtVocivQgmrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,175,1728975600"; d="scan'208";a="90868226" Received: from slindbla-desk.ger.corp.intel.com (HELO localhost) ([10.245.246.134]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2024 23:29:29 -0800 From: =?UTF-8?q?Zbigniew=20Kempczy=C5=84ski?= To: igt-dev@lists.freedesktop.org Cc: =?UTF-8?q?Zbigniew=20Kempczy=C5=84ski?= , Dominik Grzegorzek Subject: [PATCH i-g-t v6 4/6] tests/gem_gpgpu_fill: Add command line switch to dump the surface Date: Fri, 22 Nov 2024 08:29:02 +0100 Message-Id: <20241122072904.164247-5-zbigniew.kempczynski@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241122072904.164247-1-zbigniew.kempczynski@intel.com> References: <20241122072904.164247-1-zbigniew.kempczynski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" When implementation for new platform is added and shader + pipeline needs to be adopted there's useful to dump the surface data. 0xC4 pattern makes distinction from 0x4C written by the shader very hard so change it to 0x88 makes dump more clear. Signed-off-by: Zbigniew KempczyƄski Cc: Dominik Grzegorzek Reviewed-by: Dominik Grzegorzek --- tests/intel/gem_gpgpu_fill.c | 43 +++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/tests/intel/gem_gpgpu_fill.c b/tests/intel/gem_gpgpu_fill.c index aa735e5395..36c60e75f0 100644 --- a/tests/intel/gem_gpgpu_fill.c +++ b/tests/intel/gem_gpgpu_fill.c @@ -64,9 +64,11 @@ #define HEIGHT 64 #define STRIDE (WIDTH) #define SIZE (HEIGHT*STRIDE) -#define COLOR_C4 0xc4 +#define COLOR_88 0x88 #define COLOR_4C 0x4c +static bool dump_surface; + typedef struct { int drm_fd; uint32_t devid; @@ -117,27 +119,58 @@ static void gpgpu_fill(data_t *data, igt_fillfunc_t fill, uint32_t region) uint8_t *ptr; int i, j; - buf = create_buf(data, WIDTH, HEIGHT, COLOR_C4, region); + buf = create_buf(data, WIDTH, HEIGHT, COLOR_88, region); ptr = gem_mmap__device_coherent(data->drm_fd, buf->handle, 0, buf->surface[0].size, PROT_READ); for (i = 0; i < WIDTH; i++) for (j = 0; j < HEIGHT; j++) - buf_check(ptr, i, j, COLOR_C4); + buf_check(ptr, i, j, COLOR_88); fill(data->drm_fd, buf, 0, 0, WIDTH / 2, HEIGHT / 2, COLOR_4C); + if (dump_surface) { + for (j = 0; j < HEIGHT; j++) { + igt_info("[%04x] ", j); + for (i = 0; i < WIDTH; i++) { + igt_info("%02x", ptr[j * HEIGHT + i]); + if (i % 4 == 3) + igt_info(" "); + } + igt_info("\n"); + } + } + for (i = 0; i < WIDTH; i++) for (j = 0; j < HEIGHT; j++) if (i < WIDTH / 2 && j < HEIGHT / 2) buf_check(ptr, i, j, COLOR_4C); else - buf_check(ptr, i, j, COLOR_C4); + buf_check(ptr, i, j, COLOR_88); munmap(ptr, buf->surface[0].size); } -igt_main +static int opt_handler(int opt, int opt_index, void *data) +{ + switch (opt) { + case 'd': + dump_surface = true; + break; + default: + return IGT_OPT_HANDLER_ERROR; + } + + return IGT_OPT_HANDLER_SUCCESS; +} + + +const char *help_str = + " -d\tDump surface\n" + ; + + +igt_main_args("d", NULL, help_str, opt_handler, NULL) { data_t data = {0, }; igt_fillfunc_t fill_fn = NULL; -- 2.34.1