drm/connector: demote connector force-probes for non-master clients
Subsystems (2)
PATCH 1/1 drm/connector: demote connector force-probes for non-master clients
Force-probing a connector can be slow and cause flickering. As this affects the global KMS state, let's make it so only the DRM master can force-probe a connector.
Non-master DRM clients won't be able to force-probe a connector anymore. Instead, KMS will perform a regular read-only connector query.
--- drivers/gpu/drm/drm_connector.c | 11 ++++++++--- include/uapi/drm/drm_mode.h | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_connector.c +8 -3
@@ -20,6 +20,7 @@* OF THIS SOFTWARE. */ +#include <drm/drm_auth.h> #include <drm/drm_connector.h> #include <drm/drm_edid.h> #include <drm/drm_encoder.h>
@@ -2374,9 +2375,13 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,mutex_lock (&dev->mode_config.mutex);if (out_resp->count_modes ==0 ) { - connector->funcs->fill_modes (connector, - dev->mode_config.max_width, - dev->mode_config.max_height); +if (drm_is_current_master (file_priv)) + connector->funcs->fill_modes (connector, + dev->mode_config.max_width, + dev->mode_config.max_height); +else +drm_dbg_kms (dev,"User-space requested a forced probe on [CONNECTOR:%d:%s] but is not the DRM master, demoting to read-only probe" , + connector->base.id, connector->name); } out_resp->mm_width = connector->display_info.width_mm;
include/uapi/drm/drm_mode.h +4 -3
@@ -413,9 +413,10 @@ enum drm_mode_subconnector {* * **Force-probing a connector** * -* If the @count_modes field is set to zero, the kernel will perform a forced -* probe on the connector to refresh the connector status, modes and EDID. -* A forced-probe can be slow, might cause flickering and the ioctl will block. +* If the @count_modes field is set to zero and the DRM client is the DRM +* master, the kernel will perform a forced probe on the connector to refresh +* the connector status, modes and EDID. A forced-probe can be slow, might +* cause flickering and the ioctl will block. * * User-space needs to force-probe connectors to ensure their metadata is * up-to-date at startup and after receiving a hot-plug event. User-space
Signature · 6 lines
2.31.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · On Fri, 2 Apr 2021 13:22:12 +0200 Simon Ser <[email protected]> wrote:
Force-probing a connector can be slow and cause flickering. As this affects the global KMS state, let's make it so only the DRM master can force-probe a connector.
Non-master DRM clients won't be able to force-probe a connector anymore. Instead, KMS will perform a regular read-only connector query.
Signed-off-by Simon Ser <[email protected]>Cc Daniel Vetter <[email protected]>Cc Pekka Paalanen <[email protected]>
Hi,
seems like a good idea to me.
Btw. can force-probe be triggered via sysfs as well and does it require root privs?
Thanks,
pq
Quoted 42 lines
--- drivers/gpu/drm/drm_connector.c | 11 ++++++++--- include/uapi/drm/drm_mode.h | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-)drivers/gpu/drm/drm_connector.c +8
-3@@ -20,6 +20,7 @@* OF THIS SOFTWARE. */ +#include <drm/drm_auth.h> #include <drm/drm_connector.h> #include <drm/drm_edid.h> #include <drm/drm_encoder.h> @@ -2374,9 +2375,13 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,mutex_lock (&dev->mode_config.mutex);if (out_resp->count_modes ==0 ) { - connector->funcs->fill_modes (connector, - dev->mode_config.max_width, - dev->mode_config.max_height); +if (drm_is_current_master (file_priv)) + connector->funcs->fill_modes (connector, + dev->mode_config.max_width, + dev->mode_config.max_height); +else +drm_dbg_kms (dev,"User-space requested a forced probe on [CONNECTOR:%d:%s] but is not the DRM master, demoting to read-only probe" , + connector->base.id, connector->name); } out_resp->mm_width = connector->display_info.width_mm;include/uapi/drm/drm_mode.h +0
-0@@ -413,9 +413,10 @@ enum drm_mode_subconnector {* * **Force-probing a connector** *
include/uapi/drm/drm_mode.h enum drm_mode_subconnector { · line 422
Quoted 10 lines
include/uapi/drm/drm_mode.h +4
-3-* If the @count_modes field is set to zero, the kernel will perform a forced -* probe on the connector to refresh the connector status, modes and EDID. -* A forced-probe can be slow, might cause flickering and the ioctl will block. +* If the @count_modes field is set to zero and the DRM client is the DRM +* master, the kernel will perform a forced probe on the connector to refresh +* the connector status, modes and EDID. A forced-probe can be slow, might +* cause flickering and the ioctl will block. * * User-space needs to force-probe connectors to ensure their metadata is * up-to-date at startup and after receiving a hot-plug event. User-space
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines · Pekka Paalanen
Btw. can force-probe be triggered via sysfs as well and does it require root privs?
sysfs can force-probe like so:
echo detect | sudo tee /sys/class/drm/card0-DP-1/status
But this requires root, yes.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · On Wed, 07 Apr 2021 07:16:30 +0000 Simon Ser <[email protected]> wrote:
Quoted 2 lines · Pekka Paalanen
Btw. can force-probe be triggered via sysfs as well and does it require root privs?
sysfs can force-probe like so:
echo detect | sudo tee
/sys/class/drm/card0-DP-1/statusBut this requires root, yes.
Ah, all good then.
Thanks,
pq
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Ping Daniel Vetter
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 50 lines · Simon Ser
Force-probing a connector can be slow and cause flickering. As this affects the global KMS state, let's make it so only the DRM master can force-probe a connector.
Non-master DRM clients won't be able to force-probe a connector anymore. Instead, KMS will perform a regular read-only connector query.
Signed-off-by Simon Ser <[email protected]>Cc Daniel Vetter <[email protected]>Cc Pekka Paalanen <[email protected]>--- drivers/gpu/drm/drm_connector.c | 11 ++++++++--- include/uapi/drm/drm_mode.h | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-)drivers/gpu/drm/drm_connector.c +8
-3@@ -20,6 +20,7 @@* OF THIS SOFTWARE. */ +#include <drm/drm_auth.h> #include <drm/drm_connector.h> #include <drm/drm_edid.h> #include <drm/drm_encoder.h> @@ -2374,9 +2375,13 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,mutex_lock (&dev->mode_config.mutex);if (out_resp->count_modes ==0 ) { - connector->funcs->fill_modes (connector, - dev->mode_config.max_width, - dev->mode_config.max_height); +if (drm_is_current_master (file_priv)) + connector->funcs->fill_modes (connector, + dev->mode_config.max_width, + dev->mode_config.max_height); +else +drm_dbg_kms (dev,"User-space requested a forced probe on [CONNECTOR:%d:%s] but is not the DRM master, demoting to read-only probe" , + connector->base.id, connector->name); } out_resp->mm_width = connector->display_info.width_mm;include/uapi/drm/drm_mode.h +0
-0
include/uapi/drm/drm_mode.h enum drm_mode_subconnector { · line 416
Quoted 7 lines
include/uapi/drm/drm_mode.h +1
-3@@ -413,9 +413,10 @@ enum drm_mode_subconnector {* * **Force-probing a connector** * -* If the @count_modes field is set to zero, the kernel will perform a forced -* probe on the connector to refresh the connector status, modes and EDID. -* A forced-probe can be slow, might cause flickering and the ioctl will block. +* If the @count_modes field is set to zero and the DRM client is the DRM
*current* DRM master
The drm master/client relationship survives a DROPMASTER ioctl, but also it's only really relevant for the old authmagic dance. But just to be consistent here.
include/uapi/drm/drm_mode.h enum drm_mode_subconnector { · line 419
Quoted 3 lines
include/uapi/drm/drm_mode.h +3
-0+* master, the kernel will perform a forced probe on the connector to refresh +* the connector status, modes and EDID. A forced-probe can be slow, might +* cause flickering and the ioctl will block.
Do we have an igt for this? Timing test should do the job I think, assuming we have at least one output which requires an edid read (so maybe skip the test if a forced probe takes less than 10ms or so).
Patch lgtm, but igt would be really nice here.
Quoted 6 lines
include/uapi/drm/drm_mode.h +0
-0* * User-space needs to force-probe connectors to ensure their metadata is * up-to-date at startup and after receiving a hot-plug event. User-space Signature · 1 line
2.31.1
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 3 lines · Daniel Vetter
Do we have an igt for this? Timing test should do the job I think, assuming we have at least one output which requires an edid read (so maybe skip the test if a forced probe takes less than 10ms or so).
Err, an igt that only relies on timings? Sorry, but that sounds like a recipe for flaky tests.
Ideally a chamelium test would allow to make sure all of this works as expected. I don't really have this hw anymore though.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel