Skip to content

Commit 2e41bc2

Browse files
committed
NOUPSTREAM: drm: apple: Hide VRR behind a module parameter
Given that DCP requires a modeset to activate VRR, and given that this is explicitly banned by KMS API contract and VESA DisplayPort specification, hide this experimental support behind a module param. Interestingly, the HDMI spec does not require a modeset-free VRR transition. For this reason, it is expected that the KMS API contract may change in the future, as both Intel and AMD hardware require a modeset to enable VRR in some circumstances. Either VRR will be expected to be enabled whenever it is supported, *or* modesetting to toggle it on or off will be allowed. When that happens, this commit *must* be reverted. Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
1 parent 3a25a49 commit 2e41bc2

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

drivers/gpu/drm/apple/dcp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ static bool unstable_edid = true;
5858
module_param(unstable_edid, bool, 0644);
5959
MODULE_PARM_DESC(unstable_edid, "Enable unstable EDID retrival support");
6060

61+
bool vrr;
62+
module_param(vrr, bool, 0644);
63+
MODULE_PARM_DESC(vrr, "Enable Adaptive Sync/ProMotion on supported displays");
64+
6165
/* copied and simplified from drm_vblank.c */
6266
static void send_vblank_event(struct drm_device *dev,
6367
struct drm_pending_vblank_event *e,

drivers/gpu/drm/apple/iomfb_template.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
/* Register defines used in bandwidth setup structure */
3535
#define REG_DOORBELL_BIT(idx) (2 + (idx))
3636

37+
extern bool vrr;
38+
3739
struct dcp_wait_cookie {
3840
struct kref refcount;
3941
struct completion done;
@@ -546,9 +548,9 @@ static u8 dcpep_cb_prop_chunk(struct apple_dcp *dcp,
546548
static bool dcpep_process_chunks(struct apple_dcp *dcp,
547549
struct dcp_set_dcpav_prop_end_req *req)
548550
{
549-
struct apple_connector *connector = dcp->connector;
551+
// struct apple_connector *connector = dcp->connector;
550552
struct dcp_parse_ctx ctx;
551-
int ret, i;
553+
int ret; //, i;
552554

553555
if (!dcp->chunks.data) {
554556
dev_warn(dcp->dev, "ignoring spurious end\n");
@@ -590,14 +592,14 @@ static bool dcpep_process_chunks(struct apple_dcp *dcp,
590592
dcp_set_dimensions(dcp);
591593
}
592594

593-
if (connector) {
594-
for (i = 0; i < dcp->nr_modes; i++) {
595-
if (dcp->modes[i].vrr) {
596-
drm_connector_set_vrr_capable_property(&connector->base, true);
597-
break;
598-
}
599-
}
600-
}
595+
// if (connector) {
596+
// for (i = 0; i < dcp->nr_modes; i++) {
597+
// if (dcp->modes[i].vrr) {
598+
// drm_connector_set_vrr_capable_property(&connector->base, true);
599+
// break;
600+
// }
601+
// }
602+
// }
601603

602604
return true;
603605
}
@@ -1263,8 +1265,8 @@ int DCP_FW_NAME(iomfb_modeset)(struct apple_dcp *dcp,
12631265

12641266
dcp->during_modeset = true;
12651267

1266-
if (mode->vrr)
1267-
dcp_set_adaptive_sync(dcp, dcp->vrr_enabled ? mode->min_vrr : 0, cookie);
1268+
if (mode->vrr && vrr)
1269+
dcp_set_adaptive_sync(dcp, mode->min_vrr, cookie);
12681270
else
12691271
dcp_set_digital_out_mode(dcp, false, &dcp->mode,
12701272
complete_set_digital_out_mode, cookie);
@@ -1422,7 +1424,7 @@ void DCP_FW_NAME(iomfb_flush)(struct apple_dcp *dcp, struct drm_crtc *crtc, stru
14221424
req->clear = 1;
14231425
}
14241426

1425-
if (has_surface && (dcp->use_timestamps || crtc_state->vrr_enabled)) {
1427+
if (has_surface && (dcp->use_timestamps || crtc_state->vrr_enabled || vrr)) {
14261428
/*
14271429
* TODO: ascertain with certainty what these timestamps
14281430
* are. These names are guesses based on what macOS populates

0 commit comments

Comments
 (0)