On Wed, Aug 13, 2025 at 7:33 PM Alex Hung <alex.h...@amd.com> wrote: > > From: Mario Limonciello <mario.limoncie...@amd.com> > > [WHY] > If a system has a privacy screen advertised by a driver it should > be included in the DRM connector for the eDP panel. > > [HOW] > Detect statically declared privacy screens when creating eDP connector > and attach privacy screen DRM properties. > > Reviewed-by: Harry Wentland <harry.wentl...@amd.com> > Signed-off-by: Mario Limonciello <mario.limoncie...@amd.com> > Signed-off-by: Alex Hung <alex.h...@amd.com> > --- > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 25 ++++++++++++++++++- > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > index e8cfae2bd2ae..176f420effd9 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > @@ -80,6 +80,7 @@ > #include <linux/component.h> > #include <linux/sort.h> > > +#include <drm/drm_privacy_screen_consumer.h> > #include <drm/display/drm_dp_mst_helper.h> > #include <drm/display/drm_hdmi_helper.h> > #include <drm/drm_atomic.h> > @@ -7846,6 +7847,14 @@ amdgpu_dm_connector_atomic_check(struct drm_connector > *conn, > if (!crtc) > return 0; > > + if (new_con_state->privacy_screen_sw_state != > old_con_state->privacy_screen_sw_state) { > + new_crtc_state = drm_atomic_get_crtc_state(state, crtc); > + if (IS_ERR(new_crtc_state)) > + return PTR_ERR(new_crtc_state); > + > + new_crtc_state->mode_changed = true; > + } > + > if (new_con_state->colorspace != old_con_state->colorspace) { > new_crtc_state = drm_atomic_get_crtc_state(state, crtc); > if (IS_ERR(new_crtc_state)) > @@ -8541,6 +8550,18 @@ void amdgpu_dm_connector_init_helper(struct > amdgpu_display_manager *dm, > if (adev->dm.hdcp_workqueue) > > drm_connector_attach_content_protection_property(&aconnector->base, true); > } > + > + if (connector_type == DRM_MODE_CONNECTOR_eDP) {
Do the privacy screens exist on any old laptops with LVDS? If so, we should add DRM_MODE_CONNECTOR_LVDS here as well. Alex > + struct drm_privacy_screen *privacy_screen; > + > + privacy_screen = > drm_privacy_screen_get(adev_to_drm(adev)->dev, NULL); > + if (!IS_ERR(privacy_screen)) { > + > drm_connector_attach_privacy_screen_provider(&aconnector->base, > + > privacy_screen); > + } else if (PTR_ERR(privacy_screen) != -ENODEV) { > + drm_warn(adev_to_drm(adev), "Error getting > privacy-screen\n"); > + } > + } > } > > static int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap, > @@ -10265,7 +10286,7 @@ static void amdgpu_dm_atomic_commit_tail(struct > drm_atomic_state *state) > unsigned long flags; > bool wait_for_vblank = true; > struct drm_connector *connector; > - struct drm_connector_state *old_con_state, *new_con_state; > + struct drm_connector_state *old_con_state = NULL, *new_con_state = > NULL; > struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state; > int crtc_disable_count = 0; > > @@ -10383,6 +10404,8 @@ static void amdgpu_dm_atomic_commit_tail(struct > drm_atomic_state *state) > &stream_update); > mutex_unlock(&dm->dc_lock); > kfree(dummy_updates); > + > + drm_connector_update_privacy_screen(new_con_state); > } > > /** > -- > 2.43.0 >