From nobody Fri Sep 25 23:50:57 2026 Received: from smtp-8fa8.mail.infomaniak.ch (smtp-8fa8.mail.infomaniak.ch [83.166.143.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E619C46C823 for ; Mon, 7 Sep 2026 11:15:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.166.143.168 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788779758; cv=none; b=atHvGbaN9DBNjddPERo9KovEsoW+YEASou1J98zQRgm/jtFgEDrswPaknnES2Fz9iGIIKz7Hk8ySct4qJPg8iErHMRuj2SONQHLYQsdd7GfhThItea4YOSSQiypYueEKP2cI/iqeoIkH7gqzMZUrNIoqDEGy0hD/m5RsQsLKTPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788779758; c=relaxed/simple; bh=7Kj36trCE2ZexYtNjOMWQeI7ABrUJhCBRYvenZ81KpQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NC6WFmMDaT/5k40ZU5St1i31sJYFb8LW7wjDcPiXBWh9M5eo+clBd2apvnDpr2WH/z5AtUQxF9hkLStyE17SUZUy3usUuOWKUtP06mtaO61dABXr8KspQx0Vqa5vkSb4SY6Xif89eVKkyvuCHljXBZFdQNemyUpADJqmsaZt2BA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cinemaone.ch; spf=pass smtp.mailfrom=cinemaone.ch; dkim=pass (2048-bit key) header.d=cinemaone.ch header.i=@cinemaone.ch header.b=oD/6lwNf; arc=none smtp.client-ip=83.166.143.168 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cinemaone.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cinemaone.ch Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cinemaone.ch header.i=@cinemaone.ch header.b="oD/6lwNf" Received: from smtp-4-0000.mail.infomaniak.ch (unknown [IPv6:2001:1600:7:10::a6b]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4hdjR538Wmzq8b; Mon, 7 Sep 2026 12:06:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cinemaone.ch; s=20250113; t=1788775617; bh=zkVn1mTqiQPg1HIrNqylrZy//1NdkfS7RjgFs8gMWv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oD/6lwNfqVL3f/74v0o7mz99bym3DwgddTtoYJ/+t3ZJNowUJpVxAE/gv16AtUQ1B ru9qgrgoDujfLhlelGSrwB0XLU9ToEwPdGKte/NUSECL5UywCc6Ic0OLLC2hzU+hDS jw6wUxQW847FB6sqdUdzZLyFJVkuoWSOMnUAAjpXKhGVkcFkC49tGhc3gCUX3tHBgn YFS30yp6Q9f6bPZuBpS7PjKIgmJey3mfzkU3e1/9QgLX9aM3vNRvKXzA9Kc5ddDxfi pGN7lCEebuO6Kede5/+zwgRx2r5xbZLdtFhZePADXj2mQci0iVjrmRL8Yzotb2KXLA LKzf2O+e0Y5yQ== Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4hdjR45MHXzYr2; Mon, 7 Sep 2026 12:06:56 +0200 (CEST) From: Adrian Betschart To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher Cc: =?UTF-8?q?Christian=20K=C3=B6nig?= , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] drm/amd/display: support HDMI 1.4 3D modes on HDMI connectors Date: Mon, 7 Sep 2026 12:06:24 +0200 Message-ID: <20260907100626.54465-2-adrian.betschart@cinemaone.ch> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260907100626.54465-1-adrian.betschart@cinemaone.ch> References: <20260907100626.54465-1-adrian.betschart@cinemaone.ch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Infomaniak-Routing: alpha Content-Type: text/plain; charset="utf-8" Allow the stereo modes drm_edid derives from a sink's HDMI VSDB on HDMI connectors, and drive them the way a 2D stream is driven: the source (compositor or media player) lays both views out in the frame itself - side by side, top and bottom, or the doubled frame-packing timing with the 45-line active space between the eyes - and the only 3D-specific output is the HDMI vendor infoframe that tells the sink how the frame is laid out. Keep the DC timing at TIMING_3D_FORMAT_NONE for all of them. Any DC stereo timing format, including the SW_PACKED variants, makes the hardware treat the surface as two views: the pipe is split and both view addresses point at the same surface, so the whole frame ends up in each half of the output. The new vsif_3d_format stream field carries the layout to mod_build_hf_vsif_infopacket() instead, so the VSIF is right and stays right when the freesync code rebuilds it for ALLM. Frame packing needs the doubled CRTC timing; pass CRTC_STEREO_DOUBLE wherever amdgpu_dm recomputes the CRTC fields itself. Limit stereo_allowed to native HDMI connectors: on the DP-to-HDMI converter paths link validation rejects the 3D timings. Tested on a Radeon RX 7600 (DCN 3.2.1) driving a JVC DLA-RS4100 projector through an HDFury VRROOM, with Kodi rendering the packed frames: frame packing, top-and-bottom and side-by-side at 1920x1080p24, RGB 12 bpc, all engage the projector's 3D mode with correct per-eye geometry and eye assignment (checked with per-eye test patterns through shutter glasses). Signed-off-by: Adrian Betschart --- .../display/amdgpu_dm/amdgpu_dm_connector.c | 41 +++++++++++++++++-- drivers/gpu/drm/amd/display/dc/dc_stream.h | 7 ++++ .../display/modules/info_packet/info_packet.c | 3 ++ 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c b/= drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c index 0e71ba498..7a2beb175 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c @@ -851,6 +851,25 @@ STATIC_IFN_KUNIT bool adjust_colour_depth_from_display= _info( } EXPORT_IF_KUNIT(adjust_colour_depth_from_display_info); =20 +/* + * 3D layout to announce in the HDMI vendor infoframe for a DRM 3D mode. T= he + * stream timing itself stays 2D (see fill_stream_properties_from_drm_disp= lay_mode). + */ +static enum dc_timing_3d_format amdgpu_dm_vsif_3d_format(unsigned int mode= _flags) +{ + switch (mode_flags & DRM_MODE_FLAG_3D_MASK) { + case DRM_MODE_FLAG_3D_FRAME_PACKING: + return TIMING_3D_FORMAT_SW_FRAME_PACKING; + case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM: + return TIMING_3D_FORMAT_TB_SW_PACKED; + case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF: + case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL: + return TIMING_3D_FORMAT_SBS_SW_PACKED; + default: + return TIMING_3D_FORMAT_NONE; + } +} + STATIC_IFN_KUNIT void fill_stream_properties_from_drm_display_mode( struct dc_stream_state *stream, const struct drm_display_mode *mode_in, @@ -887,7 +906,15 @@ STATIC_IFN_KUNIT void fill_stream_properties_from_drm_= display_mode( */ timing_out->pixel_encoding =3D requested_encoding; =20 + /* + * The source packs both views into the frame itself (side-by-side, + * top-and-bottom, or the doubled frame-packing timing), so the display + * core scans it out as a plain 2D stream and only the HDMI vendor + * infoframe tells the sink how the frame is laid out. Any DC stereo + * timing format would make the hardware treat the surface as two views. + */ timing_out->timing_3d_format =3D TIMING_3D_FORMAT_NONE; + stream->vsif_3d_format =3D amdgpu_dm_vsif_3d_format(mode_in->flags); timing_out->display_color_depth =3D amdgpu_dm_convert_color_depth_from_di= splay_info( connector, (timing_out->pixel_encoding =3D=3D PIXEL_ENCODING_YCBCR420), @@ -1451,6 +1478,9 @@ create_stream_for_sink(struct drm_connector *connecto= r, struct dc_sink *sink =3D NULL; =20 drm_mode_init(&mode, drm_mode); + /* frame packing scans out both views plus the active space in one frame = */ + if (mode.flags & DRM_MODE_FLAG_3D_FRAME_PACKING) + drm_mode_set_crtcinfo(&mode, CRTC_STEREO_DOUBLE); memset(&saved_mode, 0, sizeof(saved_mode)); =20 if (connector->connector_type !=3D DRM_MODE_CONNECTOR_WRITEBACK) { @@ -1530,7 +1560,9 @@ create_stream_for_sink(struct drm_connector *connecto= r, } =20 if (recalculate_timing) - drm_mode_set_crtcinfo(&saved_mode, 0); + drm_mode_set_crtcinfo(&saved_mode, + (saved_mode.flags & DRM_MODE_FLAG_3D_FRAME_PACKING) ? + CRTC_STEREO_DOUBLE : 0); =20 /* * If scaling is enabled and refresh rate didn't change @@ -2449,7 +2481,9 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(s= truct drm_connector *connec if (!test_mode) goto fail; =20 - drm_mode_set_crtcinfo(test_mode, 0); + drm_mode_set_crtcinfo(test_mode, + (test_mode->flags & DRM_MODE_FLAG_3D_FRAME_PACKING) ? + CRTC_STEREO_DOUBLE : 0); =20 stream =3D amdgpu_dm_create_validate_stream_for_sink(connector, test_mode, to_dm_connector_state(connector->state), @@ -3143,7 +3177,8 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_di= splay_manager *dm, aconnector->dc_link =3D link; aconnector->base.interlace_allowed =3D false; aconnector->base.doublescan_allowed =3D false; - aconnector->base.stereo_allowed =3D false; + /* HDMI 1.4 3D only; DP-to-HDMI converters reject the timings in link val= idation */ + aconnector->base.stereo_allowed =3D connector_type =3D=3D DRM_MODE_CONNEC= TOR_HDMIA; aconnector->base.dpms =3D DRM_MODE_DPMS_OFF; aconnector->hpd.hpd =3D AMDGPU_HPD_NONE; /* not used */ aconnector->audio_inst =3D -1; diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h b/drivers/gpu/drm/a= md/display/dc/dc_stream.h index 934ae381e..e6fd75b87 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_stream.h +++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h @@ -235,6 +235,13 @@ struct dc_stream_state { =20 enum view_3d_format view_format; =20 + /** + * @vsif_3d_format: 3D layout announced in the HDMI vendor infoframe when + * the source packs both views into the frame itself and the timing is + * therefore left at TIMING_3D_FORMAT_NONE. + */ + enum dc_timing_3d_format vsif_3d_format; + bool use_vsc_sdp_for_colorimetry; bool ignore_msa_timing_param; =20 diff --git a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c = b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c index 32b697f46..13478b8bd 100644 --- a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c +++ b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c @@ -536,6 +536,9 @@ void mod_build_hf_vsif_infopacket(const struct dc_strea= m_state *stream, format =3D stream->timing.timing_3d_format; if (stream->view_format =3D=3D VIEW_3D_FORMAT_NONE) format =3D TIMING_3D_FORMAT_NONE; + /* a 2D scanout of a frame the source packed itself */ + if (format =3D=3D TIMING_3D_FORMAT_NONE) + format =3D stream->vsif_3d_format; =20 if (stream->timing.hdmi_vic !=3D 0 && stream->timing.h_total >=3D 3840 --=20 2.43.0 From nobody Fri Sep 25 23:50:57 2026 Received: from smtp-8fac.mail.infomaniak.ch (smtp-8fac.mail.infomaniak.ch [83.166.143.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8525B4503EE for ; Mon, 7 Sep 2026 10:25:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.166.143.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776723; cv=none; b=LvNDCGMj48rLhQTyg0vvtTNTBShvzKEaiOE418Z6GhtorsxvgepritHm1YW7iZPTi31qS7QWhJcYCFwC32qIHzxVYQr+Vn8AU0gJ6YjHa8Yn0072E5PLKH+cOIXFoE3AnPvX5fHw9RbZow+pfoQbI66sX/02zvXOvGLuGyHHc5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776723; c=relaxed/simple; bh=EYaA2+3vzNXwp0/BodU+MNNQ0HZs349vD2R3fgbqOhw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Uq6EW1e7LyTfUBs+FGB57CyAVp18MeFK8In9IRCe4bcZ5rowXw7BmkUK4xnoKv2mC01IasInyC1Uy4IUpD4gZpp7e42BtCWw+6Zp6nc8oobKqssqz+vi9Q3H55gT49vO9KL00BFN4XK0YH8RccMujWSE6XdzKWVqUxRBoZp1Sv8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cinemaone.ch; spf=pass smtp.mailfrom=cinemaone.ch; dkim=pass (2048-bit key) header.d=cinemaone.ch header.i=@cinemaone.ch header.b=cVKDzep1; arc=none smtp.client-ip=83.166.143.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cinemaone.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cinemaone.ch Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cinemaone.ch header.i=@cinemaone.ch header.b="cVKDzep1" Received: from smtp-4-0000.mail.infomaniak.ch (unknown [IPv6:2001:1600:7:10::a6b]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4hdjRC3wlHzqkK; Mon, 7 Sep 2026 12:07:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cinemaone.ch; s=20250113; t=1788775623; bh=dBHS/oDA3Bq/MnKWT+8QzHHpzChtVCq42IiwJ53rpN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cVKDzep1CyQTvdc/Ii2VjkiffniujobOY2OpYIPLpohena7oY7zcrBlAtZkozWUqC flu1y0agAqOipngBYSClHrYRKCrxxEYrlnClbCDLfg18qROmxz+oDqEKGeTXndSZE7 PC5QRQDMALZpT2GaSWNeDYWZcZEwkm/b+JrTQ7RvhR0L7LgUGD4wbHrbqivdTc6DXm aX6xShermTR1s5Lx16SfFssR8PIu1detKLzOp5y6dzwsSuA3jf8q5JI9wqsb5nO8VP dOvdrkn69gQR9ZbqIjAiSosE30DhPJsZlxCLpt3woG7a2S1YFhdnuOvHRG1e4ryjEt 3NlEBy5czrtMw== Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4hdjRB6NnrzYx7; Mon, 7 Sep 2026 12:07:02 +0200 (CEST) From: Adrian Betschart To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher Cc: =?UTF-8?q?Christian=20K=C3=B6nig?= , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] drm/amd/display: send the 3D_Ext_Data byte for top-and-bottom too Date: Mon, 7 Sep 2026 12:06:25 +0200 Message-ID: <20260907100626.54465-3-adrian.betschart@cinemaone.ch> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260907100626.54465-1-adrian.betschart@cinemaone.ch> References: <20260907100626.54465-1-adrian.betschart@cinemaone.ch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Infomaniak-Routing: alpha Content-Type: text/plain; charset="utf-8" HDMI 1.4b only requires the 3D_Ext_Data byte for the side-by-side (half) structure, and the vendor infoframe for top-and-bottom is built with a 5-byte payload accordingly. At least one sink family ignores a top-and-bottom VSIF without the sixth byte: a JVC DLA-RS4100 (D-ILA, "ILAFPJ--X214A") stays in 2D on the 5-byte frame and engages its 3D mode the moment the byte is present. Amlogic sources send the 6-byte form for top-and-bottom, which is why the same projector works with them. Send the extra byte, zero, for top-and-bottom as well. Sinks that do not need it ignore a zero 3D_Ext_Data field. Signed-off-by: Adrian Betschart --- drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c = b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c index 13478b8bd..3e41b33ea 100644 --- a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c +++ b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c @@ -574,6 +574,7 @@ void mod_build_hf_vsif_infopacket(const struct dc_strea= m_state *stream, case TIMING_3D_FORMAT_TOP_AND_BOTTOM: case TIMING_3D_FORMAT_TB_SW_PACKED: info_packet->sb[5] =3D (0x6 << 4); + length =3D 6; break; =20 default: --=20 2.43.0 From nobody Fri Sep 25 23:50:57 2026 Received: from smtp-42ab.mail.infomaniak.ch (smtp-42ab.mail.infomaniak.ch [84.16.66.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A568330675F for ; Mon, 7 Sep 2026 10:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788778004; cv=none; b=q2Xq1A3mILGmbYA3ouzSKkz4EbninGP5CqUvcefD1jMKFoeBE/FGPdgSs1aZkIaiq/FrpQ8w/YI+N+v/ggwkqleQsNMCLkJ7yZ4My57G2YKzul5wuf6uTxp7Z3hJdzdp1Nufhzc6aN7P9tmqW8OKQKxaz93fWh3t31xCBTtoGW4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788778004; c=relaxed/simple; bh=NNT1J7BQUG51u3Czx0ppFYsuqdteNqPayGRUNGX6xBY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tWFdsKOGnGVOguev9+to5HQBXFAX6tj49UG1EHKUEKeTmyZoQrF1lqxFZ9D0MPYzNRGrv37HlnUv3fM0NeHiWBU6a/i/RdJxj9UMsdDMpaWzpgokH5LsRhCjT+Z0a2mrxvutYIJQYqB+1jAfysVZmIVFalXxVrXftENy24XMMzk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cinemaone.ch; spf=pass smtp.mailfrom=cinemaone.ch; dkim=pass (2048-bit key) header.d=cinemaone.ch header.i=@cinemaone.ch header.b=SIyfJQtR; arc=none smtp.client-ip=84.16.66.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cinemaone.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cinemaone.ch Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cinemaone.ch header.i=@cinemaone.ch header.b="SIyfJQtR" Received: from smtp-4-0000.mail.infomaniak.ch (smtp-4-0000.mail.infomaniak.ch [10.7.10.107]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4hdjRM086gzMHk; Mon, 7 Sep 2026 12:07:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cinemaone.ch; s=20250113; t=1788775630; bh=4usX4hH8MgJcojkyuFvW45gywshubq8uHqF+sudxBMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SIyfJQtRS8kcnwYDnSvBCygU7rsrFoBYL0aD5+ENdAgegVjgRl2SQsWmfyWLnPaMO cpbp0ts8s7U/+m2RgDz1fO+CReDuxXYNT4RQp38hw5T1QBRLF3Pa8VgJlheTou1mki egQktbvuJEM0fLJV/OBMkcwhjs8kQhWOmstmdmeanRCG0QoCGP3suRzemR5zmjGOya vPbrr+xxFSvNVJw/EJ8JBvaXM0W8OogtL3wL9bgbrvPFWLevvUO/bcdCEDuAv442Ag lwxmlNYHY+edGKCxYSbFWKJ6oUHwStkv2q5d4OOuvNPU82Gm9OwcLP4TI+18vXITFY upfvcaG/Bfc3g== Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4hdjRL2MR6zXWX; Mon, 7 Sep 2026 12:07:10 +0200 (CEST) From: Adrian Betschart To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher Cc: =?UTF-8?q?Christian=20K=C3=B6nig?= , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] drm/amd/display: size frame-packed streams by the doubled timing Date: Mon, 7 Sep 2026 12:06:26 +0200 Message-ID: <20260907100626.54465-4-adrian.betschart@cinemaone.ch> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260907100626.54465-1-adrian.betschart@cinemaone.ch> References: <20260907100626.54465-1-adrian.betschart@cinemaone.ch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Infomaniak-Routing: alpha Content-Type: text/plain; charset="utf-8" A frame-packed 3D mode scans out both views and the active space between them in one frame, so the CRTC is 2205 lines tall for a 1080p mode. The stream scaling code took the source height from mode->vdisplay (1080) against the 2205-line addressable destination; with aspect scaling that keeps 1080 lines and centres them, so the first view is stretched across both eye windows and the second view is never shown. The plane viewport check clipped planes to crtc_vdisplay for the same reason. Use drm_mode_get_hv_timing(), which returns the doubled height for stereo modes and the plain display size otherwise, in both places. Measured on a Radeon RX 7600 with a frame-packed 1920x1080p24 mode: before, a row-coded 2205-line test frame showed rows of the first view in both eyes; after, each eye receives its own view. Signed-off-by: Adrian Betschart --- .../drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 11 ++++++++--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 13 +++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c b/= drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c index 7a2beb175..ac9fe2883 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c @@ -1405,9 +1405,14 @@ void amdgpu_dm_update_stream_scaling_settings(struct= drm_device *dev, if (!mode) return; =20 - /* Full screen scaling by default */ - src.width =3D mode->hdisplay; - src.height =3D mode->vdisplay; + /* + * Full screen scaling by default. A frame-packed 3D mode scans out the + * doubled timing, so the source size is the CRTC size, not vdisplay: + * with 1080 lines against a 2205-line destination the aspect fit would + * keep 1080 lines and centre them, putting the first view across both + * eye windows and none of the second. + */ + drm_mode_get_hv_timing(mode, &src.width, &src.height); dst.width =3D stream->timing.h_addressable; dst.height =3D stream->timing.v_addressable; =20 diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/driv= ers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c index 0a5a73472..8db656ef8 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c @@ -1407,16 +1407,21 @@ int amdgpu_dm_plane_helper_check_state(struct drm_p= lane_state *state, if (state->plane->type !=3D DRM_PLANE_TYPE_CURSOR) { int viewport_width =3D state->crtc_w; int viewport_height =3D state->crtc_h; + int mode_hdisplay, mode_vdisplay; + + /* frame-packed 3D scans out the doubled timing */ + drm_mode_get_hv_timing(&new_crtc_state->mode, + &mode_hdisplay, &mode_vdisplay); =20 if (state->crtc_x < 0) viewport_width +=3D state->crtc_x; - else if (state->crtc_x + state->crtc_w > new_crtc_state->mode.crtc_hdis= play) - viewport_width =3D new_crtc_state->mode.crtc_hdisplay - state->crtc_x; + else if (state->crtc_x + state->crtc_w > mode_hdisplay) + viewport_width =3D mode_hdisplay - state->crtc_x; =20 if (state->crtc_y < 0) viewport_height +=3D state->crtc_y; - else if (state->crtc_y + state->crtc_h > new_crtc_state->mode.crtc_vdis= play) - viewport_height =3D new_crtc_state->mode.crtc_vdisplay - state->crtc_y; + else if (state->crtc_y + state->crtc_h > mode_vdisplay) + viewport_height =3D mode_vdisplay - state->crtc_y; =20 if (viewport_width < 0 || viewport_height < 0) { DRM_DEBUG_ATOMIC("Plane completely outside of screen\n"); --=20 2.43.0