Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Poll for both connect/disconnect on analog connectors

DRM_CONNECTOR_POLL_CONNECT only enables polling for connections, not
disconnections. Because of this, we end up losing hotplug polling for
analog connectors once they get connected.

Easy way to reproduce:
- Grab a machine with an AMD GPU and a VGA port
- Plug a monitor into the VGA port, wait for it to update the connector
from disconnected to connected
- Disconnect the monitor on VGA, a hotplug event is never sent for the
removal of the connector.

Originally, only using DRM_CONNECTOR_POLL_CONNECT might have been a good
idea since doing VGA polling can sometimes result in having to mess with
the DAC voltages to figure out whether or not there's actually something
there since VGA doesn't have HPD. Doing this would have the potential of
showing visible artifacts on the screen every time we ran a poll while a
VGA display was connected. Luckily, amdgpu_vga_detect() only resorts to
this sort of polling if the poll is forced, and DRM's polling helper
doesn't force it's polls.

Additionally, this removes some assignments to connector->polled that
weren't actually doing anything.

Cc: stable@vger.kernel.org
Signed-off-by: Lyude <cpaul@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Lyude and committed by
Alex Deucher
b636a1b3 14ff8d48

+4 -3
+4 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
··· 1690 1690 DRM_MODE_SCALE_NONE); 1691 1691 /* no HPD on analog connectors */ 1692 1692 amdgpu_connector->hpd.hpd = AMDGPU_HPD_NONE; 1693 - connector->polled = DRM_CONNECTOR_POLL_CONNECT; 1694 1693 connector->interlace_allowed = true; 1695 1694 connector->doublescan_allowed = true; 1696 1695 break; ··· 1892 1893 } 1893 1894 1894 1895 if (amdgpu_connector->hpd.hpd == AMDGPU_HPD_NONE) { 1895 - if (i2c_bus->valid) 1896 - connector->polled = DRM_CONNECTOR_POLL_CONNECT; 1896 + if (i2c_bus->valid) { 1897 + connector->polled = DRM_CONNECTOR_POLL_CONNECT | 1898 + DRM_CONNECTOR_POLL_DISCONNECT; 1899 + } 1897 1900 } else 1898 1901 connector->polled = DRM_CONNECTOR_POLL_HPD; 1899 1902