Skip to content

Commit 6306d8d

Browse files
committed
drm/i915: Add privacy-screen support (v3)
Add support for eDP panels with a built-in privacy screen using the new drm_privacy_screen class. Changes in v3: - Move drm_privacy_screen_get() call to intel_ddi_init_dp_connector() Changes in v2: - Call drm_connector_update_privacy_screen() from intel_enable_ddi_dp() / intel_ddi_update_pipe_dp() instead of adding a for_each_new_connector_in_state() loop to intel_atomic_commit_tail() - Move the probe-deferral check to the intel_modeset_probe_defer() helper Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 94b541f commit 6306d8d

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

drivers/gpu/drm/i915/display/intel_atomic.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
139139
new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio ||
140140
new_conn_state->base.content_type != old_conn_state->base.content_type ||
141141
new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode ||
142+
new_conn_state->base.privacy_screen_sw_state != old_conn_state->base.privacy_screen_sw_state ||
142143
!drm_connector_atomic_hdr_metadata_equal(old_state, new_state))
143144
crtc_state->mode_changed = true;
144145

drivers/gpu/drm/i915/display/intel_ddi.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*
2626
*/
2727

28+
#include <drm/drm_privacy_screen_consumer.h>
2829
#include <drm/drm_scdc_helper.h>
2930

3031
#include "i915_drv.h"
@@ -2905,6 +2906,7 @@ static void intel_enable_ddi_dp(struct intel_atomic_state *state,
29052906
if (port == PORT_A && DISPLAY_VER(dev_priv) < 9)
29062907
intel_dp_stop_link_train(intel_dp, crtc_state);
29072908

2909+
drm_connector_update_privacy_screen(conn_state);
29082910
intel_edp_backlight_on(crtc_state, conn_state);
29092911

29102912
if (!dig_port->lspcon.active || dig_port->dp.has_hdmi_sink)
@@ -3111,6 +3113,7 @@ static void intel_ddi_update_pipe_dp(struct intel_atomic_state *state,
31113113
intel_drrs_update(intel_dp, crtc_state);
31123114

31133115
intel_backlight_update(state, encoder, crtc_state, conn_state);
3116+
drm_connector_update_privacy_screen(conn_state);
31143117
}
31153118

31163119
void intel_ddi_update_pipe(struct intel_atomic_state *state,
@@ -3922,6 +3925,19 @@ intel_ddi_init_dp_connector(struct intel_digital_port *dig_port)
39223925
return NULL;
39233926
}
39243927

3928+
if (dig_port->base.type == INTEL_OUTPUT_EDP) {
3929+
struct drm_device *dev = dig_port->base.base.dev;
3930+
struct drm_privacy_screen *privacy_screen;
3931+
3932+
privacy_screen = drm_privacy_screen_get(dev->dev, NULL);
3933+
if (!IS_ERR(privacy_screen)) {
3934+
drm_connector_attach_privacy_screen_provider(&connector->base,
3935+
privacy_screen);
3936+
} else if (PTR_ERR(privacy_screen) != -ENODEV) {
3937+
drm_warn(dev, "Error getting privacy-screen\n");
3938+
}
3939+
}
3940+
39253941
return connector;
39263942
}
39273943

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <drm/drm_edid.h>
4343
#include <drm/drm_fourcc.h>
4444
#include <drm/drm_plane_helper.h>
45+
#include <drm/drm_privacy_screen_consumer.h>
4546
#include <drm/drm_probe_helper.h>
4647
#include <drm/drm_rect.h>
4748

@@ -10868,13 +10869,22 @@ void intel_modeset_driver_remove_nogem(struct drm_i915_private *i915)
1086810869

1086910870
bool intel_modeset_probe_defer(struct pci_dev *pdev)
1087010871
{
10872+
struct drm_privacy_screen *privacy_screen;
10873+
1087110874
/*
1087210875
* apple-gmux is needed on dual GPU MacBook Pro
1087310876
* to probe the panel if we're the inactive GPU.
1087410877
*/
1087510878
if (vga_switcheroo_client_probe_defer(pdev))
1087610879
return true;
1087710880

10881+
/* If the LCD panel has a privacy-screen, wait for it */
10882+
privacy_screen = drm_privacy_screen_get(&pdev->dev, NULL);
10883+
if (IS_ERR(privacy_screen) && PTR_ERR(privacy_screen) == -EPROBE_DEFER)
10884+
return true;
10885+
10886+
drm_privacy_screen_put(privacy_screen);
10887+
1087810888
return false;
1087910889
}
1088010890

0 commit comments

Comments
 (0)