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 E8C1ECCFA18 for ; Thu, 13 Nov 2025 07:59:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9B05D10E510; Thu, 13 Nov 2025 07:59:00 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="WEuOWcXU"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6775F10E510 for ; Thu, 13 Nov 2025 07:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1763020739; x=1794556739; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ed+8nrKcxMdZBIv/2FiRlIpYz1ateWc9lAxWPZjbkqs=; b=WEuOWcXUbk2oDyJU99CI6i4R7V971IWPlcKRhs9p1Cr2N0lTFsI54dFj LUBjNmaDH+oGVO4SK+L9c8J2CgQ0FDUpEZOUpte5ejFpP4bV+Z0xwc+ft k82SG9HzV/yDiaAikw/HhsaPniZcDefh07xS4WQJLaB91CPk/T/sHNo5h y/6JJjAJ7/ox5OSJF+d7fPzzglDlz0Zq/ytlg3yNFQ6FYkpxLL3o3MBPS UoLmceyih+aeuvo46sB/yOMY9EgTKVO0kJRhLopNfCws4eg8gme4FSyie MsuIQ76a+p5JLAzHv5gw6mbG/xBrUGXIFKkgMmKigAX4OoBnB2gR0iWrp g==; X-CSE-ConnectionGUID: g4WpzyKaSFOWoglD26JVvg== X-CSE-MsgGUID: 8PU/nXp4SxqFAQKkceW40A== X-IronPort-AV: E=McAfee;i="6800,10657,11611"; a="64298404" X-IronPort-AV: E=Sophos;i="6.19,301,1754982000"; d="scan'208";a="64298404" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2025 23:58:56 -0800 X-CSE-ConnectionGUID: ZuumUaF3RPC6LFDoQ2H5MQ== X-CSE-MsgGUID: v0wD1NfsQniM44XrsodxkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,301,1754982000"; d="scan'208";a="189230409" Received: from sowmi-x299-aorus-gaming-3-pro.iind.intel.com ([10.223.74.56]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2025 23:58:56 -0800 From: Sowmiya S To: igt-dev@lists.freedesktop.org Cc: suraj.kandpal@intel.com, Sowmiya S Subject: [PATCH i-g-t v1 2/9] lib/igt_fb: Validate supported formats for crc calculation Date: Thu, 13 Nov 2025 13:45:16 +0530 Message-ID: <20251113081523.3088787-3-sowmiya.s@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251113081523.3088787-1-sowmiya.s@intel.com> References: <20251103103842.3025204-1-sowmiya.s@intel.com> <20251113081523.3088787-1-sowmiya.s@intel.com> MIME-Version: 1.0 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" Add logic to verify that provided formats are supported before proceeding with test execution for crc calculation Signed-off-by: Sowmiya S --- lib/igt_fb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 60853b0af..844f13e5c 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -4960,7 +4960,8 @@ int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc) if (fb->num_planes != 1) return -EINVAL; - if (fb->drm_format != DRM_FORMAT_XRGB8888 && fb->drm_format != DRM_FORMAT_XRGB2101010) + if (fb->drm_format != DRM_FORMAT_XRGB8888 && fb->drm_format != DRM_FORMAT_XRGB2101010 && + fb->drm_format != DRM_FORMAT_XBGR8888 && fb->drm_format != DRM_FORMAT_XBGR2101010) return -EINVAL; ptr = igt_fb_map_buffer(fb->fd, fb); @@ -4987,9 +4988,11 @@ int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc) for (x = 0; x < fb->width; x++) { uint32_t pixel = le32_to_cpu(line[x]); - if (fb->drm_format == DRM_FORMAT_XRGB8888) + if (fb->drm_format == DRM_FORMAT_XRGB8888 || + fb->drm_format == DRM_FORMAT_XBGR8888) pixel &= 0x00ffffff; - else if (fb->drm_format == DRM_FORMAT_XRGB2101010) + else if (fb->drm_format == DRM_FORMAT_XRGB2101010 || + fb->drm_format == DRM_FORMAT_XBGR2101010) pixel &= 0x3fffffff; hash ^= pixel; -- 2.43.0