Skip to content

Commit 05773e6

Browse files
Lawstorant1Naim
authored andcommitted
drm: Add passive_vrr_capable property to connector
Supplement to the passive_vrr_disabled crtc property Drivers can add the property to a connector with drm_connector_attach_passive_vrr_capable_property(). The value should be updated based on driver and hardware capability by using drm_connector_set_passive_vrr_capable_property(). Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
1 parent b18c283 commit 05773e6

2 files changed

Lines changed: 88 additions & 0 deletions

File tree

drivers/gpu/drm/drm_connector.c

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,6 +2352,16 @@ EXPORT_SYMBOL(drm_mode_create_scaling_mode_property);
23522352
*
23532353
* Absence of the property should indicate absence of support.
23542354
*
2355+
* "passive_vrr_capable":
2356+
* Optional &drm_connector boolean property that drivers should attach
2357+
* with drm_connector_attach_passive_vrr_capable_property() on
2358+
* connectors that could support keeping variable refresh rate signalling
2359+
* in fixed-refresh rate scenarios like desktop work. Drivers should update
2360+
* the property value by calling
2361+
* drm_connector_set_passive_vrr_capable_property().
2362+
*
2363+
* Absence of the property should indicate absence of support.
2364+
*
23552365
* "VRR_ENABLED":
23562366
* Default &drm_crtc boolean property that notifies the driver that the
23572367
* content on the CRTC is suitable for variable refresh rate presentation.
@@ -2370,6 +2380,17 @@ EXPORT_SYMBOL(drm_mode_create_scaling_mode_property);
23702380
*
23712381
* The driver may place further restrictions within these minimum
23722382
* and maximum bounds.
2383+
*
2384+
* "PASSIVE_VRR_DISABLED":
2385+
* Default &drm_crtc boolean property that notifies the driver that the
2386+
* VRR singalling should be disabled in fixed refresh rate scenarios.
2387+
* Functionally, psssive vrr works the same as VRR_ENABLED == false
2388+
* but works around displays blanking (mainly HDMI) that do not support
2389+
* seamless VRR transitions. Also helps with brightness flickering during
2390+
* VRR transitions.
2391+
*
2392+
* Passive VRR mode is not that useful for DP/eDP sinks where seamless VRR
2393+
* transitions are enforced by the standard.
23732394
*/
23742395

23752396
/**
@@ -2403,6 +2424,37 @@ int drm_connector_attach_vrr_capable_property(
24032424
}
24042425
EXPORT_SYMBOL(drm_connector_attach_vrr_capable_property);
24052426

2427+
/**
2428+
* drm_connector_attach_passive_vrr_capable_property - creates the
2429+
* passive_vrr_capable property
2430+
* @connector: connector to create the passive_vrr_capable property on.
2431+
*
2432+
* This is used by atomic drivers to add support for querying
2433+
* variable refresh rate on desktop capability for a connector.
2434+
*
2435+
* Returns:
2436+
* Zero on success, negative errno on failure.
2437+
*/
2438+
int drm_connector_attach_passive_vrr_capable_property(
2439+
struct drm_connector *connector)
2440+
{
2441+
struct drm_device *dev = connector->dev;
2442+
struct drm_property *prop;
2443+
2444+
if (!connector->passive_vrr_capable_property) {
2445+
prop = drm_property_create_bool(dev, DRM_MODE_PROP_IMMUTABLE,
2446+
"passive_vrr_capable");
2447+
if (!prop)
2448+
return -ENOMEM;
2449+
2450+
connector->passive_vrr_capable_property = prop;
2451+
drm_object_attach_property(&connector->base, prop, 0);
2452+
}
2453+
2454+
return 0;
2455+
}
2456+
EXPORT_SYMBOL(drm_connector_attach_passive_vrr_capable_property);
2457+
24062458
/**
24072459
* drm_connector_attach_scaling_mode_property - attach atomic scaling mode property
24082460
* @connector: connector to attach scaling mode property on.
@@ -2974,6 +3026,27 @@ void drm_connector_set_vrr_capable_property(
29743026
}
29753027
EXPORT_SYMBOL(drm_connector_set_vrr_capable_property);
29763028

3029+
/**
3030+
* drm_connector_set_passive_vrr_disabled_capable_property - sets the variable refresh
3031+
* rate on desktop capable property for a connector
3032+
* @connector: drm connector
3033+
* @capable: True if the connector is variable refresh rate on desktop capable
3034+
*
3035+
* Should be used by atomic drivers to update the indicated support for
3036+
* variable refresh rate on desktop over a connector.
3037+
*/
3038+
void drm_connector_set_passive_vrr_capable_property(
3039+
struct drm_connector *connector, bool capable)
3040+
{
3041+
if (!connector->passive_vrr_capable_property)
3042+
return;
3043+
3044+
drm_object_property_set_value(&connector->base,
3045+
connector->passive_vrr_capable_property,
3046+
capable);
3047+
}
3048+
EXPORT_SYMBOL(drm_connector_set_passive_vrr_capable_property);
3049+
29773050
/**
29783051
* drm_connector_set_panel_orientation - sets the connector's panel_orientation
29793052
* @connector: connector for which to set the panel-orientation property.

include/drm/drm_connector.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,6 +2146,17 @@ struct drm_connector {
21462146
*/
21472147
struct drm_property *vrr_capable_property;
21482148

2149+
/**
2150+
* @passive_vrr_capable_property: Optional property to help userspace
2151+
* query hardware support for passive variable refresh rate on a
2152+
* connector. Drivers can add the property to a connector by
2153+
* calling drm_connector_attach_passive_vrr_capable_property().
2154+
*
2155+
* This should be updated only by calling
2156+
* drm_connector_set_passive_vrr_capable_property().
2157+
*/
2158+
struct drm_property *passive_vrr_capable_property;
2159+
21492160
/**
21502161
* @colorspace_property: Connector property to set the suitable
21512162
* colorspace supported by the sink.
@@ -2540,6 +2551,8 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
25402551
u32 scaling_mode_mask);
25412552
int drm_connector_attach_vrr_capable_property(
25422553
struct drm_connector *connector);
2554+
int drm_connector_attach_passive_vrr_capable_property(
2555+
struct drm_connector *connector);
25432556
int drm_connector_attach_broadcast_rgb_property(struct drm_connector *connector);
25442557
int drm_connector_attach_colorspace_property(struct drm_connector *connector);
25452558
int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector);
@@ -2562,6 +2575,8 @@ void drm_connector_set_link_status_property(struct drm_connector *connector,
25622575
uint64_t link_status);
25632576
void drm_connector_set_vrr_capable_property(
25642577
struct drm_connector *connector, bool capable);
2578+
void drm_connector_set_passive_vrr_capable_property(
2579+
struct drm_connector *connector, bool capable);
25652580
int drm_connector_set_panel_orientation(
25662581
struct drm_connector *connector,
25672582
enum drm_panel_orientation panel_orientation);

0 commit comments

Comments
 (0)