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 61D4ED65C70 for ; Wed, 17 Dec 2025 15:38:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F366C10ED01; Wed, 17 Dec 2025 15:38:19 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="HJY0GEG9"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id C555710ED23 for ; Wed, 17 Dec 2025 15:38:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1765985899; x=1797521899; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=YdAp5DPSLmNJy7HcScqF1k5PTeKFPuRruW52XHqzN9M=; b=HJY0GEG98gzI79P6LwDCjsjUsJi+m0N6R19t6d9TLx9Ooy+mLQAQf+kM laB5GHTuYfVBJBYKfRY1wlS5v19S8B8xYfKFjNVgYw89HuGdnGcDCYkWV q4nT/BOGpPfnuQgqheDVmVaJojn3QI9uCft2+qcSyDpjLAq37WN9TKT7p jj6z/OjeOo5xXoQ/IJHnkYwlcF5NIYj5eQKMTlojdNqRSPxjPzLnHHAaS JbXuT4m5mV5lzSsB1aaA4P12c1CpfY0OIWrWZstpXAOWMWU5IcZqN5cCk UP2cpDW1ZM8fyIGO+qDSoI/SfM8nzwcpjyRvrwE+arwZOfZDGpjXfLq8S A==; X-CSE-ConnectionGUID: pbCw0G9nSd2R03wWGJA1kA== X-CSE-MsgGUID: bPVrhnYpQSG3iZjUyIFHlg== X-IronPort-AV: E=McAfee;i="6800,10657,11645"; a="71557007" X-IronPort-AV: E=Sophos;i="6.21,156,1763452800"; d="scan'208";a="71557007" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2025 07:38:19 -0800 X-CSE-ConnectionGUID: bJGr27qdSE2icAsGIWipmA== X-CSE-MsgGUID: 4eu4TesuSaeLehihU049/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,156,1763452800"; d="scan'208";a="221718705" Received: from klitkey1-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.245.196]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2025 07:38:18 -0800 From: Ville Syrjala To: igt-dev@lists.freedesktop.org Subject: [PATCH i-g-t 05/11] lib/kms: Extract igt_crtc_plane_init() Date: Wed, 17 Dec 2025 17:37:51 +0200 Message-ID: <20251217153758.9369-6-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251217153758.9369-1-ville.syrjala@linux.intel.com> References: <20251217153758.9369-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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" From: Ville Syrjälä Coccinelle tends to hit some kind of pathological performance problem with igt_display_require(). Carving it up seems to help a bit, so extract the plane init loop into a separate function. Signed-off-by: Ville Syrjälä --- lib/igt_kms.c | 113 +++++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 52 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 5679643e167a..233f326d487f 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -3052,13 +3052,71 @@ void igt_display_reset_outputs(igt_display_t *display) drmModeFreeResources(resources); } +static void igt_crtc_plane_init(igt_display_t *display, + igt_crtc_t *pipe, + drmModeRes *resources, + igt_plane_t *global_plane) +{ + drmModePlane *drm_plane = global_plane->drm_plane; + int type = global_plane->type; + igt_plane_t *plane; + int index; + + if (type == DRM_PLANE_TYPE_PRIMARY && pipe->plane_primary == -1) { + index = 0; + + pipe->plane_primary = index; + pipe->num_primary_planes++; + } else if (type == DRM_PLANE_TYPE_CURSOR && pipe->plane_cursor == -1) { + index = pipe->n_planes - 1; + + pipe->plane_cursor = index; + display->has_cursor_plane = true; + } else { + for (index = 1; index < pipe->n_planes; index++) { + if (pipe->planes[index].index < 0) + break; + } + + /* + * Increment num_primary_planes for any extra + * primary plane found. + */ + if (type == DRM_PLANE_TYPE_PRIMARY) + pipe->num_primary_planes++; + } + + igt_assert_lt(index, pipe->n_planes); + + plane = &pipe->planes[index]; + + igt_assert_lt(plane->index, 0); + + plane->index = index; + plane->type = type; + plane->pipe = pipe; + plane->drm_plane = drm_plane; + plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL; + plane->ref = global_plane; + + /* + * HACK: point the global plane to the first pipe that + * it can go on. + */ + if (!global_plane->ref) + igt_plane_set_pipe(plane, pipe); + + igt_fill_plane_props(display, plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names); + + igt_fill_plane_format_mod(display, plane); +} + static void igt_crtc_init(igt_display_t *display, drmModeRes *resources, int i) { igt_crtc_t *pipe = igt_crtc_for_pipe(display, i); - igt_plane_t *plane; int crtc_mask = 0; - int j, type; + int j; pipe->display = display; pipe->plane_cursor = -1; @@ -3091,60 +3149,11 @@ static void igt_crtc_init(igt_display_t *display, for (j = 0; j < display->n_planes; j++) { igt_plane_t *global_plane = &display->planes[j]; drmModePlane *drm_plane = global_plane->drm_plane; - int index; if (!(drm_plane->possible_crtcs & crtc_mask)) continue; - type = global_plane->type; - - if (type == DRM_PLANE_TYPE_PRIMARY && pipe->plane_primary == -1) { - index = 0; - - pipe->plane_primary = index; - pipe->num_primary_planes++; - } else if (type == DRM_PLANE_TYPE_CURSOR && pipe->plane_cursor == -1) { - index = pipe->n_planes - 1; - - pipe->plane_cursor = index; - display->has_cursor_plane = true; - } else { - for (index = 1 ; index < pipe->n_planes; index++) { - if (pipe->planes[index].index < 0) - break; - } - - /* - * Increment num_primary_planes for any extra - * primary plane found. - */ - if (type == DRM_PLANE_TYPE_PRIMARY) - pipe->num_primary_planes++; - } - - igt_assert_lt(index, pipe->n_planes); - - plane = &pipe->planes[index]; - - igt_assert_lt(plane->index, 0); - - plane->index = index; - plane->type = type; - plane->pipe = pipe; - plane->drm_plane = drm_plane; - plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL; - plane->ref = global_plane; - - /* - * HACK: point the global plane to the first pipe that - * it can go on. - */ - if (!global_plane->ref) - igt_plane_set_pipe(plane, pipe); - - igt_fill_plane_props(display, plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names); - - igt_fill_plane_format_mod(display, plane); + igt_crtc_plane_init(display, pipe, resources, global_plane); } /* -- 2.51.2