From patchwork Thu Oct 3 11:32:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13820931 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 12125CF34A0 for ; Thu, 3 Oct 2024 11:33:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 06FD410E80E; Thu, 3 Oct 2024 11:33:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="FVYvjx+s"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id D163410E80E; Thu, 3 Oct 2024 11:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727955191; x=1759491191; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rm5LSkURhard/N2DpG0TI0MuslvYk0AZcCxYaokZlOA=; b=FVYvjx+sahosBytJASfSk2xF8+xhf35pTQOWqwtTWRd4PrYcv/REoAPh 3m5wYJKm4YDhd8QduVJq32rrPUXqmOPvQlKWDACAstFJYBrbR5CFLOlmG 7x7i7yct8pF8No/4acEMn+4BkIWxaavSUVGwPm8/83TjSnDs6aEu896ca qq2gFxIN3nSA6QJ78CUTow/WhGdpbfgkTGQSdsOUW/fUp6IjHiTRJEoos EhNTsz4RjLWLJ2MlxXKQewPSPbNUn59rHxVCN8gFXsF7FpYmMYeZFF9hO pFfxs9QsaGKiJDqNFCs5Sy0QITGcMrwwosne482O5hnf9fMTW8tdEM3XO A==; X-CSE-ConnectionGUID: NYcr2+iBSXq+nkj2OLVQwg== X-CSE-MsgGUID: RzDUQB0lRaekMIG0o7OdaQ== X-IronPort-AV: E=McAfee;i="6700,10204,11214"; a="38502977" X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="38502977" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2024 04:33:11 -0700 X-CSE-ConnectionGUID: xliktpP5Td6mI5q74EbI5Q== X-CSE-MsgGUID: kDfVsZTzRMeOGb4RrQBemQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="74426493" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 03 Oct 2024 04:33:08 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 03 Oct 2024 14:33:07 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, Jani Nikula , Thomas Zimmermann Subject: [PATCH 1/8] drm/client: Constify modes Date: Thu, 3 Oct 2024 14:32:57 +0300 Message-ID: <20241003113304.11700-2-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241003113304.11700-1-ville.syrjala@linux.intel.com> References: <20241003113304.11700-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä The modes used by the client code live on the connectors' mode lists, which are not owned by the client code, and thus it has no business modifying the modes. Mark the modes const to make that fact abundantly clear. Reviewed-by: Jani Nikula Reviewed-by: Thomas Zimmermann Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 39 +++++++++++++++------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c index 251f94313717..20882dffcf5e 100644 --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -117,10 +117,10 @@ drm_client_find_modeset(struct drm_client_dev *client, struct drm_crtc *crtc) return NULL; } -static struct drm_display_mode * +static const struct drm_display_mode * drm_connector_get_tiled_mode(struct drm_connector *connector) { - struct drm_display_mode *mode; + const struct drm_display_mode *mode; list_for_each_entry(mode, &connector->modes, head) { if (mode->hdisplay == connector->tile_h_size && @@ -130,10 +130,10 @@ drm_connector_get_tiled_mode(struct drm_connector *connector) return NULL; } -static struct drm_display_mode * +static const struct drm_display_mode * drm_connector_fallback_non_tiled_mode(struct drm_connector *connector) { - struct drm_display_mode *mode; + const struct drm_display_mode *mode; list_for_each_entry(mode, &connector->modes, head) { if (mode->hdisplay == connector->tile_h_size && @@ -144,10 +144,10 @@ drm_connector_fallback_non_tiled_mode(struct drm_connector *connector) return NULL; } -static struct drm_display_mode * +static const struct drm_display_mode * drm_connector_preferred_mode(struct drm_connector *connector, int width, int height) { - struct drm_display_mode *mode; + const struct drm_display_mode *mode; list_for_each_entry(mode, &connector->modes, head) { if (mode->hdisplay > width || @@ -159,16 +159,18 @@ drm_connector_preferred_mode(struct drm_connector *connector, int width, int hei return NULL; } -static struct drm_display_mode *drm_connector_first_mode(struct drm_connector *connector) +static const struct drm_display_mode * +drm_connector_first_mode(struct drm_connector *connector) { return list_first_entry_or_null(&connector->modes, struct drm_display_mode, head); } -static struct drm_display_mode *drm_connector_pick_cmdline_mode(struct drm_connector *connector) +static const struct drm_display_mode * +drm_connector_pick_cmdline_mode(struct drm_connector *connector) { - struct drm_cmdline_mode *cmdline_mode; - struct drm_display_mode *mode; + const struct drm_cmdline_mode *cmdline_mode; + const struct drm_display_mode *mode; bool prefer_non_interlace; /* @@ -266,13 +268,14 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors, static bool drm_client_target_cloned(struct drm_device *dev, struct drm_connector **connectors, unsigned int connector_count, - struct drm_display_mode **modes, + const struct drm_display_mode **modes, struct drm_client_offset *offsets, bool *enabled, int width, int height) { int count, i, j; bool can_clone = false; - struct drm_display_mode *dmt_mode, *mode; + const struct drm_display_mode *mode; + struct drm_display_mode *dmt_mode; /* only contemplate cloning in the single crtc case */ if (dev->mode_config.num_crtc > 1) @@ -351,7 +354,7 @@ static bool drm_client_target_cloned(struct drm_device *dev, static int drm_client_get_tile_offsets(struct drm_device *dev, struct drm_connector **connectors, unsigned int connector_count, - struct drm_display_mode **modes, + const struct drm_display_mode **modes, struct drm_client_offset *offsets, int idx, int h_idx, int v_idx) @@ -386,7 +389,7 @@ static int drm_client_get_tile_offsets(struct drm_device *dev, static bool drm_client_target_preferred(struct drm_device *dev, struct drm_connector **connectors, unsigned int connector_count, - struct drm_display_mode **modes, + const struct drm_display_mode **modes, struct drm_client_offset *offsets, bool *enabled, int width, int height) { @@ -505,7 +508,7 @@ static int drm_client_pick_crtcs(struct drm_client_dev *client, struct drm_connector **connectors, unsigned int connector_count, struct drm_crtc **best_crtcs, - struct drm_display_mode **modes, + const struct drm_display_mode **modes, int n, int width, int height) { struct drm_device *dev = client->dev; @@ -580,7 +583,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, struct drm_connector **connectors, unsigned int connector_count, struct drm_crtc **crtcs, - struct drm_display_mode **modes, + const struct drm_display_mode **modes, struct drm_client_offset *offsets, bool *enabled, int width, int height) { @@ -791,7 +794,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, struct drm_client_offset *offsets; unsigned int connector_count = 0; /* points to modes protected by mode_config.mutex */ - struct drm_display_mode **modes; + const struct drm_display_mode **modes; struct drm_crtc **crtcs; int i, ret = 0; bool *enabled; @@ -862,7 +865,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, drm_client_modeset_release(client); for (i = 0; i < connector_count; i++) { - struct drm_display_mode *mode = modes[i]; + const struct drm_display_mode *mode = modes[i]; struct drm_crtc *crtc = crtcs[i]; struct drm_client_offset *offset = &offsets[i]; From patchwork Thu Oct 3 11:32:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13820932 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 742D2CF34A0 for ; Thu, 3 Oct 2024 11:33:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DFDC010E812; Thu, 3 Oct 2024 11:33:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="a+Bjv6fy"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8F5F210E820; Thu, 3 Oct 2024 11:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727955195; x=1759491195; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fd9r1r1zQbbjpT4GoY89RaL3WnXKpOi+7xvH8+3IbHw=; b=a+Bjv6fyJy9yUOfvXFHbw9R18pIOVANHjpCu5HfuGAnI5v68pceJN96Q QKLjgcrIecx5iefATK6rMhncgyiqKgW6XkdNK1G50DnXk41/CR+6fczlQ SBj8mKHZa2o2+WDyH0OQoG25O52QhY2m2Tvt3mu0xoeH1dIY1HTnIRQZ9 QBAdyKSXCo0ZOfQeH1B/gbELeUP0DgxXT9voDapmPAAGyg2NlkkScr5eh JvUTbmSwQbTYppBv5iwDYuS+QYg11sdPglYa2esbsjovku3yY9NFN06Fu 7ngjwOftHYl+g0BPm1E9PuLQcOcACwTU0adg3TutdWOmUaxeGAZaFytNj w==; X-CSE-ConnectionGUID: vLJ2GrpfTNqTc5t0bEv1Lg== X-CSE-MsgGUID: fSabHlbxRGW1z26tVb5NYg== X-IronPort-AV: E=McAfee;i="6700,10204,11214"; a="38502986" X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="38502986" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2024 04:33:14 -0700 X-CSE-ConnectionGUID: Ca7h1RIUT62Snedfz7u/GA== X-CSE-MsgGUID: PjzOoTttSHS6gPFPzIy6Ug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="74426504" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 03 Oct 2024 04:33:12 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 03 Oct 2024 14:33:10 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, Jani Nikula , Thomas Zimmermann Subject: [PATCH 2/8] drm/client: Use array notation for function arguments Date: Thu, 3 Oct 2024 14:32:58 +0300 Message-ID: <20241003113304.11700-3-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241003113304.11700-1-ville.syrjala@linux.intel.com> References: <20241003113304.11700-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Use the array notation rather that the pointer notation for function arguments. This makes it clear to the reader that we are in fact dealing with an array rather than a single pointer. Functionally the two are equivalent. Reviewed-by: Jani Nikula Reviewed-by: Thomas Zimmermann Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 42 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c index 20882dffcf5e..068ce32cc41b 100644 --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -239,9 +239,9 @@ static bool drm_connector_enabled(struct drm_connector *connector, bool strict) return enable; } -static void drm_client_connectors_enabled(struct drm_connector **connectors, +static void drm_client_connectors_enabled(struct drm_connector *connectors[], unsigned int connector_count, - bool *enabled) + bool enabled[]) { bool any_enabled = false; struct drm_connector *connector; @@ -266,11 +266,11 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors, } static bool drm_client_target_cloned(struct drm_device *dev, - struct drm_connector **connectors, + struct drm_connector *connectors[], unsigned int connector_count, - const struct drm_display_mode **modes, - struct drm_client_offset *offsets, - bool *enabled, int width, int height) + const struct drm_display_mode *modes[], + struct drm_client_offset offsets[], + bool enabled[], int width, int height) { int count, i, j; bool can_clone = false; @@ -352,10 +352,10 @@ static bool drm_client_target_cloned(struct drm_device *dev, } static int drm_client_get_tile_offsets(struct drm_device *dev, - struct drm_connector **connectors, + struct drm_connector *connectors[], unsigned int connector_count, - const struct drm_display_mode **modes, - struct drm_client_offset *offsets, + const struct drm_display_mode *modes[], + struct drm_client_offset offsets[], int idx, int h_idx, int v_idx) { @@ -387,11 +387,11 @@ static int drm_client_get_tile_offsets(struct drm_device *dev, } static bool drm_client_target_preferred(struct drm_device *dev, - struct drm_connector **connectors, + struct drm_connector *connectors[], unsigned int connector_count, - const struct drm_display_mode **modes, - struct drm_client_offset *offsets, - bool *enabled, int width, int height) + const struct drm_display_mode *modes[], + struct drm_client_offset offsets[], + bool enabled[], int width, int height) { const u64 mask = BIT_ULL(connector_count) - 1; struct drm_connector *connector; @@ -505,10 +505,10 @@ static bool connector_has_possible_crtc(struct drm_connector *connector, } static int drm_client_pick_crtcs(struct drm_client_dev *client, - struct drm_connector **connectors, + struct drm_connector *connectors[], unsigned int connector_count, - struct drm_crtc **best_crtcs, - const struct drm_display_mode **modes, + struct drm_crtc *best_crtcs[], + const struct drm_display_mode *modes[], int n, int width, int height) { struct drm_device *dev = client->dev; @@ -580,12 +580,12 @@ static int drm_client_pick_crtcs(struct drm_client_dev *client, /* Try to read the BIOS display configuration and use it for the initial config */ static bool drm_client_firmware_config(struct drm_client_dev *client, - struct drm_connector **connectors, + struct drm_connector *connectors[], unsigned int connector_count, - struct drm_crtc **crtcs, - const struct drm_display_mode **modes, - struct drm_client_offset *offsets, - bool *enabled, int width, int height) + struct drm_crtc *crtcs[], + const struct drm_display_mode *modes[], + struct drm_client_offset offsets[], + bool enabled[], int width, int height) { const int count = min_t(unsigned int, connector_count, BITS_PER_LONG); unsigned long conn_configured, conn_seq, mask; From patchwork Thu Oct 3 11:32:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13820933 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 CBDC7CF34A1 for ; Thu, 3 Oct 2024 11:33:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F15210E81D; Thu, 3 Oct 2024 11:33:19 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="oDPCwA0j"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7D78010E81D; Thu, 3 Oct 2024 11:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727955197; x=1759491197; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BDSrjUIiQXzEkADw2TPtq/z33dnzAPhvhoZ2CFHP/nc=; b=oDPCwA0jN/TTOJbjpB+sfRIMiw2tu2XX8fAENd8hIL7k/YUHnq2ugl1y D9d6cDrZRY3iQlPlgl5DZRZzMmWck9nO5vXWr8d3RWqJoLsuXd9lD/LP1 lL+ZB/gCkE+bZnkEGx/WWOadI5zmnPteO1zIY4tc39fepAOkf0IrQZ7TC 6TdW49AhQlDLI3FoyVdjiQIQa/EMh1velAGJaYmKcHfnHIs2uu1+71zlw dkj93urXC7FlsU9vL65kYj5sUwCrI6ROZKEXmdNg/6Wk51HrQg2OfpnvQ nC1VV+VU9XIiTq5YYE2wgeL75EYn78GFIaLdtdv61XNMuez3mq2e2HDgD w==; X-CSE-ConnectionGUID: eObA/gzeQeqxf3YU4SkyAg== X-CSE-MsgGUID: 6WOIux62S1WXoN55W3Osug== X-IronPort-AV: E=McAfee;i="6700,10204,11214"; a="38502993" X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="38502993" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2024 04:33:17 -0700 X-CSE-ConnectionGUID: 4/3U3yt6QgyAYq1D8IGoEQ== X-CSE-MsgGUID: OGd3v/2/SyiwYvu++AFYog== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="74426509" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 03 Oct 2024 04:33:15 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 03 Oct 2024 14:33:14 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH 3/8] drm/client: Streamline mode selection debugs Date: Thu, 3 Oct 2024 14:32:59 +0300 Message-ID: <20241003113304.11700-4-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241003113304.11700-1-ville.syrjala@linux.intel.com> References: <20241003113304.11700-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Get rid of all the redundant debugs and just wait until the end to print which mode (and of which type) we picked. Reviewed-by: Thomas Zimmermann Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 70 +++++++++++++--------------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c index 068ce32cc41b..888323137a6a 100644 --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -408,6 +408,8 @@ static bool drm_client_target_preferred(struct drm_device *dev, retry: for (i = 0; i < connector_count; i++) { + const char *mode_type; + connector = connectors[i]; if (conn_configured & BIT_ULL(i)) @@ -441,20 +443,20 @@ static bool drm_client_target_preferred(struct drm_device *dev, modes, offsets, i, connector->tile_h_loc, connector->tile_v_loc); } - drm_dbg_kms(dev, "[CONNECTOR:%d:%s] looking for cmdline mode\n", - connector->base.id, connector->name); - /* got for command line mode first */ + mode_type = "cmdline"; modes[i] = drm_connector_pick_cmdline_mode(connector); + if (!modes[i]) { - drm_dbg_kms(dev, "[CONNECTOR:%d:%s] looking for preferred mode, tile %d\n", - connector->base.id, connector->name, - connector->tile_group ? connector->tile_group->id : 0); + mode_type = "preferred"; modes[i] = drm_connector_preferred_mode(connector, width, height); } - /* No preferred modes, pick one off the list */ - if (!modes[i]) + + if (!modes[i]) { + mode_type = "first"; modes[i] = drm_connector_first_mode(connector); + } + /* * In case of tiled mode if all tiles not present fallback to * first available non tiled mode. @@ -469,18 +471,22 @@ static bool drm_client_target_preferred(struct drm_device *dev, (connector->tile_h_loc == 0 && connector->tile_v_loc == 0 && !drm_connector_get_tiled_mode(connector))) { - drm_dbg_kms(dev, - "[CONNECTOR:%d:%s] Falling back to non-tiled mode\n", - connector->base.id, connector->name); + mode_type = "non tiled"; modes[i] = drm_connector_fallback_non_tiled_mode(connector); } else { + mode_type = "tiled"; modes[i] = drm_connector_get_tiled_mode(connector); } } - drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Found mode %s\n", - connector->base.id, connector->name, - modes[i] ? modes[i]->name : "none"); + if (modes[i]) + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] found %s mode: %s\n", + connector->base.id, connector->name, + mode_type, modes[i]->name); + else + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] no mode found\n", + connector->base.id, connector->name); + conn_configured |= BIT_ULL(i); } @@ -627,6 +633,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, struct drm_connector *connector; struct drm_encoder *encoder; struct drm_crtc *new_crtc; + const char *mode_type; connector = connectors[i]; @@ -676,30 +683,22 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, */ for (j = 0; j < count; j++) { if (crtcs[j] == new_crtc) { - drm_dbg_kms(dev, "fallback: cloned configuration\n"); + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] fallback: cloned configuration\n", + connector->base.id, connector->name); goto bail; } } - drm_dbg_kms(dev, "[CONNECTOR:%d:%s] looking for cmdline mode\n", - connector->base.id, connector->name); - - /* go for command line mode first */ + mode_type = "cmdline"; modes[i] = drm_connector_pick_cmdline_mode(connector); - /* try for preferred next */ if (!modes[i]) { - drm_dbg_kms(dev, - "[CONNECTOR:%d:%s] looking for preferred mode, has tile: %s\n", - connector->base.id, connector->name, - str_yes_no(connector->has_tile)); + mode_type = "preferred"; modes[i] = drm_connector_preferred_mode(connector, width, height); } - /* No preferred mode marked by the EDID? Are there any modes? */ - if (!modes[i] && !list_empty(&connector->modes)) { - drm_dbg_kms(dev, "[CONNECTOR:%d:%s] using first listed mode\n", - connector->base.id, connector->name); + if (!modes[i]) { + mode_type = "first"; modes[i] = drm_connector_first_mode(connector); } @@ -716,28 +715,25 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, * This is crtc->mode and not crtc->state->mode for the * fastboot check to work correctly. */ - drm_dbg_kms(dev, "[CONNECTOR:%d:%s] looking for current mode\n", - connector->base.id, connector->name); + mode_type = "current"; modes[i] = &connector->state->crtc->mode; } + /* * In case of tiled modes, if all tiles are not present * then fallback to a non tiled mode. */ if (connector->has_tile && num_tiled_conns < connector->num_h_tile * connector->num_v_tile) { - drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Falling back to non-tiled mode\n", - connector->base.id, connector->name); + mode_type = "non tiled"; modes[i] = drm_connector_fallback_non_tiled_mode(connector); } crtcs[i] = new_crtc; - drm_dbg_kms(dev, "[CONNECTOR:%d:%s] on [CRTC:%d:%s]: %dx%d%s\n", + drm_dbg_kms(dev, "[CONNECTOR::%d:%s] on [CRTC:%d:%s] using %s mode: %s\n", connector->base.id, connector->name, - connector->state->crtc->base.id, - connector->state->crtc->name, - modes[i]->hdisplay, modes[i]->vdisplay, - modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : ""); + new_crtc->base.id, new_crtc->name, + mode_type, modes[i]->name); fallback = false; conn_configured |= BIT(i); From patchwork Thu Oct 3 11:33:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13820934 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 8D0CCCF34A2 for ; Thu, 3 Oct 2024 11:33:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 115A410E810; Thu, 3 Oct 2024 11:33:21 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Gwfmxxr/"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66C8210E810; Thu, 3 Oct 2024 11:33:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727955200; x=1759491200; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8OG3aiwMiaCIAGyXsunLlA/oR12e6JLEMlC4dQiOiZw=; b=Gwfmxxr/9QY07ekZsMQYNPzqAsTrx0GImJv74M1NHqLDbBT5Dvtyhbvl X3d8N9V9wbrG2NCWEarQPQgGYa/j3TxuiDM04s3mQEyAYPHR4QRnuPoGN e0Vszu4pi4RWyVmrzYW+Uz02i67sGA4R7o9AkrKw1E8/cvarJZDjlzwVs 51wS8YYEemkhDzOMeOJlNbU6VrQ8TS1p21GkE3kRYmujZ7NBZGtxyR56L BDmmUHGTUXdEbZn72krh9DsJkO9ueXl2c1Ejkn/mKNlIZkad7EfFT3u7S Ngn7qQYK9YRy8QmqjYEQi7rZ/3IP6MM8TwNtlNGwdNxt07fLs+SSonacR A==; X-CSE-ConnectionGUID: +SgQW3MvQTSBznC4mQfElg== X-CSE-MsgGUID: T2LJOmigS9aIKouUdaAjyQ== X-IronPort-AV: E=McAfee;i="6700,10204,11214"; a="38503000" X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="38503000" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2024 04:33:20 -0700 X-CSE-ConnectionGUID: Bt1QwBSPSPqYegaP0aX3mg== X-CSE-MsgGUID: 0zMRTFSXS0Cnnyx3Vjy/LQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="74426520" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 03 Oct 2024 04:33:18 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 03 Oct 2024 14:33:17 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org Subject: [PATCH 4/8] drm/client: Make copies of modes Date: Thu, 3 Oct 2024 14:33:00 +0300 Message-ID: <20241003113304.11700-5-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241003113304.11700-1-ville.syrjala@linux.intel.com> References: <20241003113304.11700-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä drm_client_firmware_config() is currently picking up the current mode of the crtc via the legacy crtc->mode, which is not supposed to be used by atomic drivers at all. We can't simply switch over to the proper crtc->state->mode because we drop the crtc->mutex (which protects crtc->state) before the mode gets used. The most straightforward solution to extend the lifetime of modes[] seem to be to make full copies of the modes instead of just storing pointers. We do have to replace the NULL checks with something else though. Checking that mode->clock!=0 should be sufficient. And with this we can undo also commit 3eadd887dbac ("drm/client:Fully protect modes[] with dev->mode_config.mutex") as the lifetime of modes[] no longer has anything to do with that lock. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 80 +++++++++++++++------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c index 888323137a6a..d413e119db3f 100644 --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -265,10 +265,15 @@ static void drm_client_connectors_enabled(struct drm_connector *connectors[], enabled[i] = drm_connector_enabled(connectors[i], false); } +static bool mode_valid(const struct drm_display_mode *mode) +{ + return mode->clock != 0; +} + static bool drm_client_target_cloned(struct drm_device *dev, struct drm_connector *connectors[], unsigned int connector_count, - const struct drm_display_mode *modes[], + struct drm_display_mode modes[], struct drm_client_offset offsets[], bool enabled[], int width, int height) { @@ -296,15 +301,16 @@ static bool drm_client_target_cloned(struct drm_device *dev, for (i = 0; i < connector_count; i++) { if (!enabled[i]) continue; - modes[i] = drm_connector_pick_cmdline_mode(connectors[i]); - if (!modes[i]) { + + drm_mode_copy(&modes[i], drm_connector_pick_cmdline_mode(connectors[i])); + if (!mode_valid(&modes[i])) { can_clone = false; break; } for (j = 0; j < i; j++) { if (!enabled[j]) continue; - if (!drm_mode_match(modes[j], modes[i], + if (!drm_mode_match(&modes[j], &modes[i], DRM_MODE_MATCH_TIMINGS | DRM_MODE_MATCH_CLOCK | DRM_MODE_MATCH_FLAGS | @@ -335,9 +341,9 @@ static bool drm_client_target_cloned(struct drm_device *dev, DRM_MODE_MATCH_CLOCK | DRM_MODE_MATCH_FLAGS | DRM_MODE_MATCH_3D_FLAGS)) - modes[i] = mode; + drm_mode_copy(&modes[i], mode); } - if (!modes[i]) + if (!mode_valid(&modes[i])) can_clone = false; } drm_mode_destroy(dev, dmt_mode); @@ -354,7 +360,7 @@ static bool drm_client_target_cloned(struct drm_device *dev, static int drm_client_get_tile_offsets(struct drm_device *dev, struct drm_connector *connectors[], unsigned int connector_count, - const struct drm_display_mode *modes[], + const struct drm_display_mode modes[], struct drm_client_offset offsets[], int idx, int h_idx, int v_idx) @@ -368,17 +374,17 @@ static int drm_client_get_tile_offsets(struct drm_device *dev, if (!connector->has_tile) continue; - if (!modes[i] && (h_idx || v_idx)) { + if (!mode_valid(&modes[i]) && (h_idx || v_idx)) { drm_dbg_kms(dev, "[CONNECTOR:%d:%s] no modes for connector tiled %d\n", connector->base.id, connector->name, i); continue; } if (connector->tile_h_loc < h_idx) - hoffset += modes[i]->hdisplay; + hoffset += modes[i].hdisplay; if (connector->tile_v_loc < v_idx) - voffset += modes[i]->vdisplay; + voffset += modes[i].vdisplay; } offsets[idx].x = hoffset; offsets[idx].y = voffset; @@ -389,7 +395,7 @@ static int drm_client_get_tile_offsets(struct drm_device *dev, static bool drm_client_target_preferred(struct drm_device *dev, struct drm_connector *connectors[], unsigned int connector_count, - const struct drm_display_mode *modes[], + struct drm_display_mode modes[], struct drm_client_offset offsets[], bool enabled[], int width, int height) { @@ -445,16 +451,16 @@ static bool drm_client_target_preferred(struct drm_device *dev, } mode_type = "cmdline"; - modes[i] = drm_connector_pick_cmdline_mode(connector); + drm_mode_copy(&modes[i], drm_connector_pick_cmdline_mode(connector)); - if (!modes[i]) { + if (!mode_valid(&modes[i])) { mode_type = "preferred"; - modes[i] = drm_connector_preferred_mode(connector, width, height); + drm_mode_copy(&modes[i], drm_connector_preferred_mode(connector, width, height)); } - if (!modes[i]) { + if (!mode_valid(&modes[i])) { mode_type = "first"; - modes[i] = drm_connector_first_mode(connector); + drm_mode_copy(&modes[i], drm_connector_first_mode(connector)); } /* @@ -472,17 +478,17 @@ static bool drm_client_target_preferred(struct drm_device *dev, connector->tile_v_loc == 0 && !drm_connector_get_tiled_mode(connector))) { mode_type = "non tiled"; - modes[i] = drm_connector_fallback_non_tiled_mode(connector); + drm_mode_copy(&modes[i], drm_connector_fallback_non_tiled_mode(connector)); } else { mode_type = "tiled"; - modes[i] = drm_connector_get_tiled_mode(connector); + drm_mode_copy(&modes[i], drm_connector_get_tiled_mode(connector)); } } - if (modes[i]) + if (mode_valid(&modes[i])) drm_dbg_kms(dev, "[CONNECTOR:%d:%s] found %s mode: %s\n", connector->base.id, connector->name, - mode_type, modes[i]->name); + mode_type, modes[i].name); else drm_dbg_kms(dev, "[CONNECTOR:%d:%s] no mode found\n", connector->base.id, connector->name); @@ -514,7 +520,7 @@ static int drm_client_pick_crtcs(struct drm_client_dev *client, struct drm_connector *connectors[], unsigned int connector_count, struct drm_crtc *best_crtcs[], - const struct drm_display_mode *modes[], + const struct drm_display_mode modes[], int n, int width, int height) { struct drm_device *dev = client->dev; @@ -532,7 +538,7 @@ static int drm_client_pick_crtcs(struct drm_client_dev *client, best_crtcs[n] = NULL; best_score = drm_client_pick_crtcs(client, connectors, connector_count, best_crtcs, modes, n + 1, width, height); - if (modes[n] == NULL) + if (!mode_valid(&modes[n])) return best_score; crtcs = kcalloc(connector_count, sizeof(*crtcs), GFP_KERNEL); @@ -566,7 +572,7 @@ static int drm_client_pick_crtcs(struct drm_client_dev *client, if (dev->mode_config.num_crtc > 1) continue; - if (!drm_mode_equal(modes[o], modes[n])) + if (!drm_mode_equal(&modes[o], &modes[n])) continue; } @@ -589,7 +595,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, struct drm_connector *connectors[], unsigned int connector_count, struct drm_crtc *crtcs[], - const struct drm_display_mode *modes[], + struct drm_display_mode modes[], struct drm_client_offset offsets[], bool enabled[], int width, int height) { @@ -690,20 +696,20 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, } mode_type = "cmdline"; - modes[i] = drm_connector_pick_cmdline_mode(connector); + drm_mode_copy(&modes[i], drm_connector_pick_cmdline_mode(connector)); - if (!modes[i]) { + if (!mode_valid(&modes[i])) { mode_type = "preferred"; - modes[i] = drm_connector_preferred_mode(connector, width, height); + drm_mode_copy(&modes[i], drm_connector_preferred_mode(connector, width, height)); } - if (!modes[i]) { + if (!mode_valid(&modes[i])) { mode_type = "first"; - modes[i] = drm_connector_first_mode(connector); + drm_mode_copy(&modes[i], drm_connector_first_mode(connector)); } /* last resort: use current mode */ - if (!modes[i]) { + if (!mode_valid(&modes[i])) { /* * IMPORTANT: We want to use the adjusted mode (i.e. * after the panel fitter upscaling) as the initial @@ -716,7 +722,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, * fastboot check to work correctly. */ mode_type = "current"; - modes[i] = &connector->state->crtc->mode; + drm_mode_copy(&modes[i], &connector->state->crtc->mode); } /* @@ -726,14 +732,14 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, if (connector->has_tile && num_tiled_conns < connector->num_h_tile * connector->num_v_tile) { mode_type = "non tiled"; - modes[i] = drm_connector_fallback_non_tiled_mode(connector); + drm_mode_copy(&modes[i], drm_connector_fallback_non_tiled_mode(connector)); } crtcs[i] = new_crtc; drm_dbg_kms(dev, "[CONNECTOR::%d:%s] on [CRTC:%d:%s] using %s mode: %s\n", connector->base.id, connector->name, new_crtc->base.id, new_crtc->name, - mode_type, modes[i]->name); + mode_type, modes[i].name); fallback = false; conn_configured |= BIT(i); @@ -789,8 +795,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, unsigned int total_modes_count = 0; struct drm_client_offset *offsets; unsigned int connector_count = 0; - /* points to modes protected by mode_config.mutex */ - const struct drm_display_mode **modes; + struct drm_display_mode *modes; struct drm_crtc **crtcs; int i, ret = 0; bool *enabled; @@ -858,10 +863,12 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, crtcs, modes, 0, width, height); } + mutex_unlock(&dev->mode_config.mutex); + drm_client_modeset_release(client); for (i = 0; i < connector_count; i++) { - const struct drm_display_mode *mode = modes[i]; + const struct drm_display_mode *mode = &modes[i]; struct drm_crtc *crtc = crtcs[i]; struct drm_client_offset *offset = &offsets[i]; @@ -892,7 +899,6 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, modeset->y = offset->y; } } - mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&client->modeset_mutex); out: From patchwork Thu Oct 3 11:33:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13820935 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 D6056CF34A3 for ; Thu, 3 Oct 2024 11:33:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 53F2B10E81B; Thu, 3 Oct 2024 11:33:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Ekg/2ATL"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 47A1A10E81B; Thu, 3 Oct 2024 11:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727955203; x=1759491203; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zwoTH6dv5J17CVV+F7mJ9gz7DFU3Wnk39sxXGUoH3LE=; b=Ekg/2ATLTZMEXkakf22dpGtvz8+cw8G/gvgszHwJgz/3UekixVZm345e b02YOMr8Ja2LKS8ZCkSOjAnQbMRklVpia7n1qJ2CspJ7zeFs1NwzFHv3t H4TDLEDVoKFWpLUXhUgl6MiSr789/Ejxz+fnmYGRfq//BfgDsuJZxUhkU JL4U+HeGcUQRd70VcCHf0XeiKkk9Uub4/kAPLzbuLU7PiR90sVH4Ciuzt gVlCQXb8aA0UusTgeylxzBq2mR4tuPyyplmDFRRE3iOjrdmyXgRy2Nm0t BHVZdfihfP575iz4J7eas4WxykCH6S/Mis2v1la7IN/daPV6Fr/68ztmw w==; X-CSE-ConnectionGUID: VhY8wgrhQnelaNzbnbKzdA== X-CSE-MsgGUID: ep2iv+BHT/2323q6HDN5MA== X-IronPort-AV: E=McAfee;i="6700,10204,11214"; a="38503006" X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="38503006" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2024 04:33:23 -0700 X-CSE-ConnectionGUID: DyDTOqyySi+K1kD8KUSg5g== X-CSE-MsgGUID: Wy/ocmcvRX6/jUQb3FZPJQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="74426543" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 03 Oct 2024 04:33:21 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 03 Oct 2024 14:33:20 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org Subject: [PATCH 5/8] drm/client: Stop using the legacy crtc->mode Date: Thu, 3 Oct 2024 14:33:01 +0300 Message-ID: <20241003113304.11700-6-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241003113304.11700-1-ville.syrjala@linux.intel.com> References: <20241003113304.11700-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä crtc->mode is legacy junk and shouldn't really be used with atomic drivers. Most (all?) atomic drivers do end up still calling drm_atomic_helper_update_legacy_modeset_state() at some point, so crtc->mode does still get populated, and this does work for now. But now that the modes[] lifetime issues have been sorted out we can just switch over to the proper crtc->state->mode. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c index d413e119db3f..3e49448370c4 100644 --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -710,19 +710,8 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, /* last resort: use current mode */ if (!mode_valid(&modes[i])) { - /* - * IMPORTANT: We want to use the adjusted mode (i.e. - * after the panel fitter upscaling) as the initial - * config, not the input mode, which is what crtc->mode - * usually contains. But since our current - * code puts a mode derived from the post-pfit timings - * into crtc->mode this works out correctly. - * - * This is crtc->mode and not crtc->state->mode for the - * fastboot check to work correctly. - */ mode_type = "current"; - drm_mode_copy(&modes[i], &connector->state->crtc->mode); + drm_mode_copy(&modes[i], &new_crtc->state->mode); } /* From patchwork Thu Oct 3 11:33:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13820936 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 257DBCF34A0 for ; Thu, 3 Oct 2024 11:33:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 804A310E815; Thu, 3 Oct 2024 11:33:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="V4q0ZjYF"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 37AC110E820; Thu, 3 Oct 2024 11:33:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727955206; x=1759491206; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VVMqQcBdcou5qUEVhJvQfq/RY710EKN0rEC7SgU3fEs=; b=V4q0ZjYF7Hgd99ZvlpDOH0SjfLTUsnHt2ZcpgZeJZE2+yq8LvjxsGZWo uxY+r243wr76uQTSuKphvefiu6Lhvi1biNaKbc8ftZxZ02Sde0SZwVR+0 giStBi5NqHOfCCUdOKjuhxpTsSfUuDMwRsi3j5BfPYNIBHIjC1dewHnHF AWN1hQnvayfC8yO4pcZaGWfNL41UNqBNqnRJ5KJFnhmre7mNjTUnqabH3 9jpJrwe0gSfaMz0kDnlNkQx0cT+e/1NjNs6FEQINh+hZwTWQUupGQokBw umKIYUdSdVNwuQx/BWnEyfqR46tSpkMbD2SDhD20pGK+jYGPkpNcMseOD A==; X-CSE-ConnectionGUID: sPnx60oaToasSih9Hb84NA== X-CSE-MsgGUID: OxOMEJr1T0Sk1AcWszsmtg== X-IronPort-AV: E=McAfee;i="6700,10204,11214"; a="38503011" X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="38503011" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2024 04:33:26 -0700 X-CSE-ConnectionGUID: QezMuPH3Th2JXqQXnJH8Zw== X-CSE-MsgGUID: HcT+6jStSYy4FwjamWFGPg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="74426551" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 03 Oct 2024 04:33:24 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 03 Oct 2024 14:33:23 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org Subject: [PATCH 6/8] drm/client: s/new_crtc/crtc/ Date: Thu, 3 Oct 2024 14:33:02 +0300 Message-ID: <20241003113304.11700-7-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241003113304.11700-1-ville.syrjala@linux.intel.com> References: <20241003113304.11700-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Rename the 'new_crtc' variable to just 'crtc' in drm_client_firmware_config(). We don't call any of the other stuff in here new or old so this feels out of place. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c index 3e49448370c4..b82bb3119cb2 100644 --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -638,7 +638,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, for (i = 0; i < count; i++) { struct drm_connector *connector; struct drm_encoder *encoder; - struct drm_crtc *new_crtc; + struct drm_crtc *crtc; const char *mode_type; connector = connectors[i]; @@ -680,7 +680,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, num_connectors_enabled++; - new_crtc = connector->state->crtc; + crtc = connector->state->crtc; /* * Make sure we're not trying to drive multiple connectors @@ -688,7 +688,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, * match the BIOS. */ for (j = 0; j < count; j++) { - if (crtcs[j] == new_crtc) { + if (crtcs[j] == crtc) { drm_dbg_kms(dev, "[CONNECTOR:%d:%s] fallback: cloned configuration\n", connector->base.id, connector->name); goto bail; @@ -711,7 +711,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, /* last resort: use current mode */ if (!mode_valid(&modes[i])) { mode_type = "current"; - drm_mode_copy(&modes[i], &new_crtc->state->mode); + drm_mode_copy(&modes[i], &crtc->state->mode); } /* @@ -723,11 +723,11 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, mode_type = "non tiled"; drm_mode_copy(&modes[i], drm_connector_fallback_non_tiled_mode(connector)); } - crtcs[i] = new_crtc; + crtcs[i] = crtc; drm_dbg_kms(dev, "[CONNECTOR::%d:%s] on [CRTC:%d:%s] using %s mode: %s\n", connector->base.id, connector->name, - new_crtc->base.id, new_crtc->name, + crtc->base.id, crtc->name, mode_type, modes[i].name); fallback = false; From patchwork Thu Oct 3 11:33:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13820937 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 6B37CCF34A2 for ; Thu, 3 Oct 2024 11:33:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DA58910E814; Thu, 3 Oct 2024 11:33:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="NXIirvmz"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2CF9F10E821; Thu, 3 Oct 2024 11:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727955209; x=1759491209; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NuHtJdJEXZoudh312q05jebSYfR677TsErJhjIjU/78=; b=NXIirvmzR67+Wk15VAyfAdw5DKn8vomSaLgbWM8KosINxXdha0oCMF/y kJQq8s7DVnxLwYo6veZcBB5mZ+f3I1aD/Tmm6MFSDNjv4po/TV25LPLGq jFxXhhwTx6hdrSJXDJ+nDvsCAAhkmzVmgHBL2WVQMb+Bw98lTwy/obZXM MlxAbiADO447Q8mPy928xYEV3VYZDjMY19HE9Hn/XsljRoisZhH/cqzPm gokwj1jdppJs4KwL4BMNokRgrhufkiCC3O3zsjmeuXz1C4hGHi2bTUmQ7 sDqa0a42vlJhYiQxix7TFBIMVWfdSlOvzbcV/57omtTbQdcQr9U0tINcq A==; X-CSE-ConnectionGUID: i1AFAQGdTK6LY20GfL1bbA== X-CSE-MsgGUID: FszGU5blQCaMRI78NBDCJA== X-IronPort-AV: E=McAfee;i="6700,10204,11214"; a="38503015" X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="38503015" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2024 04:33:29 -0700 X-CSE-ConnectionGUID: iVSccN+ZTnmNx5tFCXSm9w== X-CSE-MsgGUID: VqT8nmQATe69GevulRqtDQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="74426558" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 03 Oct 2024 04:33:27 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 03 Oct 2024 14:33:26 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org Subject: [PATCH 7/8] drm/client: Move variables to tighter scope Date: Thu, 3 Oct 2024 14:33:03 +0300 Message-ID: <20241003113304.11700-8-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241003113304.11700-1-ville.syrjala@linux.intel.com> References: <20241003113304.11700-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Bunch of variables are only needed inside loops and whatnot. Move them to a tighter scope to make the code less confusing. Also replace the 'unsigned int i' footguns with plain signed ints. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 33 +++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c index b82bb3119cb2..ccf5c9b5537b 100644 --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -73,9 +73,10 @@ int drm_client_modeset_create(struct drm_client_dev *client) static void drm_client_modeset_release(struct drm_client_dev *client) { struct drm_mode_set *modeset; - unsigned int i; drm_client_for_each_modeset(modeset, client) { + unsigned int i; + drm_mode_destroy(client->dev, modeset->mode); modeset->mode = NULL; modeset->fb = NULL; @@ -277,9 +278,8 @@ static bool drm_client_target_cloned(struct drm_device *dev, struct drm_client_offset offsets[], bool enabled[], int width, int height) { - int count, i, j; + int count, i; bool can_clone = false; - const struct drm_display_mode *mode; struct drm_display_mode *dmt_mode; /* only contemplate cloning in the single crtc case */ @@ -299,6 +299,8 @@ static bool drm_client_target_cloned(struct drm_device *dev, /* check the command line or if nothing common pick 1024x768 */ can_clone = true; for (i = 0; i < connector_count; i++) { + int j; + if (!enabled[i]) continue; @@ -332,6 +334,8 @@ static bool drm_client_target_cloned(struct drm_device *dev, goto fail; for (i = 0; i < connector_count; i++) { + const struct drm_display_mode *mode; + if (!enabled[i]) continue; @@ -365,12 +369,12 @@ static int drm_client_get_tile_offsets(struct drm_device *dev, int idx, int h_idx, int v_idx) { - struct drm_connector *connector; int i; int hoffset = 0, voffset = 0; for (i = 0; i < connector_count; i++) { - connector = connectors[i]; + struct drm_connector *connector = connectors[i]; + if (!connector->has_tile) continue; @@ -400,7 +404,6 @@ static bool drm_client_target_preferred(struct drm_device *dev, bool enabled[], int width, int height) { const u64 mask = BIT_ULL(connector_count) - 1; - struct drm_connector *connector; u64 conn_configured = 0; int tile_pass = 0; int num_tiled_conns = 0; @@ -414,9 +417,9 @@ static bool drm_client_target_preferred(struct drm_device *dev, retry: for (i = 0; i < connector_count; i++) { + struct drm_connector *connector = connectors[i]; const char *mode_type; - connector = connectors[i]; if (conn_configured & BIT_ULL(i)) continue; @@ -526,9 +529,8 @@ static int drm_client_pick_crtcs(struct drm_client_dev *client, struct drm_device *dev = client->dev; struct drm_connector *connector; int my_score, best_score, score; - struct drm_crtc **crtcs, *crtc; + struct drm_crtc **crtcs; struct drm_mode_set *modeset; - int o; if (n == connector_count) return 0; @@ -558,7 +560,8 @@ static int drm_client_pick_crtcs(struct drm_client_dev *client, * remaining connectors */ drm_client_for_each_modeset(modeset, client) { - crtc = modeset->crtc; + struct drm_crtc *crtc = modeset->crtc; + int o; if (!connector_has_possible_crtc(connector, crtc)) continue; @@ -602,7 +605,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, const int count = min_t(unsigned int, connector_count, BITS_PER_LONG); unsigned long conn_configured, conn_seq, mask; struct drm_device *dev = client->dev; - int i, j; + int i; bool *save_enabled; bool fallback = true, ret = true; int num_connectors_enabled = 0; @@ -636,12 +639,11 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, retry: conn_seq = conn_configured; for (i = 0; i < count; i++) { - struct drm_connector *connector; + struct drm_connector *connector = connectors[i]; struct drm_encoder *encoder; struct drm_crtc *crtc; const char *mode_type; - - connector = connectors[i]; + int j; if (conn_configured & BIT(i)) continue; @@ -1204,11 +1206,12 @@ static void drm_client_modeset_dpms_legacy(struct drm_client_dev *client, int dp struct drm_connector *connector; struct drm_mode_set *modeset; struct drm_modeset_acquire_ctx ctx; - int j; int ret; DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret); drm_client_for_each_modeset(modeset, client) { + int j; + if (!modeset->crtc->enabled) continue; From patchwork Thu Oct 3 11:33:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13820938 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 25A71CF34A0 for ; Thu, 3 Oct 2024 11:33:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B8CC10E821; Thu, 3 Oct 2024 11:33:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="cL/f57Lr"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 16BE010E821; Thu, 3 Oct 2024 11:33:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727955212; x=1759491212; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PGZLCcVIH9CT89YkamNILT79DNR60PJ7u1AA9UGz0F8=; b=cL/f57LreOOAq8MJH/ScZ8BPk8NvOh7qdGeWaaG8gfnA6cDr6I72DRVR BPCRxW/0KNivGbcXQjYfVCVjt28zdEpeZanMz7ZSrk/Y43NTI2O1wLmkm LzqccX7ggutrsWyuYvA66QLRNg/l066O/JBMiB7txMYhr2SKbaXYrygdj wSdLr4Wrfvsiq4hzszaUJ53v67XsWJGXoxAhvstRy8WAQQV2Vp2mx1P/R 5HcK8mog8GrKbKBxwLEdnXQyJxt1tXiKQTFtaiL8lVT1/ygo6w0knGj1k uprxtIbGJ2n1kkmbS6GDQhktev3/J0SmlkKnCFNb2+imZoBW6fSOAuHJe Q==; X-CSE-ConnectionGUID: DtqQTXzkQ+mwMgjs1556HA== X-CSE-MsgGUID: uNvbvoj6RTimeChqAuw2Dg== X-IronPort-AV: E=McAfee;i="6700,10204,11214"; a="38503021" X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="38503021" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2024 04:33:32 -0700 X-CSE-ConnectionGUID: 70JAljCWQH2HkfiFo64EQw== X-CSE-MsgGUID: ner3WqVYQZOpa5PWkpW/Mw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,174,1725346800"; d="scan'208";a="74426565" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 03 Oct 2024 04:33:30 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 03 Oct 2024 14:33:29 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org Subject: [PATCH 8/8] drm/client: s/unsigned int i/int i/ Date: Thu, 3 Oct 2024 14:33:04 +0300 Message-ID: <20241003113304.11700-9-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241003113304.11700-1-ville.syrjala@linux.intel.com> References: <20241003113304.11700-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Replace the 'unsigned int i' footguns with plain old signed int. Avoids accidents if/when someone decides they need to iterate backwards. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_client_modeset.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c index ccf5c9b5537b..875d517fa8f2 100644 --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -39,7 +39,7 @@ int drm_client_modeset_create(struct drm_client_dev *client) unsigned int max_connector_count = 1; struct drm_mode_set *modeset; struct drm_crtc *crtc; - unsigned int i = 0; + int i = 0; /* Add terminating zero entry to enable index less iteration */ client->modesets = kcalloc(num_crtc + 1, sizeof(*client->modesets), GFP_KERNEL); @@ -75,7 +75,7 @@ static void drm_client_modeset_release(struct drm_client_dev *client) struct drm_mode_set *modeset; drm_client_for_each_modeset(modeset, client) { - unsigned int i; + int i; drm_mode_destroy(client->dev, modeset->mode); modeset->mode = NULL; @@ -925,7 +925,7 @@ bool drm_client_rotation(struct drm_mode_set *modeset, unsigned int *rotation) struct drm_plane *plane = modeset->crtc->primary; struct drm_cmdline_mode *cmdline; u64 valid_mask = 0; - unsigned int i; + int i; if (!modeset->num_connectors) return false;