diff --git a/drivers/gpu/drm/apple/apple_drv.c b/drivers/gpu/drm/apple/apple_drv.c index c11366e4d2e07..32ca064cff583 100644 --- a/drivers/gpu/drm/apple/apple_drv.c +++ b/drivers/gpu/drm/apple/apple_drv.c @@ -1695,6 +1695,34 @@ static int apple_connector_notch_fastset(struct drm_connector *conn, return drm_atomic_add_affected_planes(state, new->crtc); } +/* + * The panel's paced rates (dcp_paced_rates()) are one timing to the DCP: + * switching between them changes only how the swaps are paced, so it is no + * mode set (a mode set away from that timing crashes the T6050 DCP). + */ +static void apple_connector_rate_fastset(struct drm_connector *conn, + struct drm_atomic_commit *state, + struct drm_connector_state *new) +{ + struct platform_device *pdev; + struct drm_crtc_state *old_cs, *new_cs; + + if (conn->funcs != &apple_connector_funcs || !new->crtc) + return; + pdev = READ_ONCE(to_apple_connector(conn)->dcp); + if (!pdev) + return; + old_cs = drm_atomic_get_old_crtc_state(state, new->crtc); + new_cs = drm_atomic_get_new_crtc_state(state, new->crtc); + if (!old_cs || !new_cs || !new_cs->mode_changed || new_cs->active_changed || + new_cs->connectors_changed || !old_cs->active || !new_cs->active || + old_cs->enable != new_cs->enable || + !dcp_paced_fastset(platform_get_drvdata(pdev), &old_cs->mode, &new_cs->mode)) + return; + new_cs->mode_changed = false; + drm_mode_copy(&new_cs->adjusted_mode, &new_cs->mode); +} + static int apple_connector_atomic_check(struct drm_connector *conn, struct drm_atomic_commit *state) { @@ -1708,6 +1736,7 @@ static int apple_connector_atomic_check(struct drm_connector *conn, ret = apple_connector_notch_fastset(conn, state, new); if (ret) return ret; + apple_connector_rate_fastset(conn, state, new); if (blob && (blob->length != sizeof(struct hdr_output_metadata) || !dcp_hdr_is_type1(blob->data))) diff --git a/drivers/gpu/drm/apple/dcp-display-metadata.c b/drivers/gpu/drm/apple/dcp-display-metadata.c index 1e393c2ea9d2b..5dc52cc1403f8 100644 --- a/drivers/gpu/drm/apple/dcp-display-metadata.c +++ b/drivers/gpu/drm/apple/dcp-display-metadata.c @@ -531,6 +531,9 @@ const struct drm_edid *dcp_panel_edid(const struct dcp_display_metadata *metadat } if (!timing || clock > 2550000) return ERR_PTR(-ERANGE); + /* A swap-paced panel takes any rate down to its lowest, not only its timings'. */ + if (metadata->vrr_min_hz && metadata->vrr_min_hz < min_v) + min_v = metadata->vrr_min_hz; memcpy(block.header, "\x00\xff\xff\xff\xff\xff\xff\x00", 8); block.product_id.manufacturer_name = cpu_to_be16(manufacturer); diff --git a/drivers/gpu/drm/apple/dcp-display-metadata.h b/drivers/gpu/drm/apple/dcp-display-metadata.h index 9a12bebaacbf2..8d82f63b56631 100644 --- a/drivers/gpu/drm/apple/dcp-display-metadata.h +++ b/drivers/gpu/drm/apple/dcp-display-metadata.h @@ -20,6 +20,8 @@ struct dcp_display_metadata { u32 max_luminance, max_fall, min_luminance; /* 16.16 cd/m2 */ /* DCP_METADATA_DEFAULT_*: what the sink left out, so the EDID leaves undefined */ u32 defaults; + /* A swap-paced panel's lowest rate (dcp_refresh_swap_paced()); 0 if none */ + u32 vrr_min_hz; }; #define DCP_METADATA_DEFAULT_SIZE BIT(0) diff --git a/drivers/gpu/drm/apple/dcp-internal.h b/drivers/gpu/drm/apple/dcp-internal.h index 81cf7a5545e3f..dec2ecd27779a 100644 --- a/drivers/gpu/drm/apple/dcp-internal.h +++ b/drivers/gpu/drm/apple/dcp-internal.h @@ -78,6 +78,8 @@ struct iomfb_transaction { bool brightness_only; bool presentation; bool completed; + /* A paced rate's frame time (dcp_paced_rates()); 0 sends at once. */ + u32 pace_ns; }; struct apple_dcp_typec_port; @@ -1534,6 +1536,13 @@ struct apple_dcp { struct delayed_work backlight_retry; /* A firmware 27 panel's EDR ramp on a still frame (iomfb_edr_tick()) */ struct delayed_work edr_tick; + /* + * A paced rate's timeline (iomfb_pace_hold()): when the next + * swap is due to be shown, and when the last one was. + */ + struct hrtimer pace_timer; + ktime_t pace_next; + ktime_t last_complete; unsigned long deadline; unsigned int queued; bool stopped; @@ -1781,6 +1790,9 @@ void dcp_backlight_s2r_restore(struct apple_dcp *dcp); s32 dcp_ext_backlight_value(struct apple_dcp *dcp); bool dcp_ext_backlight_nits(struct apple_dcp *dcp, u64 *nits); bool dcp_has_panel(struct apple_dcp *dcp); +bool dcp_paced_rates(struct apple_dcp *dcp); +bool dcp_paced_fastset(struct apple_dcp *dcp, const struct drm_display_mode *old, + const struct drm_display_mode *new); extern int fw27_panel_boot_mode; extern int notify_clients_form; diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index 410f1c8bc1e7a..bbfbabcb211db 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -80,6 +80,7 @@ #include "dcp-fabric.h" #include "dcp-hdmi.h" #include "dcp-syslog.h" +#include "dcp-refresh.h" #include "dcp-internal.h" #include "j613-25g83.h" #include "dcp-external-bw.h" @@ -1747,6 +1748,19 @@ bool dcp_panel_metadata_current(struct apple_dcp *dcp, u64 generation) return valid; } +/* The lowest rate a firmware 27 panel's timings are paced to, 0 for none. */ +static u32 dcp_panel_paced_min(struct apple_dcp *dcp, const struct dcp_display_mode *modes, + unsigned int count) +{ + u32 low, high, min = 0; + + for (unsigned int i = 0; i < count && dcp->fw_compat == DCP_FIRMWARE_V_27_0; i++) + if (dcp_refresh_swap_paced((u32)drm_mode_vrefresh(&modes[i].mode) << 16, + modes[i].vrr, dcp_has_panel(dcp), &low, &high)) + min = low >> 16; + return min; +} + const struct drm_edid *dcp_panel_edid_snapshot(struct apple_dcp *dcp, const struct dcp_display_mode *modes, unsigned int count, u64 *generation) @@ -1778,6 +1792,8 @@ const struct drm_edid *dcp_panel_edid_snapshot(struct apple_dcp *dcp, metadata.max_fall = metadata.max_luminance; metadata.min_luminance = 0; } + /* Its range reaches the lowest rate the panel paces. */ + metadata.vrr_min_hz = dcp_panel_paced_min(dcp, modes, count); /* The caller supplies the same retained catalog it is publishing. */ edid = size ? drm_edid_alloc(raw, size) : dcp_panel_edid(&metadata, dcp->panel.color_target, modes, count, diff --git a/drivers/gpu/drm/apple/iomfb.c b/drivers/gpu/drm/apple/iomfb.c index 91f084aa2e28b..9da090a394ddf 100644 --- a/drivers/gpu/drm/apple/iomfb.c +++ b/drivers/gpu/drm/apple/iomfb.c @@ -516,6 +516,48 @@ static void iomfb_queue_advance(struct apple_dcp *dcp) schedule_work(&dcp->iomfb.work); } +/* Sent this early, a swap makes the panel's tick at its due time. */ +#define IOMFB_PACE_LEAD_NS (2 * NSEC_PER_MSEC) + +static enum hrtimer_restart iomfb_pace_fire(struct hrtimer *timer) +{ + struct apple_dcp *dcp = container_of(timer, struct apple_dcp, iomfb.pace_timer); + + schedule_work(&dcp->iomfb.work); + return HRTIMER_NORESTART; +} + +/* + * Whether a paced swap waits for its due time (dcp_paced_rates()). The due + * times are whole periods apart, so a rate that is no whole number of panel + * ticks keeps its average; a swap a period or more late starts them again from + * the last swap shown. Other transactions leave the schedule alone. + */ +static bool iomfb_pace_hold(struct apple_dcp *dcp, struct iomfb_transaction *transaction) +{ + ktime_t now = ktime_get(), due, last; + + if (!transaction->presentation) + return false; + if (!transaction->pace_ns) { + dcp->iomfb.pace_next = 0; + return false; + } + due = dcp->iomfb.pace_next; + if (!due || ktime_before(ktime_add_ns(due, transaction->pace_ns), now)) { + last = READ_ONCE(dcp->iomfb.last_complete); + due = last ? ktime_add_ns(last, transaction->pace_ns) : now; + } + if (ktime_before(now, ktime_sub_ns(due, IOMFB_PACE_LEAD_NS))) { + dcp->iomfb.pace_next = due; + hrtimer_start(&dcp->iomfb.pace_timer, + ktime_sub_ns(due, IOMFB_PACE_LEAD_NS), HRTIMER_MODE_ABS); + return true; + } + dcp->iomfb.pace_next = ktime_add_ns(due, transaction->pace_ns); + return false; +} + /* Start the first pending transaction if nothing holds the queue; true if one started. */ static bool iomfb_start_next_locked(struct apple_dcp *dcp) { @@ -529,6 +571,9 @@ static bool iomfb_start_next_locked(struct apple_dcp *dcp) transaction = list_first_entry(&dcp->iomfb.pending, struct iomfb_transaction, link); + /* A paced swap not yet due: iomfb_pace_fire() schedules the worker. */ + if (iomfb_pace_hold(dcp, transaction)) + return false; list_del(&transaction->link); dcp->iomfb.queued--; dcp->iomfb.active = transaction; @@ -727,6 +772,8 @@ void iomfb_queue_init(struct apple_dcp *dcp) init_waitqueue_head(&dcp->channels_idle_wq); spin_lock_init(&dcp->v27_idle_lock); INIT_DELAYED_WORK(&dcp->v27_idle_cache_work, iomfb_v27_idle_cache_work); + hrtimer_setup(&dcp->iomfb.pace_timer, iomfb_pace_fire, CLOCK_MONOTONIC, + HRTIMER_MODE_ABS); atomic_set(&dcp->iomfb.opaque_x_state, IOMFB_OPAQUE_X_WAITING); } @@ -778,6 +825,7 @@ void iomfb_queue_stop(struct apple_dcp *dcp) spin_unlock_irqrestore(&dcp->iomfb.callback_lock, flags); iomfb_discard_pending(dcp); mutex_unlock(&dcp->iomfb.lock); + hrtimer_cancel(&dcp->iomfb.pace_timer); cancel_work_sync(&dcp->iomfb.work); cancel_work_sync(&dcp->iomfb.callback_work); while ((item = iomfb_pop_callback(dcp))) @@ -4663,6 +4711,49 @@ bool dcp_notch_mode_known(struct apple_dcp *dcp, const struct drm_display_mode * dcp_notch_twin_of(&fixed, mode, dcp->notch_rows); } +/* + * Firmware 27 lists the ProMotion panel's fixed rates (60, 59.94, 50, 48 and + * 47.95 Hz, each "IsPromoted") with its 120 Hz timing: the set macOS offers. + * A mode set to one of them crashes the T6050 internal DCP (see + * dcp_mode_settable()), but the panel shows each swap on the first 240 Hz tick + * after it arrives (dcp_refresh_swap_paced()). So such a rate is offered as a + * mode that keeps the DCP on the 120 Hz timing of its size, and the swaps are + * paced to the rate (iomfb_pace_hold()): 60 and 48 Hz are whole ticks, the + * others land on the nearest tick and keep their average. Only while the + * panel runs that 120 Hz timing: a panel iBoot left at 60 Hz keeps just that. + */ +bool dcp_paced_rates(struct apple_dcp *dcp) +{ + u32 boot = READ_ONCE(dcp->boot_rate); + + return dcp->hw.only_120hz_modes && dcp->fw_compat == DCP_FIRMWARE_V_27_0 && + (!boot || boot == 120) && dcp_has_panel(dcp); +} + +static bool dcp_mode_is_promotion(const struct drm_display_mode *mode) +{ + return dcp_refresh_is_promotion((u32)drm_mode_vrefresh(mode) << 16); +} + +/* The timing the DCP runs for @found: its own, or for a paced rate the 120 Hz one. */ +static const struct dcp_display_mode * +dcp_paced_base(struct apple_dcp *dcp, const struct dcp_display_mode *modes, + unsigned int count, const struct dcp_display_mode *found) +{ + unsigned int i; + + if (!dcp_paced_rates(dcp) || dcp_mode_is_promotion(&found->mode)) + return found; + for (i = 0; i < count; i++) + if (!modes[i].automatic_rgb8_quirk && + modes[i].mode.hdisplay == found->mode.hdisplay && + modes[i].mode.vdisplay == found->mode.vdisplay && + dcp_mode_is_promotion(&modes[i].mode)) + return &modes[i]; + /* No 120 Hz timing of its size: dcp_mode_settable() refuses it. */ + return found; +} + static const struct dcp_display_mode * dcp_find_mode(struct apple_dcp *dcp, const struct drm_display_mode *mode) { @@ -4677,7 +4768,7 @@ dcp_find_mode(struct apple_dcp *dcp, const struct drm_display_mode *mode) DRM_MODE_MATCH_TIMINGS | DRM_MODE_MATCH_CLOCK)) { if (!modes[i].automatic_rgb8_quirk) - return &modes[i]; + return dcp_paced_base(dcp, modes, count, &modes[i]); mutex_lock(&dcp->hpd_mutex); mutex_lock(&dcp->dcpavserv.lock); spin_lock_irqsave(&dcp->metadata.lock, flags); @@ -4707,6 +4798,31 @@ bool lookup_mode(struct apple_dcp *dcp, const struct drm_display_mode *mode, return true; } +/* Two modes the DCP runs as one timing: paced rates of the same size. */ +bool dcp_paced_fastset(struct apple_dcp *dcp, const struct drm_display_mode *old, + const struct drm_display_mode *new) +{ + const struct dcp_display_mode *a, *b; + + if (!dcp_paced_rates(dcp)) + return false; + a = dcp_find_mode(dcp, old); + b = dcp_find_mode(dcp, new); + return a && a == b; +} + +/* A paced rate's frame time in ns, 0 for a mode the swaps need no pacing for. */ +static u32 dcp_pace_ns(struct apple_dcp *dcp, const struct drm_crtc_state *state) +{ + const struct drm_display_mode *mode = &state->mode; + + if (!state->active || state->vrr_enabled || !dcp_paced_rates(dcp) || + mode->clock <= 0 || !mode->htotal || !mode->vtotal || + dcp_mode_is_promotion(mode)) + return 0; + return div_u64((u64)mode->htotal * mode->vtotal * 1000000ULL, mode->clock); +} + /* * H17P keeps the mode the bootloader programmed and never sends * set_digital_out_mode (see DCP_INHERIT_BOOT_MODE in iomfb_template.c), so a @@ -4732,11 +4848,13 @@ static bool dcp_mode_settable(struct apple_dcp *dcp, * DCPs crash on a mode set away from the timing iBoot left the panel * at: 120 -> 60 Hz, and 60 -> 120 Hz when macOS left it at 60 Hz. * Offer only the rate the firmware reported at start - * (dcp_rtk_syslog_boot_rate()), 120 Hz when it reported none. + * (dcp_rtk_syslog_boot_rate()), 120 Hz when it reported none. A paced + * rate runs that timing (dcp_paced_rates()): dcp_find_mode() gave its + * 120 Hz entry. */ if (dcp->hw.only_120hz_modes && dcp->fw_compat == DCP_FIRMWARE_V_27_0 && - drm_mode_vrefresh(mode) != (READ_ONCE(dcp->boot_rate) ?: 120)) + drm_mode_vrefresh(&dcp_mode->mode) != (READ_ONCE(dcp->boot_rate) ?: 120)) return false; return true; @@ -5899,6 +6017,7 @@ static void iomfb_queue_atomic(struct apple_dcp *dcp, struct drm_crtc *crtc, struct drm_atomic_commit *state) { struct iomfb_atomic_transaction *atomic; + struct drm_crtc_state *crtc_state; int ret; if (READ_ONCE(dcp->iomfb.presentation_paused) || @@ -5915,6 +6034,8 @@ static void iomfb_queue_atomic(struct apple_dcp *dcp, struct drm_crtc *crtc, atomic->state = drm_atomic_commit_get(state); atomic->crtc = crtc; atomic->dcp = dcp; + crtc_state = drm_atomic_get_new_crtc_state(state, crtc); + atomic->transaction.pace_ns = crtc_state ? dcp_pace_ns(dcp, crtc_state) : 0; ret = iomfb_queue_admit(dcp, &atomic->transaction, iomfb_commit_starts_direct(state)); if (!ret) diff --git a/drivers/gpu/drm/apple/iomfb_template.c b/drivers/gpu/drm/apple/iomfb_template.c index d073f252f89a0..bb5fde193ab9b 100644 --- a/drivers/gpu/drm/apple/iomfb_template.c +++ b/drivers/gpu/drm/apple/iomfb_template.c @@ -908,6 +908,9 @@ static void dcp_report_swap_complete(struct apple_dcp *dcp, u32 id, ktime_t now, dcp->have_swap_complete = true; dcp_swap_watchdog_complete(dcp); if (retire) { + /* Where a paced rate's next swap is due from (iomfb_pace_hold()). */ + if (shown) + WRITE_ONCE(dcp->iomfb.last_complete, now); dcp_release_retained_framebuffers(dcp, id); dcp_drm_crtc_page_flip(dcp, now); #if (DCP_FW_H17(DCP_FW_VER) && DCP_FW_VER >= DCP_FW_VERSION(27, 0, 0)) diff --git a/drivers/gpu/drm/apple/parser-test.c b/drivers/gpu/drm/apple/parser-test.c index 8e0d4e1470653..eb5d18854281d 100644 --- a/drivers/gpu/drm/apple/parser-test.c +++ b/drivers/gpu/drm/apple/parser-test.c @@ -1515,6 +1515,28 @@ static void parser_panel_identity(struct kunit *test) KUNIT_EXPECT_EQ(test, raw->detailed_timings[3].data.other_data.data.range.max_vfreq, 120); KUNIT_EXPECT_EQ(test, modes[0].mode.clock, 540005); drm_edid_free(edid); + + /* + * A firmware 27 panel: fixed 60 and 120 Hz timings, paced down to 24 Hz + * (vrr_min_hz). Its range starts there, not at its lowest timing. + */ + modes[1].vrr = false; + modes[1].min_vrr = 0; + modes[1].max_vrr = 0; + metadata.vrr_min_hz = 24; + edid = dcp_panel_edid(&metadata, NULL, modes, 2, 345, 223); + KUNIT_ASSERT_FALSE(test, IS_ERR(edid)); + raw = drm_edid_raw(edid); + KUNIT_EXPECT_EQ(test, raw->detailed_timings[3].data.other_data.data.range.min_vfreq, 24); + KUNIT_EXPECT_EQ(test, raw->detailed_timings[3].data.other_data.data.range.max_vfreq, 121); + drm_edid_free(edid); + /* Without it the lowest timing (60 Hz) is the floor, as before. */ + metadata.vrr_min_hz = 0; + edid = dcp_panel_edid(&metadata, NULL, modes, 2, 345, 223); + KUNIT_ASSERT_FALSE(test, IS_ERR(edid)); + raw = drm_edid_raw(edid); + KUNIT_EXPECT_EQ(test, raw->detailed_timings[3].data.other_data.data.range.min_vfreq, 60); + drm_edid_free(edid); } static const struct dcp_display_mode panel_color_mode = { @@ -2136,7 +2158,8 @@ static void parser_desktop_metadata_timing(struct kunit *test) /* * The M5 internal DCP (firmware 27) crashes on any set_digital_out_mode that * is not the 120 Hz boot timing (3024x1986@60 killed the co-processor). The - * connector must refuse every other mode of the internal panel. + * connector must refuse every other timing of the internal panel; its other + * rates are offered only as paced modes of the 120 Hz timing. */ static void parser_internal_v27_only_120hz(struct kunit *test) { @@ -2144,6 +2167,7 @@ static void parser_internal_v27_only_120hz(struct kunit *test) struct apple_dcp *dcp = kunit_kzalloc(test, sizeof(*dcp), GFP_KERNEL); struct platform_device *pipeline = kunit_kzalloc(test, sizeof(*pipeline), GFP_KERNEL); struct apple_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); + struct dcp_display_mode found; unsigned int i; KUNIT_ASSERT_NOT_NULL(test, catalog); @@ -2188,6 +2212,26 @@ static void parser_internal_v27_only_120hz(struct kunit *test) KUNIT_EXPECT_EQ(test, dcp_mode_valid(&connector->base, &catalog[1].mode), MODE_OK); dcp->fw_compat = DCP_FIRMWARE_V_27_0; + /* + * The panel's other rates are paced (dcp_paced_rates()): offered, run on + * the 120 Hz timing, and switched to without a mode set. + */ + dcp->panel.width_mm = 302; + KUNIT_EXPECT_EQ(test, dcp_mode_valid(&connector->base, &catalog[0].mode), MODE_OK); + KUNIT_EXPECT_EQ(test, dcp_mode_valid(&connector->base, &catalog[1].mode), MODE_OK); + KUNIT_EXPECT_TRUE(test, lookup_mode(dcp, &catalog[1].mode, &found)); + KUNIT_EXPECT_EQ(test, found.timing_mode_id, 2); + KUNIT_EXPECT_TRUE(test, dcp_paced_fastset(dcp, &catalog[0].mode, &catalog[1].mode)); + /* Left at 60 Hz by iBoot: no pacing, its own 60 Hz timing only. */ + dcp->boot_rate = 60; + KUNIT_EXPECT_FALSE(test, dcp_paced_fastset(dcp, &catalog[0].mode, &catalog[1].mode)); + KUNIT_EXPECT_EQ(test, dcp_mode_valid(&connector->base, &catalog[0].mode), MODE_BAD); + KUNIT_EXPECT_EQ(test, dcp_mode_valid(&connector->base, &catalog[1].mode), MODE_OK); + KUNIT_EXPECT_TRUE(test, lookup_mode(dcp, &catalog[1].mode, &found)); + KUNIT_EXPECT_EQ(test, found.timing_mode_id, 3); + dcp->boot_rate = 0; + dcp->panel.width_mm = 0; + /* The T8142 Air internal DCP (60 Hz panel, firmware 27.0) and the T6050 dcpext keep every mode. */ dcp->hw.only_120hz_modes = false; KUNIT_EXPECT_EQ(test, dcp_mode_valid(&connector->base, &catalog[0].mode), MODE_OK); diff --git a/tools/asahi/dcpext26-queue-tests.py b/tools/asahi/dcpext26-queue-tests.py index eae153e6bc861..9520f9b506e87 100644 --- a/tools/asahi/dcpext26-queue-tests.py +++ b/tools/asahi/dcpext26-queue-tests.py @@ -73,7 +73,7 @@ def function(name): #define current NULL static unsigned long jiffies; struct apple_dcp; -struct iomfb_transaction {struct list_head link;void (*start)(struct apple_dcp *,struct iomfb_transaction *);void (*release)(struct iomfb_transaction *);bool brightness_only,presentation,completed,backlight_failed;}; +struct iomfb_transaction {struct list_head link;void (*start)(struct apple_dcp *,struct iomfb_transaction *);void (*release)(struct iomfb_transaction *);bool brightness_only,presentation,completed,backlight_failed;u32 pace_ns;}; struct iomfb_scanout_h17p {int request;struct drm_framebuffer *fb[4];struct list_head link;}; struct apple_dcp { void *dev;bool s2r_scanout_stale,s2r_scanout_hold,sleep_v27_closed; @@ -93,6 +93,11 @@ def function(name): static unsigned flushed; static void iomfb_flush_h17p(struct apple_dcp *d,struct drm_crtc *c,struct drm_atomic_commit *s){assert(d->iomfb.next_scanout);flushed++;d->present_state_h17p.pending=true;} #define iomfb_flush_v27 iomfb_flush_h17p +/* Paced rates (dcp_paced_rates()) are an internal panel's: none here. */ +struct drm_crtc_state; +static struct drm_crtc_state *drm_atomic_get_new_crtc_state(struct drm_atomic_commit *s,struct drm_crtc *c){return NULL;} +static u32 dcp_pace_ns(struct apple_dcp *d,const struct drm_crtc_state *c){return 0;} +static bool iomfb_pace_hold(struct apple_dcp *d,struct iomfb_transaction *t){return false;} ''' names = ['ext26_scanout_bytes', 'iomfb_scanout_release_h17p', 'iomfb_scanout_prepare_h17p', 'iomfb_scanout_put_h17p', diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py b/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py index 9125b61bf36ac..82960ee8f2dae 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py @@ -424,6 +424,9 @@ def panel_identity(root, output=None): helpers = '\n'.join(block(source, name) for name in ( 'void dcp_panel_metadata_replace(', 'static bool dcp_panel_edid_has_identity(', 'void dcp_panel_edid_receive(', 'bool dcp_panel_metadata_current(', 'const struct drm_edid *dcp_panel_edid_snapshot(')) + # A desktop 26.6 panel is not paced (dcp_panel_paced_min() is firmware 27's). + helpers = ('static u32 dcp_panel_paced_min(struct apple_dcp *d, const struct dcp_display_mode *m,' + ' unsigned int n) { (void)d; (void)m; (void)n; return 0; }\n') + helpers backend = (root / 'drivers/gpu/drm/apple/iomfb_v26_6_desktop.c').read_text() dictionary = block((root/'drivers/gpu/drm/apple/parser.c').read_text(), 'static int parse_panel_edid_value(') dictionary += block((root/'drivers/gpu/drm/apple/parser.c').read_text(), 'int parse_panel_edid_data(') diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/rate.py b/tools/testing/selftests/drivers/gpu/apple-dcp/rate.py index 72f534815f8d3..da8b93abb7748 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/rate.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/rate.py @@ -1076,7 +1076,7 @@ def publication(root): + mode_helpers) # The desktop 26.6 VRR filter is gone once that firmware takes adaptive sync. vrr_filter = block(iomfb,'static bool dcp_mode_vrr_supported(')+'\n' if 'static bool dcp_mode_vrr_supported(' in iomfb else '' - publication = block(iomfb,'static void dcp_clear_connector_edid(')+'\n'+block(iomfb,'static void dcp_consume_edid_invalidation(')+mode_helpers+vrr_filter+block(iomfb,'int dcp_get_modes(')+block(iomfb,'static const struct dcp_display_mode *\ndcp_find_mode(')+block(iomfb,'bool lookup_mode(') + publication = block(iomfb,'static void dcp_clear_connector_edid(')+'\n'+block(iomfb,'static void dcp_consume_edid_invalidation(')+mode_helpers+vrr_filter+block(iomfb,'int dcp_get_modes(')+'\n/* No paced rates here (dcp_paced_rates() is a T6050 panel\'s): a mode runs its own timing. */\nstatic const struct dcp_display_mode *dcp_paced_base(struct apple_dcp *d, const struct dcp_display_mode *m, unsigned int n, const struct dcp_display_mode *found){(void)d;(void)m;(void)n;return found;}\n'+block(iomfb,'static const struct dcp_display_mode *\ndcp_find_mode(')+block(iomfb,'bool lookup_mode(') if 'dcp_edid_sdr(' in publication: # Keep extracting the real publication path, including its SDR helper. # Model only kernel allocation/DRM ownership at the host boundary.