From c39b257d5985fe297d9eaa8314bf5235cabe3550 Mon Sep 17 00:00:00 2001 From: Rolando Trevino <122947376+rolotrealanis98@users.noreply.github.com> Date: Mon, 30 Nov 2026 09:07:02 -0500 Subject: [PATCH 1/3] drm/apple: T6050: no DSC modes on an external engine without its provider clock On the J716s a USB-C display at 2560x1600@260 stayed black: the dcpext firmware enables DSC for it, sizes the stream from its provider clock 0 ("using getClockFrequency(0)"), the driver has no firmware clock to give (the ADT's dispext/dcpext clock-ids are empty) and the firmware logs "getClockFrequency(0) (0) < videoClock ... Giving up on frequencies". The same display at 60 and 165 Hz (no DSC) shows a picture on both USB-C ports, and HDMI at 165 Hz does too. Until that clock is known, an apple,t6050-dcpext without firmware clocks offers only the modes a 4-lane HBR3 link carries uncompressed at 10 bits per component. Signed-off-by: Rolando Trevino <122947376+rolotrealanis98@users.noreply.github.com> --- drivers/gpu/drm/apple/iomfb.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/apple/iomfb.c b/drivers/gpu/drm/apple/iomfb.c index b507be69895a7..1e0a2ae34496b 100644 --- a/drivers/gpu/drm/apple/iomfb.c +++ b/drivers/gpu/drm/apple/iomfb.c @@ -3937,6 +3937,23 @@ static bool dcp_mode_beyond_provider_clock(struct apple_dcp *dcp, READ_ONCE(dcp->pmp_display_acked)); } +/* + * A T6050 external engine's firmware sizes a DSC stream from its provider clock 0 + * ("using getClockFrequency(0)"). The J716s ADT gives the engines no clock-ids, so + * the driver has no clock to answer with, the firmware gives up on its frequencies + * and a DSC mode stays black (an uncompressed one runs). Until that clock is known, + * such an engine offers only the modes a 4-lane HBR3 link carries uncompressed at + * 10 bits per component: 25.92 Gb/s of payload. + */ +#define DCP_EXT_UNCOMPRESSED_PAYLOAD_BPS 25920000000ULL + +static bool dcp_ext_mode_needs_unclocked_dsc(struct apple_dcp *dcp, u32 clock_khz) +{ + return !dcp->num_firmware_clocks && + of_device_is_compatible(dcp->dev->of_node, "apple,t6050-dcpext") && + (u64)clock_khz * 1000 * 30 > DCP_EXT_UNCOMPRESSED_PAYLOAD_BPS; +} + enum drm_mode_status dcp_mode_valid(struct drm_connector *connector, const struct drm_display_mode *mode) { @@ -3965,7 +3982,8 @@ enum drm_mode_status dcp_mode_valid(struct drm_connector *connector, */ if (dcp_peer_mode_limited_v27(dcp, mode->clock)) return MODE_CLOCK_HIGH; - if (dcp_mode_beyond_provider_clock(dcp, connector, mode)) + if (dcp_mode_beyond_provider_clock(dcp, connector, mode) || + dcp_ext_mode_needs_unclocked_dsc(dcp, mode->clock)) return MODE_CLOCK_HIGH; return dcp_mode_settable(dcp, mode) ? MODE_OK : MODE_BAD; } From 1660f80541d541dbcc1ea451bfac26b3430d5f7e Mon Sep 17 00:00:00 2001 From: Rolando Trevino <122947376+rolotrealanis98@users.noreply.github.com> Date: Fri, 4 Dec 2026 03:55:59 -0500 Subject: [PATCH 2/3] drm/apple: T6050: refuse the firmware's DSC-required modes, not a clock cap The previous change capped an apple,t6050-dcpext without firmware clocks at what a four-lane HBR3 link carries uncompressed at 10 bits per component. That is only an upper bound: it lets through modes a narrower link compresses, and applies the same limit to HDMI. The firmware sends, with each timing of the connected display, the color elements that need DSC on its link (DSCRequiredColorElementIDs). On the J716s, for a 2560x1600 display on USB-C, it lists every element of 2560x1600@240 and @260 and none of the others. 260 Hz is the mode that stays black; 60 to 180 Hz run uncompressed. The parser already reads that list into the timing's color restrictions. Record whether the color element a mode uses is in it, and refuse those modes on such an engine instead of comparing the clock. Check external_processor before the compatible string, so a DCP without a device, as in the display KUnit tests, is not dereferenced: with the cap, parser_internal_v27_only_120hz oopsed in dcp_mode_valid(). Signed-off-by: Rolando Trevino <122947376+rolotrealanis98@users.noreply.github.com> --- drivers/gpu/drm/apple/iomfb.c | 32 ++++++++++++++++----------- drivers/gpu/drm/apple/parser-test.c | 34 +++++++++++++++++++++++++++++ drivers/gpu/drm/apple/parser.c | 2 ++ drivers/gpu/drm/apple/parser.h | 2 ++ 4 files changed, 57 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/apple/iomfb.c b/drivers/gpu/drm/apple/iomfb.c index 1e0a2ae34496b..744a2ad5a4d55 100644 --- a/drivers/gpu/drm/apple/iomfb.c +++ b/drivers/gpu/drm/apple/iomfb.c @@ -3938,20 +3938,26 @@ static bool dcp_mode_beyond_provider_clock(struct apple_dcp *dcp, } /* - * A T6050 external engine's firmware sizes a DSC stream from its provider clock 0 - * ("using getClockFrequency(0)"). The J716s ADT gives the engines no clock-ids, so - * the driver has no clock to answer with, the firmware gives up on its frequencies - * and a DSC mode stays black (an uncompressed one runs). Until that clock is known, - * such an engine offers only the modes a 4-lane HBR3 link carries uncompressed at - * 10 bits per component: 25.92 Gb/s of payload. + * A T6050 external engine leaves a mode black when its firmware compresses it + * with DSC: on the J716s a USB-C display at 2560x1600@240 and @260, which the + * firmware lists as DSC required for every color element, while the same + * display runs uncompressed up to 180 Hz. The J716s ADT gives these engines no + * clock-ids, so the driver has no provider clock to answer the firmware with. + * Until that is solved, such an engine offers only the modes whose color + * element the firmware does not list in DSCRequiredColorElementIDs, the list + * it sends with each timing of the connected display, rather than assuming a + * link rate and lane count or a port type. */ -#define DCP_EXT_UNCOMPRESSED_PAYLOAD_BPS 25920000000ULL - -static bool dcp_ext_mode_needs_unclocked_dsc(struct apple_dcp *dcp, u32 clock_khz) +static bool dcp_ext_mode_needs_unclocked_dsc(struct apple_dcp *dcp, + const struct drm_display_mode *mode) { - return !dcp->num_firmware_clocks && - of_device_is_compatible(dcp->dev->of_node, "apple,t6050-dcpext") && - (u64)clock_khz * 1000 * 30 > DCP_EXT_UNCOMPRESSED_PAYLOAD_BPS; + const struct dcp_display_mode *dcp_mode; + + if (dcp->num_firmware_clocks || !dcp->hw.external_processor || + !of_device_is_compatible(dcp->dev->of_node, "apple,t6050-dcpext")) + return false; + dcp_mode = dcp_find_mode(dcp, mode); + return dcp_mode && dcp_mode->color_needs_dsc; } enum drm_mode_status dcp_mode_valid(struct drm_connector *connector, @@ -3983,7 +3989,7 @@ enum drm_mode_status dcp_mode_valid(struct drm_connector *connector, if (dcp_peer_mode_limited_v27(dcp, mode->clock)) return MODE_CLOCK_HIGH; if (dcp_mode_beyond_provider_clock(dcp, connector, mode) || - dcp_ext_mode_needs_unclocked_dsc(dcp, mode->clock)) + dcp_ext_mode_needs_unclocked_dsc(dcp, mode)) return MODE_CLOCK_HIGH; return dcp_mode_settable(dcp, mode) ? MODE_OK : MODE_BAD; } diff --git a/drivers/gpu/drm/apple/parser-test.c b/drivers/gpu/drm/apple/parser-test.c index 340e1157108d6..edba83ffcddf8 100644 --- a/drivers/gpu/drm/apple/parser-test.c +++ b/drivers/gpu/drm/apple/parser-test.c @@ -253,6 +253,39 @@ static void parser_tiled_size_keeps_dsc_modes(struct kunit *test) kfree(modes); } +/* The mode records whether the color element it uses is DSC required. */ +static void parser_color_needs_dsc(struct kunit *test) +{ + struct parser_record record = valid_record(7, 10); + struct dcp_display_mode *modes; + struct parser_blob *blob; + unsigned int count; + + blob = make_blob(test, &record, 1); + KUNIT_ASSERT_NOT_NULL(test, blob); + modes = parse_blob(blob, &count, 0, false); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, modes); + KUNIT_ASSERT_EQ(test, count, 1U); + KUNIT_EXPECT_FALSE(test, modes[0].color_needs_dsc); + kfree(modes); + + record.dsc_required = true; + blob = make_blob(test, &record, 1); + KUNIT_ASSERT_NOT_NULL(test, blob); + modes = parse_blob(blob, &count, 0, false); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, modes); + KUNIT_ASSERT_EQ(test, count, 1U); + KUNIT_EXPECT_TRUE(test, modes[0].color_needs_dsc); + kfree(modes); + + /* A tiled half drops the list, and with it the flag. */ + modes = parse_blob_tiled(blob, &count, 1920, 1080); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, modes); + KUNIT_ASSERT_EQ(test, count, 1U); + KUNIT_EXPECT_FALSE(test, modes[0].color_needs_dsc); + kfree(modes); +} + static void parser_score_presence(struct kunit *test) { struct parser_record records[] = { valid_record(7, 100), valid_record(8, 0) }; @@ -2428,6 +2461,7 @@ static struct kunit_case parser_cases[] = { KUNIT_CASE(parser_panel_color_target), KUNIT_CASE(parser_panel_adt_color_target), KUNIT_CASE(parser_tiled_size_keeps_dsc_modes), + KUNIT_CASE(parser_color_needs_dsc), KUNIT_CASE(parser_score_presence), KUNIT_CASE(parser_legacy_ties), KUNIT_CASE(parser_color_presence), diff --git a/drivers/gpu/drm/apple/parser.c b/drivers/gpu/drm/apple/parser.c index 35a8c2bf25de9..9ee3b14c66b2b 100644 --- a/drivers/gpu/drm/apple/parser.c +++ b/drivers/gpu/drm/apple/parser.c @@ -1262,6 +1262,8 @@ static int parse_mode(struct dcp_parse_ctx *handle, out->timing_mode_id = id; out->color_mode_id = best_color_mode; + out->color_needs_dsc = limits_known && + timing_color_contains(&limits.dsc_required, best_color_mode); out->preferred = is_preferred; out->firmware_preferred = external_sdr ? preferred : is_preferred; diff --git a/drivers/gpu/drm/apple/parser.h b/drivers/gpu/drm/apple/parser.h index aff4b4cb45cb5..4b0781bd99be9 100644 --- a/drivers/gpu/drm/apple/parser.h +++ b/drivers/gpu/drm/apple/parser.h @@ -184,6 +184,8 @@ struct dcp_display_mode { * only, outside the external SDR path */ bool sdr_unsafe; + /* The firmware lists the mode's color element as DSC required */ + bool color_needs_dsc; /* The firmware score of the timing */ s64 score; /* The sync polarity flags of the timing, if it reports them */ From 86202c62a6059518f9f2ca71f0d58b84beb28a27 Mon Sep 17 00:00:00 2001 From: rolotrealanis98 <122947376+rolotrealanis98@users.noreply.github.com> Date: Fri, 4 Dec 2026 11:46:49 -0500 Subject: [PATCH 3/3] drm/apple: T6050: keep clockless engines off DSC-required color elements The filter refused a timing when the parser's pick for it was DSC required. Over HDMI on the J716s that pick is 10-bit RGB (color element 88) for every 2560x1600 timing, and at 165 Hz the firmware lists 88 as DSC required but not 8-bit RGB (83), so 2560x1600@165 went away although it runs uncompressed. The same pick was also what a default color request set: 88 at 165 Hz, which this engine can only run compressed. A clockless T6050 external engine now asks for no DSC (dcp_color_request.no_dsc): the color selection skips DSC-required elements, the default SDR request included, and a timing is refused only when none of its safe SDR elements runs uncompressed. The parser's color_needs_dsc goes; the KUnit case checks the selection instead. Co-Authored-By: Claude Opus 5.5 Signed-off-by: rolotrealanis98 <122947376+rolotrealanis98@users.noreply.github.com> --- drivers/gpu/drm/apple/dcp-color.h | 48 ++++++++++++++++-- drivers/gpu/drm/apple/iomfb.c | 37 ++++++++------ drivers/gpu/drm/apple/parser-test.c | 77 ++++++++++++++++++----------- drivers/gpu/drm/apple/parser.c | 2 - drivers/gpu/drm/apple/parser.h | 2 - 5 files changed, 115 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/apple/dcp-color.h b/drivers/gpu/drm/apple/dcp-color.h index 88307f86063f6..9800f1e49a7be 100644 --- a/drivers/gpu/drm/apple/dcp-color.h +++ b/drivers/gpu/drm/apple/dcp-color.h @@ -26,6 +26,11 @@ struct dcp_color_request { bool allow_dsc; bool allow_unsafe_sdr; bool default_rgb; + /* + * The engine cannot run a DSC-compressed link (a T6050 external engine + * without firmware clocks): never select a DSC-required color element. + */ + bool no_dsc; }; static inline bool dcp_color_request_is_default(const struct dcp_color_request *req) @@ -303,8 +308,8 @@ dcp_scan_color_modes(const struct dcp_display_mode *mode, if ((e->flags & DCP_COLOR_FLAG_UNSAFE) && !allow_unsafe) continue; - if ((e->flags & DCP_COLOR_FLAG_DSC) && hdr && - (!req->allow_dsc || allow_unsafe)) + if ((e->flags & DCP_COLOR_FLAG_DSC) && + (req->no_dsc || (hdr && (!req->allow_dsc || allow_unsafe)))) continue; if (allow_unsafe && hdr && mode->sdr_unsafe_max_bpp && dcp_color_wire_bpp(fmt, e->depth) > mode->sdr_unsafe_max_bpp) @@ -331,6 +336,34 @@ dcp_scan_color_modes(const struct dcp_display_mode *mode, return best; } +static inline bool dcp_color_id_needs_dsc(const struct dcp_display_mode *mode, s64 id) +{ + unsigned int i; + + for (i = 0; i < mode->nr_colors; i++) + if (mode->colors[i].id == id) + return mode->colors[i].flags & DCP_COLOR_FLAG_DSC; + return false; +} + +/* + * Whether @mode has an SDR color element that runs without DSC and is not + * unsafe: what a request with no_dsc and default SDR settings can select. + */ +static inline bool dcp_mode_has_dsc_free_sdr(const struct dcp_display_mode *mode) +{ + unsigned int i; + + for (i = 0; i < mode->nr_colors; i++) { + const struct dcp_color_entry *e = &mode->colors[i]; + + if (e->eotf == DCP_EOTF_SDR_GAMMA && + !(e->flags & (DCP_COLOR_FLAG_DSC | DCP_COLOR_FLAG_UNSAFE))) + return true; + } + return false; +} + static inline int dcp_select_color_mode(const struct dcp_display_mode *mode, const struct dcp_color_request *req, struct dcp_color_mode *out) @@ -339,13 +372,20 @@ static inline int dcp_select_color_mode(const struct dcp_display_mode *mode, const struct dcp_color_entry *best; if (dcp_color_request_is_default(req)) { + /* + * The timing's own pick can be a DSC-required element (10-bit RGB + * at 2560x1600@165 over HDMI) next to one that runs uncompressed + * (8-bit RGB): without DSC, the scan below picks among the others. + */ if (req->eotf == HDMI_EOTF_TRADITIONAL_GAMMA_SDR && - req->colorspace == DRM_MODE_COLORIMETRY_DEFAULT) + req->colorspace == DRM_MODE_COLORIMETRY_DEFAULT && + !(req->no_dsc && dcp_color_id_needs_dsc(mode, mode->color_mode_id))) return dcp_default_sdr_color(mode, out); if (req->eotf == HDMI_EOTF_SMPTE_ST2084 && (req->colorspace == DRM_MODE_COLORIMETRY_DEFAULT || req->colorspace == DRM_MODE_COLORIMETRY_BT2020_RGB)) { - if (!req->allow_hdr || mode->pq.score < 0) + if (!req->allow_hdr || mode->pq.score < 0 || + (req->no_dsc && dcp_color_id_needs_dsc(mode, mode->pq.id))) return -EINVAL; *out = mode->pq; return 0; diff --git a/drivers/gpu/drm/apple/iomfb.c b/drivers/gpu/drm/apple/iomfb.c index 744a2ad5a4d55..6186c1fb8d336 100644 --- a/drivers/gpu/drm/apple/iomfb.c +++ b/drivers/gpu/drm/apple/iomfb.c @@ -3730,6 +3730,25 @@ static void dcp_hdr_metadata_sync(struct apple_dcp *dcp, struct drm_crtc *crtc, afk_service_put(service); } +/* + * A T6050 external engine leaves a mode black when its firmware compresses it + * with DSC: on the J716s a USB-C display at 2560x1600@240 and @260, which the + * firmware lists as DSC required for every color element, while the same + * display runs uncompressed up to 180 Hz. The J716s ADT gives these engines no + * clock-ids, so the driver has no provider clock to answer the firmware with. + * Until that is solved, such an engine never selects a color element the + * firmware lists in DSCRequiredColorElementIDs, the list it sends with each + * timing of the connected display (dcp_color_request.no_dsc), and offers a + * timing only when one of its SDR elements is not on it. Over HDMI at + * 2560x1600@165 that keeps the timing on 8-bit RGB, where 10-bit RGB needs + * DSC; no link rate, lane count or port type is assumed. + */ +static bool dcp_ext_unclocked(struct apple_dcp *dcp) +{ + return !dcp->num_firmware_clocks && dcp->hw.external_processor && + of_device_is_compatible(dcp->dev->of_node, "apple,t6050-dcpext"); +} + static void dcp_crtc_color_request(struct apple_dcp *dcp, struct drm_crtc *crtc, struct drm_atomic_commit *commit, struct dcp_color_request *req) @@ -3751,6 +3770,7 @@ static void dcp_crtc_color_request(struct apple_dcp *dcp, struct drm_crtc *crtc, .allow_unsafe_sdr = dcp->hw.iomfb_method_profile != DCP_IOMFB_METHODS_H17P_EXTERNAL, .default_rgb = dcp_sdr_default_rgb(dcp), + .no_dsc = dcp_ext_unclocked(dcp), }; } @@ -3937,27 +3957,16 @@ static bool dcp_mode_beyond_provider_clock(struct apple_dcp *dcp, READ_ONCE(dcp->pmp_display_acked)); } -/* - * A T6050 external engine leaves a mode black when its firmware compresses it - * with DSC: on the J716s a USB-C display at 2560x1600@240 and @260, which the - * firmware lists as DSC required for every color element, while the same - * display runs uncompressed up to 180 Hz. The J716s ADT gives these engines no - * clock-ids, so the driver has no provider clock to answer the firmware with. - * Until that is solved, such an engine offers only the modes whose color - * element the firmware does not list in DSCRequiredColorElementIDs, the list - * it sends with each timing of the connected display, rather than assuming a - * link rate and lane count or a port type. - */ static bool dcp_ext_mode_needs_unclocked_dsc(struct apple_dcp *dcp, const struct drm_display_mode *mode) { const struct dcp_display_mode *dcp_mode; - if (dcp->num_firmware_clocks || !dcp->hw.external_processor || - !of_device_is_compatible(dcp->dev->of_node, "apple,t6050-dcpext")) + if (!dcp_ext_unclocked(dcp)) return false; + /* A timing with an uncompressed SDR element stays: the mode set picks it (no_dsc). */ dcp_mode = dcp_find_mode(dcp, mode); - return dcp_mode && dcp_mode->color_needs_dsc; + return dcp_mode && !dcp_mode_has_dsc_free_sdr(dcp_mode); } enum drm_mode_status dcp_mode_valid(struct drm_connector *connector, diff --git a/drivers/gpu/drm/apple/parser-test.c b/drivers/gpu/drm/apple/parser-test.c index edba83ffcddf8..144bb7e66b3d3 100644 --- a/drivers/gpu/drm/apple/parser-test.c +++ b/drivers/gpu/drm/apple/parser-test.c @@ -8,6 +8,7 @@ #include #include "dcp.h" +#include "dcp-color.h" #include #include @@ -253,37 +254,55 @@ static void parser_tiled_size_keeps_dsc_modes(struct kunit *test) kfree(modes); } -/* The mode records whether the color element it uses is DSC required. */ -static void parser_color_needs_dsc(struct kunit *test) -{ - struct parser_record record = valid_record(7, 10); - struct dcp_display_mode *modes; - struct parser_blob *blob; - unsigned int count; +/* + * A clockless T6050 external engine (dcp_color_request.no_dsc) runs a timing + * on an SDR element the firmware does not list as DSC required, even when the + * timing's own pick is on the list, and refuses the timing when all are. + */ +static void color_no_dsc_picks_uncompressed(struct kunit *test) +{ + struct dcp_display_mode mode = { + .color_mode_id = 88, + .sdr_rgb = { .id = 88, .score = 1, .depth = 10, .eotf = DCP_EOTF_SDR_GAMMA, + .format = DCP_COLOR_FORMAT_RGB, .colorimetry = DCP_COLORIMETRY_SRGB }, + .sdr_444 = { .score = -1 }, .sdr = { .score = -1 }, .best = { .score = -1 }, + .pq = { .score = -1 }, + .nr_colors = 2, + .colors = { + { .id = 88, .depth = 10, .eotf = DCP_EOTF_SDR_GAMMA, + .format = DCP_COLOR_FORMAT_RGB, .colorimetry = DCP_COLORIMETRY_SRGB, + .flags = DCP_COLOR_FLAG_DSC }, + { .id = 83, .depth = 8, .eotf = DCP_EOTF_SDR_GAMMA, + .format = DCP_COLOR_FORMAT_RGB, .colorimetry = DCP_COLORIMETRY_SRGB }, + }, + }; + struct dcp_color_request req = { + .eotf = HDMI_EOTF_TRADITIONAL_GAMMA_SDR, + .colorspace = DRM_MODE_COLORIMETRY_DEFAULT, + .color_format = DRM_CONNECTOR_COLOR_FORMAT_AUTO, + .broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO, + }; + struct dcp_color_mode out; - blob = make_blob(test, &record, 1); - KUNIT_ASSERT_NOT_NULL(test, blob); - modes = parse_blob(blob, &count, 0, false); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, modes); - KUNIT_ASSERT_EQ(test, count, 1U); - KUNIT_EXPECT_FALSE(test, modes[0].color_needs_dsc); - kfree(modes); + /* Engines that compress keep the timing's own pick. */ + KUNIT_ASSERT_EQ(test, dcp_select_color_mode(&mode, &req, &out), 0); + KUNIT_EXPECT_EQ(test, out.id, 88); - record.dsc_required = true; - blob = make_blob(test, &record, 1); - KUNIT_ASSERT_NOT_NULL(test, blob); - modes = parse_blob(blob, &count, 0, false); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, modes); - KUNIT_ASSERT_EQ(test, count, 1U); - KUNIT_EXPECT_TRUE(test, modes[0].color_needs_dsc); - kfree(modes); + req.no_dsc = true; + KUNIT_EXPECT_TRUE(test, dcp_mode_has_dsc_free_sdr(&mode)); + KUNIT_ASSERT_EQ(test, dcp_select_color_mode(&mode, &req, &out), 0); + KUNIT_EXPECT_EQ(test, out.id, 83); + KUNIT_EXPECT_EQ(test, out.depth, 8); + /* A compositor's 10 bpc cap changes nothing. */ + req.max_bpc = 10; + KUNIT_ASSERT_EQ(test, dcp_select_color_mode(&mode, &req, &out), 0); + KUNIT_EXPECT_EQ(test, out.id, 83); - /* A tiled half drops the list, and with it the flag. */ - modes = parse_blob_tiled(blob, &count, 1920, 1080); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, modes); - KUNIT_ASSERT_EQ(test, count, 1U); - KUNIT_EXPECT_FALSE(test, modes[0].color_needs_dsc); - kfree(modes); + /* 2560x1600@240: every element needs DSC. */ + mode.colors[1].flags = DCP_COLOR_FLAG_DSC; + KUNIT_EXPECT_FALSE(test, dcp_mode_has_dsc_free_sdr(&mode)); + req.max_bpc = 0; + KUNIT_EXPECT_EQ(test, dcp_select_color_mode(&mode, &req, &out), -EINVAL); } static void parser_score_presence(struct kunit *test) @@ -2461,7 +2480,7 @@ static struct kunit_case parser_cases[] = { KUNIT_CASE(parser_panel_color_target), KUNIT_CASE(parser_panel_adt_color_target), KUNIT_CASE(parser_tiled_size_keeps_dsc_modes), - KUNIT_CASE(parser_color_needs_dsc), + KUNIT_CASE(color_no_dsc_picks_uncompressed), KUNIT_CASE(parser_score_presence), KUNIT_CASE(parser_legacy_ties), KUNIT_CASE(parser_color_presence), diff --git a/drivers/gpu/drm/apple/parser.c b/drivers/gpu/drm/apple/parser.c index 9ee3b14c66b2b..35a8c2bf25de9 100644 --- a/drivers/gpu/drm/apple/parser.c +++ b/drivers/gpu/drm/apple/parser.c @@ -1262,8 +1262,6 @@ static int parse_mode(struct dcp_parse_ctx *handle, out->timing_mode_id = id; out->color_mode_id = best_color_mode; - out->color_needs_dsc = limits_known && - timing_color_contains(&limits.dsc_required, best_color_mode); out->preferred = is_preferred; out->firmware_preferred = external_sdr ? preferred : is_preferred; diff --git a/drivers/gpu/drm/apple/parser.h b/drivers/gpu/drm/apple/parser.h index 4b0781bd99be9..aff4b4cb45cb5 100644 --- a/drivers/gpu/drm/apple/parser.h +++ b/drivers/gpu/drm/apple/parser.h @@ -184,8 +184,6 @@ struct dcp_display_mode { * only, outside the external SDR path */ bool sdr_unsafe; - /* The firmware lists the mode's color element as DSC required */ - bool color_needs_dsc; /* The firmware score of the timing */ s64 score; /* The sync polarity flags of the timing, if it reports them */