From patchwork Wed Jan 8 15:19:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 13931131 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 EC8A2E7719A for ; Wed, 8 Jan 2025 15:18:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A16410E42D; Wed, 8 Jan 2025 15:18:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="kdTENjZY"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4FB2310E8E3 for ; Wed, 8 Jan 2025 15:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736349508; x=1767885508; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VXTGgl1K9SXx+dHPVWRFKxdDWNT6igKTtOBzy0IkRh4=; b=kdTENjZYngraDL0j7NMFCSkaNPbYl3rktD87ZL8FDsSQeyEkGa0nEWzG UXQsYZZax2MvaC6VEg57olIdiEUQihQuazWVELBV04RuDa19uSXyWwLWR 8WRECYeMuB0AKInsChU1kWTWt8nuWhdlZcs+sRLZXFJC2lf/aHgoTt+q7 jfxVv1XffULv11WtjjzpxS7FExqecdTZH5h9+uBRSQwcFL7aqLBRABQtd 1fNUPzZkBj4H3GW1ygRKIb83bbmsUniF/owLWlqoedB7LW8oo97KcqZpZ 8+o7cFr42rXMqjLCLzN9Wq0mkM70IAub0GsRsv3ABGOM9kKmQOnlRVDFN w==; X-CSE-ConnectionGUID: 0XSNb759TyWLVxtZqPRP9g== X-CSE-MsgGUID: BZiU5YA3QLaaZ88yvv2GEQ== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="36694387" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="36694387" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 07:18:28 -0800 X-CSE-ConnectionGUID: nK1xYYhRSZ2kpvtbBM+qDA== X-CSE-MsgGUID: Dbk5ETwjTTWDk1SteE/kww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="103626812" Received: from ideak-desk.fi.intel.com ([10.237.72.78]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 07:18:27 -0800 From: Imre Deak To: intel-gfx@lists.freedesktop.org Cc: Rodrigo Vivi Subject: [PATCH 1/5] drm/i915/dp_mst: Fix error handling while adding a connector Date: Wed, 8 Jan 2025 17:19:12 +0200 Message-ID: <20250108151916.491113-2-imre.deak@intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20250108151916.491113-1-imre.deak@intel.com> References: <20250108151916.491113-1-imre.deak@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" After an error during adding an MST connector the MST port and the intel_connector object could be leaked, fix this up. Reviewed-by: Rodrigo Vivi Signed-off-by: Imre Deak --- drivers/gpu/drm/i915/display/intel_dp_mst.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 227bd2783e641..7ecd639d6f25b 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -1717,11 +1717,8 @@ mst_topology_add_connector(struct drm_dp_mst_topology_mgr *mgr, ret = drm_connector_dynamic_init(display->drm, connector, &mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort, NULL); - if (ret) { - drm_dp_mst_put_port_malloc(port); - intel_connector_free(intel_connector); - return NULL; - } + if (ret) + goto err_put_port; intel_connector->dp.dsc_decompression_aux = drm_dp_mst_dsc_aux_for_port(port); intel_dp_mst_read_decompression_port_dsc_caps(intel_dp, intel_connector); @@ -1736,12 +1733,12 @@ mst_topology_add_connector(struct drm_dp_mst_topology_mgr *mgr, ret = drm_connector_attach_encoder(&intel_connector->base, enc); if (ret) - goto err; + goto err_cleanup_connector; } ret = mst_topology_add_connector_properties(intel_dp, connector, pathprop); if (ret) - goto err; + goto err_cleanup_connector; ret = intel_dp_hdcp_init(dig_port, intel_connector); if (ret) @@ -1750,8 +1747,12 @@ mst_topology_add_connector(struct drm_dp_mst_topology_mgr *mgr, return connector; -err: +err_cleanup_connector: drm_connector_cleanup(connector); +err_put_port: + drm_dp_mst_put_port_malloc(port); + intel_connector_free(intel_connector); + return NULL; } From patchwork Wed Jan 8 15:19:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 13931133 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 142CDE77199 for ; Wed, 8 Jan 2025 15:18:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A99FB10EBEA; Wed, 8 Jan 2025 15:18:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Fo/TNjzO"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD3CC10EBE3 for ; Wed, 8 Jan 2025 15:18: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=1736349509; x=1767885509; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NCSDE/OAOMTzOJm08SPkKbndPV21bMQR1KELcfbePXM=; b=Fo/TNjzOSTC0dEr/xnLS+GzgH8d1SQhZRTf4jUNHpwg+k9XhEVG7ZSsV WHlaJjI/PW1OyyjkRkI/1Y21stiLpdXlWJu5OEt6trdzDSl6pbf/jkt/N NcFEVqOoNQavKeH0z1L+z7a3NYOTHhpqcnlo+yt0QXXFuMYNfZxh1uI8e HdqkRu23kEmUnWH/N6D0QShXE4hFucMZHWO/wSq2IfYf/zjNt82ycNUiF gmoiwhbv4vYqv2e2NJMjbiERtUBg4I4MPNLORy5eTxLrvlcKMbJvmuD+3 oicbOJx+MVs63vqOoKPAVrUOsGn6RLeOAFXVjiRtCBAWycreAqipkmtk6 A==; X-CSE-ConnectionGUID: e1Sg7Z3DQm2RtsQ9cPjuCQ== X-CSE-MsgGUID: 1BlTvPwRRTqmbZicsnfpPw== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="36694389" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="36694389" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 07:18:29 -0800 X-CSE-ConnectionGUID: UACvWxgJRwG1mAzQN6MnDQ== X-CSE-MsgGUID: s6N2tSwyRYCQbxSFXmIXmA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="103626816" Received: from ideak-desk.fi.intel.com ([10.237.72.78]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 07:18:28 -0800 From: Imre Deak To: intel-gfx@lists.freedesktop.org Cc: Jani Nikula Subject: [PATCH 2/5] drm/i915/dp_mst: Use intel_connector vs. drm_connector pointer in intel_dp_mst.c Date: Wed, 8 Jan 2025 17:19:13 +0200 Message-ID: <20250108151916.491113-3-imre.deak@intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20250108151916.491113-1-imre.deak@intel.com> References: <20250108151916.491113-1-imre.deak@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Follow the canonical way in intel_dp_mst.c, referencing a connector only via a struct intel_connector pointer and naming this pointer 'connector' instead of 'intel_connector', the only exception being the casting of a drm_connector function parameter pointer to intel_connector, calling the drm_connector pointer _connector. Suggested-by: Jani Nikula Reviewed-by: Jani Nikula Signed-off-by: Imre Deak --- drivers/gpu/drm/i915/display/intel_dp_mst.c | 180 ++++++++++---------- 1 file changed, 88 insertions(+), 92 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 7ecd639d6f25b..a7bfedc5945ea 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -943,33 +943,32 @@ mst_connector_atomic_topology_check(struct intel_connector *connector, } static int -mst_connector_atomic_check(struct drm_connector *connector, +mst_connector_atomic_check(struct drm_connector *_connector, struct drm_atomic_state *_state) { struct intel_atomic_state *state = to_intel_atomic_state(_state); - struct intel_connector *intel_connector = - to_intel_connector(connector); + struct intel_connector *connector = to_intel_connector(_connector); int ret; - ret = intel_digital_connector_atomic_check(connector, &state->base); + ret = intel_digital_connector_atomic_check(&connector->base, &state->base); if (ret) return ret; - ret = mst_connector_atomic_topology_check(intel_connector, state); + ret = mst_connector_atomic_topology_check(connector, state); if (ret) return ret; - if (intel_connector_needs_modeset(state, connector)) { + if (intel_connector_needs_modeset(state, &connector->base)) { ret = intel_dp_tunnel_atomic_check_state(state, - intel_connector->mst_port, - intel_connector); + connector->mst_port, + connector); if (ret) return ret; } return drm_dp_atomic_release_time_slots(&state->base, - &intel_connector->mst_port->mst_mgr, - intel_connector->port); + &connector->mst_port->mst_mgr, + connector->port); } static void mst_stream_disable(struct intel_atomic_state *state, @@ -1349,23 +1348,23 @@ static bool mst_stream_initial_fastset_check(struct intel_encoder *encoder, return intel_dp_initial_fastset_check(primary_encoder, crtc_state); } -static int mst_connector_get_ddc_modes(struct drm_connector *connector) +static int mst_connector_get_ddc_modes(struct drm_connector *_connector) { - struct intel_display *display = to_intel_display(connector->dev); - struct intel_connector *intel_connector = to_intel_connector(connector); - struct intel_dp *intel_dp = intel_connector->mst_port; + struct intel_connector *connector = to_intel_connector(_connector); + struct intel_display *display = to_intel_display(connector->base.dev); + struct intel_dp *intel_dp = connector->mst_port; const struct drm_edid *drm_edid; int ret; - if (drm_connector_is_unregistered(connector)) - return intel_connector_update_modes(connector, NULL); + if (drm_connector_is_unregistered(&connector->base)) + return intel_connector_update_modes(&connector->base, NULL); if (!intel_display_driver_check_access(display)) - return drm_edid_connector_add_modes(connector); + return drm_edid_connector_add_modes(&connector->base); - drm_edid = drm_dp_mst_edid_read(connector, &intel_dp->mst_mgr, intel_connector->port); + drm_edid = drm_dp_mst_edid_read(&connector->base, &intel_dp->mst_mgr, connector->port); - ret = intel_connector_update_modes(connector, drm_edid); + ret = intel_connector_update_modes(&connector->base, drm_edid); drm_edid_free(drm_edid); @@ -1373,32 +1372,29 @@ static int mst_connector_get_ddc_modes(struct drm_connector *connector) } static int -mst_connector_late_register(struct drm_connector *connector) +mst_connector_late_register(struct drm_connector *_connector) { - struct intel_connector *intel_connector = to_intel_connector(connector); + struct intel_connector *connector = to_intel_connector(_connector); int ret; - ret = drm_dp_mst_connector_late_register(connector, - intel_connector->port); + ret = drm_dp_mst_connector_late_register(&connector->base, connector->port); if (ret < 0) return ret; - ret = intel_connector_register(connector); + ret = intel_connector_register(&connector->base); if (ret < 0) - drm_dp_mst_connector_early_unregister(connector, - intel_connector->port); + drm_dp_mst_connector_early_unregister(&connector->base, connector->port); return ret; } static void -mst_connector_early_unregister(struct drm_connector *connector) +mst_connector_early_unregister(struct drm_connector *_connector) { - struct intel_connector *intel_connector = to_intel_connector(connector); + struct intel_connector *connector = to_intel_connector(_connector); - intel_connector_unregister(connector); - drm_dp_mst_connector_early_unregister(connector, - intel_connector->port); + intel_connector_unregister(&connector->base); + drm_dp_mst_connector_early_unregister(&connector->base, connector->port); } static const struct drm_connector_funcs mst_connector_funcs = { @@ -1412,23 +1408,25 @@ static const struct drm_connector_funcs mst_connector_funcs = { .atomic_duplicate_state = intel_digital_connector_duplicate_state, }; -static int mst_connector_get_modes(struct drm_connector *connector) +static int mst_connector_get_modes(struct drm_connector *_connector) { - return mst_connector_get_ddc_modes(connector); + struct intel_connector *connector = to_intel_connector(_connector); + + return mst_connector_get_ddc_modes(&connector->base); } static int -mst_connector_mode_valid_ctx(struct drm_connector *connector, +mst_connector_mode_valid_ctx(struct drm_connector *_connector, const struct drm_display_mode *mode, struct drm_modeset_acquire_ctx *ctx, enum drm_mode_status *status) { - struct intel_display *display = to_intel_display(connector->dev); - struct drm_i915_private *dev_priv = to_i915(connector->dev); - struct intel_connector *intel_connector = to_intel_connector(connector); - struct intel_dp *intel_dp = intel_connector->mst_port; + struct intel_connector *connector = to_intel_connector(_connector); + struct intel_display *display = to_intel_display(connector->base.dev); + struct drm_i915_private *dev_priv = to_i915(connector->base.dev); + struct intel_dp *intel_dp = connector->mst_port; struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst_mgr; - struct drm_dp_mst_port *port = intel_connector->port; + struct drm_dp_mst_port *port = connector->port; const int min_bpp = 18; int max_dotclk = display->cdclk.max_dotclk_freq; int max_rate, mode_rate, max_lanes, max_link_clock; @@ -1439,7 +1437,7 @@ mst_connector_mode_valid_ctx(struct drm_connector *connector, int target_clock = mode->clock; int num_joined_pipes; - if (drm_connector_is_unregistered(connector)) { + if (drm_connector_is_unregistered(&connector->base)) { *status = MODE_ERROR; return 0; } @@ -1477,7 +1475,7 @@ mst_connector_mode_valid_ctx(struct drm_connector *connector, * corresponding link capabilities of the sink) in case the * stream is uncompressed for it by the last branch device. */ - num_joined_pipes = intel_dp_num_joined_pipes(intel_dp, intel_connector, + num_joined_pipes = intel_dp_num_joined_pipes(intel_dp, connector, mode->hdisplay, target_clock); max_dotclk *= num_joined_pipes; @@ -1491,14 +1489,14 @@ mst_connector_mode_valid_ctx(struct drm_connector *connector, return 0; } - if (intel_dp_has_dsc(intel_connector)) { + if (intel_dp_has_dsc(connector)) { /* * TBD pass the connector BPC, * for now U8_MAX so that max BPC on that platform would be picked */ - int pipe_bpp = intel_dp_dsc_compute_max_bpp(intel_connector, U8_MAX); + int pipe_bpp = intel_dp_dsc_compute_max_bpp(connector, U8_MAX); - if (drm_dp_sink_supports_fec(intel_connector->dp.fec_capability)) { + if (drm_dp_sink_supports_fec(connector->dp.fec_capability)) { dsc_max_compressed_bpp = intel_dp_dsc_get_max_compressed_bpp(display, max_link_clock, @@ -1509,7 +1507,7 @@ mst_connector_mode_valid_ctx(struct drm_connector *connector, INTEL_OUTPUT_FORMAT_RGB, pipe_bpp, 64); dsc_slice_count = - intel_dp_dsc_get_slice_count(intel_connector, + intel_dp_dsc_get_slice_count(connector, target_clock, mode->hdisplay, num_joined_pipes); @@ -1533,39 +1531,39 @@ mst_connector_mode_valid_ctx(struct drm_connector *connector, } static struct drm_encoder * -mst_connector_atomic_best_encoder(struct drm_connector *connector, +mst_connector_atomic_best_encoder(struct drm_connector *_connector, struct drm_atomic_state *state) { - struct drm_connector_state *connector_state = drm_atomic_get_new_connector_state(state, - connector); - struct intel_connector *intel_connector = to_intel_connector(connector); - struct intel_dp *intel_dp = intel_connector->mst_port; + struct intel_connector *connector = to_intel_connector(_connector); + struct drm_connector_state *connector_state = + drm_atomic_get_new_connector_state(state, &connector->base); + struct intel_dp *intel_dp = connector->mst_port; struct intel_crtc *crtc = to_intel_crtc(connector_state->crtc); return &intel_dp->mst_encoders[crtc->pipe]->base.base; } static int -mst_connector_detect_ctx(struct drm_connector *connector, +mst_connector_detect_ctx(struct drm_connector *_connector, struct drm_modeset_acquire_ctx *ctx, bool force) { - struct intel_display *display = to_intel_display(connector->dev); - struct intel_connector *intel_connector = to_intel_connector(connector); - struct intel_dp *intel_dp = intel_connector->mst_port; + struct intel_connector *connector = to_intel_connector(_connector); + struct intel_display *display = to_intel_display(connector->base.dev); + struct intel_dp *intel_dp = connector->mst_port; if (!intel_display_device_enabled(display)) return connector_status_disconnected; - if (drm_connector_is_unregistered(connector)) + if (drm_connector_is_unregistered(&connector->base)) return connector_status_disconnected; if (!intel_display_driver_check_access(display)) - return connector->status; + return connector->base.status; - intel_dp_flush_connector_commits(intel_connector); + intel_dp_flush_connector_commits(connector); - return drm_dp_mst_detect_port(connector, ctx, &intel_dp->mst_mgr, - intel_connector->port); + return drm_dp_mst_detect_port(&connector->base, ctx, &intel_dp->mst_mgr, + connector->port); } static const struct drm_connector_helper_funcs mst_connector_helper_funcs = { @@ -1601,29 +1599,30 @@ static bool mst_connector_get_hw_state(struct intel_connector *connector) } static int mst_topology_add_connector_properties(struct intel_dp *intel_dp, - struct drm_connector *connector, + struct drm_connector *_connector, const char *pathprop) { struct intel_display *display = to_intel_display(intel_dp); + struct intel_connector *connector = to_intel_connector(_connector); - drm_object_attach_property(&connector->base, + drm_object_attach_property(&connector->base.base, display->drm->mode_config.path_property, 0); - drm_object_attach_property(&connector->base, + drm_object_attach_property(&connector->base.base, display->drm->mode_config.tile_property, 0); - intel_attach_force_audio_property(connector); - intel_attach_broadcast_rgb_property(connector); + intel_attach_force_audio_property(&connector->base); + intel_attach_broadcast_rgb_property(&connector->base); /* * Reuse the prop from the SST connector because we're * not allowed to create new props after device registration. */ - connector->max_bpc_property = + connector->base.max_bpc_property = intel_dp->attached_connector->base.max_bpc_property; - if (connector->max_bpc_property) - drm_connector_attach_max_bpc_property(connector, 6, 12); + if (connector->base.max_bpc_property) + drm_connector_attach_max_bpc_property(&connector->base, 6, 12); - return drm_connector_set_path_property(connector, pathprop); + return drm_connector_set_path_property(&connector->base, pathprop); } static void @@ -1696,62 +1695,59 @@ mst_topology_add_connector(struct drm_dp_mst_topology_mgr *mgr, struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr); struct intel_display *display = to_intel_display(intel_dp); struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); - struct intel_connector *intel_connector; - struct drm_connector *connector; + struct intel_connector *connector; enum pipe pipe; int ret; - intel_connector = intel_connector_alloc(); - if (!intel_connector) + connector = intel_connector_alloc(); + if (!connector) return NULL; - connector = &intel_connector->base; - - intel_connector->get_hw_state = mst_connector_get_hw_state; - intel_connector->sync_state = intel_dp_connector_sync_state; - intel_connector->mst_port = intel_dp; - intel_connector->port = port; + connector->get_hw_state = mst_connector_get_hw_state; + connector->sync_state = intel_dp_connector_sync_state; + connector->mst_port = intel_dp; + connector->port = port; drm_dp_mst_get_port_malloc(port); - intel_dp_init_modeset_retry_work(intel_connector); + intel_dp_init_modeset_retry_work(connector); - ret = drm_connector_dynamic_init(display->drm, connector, &mst_connector_funcs, + ret = drm_connector_dynamic_init(display->drm, &connector->base, &mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort, NULL); if (ret) goto err_put_port; - intel_connector->dp.dsc_decompression_aux = drm_dp_mst_dsc_aux_for_port(port); - intel_dp_mst_read_decompression_port_dsc_caps(intel_dp, intel_connector); - intel_connector->dp.dsc_hblank_expansion_quirk = - detect_dsc_hblank_expansion_quirk(intel_connector); + connector->dp.dsc_decompression_aux = drm_dp_mst_dsc_aux_for_port(port); + intel_dp_mst_read_decompression_port_dsc_caps(intel_dp, connector); + connector->dp.dsc_hblank_expansion_quirk = + detect_dsc_hblank_expansion_quirk(connector); - drm_connector_helper_add(connector, &mst_connector_helper_funcs); + drm_connector_helper_add(&connector->base, &mst_connector_helper_funcs); for_each_pipe(display, pipe) { struct drm_encoder *enc = &intel_dp->mst_encoders[pipe]->base.base; - ret = drm_connector_attach_encoder(&intel_connector->base, enc); + ret = drm_connector_attach_encoder(&connector->base, enc); if (ret) goto err_cleanup_connector; } - ret = mst_topology_add_connector_properties(intel_dp, connector, pathprop); + ret = mst_topology_add_connector_properties(intel_dp, &connector->base, pathprop); if (ret) goto err_cleanup_connector; - ret = intel_dp_hdcp_init(dig_port, intel_connector); + ret = intel_dp_hdcp_init(dig_port, connector); if (ret) drm_dbg_kms(display->drm, "[%s:%d] HDCP MST init failed, skipping.\n", - connector->name, connector->base.id); + connector->base.name, connector->base.base.id); - return connector; + return &connector->base; err_cleanup_connector: - drm_connector_cleanup(connector); + drm_connector_cleanup(&connector->base); err_put_port: drm_dp_mst_put_port_malloc(port); - intel_connector_free(intel_connector); + intel_connector_free(connector); return NULL; } From patchwork Wed Jan 8 15:19:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 13931132 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 0E2BCE77188 for ; Wed, 8 Jan 2025 15:18:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A769610EBE3; Wed, 8 Jan 2025 15:18:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="fiJxBIM2"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id C736910EBE3 for ; Wed, 8 Jan 2025 15:18: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=1736349510; x=1767885510; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3jJAv6/bd9Xo5D5HTo+23KkCeRopSMzughvjQP6VKZg=; b=fiJxBIM2jrl59HWPSBBQPcVAk4HFjjrTendqn/aHxRNGlSZLRPRMwAjt VIOYfqBjN2xODb1ZtPtlepBd5OgvVYy8CpXdDkejMD+27UD+cWImR6cME AO4y+3IAHpgwK7ROfqLF4H7KfrTNX5uuqPqGyEqgJlLq1o04uHherJgh7 iirw+OgB7Qxx2VMF1JN97hmXpkZCiJaR3DR8dAAqhqncZAoDefoAhuxwn svQAn670yCs73vk3XYJBJx5IICL9VfJ0E4HS4w0lLP6YBOEcFWY4gDdbO IG3gSr/oqtG+pLUWXzsg9FYjKSTjXL63n84GTPwmx7cosgYoOrPOf5lta g==; X-CSE-ConnectionGUID: 3p5jpR9pT76wOusXrrQ37w== X-CSE-MsgGUID: rLpjlsL5SWOzGyfnYwnSWw== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="36694390" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="36694390" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 07:18:30 -0800 X-CSE-ConnectionGUID: /fv0ptsETWuJzAszhu13IQ== X-CSE-MsgGUID: tuOaIjDnSsaJllAdc27NwA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="103626821" Received: from ideak-desk.fi.intel.com ([10.237.72.78]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 07:18:29 -0800 From: Imre Deak To: intel-gfx@lists.freedesktop.org Cc: Jani Nikula Subject: [PATCH 3/5] drm/i915/dp_mst: Simplify using to_intel_display() passing it an intel_connector pointer Date: Wed, 8 Jan 2025 17:19:14 +0200 Message-ID: <20250108151916.491113-4-imre.deak@intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20250108151916.491113-1-imre.deak@intel.com> References: <20250108151916.491113-1-imre.deak@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Simplify the use of to_intel_display() in intel_dp_mst.c passing it the already available intel_connector pointer, instead of looking up a drm_device pointer for the same purpose. Suggested-by: Jani Nikula Signed-off-by: Imre Deak Reviewed-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_dp_mst.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index a7bfedc5945ea..85f451c986ae8 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -1351,7 +1351,7 @@ static bool mst_stream_initial_fastset_check(struct intel_encoder *encoder, static int mst_connector_get_ddc_modes(struct drm_connector *_connector) { struct intel_connector *connector = to_intel_connector(_connector); - struct intel_display *display = to_intel_display(connector->base.dev); + struct intel_display *display = to_intel_display(connector); struct intel_dp *intel_dp = connector->mst_port; const struct drm_edid *drm_edid; int ret; @@ -1422,7 +1422,7 @@ mst_connector_mode_valid_ctx(struct drm_connector *_connector, enum drm_mode_status *status) { struct intel_connector *connector = to_intel_connector(_connector); - struct intel_display *display = to_intel_display(connector->base.dev); + struct intel_display *display = to_intel_display(connector); struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_dp *intel_dp = connector->mst_port; struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst_mgr; @@ -1548,7 +1548,7 @@ mst_connector_detect_ctx(struct drm_connector *_connector, struct drm_modeset_acquire_ctx *ctx, bool force) { struct intel_connector *connector = to_intel_connector(_connector); - struct intel_display *display = to_intel_display(connector->base.dev); + struct intel_display *display = to_intel_display(connector); struct intel_dp *intel_dp = connector->mst_port; if (!intel_display_device_enabled(display)) From patchwork Wed Jan 8 15:19:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 13931134 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 85BF3E7719B for ; Wed, 8 Jan 2025 15:18:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED0D410EBEF; Wed, 8 Jan 2025 15:18:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="GSWuxYLj"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id EEBE110EBEB for ; Wed, 8 Jan 2025 15:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736349512; x=1767885512; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OmAxzj+rSMTldinbiEIEjpkSz/Eip3QaqG42G2Uoy3c=; b=GSWuxYLjGqzEfN1WqIXGbnxxN03mkeywYe0v+5JgetKi8UD79hqF06zN jHkm6LT1a7Z5U/FOK3PPYxro/1kXYgLjpTstDPrRgISx2doR/cM+Tludg aA4tJT8ecnarQe/jbbUTCbDgcAIlOkZhG+v16BIvF6EfE8xE0YM1sQQv/ dgS4+GNU1Vl5MYG7sxT1ESB18Ytl08PUxOXF/u766eVF0OLm/sscMmIeP Zy7DgD7dmr6OO3eHnEvyAJAzjks8z447H2H6vAmwbwiiDuaY1S0Mz+Sby uKqRFQzSTP5SsYeqxQmmZwFf/63gRbkBcTNEkNbDofBWzbe/rUS0ce/8u w==; X-CSE-ConnectionGUID: TPVcKBsCSqiCqqBqYkvKGg== X-CSE-MsgGUID: GKe5rYYCTfagHJRlbrKa/Q== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="36694392" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="36694392" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 07:18:31 -0800 X-CSE-ConnectionGUID: VnsZk2O7Ti2T/o8BSwRyxA== X-CSE-MsgGUID: epepRH01SJyeu/i05y6+kg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="103626828" Received: from ideak-desk.fi.intel.com ([10.237.72.78]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 07:18:30 -0800 From: Imre Deak To: intel-gfx@lists.freedesktop.org Cc: Jani Nikula Subject: [PATCH 4/5] drm/i915/dp_mst: Simplify getting a drm_device pointer needed by to_i915() Date: Wed, 8 Jan 2025 17:19:15 +0200 Message-ID: <20250108151916.491113-5-imre.deak@intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20250108151916.491113-1-imre.deak@intel.com> References: <20250108151916.491113-1-imre.deak@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Simplify getting a drm_device pointer when using to_i915() in intel_dp_mst.c from the already available intel_display object, instead of getting it from a DRM KMS object. While at it rename dev_priv to i915, following the driver's standard terminology. Suggested-by: Jani Nikula Signed-off-by: Imre Deak Reviewed-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_dp_mst.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 85f451c986ae8..fbc504037a969 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -1423,7 +1423,7 @@ mst_connector_mode_valid_ctx(struct drm_connector *_connector, { struct intel_connector *connector = to_intel_connector(_connector); struct intel_display *display = to_intel_display(connector); - struct drm_i915_private *dev_priv = to_i915(connector->base.dev); + struct drm_i915_private *i915 = to_i915(display->drm); struct intel_dp *intel_dp = connector->mst_port; struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst_mgr; struct drm_dp_mst_port *port = connector->port; @@ -1442,7 +1442,7 @@ mst_connector_mode_valid_ctx(struct drm_connector *_connector, return 0; } - *status = intel_cpu_transcoder_mode_valid(dev_priv, mode); + *status = intel_cpu_transcoder_mode_valid(i915, mode); if (*status != MODE_OK) return 0; @@ -1526,7 +1526,7 @@ mst_connector_mode_valid_ctx(struct drm_connector *_connector, return 0; } - *status = intel_mode_valid_max_plane_size(dev_priv, mode, num_joined_pipes); + *status = intel_mode_valid_max_plane_size(i915, mode, num_joined_pipes); return 0; } From patchwork Wed Jan 8 15:19:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 13931135 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 B19B1E7719A for ; Wed, 8 Jan 2025 15:18:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 565F110EBEE; Wed, 8 Jan 2025 15:18:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="AOt8wwRO"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD6CA10EBEC for ; Wed, 8 Jan 2025 15:18: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=1736349512; x=1767885512; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=vo8VfFFQ3yx0dLhwJj+Nol4lSU/uFA5FR6wFx00khlw=; b=AOt8wwRO5JcuW+1aaoMX+wRKmyEBt5O092HqPChQ54CtT3e7xNlalFCY zHeH12jWMMapWH3JvPuSMUjhmuB+/TAGuypPJ5KKjFtmOJmk4UHPfRKLf FaI2QWt5G75VCaIoPKaWO4vaZCDU/81xzuAcMNB+zaTZHux0VEFgNMmkZ huBlx52CUNpe82Jnla7QWJrx2oOZHbVbqNstD8RR0KXaGupQYOVGAmaxF UFdbnhA9Tsetimlk3+wrcWcYEjRUO8I0Ru86weNkj2IKJSX3Oti1e63X7 XeebzmlQiRY7JcOGXGYvlZH1GddAAJuiVRCbj7CpKDXNIYJf1MGn5S7aq A==; X-CSE-ConnectionGUID: UWDID4I8RZyCEQRQD+Pp4Q== X-CSE-MsgGUID: 8gSyL+S8QqqIhQ9TY7esMg== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="36694393" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="36694393" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 07:18:32 -0800 X-CSE-ConnectionGUID: KELpa5PiROu9ram7f8zedA== X-CSE-MsgGUID: ebBIk/nCSQy33rmkxEJFGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="103626829" Received: from ideak-desk.fi.intel.com ([10.237.72.78]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 07:18:32 -0800 From: Imre Deak To: intel-gfx@lists.freedesktop.org Subject: [PATCH 5/5] drm/i915/dp_mst: Use intel_display::platform.alderlake_p instead of IS_ALDERLAKE_P() Date: Wed, 8 Jan 2025 17:19:16 +0200 Message-ID: <20250108151916.491113-6-imre.deak@intel.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20250108151916.491113-1-imre.deak@intel.com> References: <20250108151916.491113-1-imre.deak@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Use the driver's standard intel_display::platform.alderlake_p instead of IS_ALDERLAKE_P(). Signed-off-by: Imre Deak Reviewed-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_dp_mst.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index fbc504037a969..e422e4ee9d280 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -1219,11 +1219,10 @@ static void mst_stream_pre_enable(struct intel_atomic_state *state, static void enable_bs_jitter_was(const struct intel_crtc_state *crtc_state) { struct intel_display *display = to_intel_display(crtc_state); - struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); u32 clear = 0; u32 set = 0; - if (!IS_ALDERLAKE_P(i915)) + if (!display->platform.alderlake_p) return; if (!IS_DISPLAY_STEP(display, STEP_D0, STEP_FOREVER))