Skip to content

Commit fa64934

Browse files
committed
Merge tag 'drm-misc-fixes-2025-01-15' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
drm-misc-fixes for v6.13: - itee-it6263 error handling fix. - Fix warn when unloading v3d. - Fix W=1 build for kunit tests. - Fix backlight regression for macbooks 5,1 in nouveau. - Handle YCbCr420 better in bridge code, with tests. - Fix cross-device fence handling in nouveau. - Fix BO reservation handling in vmwgfx. Signed-off-by: Dave Airlie <[email protected]> From: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 5bc55a3 + ef84aee commit fa64934

File tree

16 files changed

+111
-30
lines changed

16 files changed

+111
-30
lines changed

drivers/gpu/drm/bridge/ite-it6263.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,8 @@ static int it6263_probe(struct i2c_client *client)
845845
it->lvds_i2c = devm_i2c_new_dummy_device(dev, client->adapter,
846846
LVDS_INPUT_CTRL_I2C_ADDR);
847847
if (IS_ERR(it->lvds_i2c))
848-
dev_err_probe(it->dev, PTR_ERR(it->lvds_i2c),
849-
"failed to allocate I2C device for LVDS\n");
848+
return dev_err_probe(it->dev, PTR_ERR(it->lvds_i2c),
849+
"failed to allocate I2C device for LVDS\n");
850850

851851
it->lvds_regmap = devm_regmap_init_i2c(it->lvds_i2c,
852852
&it6263_lvds_regmap_config);

drivers/gpu/drm/display/drm_bridge_connector.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,10 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
459459
if (connector_type == DRM_MODE_CONNECTOR_Unknown)
460460
return ERR_PTR(-EINVAL);
461461

462-
if (bridge_connector->bridge_hdmi)
462+
if (bridge_connector->bridge_hdmi) {
463+
if (!connector->ycbcr_420_allowed)
464+
supported_formats &= ~BIT(HDMI_COLORSPACE_YUV420);
465+
463466
ret = drmm_connector_hdmi_init(drm, connector,
464467
bridge_connector->bridge_hdmi->vendor,
465468
bridge_connector->bridge_hdmi->product,
@@ -468,10 +471,11 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
468471
connector_type, ddc,
469472
supported_formats,
470473
max_bpc);
471-
else
474+
} else {
472475
ret = drmm_connector_init(drm, connector,
473476
&drm_bridge_connector_funcs,
474477
connector_type, ddc);
478+
}
475479
if (ret)
476480
return ERR_PTR(ret);
477481

drivers/gpu/drm/drm_bridge.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ void drm_bridge_add(struct drm_bridge *bridge)
207207
{
208208
mutex_init(&bridge->hpd_mutex);
209209

210+
if (bridge->ops & DRM_BRIDGE_OP_HDMI)
211+
bridge->ycbcr_420_allowed = !!(bridge->supported_formats &
212+
BIT(HDMI_COLORSPACE_YUV420));
213+
210214
mutex_lock(&bridge_lock);
211215
list_add_tail(&bridge->list, &bridge_list);
212216
mutex_unlock(&bridge_lock);

drivers/gpu/drm/drm_connector.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,9 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
507507
if (!supported_formats || !(supported_formats & BIT(HDMI_COLORSPACE_RGB)))
508508
return -EINVAL;
509509

510+
if (connector->ycbcr_420_allowed != !!(supported_formats & BIT(HDMI_COLORSPACE_YUV420)))
511+
return -EINVAL;
512+
510513
if (!(max_bpc == 8 || max_bpc == 10 || max_bpc == 12))
511514
return -EINVAL;
512515

drivers/gpu/drm/nouveau/nouveau_fence.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,13 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan,
387387
if (f) {
388388
struct nouveau_channel *prev;
389389
bool must_wait = true;
390+
bool local;
390391

391392
rcu_read_lock();
392393
prev = rcu_dereference(f->channel);
393-
if (prev && (prev == chan ||
394-
fctx->sync(f, prev, chan) == 0))
394+
local = prev && prev->cli->drm == chan->cli->drm;
395+
if (local && (prev == chan ||
396+
fctx->sync(f, prev, chan) == 0))
395397
must_wait = false;
396398
rcu_read_unlock();
397399
if (!must_wait)

drivers/gpu/drm/nouveau/nvkm/engine/disp/mcp77.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ mcp77_sor = {
3131
.state = g94_sor_state,
3232
.power = nv50_sor_power,
3333
.clock = nv50_sor_clock,
34+
.bl = &nv50_sor_bl,
3435
.hdmi = &g84_sor_hdmi,
3536
.dp = &g94_sor_dp,
3637
};

drivers/gpu/drm/tests/drm_connector_test.c

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,64 @@ static void drm_test_connector_hdmi_init_formats_no_rgb(struct kunit *test)
635635
KUNIT_EXPECT_LT(test, ret, 0);
636636
}
637637

638+
struct drm_connector_hdmi_init_formats_yuv420_allowed_test {
639+
unsigned long supported_formats;
640+
bool yuv420_allowed;
641+
int expected_result;
642+
};
643+
644+
#define YUV420_ALLOWED_TEST(_formats, _allowed, _result) \
645+
{ \
646+
.supported_formats = BIT(HDMI_COLORSPACE_RGB) | (_formats), \
647+
.yuv420_allowed = _allowed, \
648+
.expected_result = _result, \
649+
}
650+
651+
static const struct drm_connector_hdmi_init_formats_yuv420_allowed_test
652+
drm_connector_hdmi_init_formats_yuv420_allowed_tests[] = {
653+
YUV420_ALLOWED_TEST(BIT(HDMI_COLORSPACE_YUV420), true, 0),
654+
YUV420_ALLOWED_TEST(BIT(HDMI_COLORSPACE_YUV420), false, -EINVAL),
655+
YUV420_ALLOWED_TEST(BIT(HDMI_COLORSPACE_YUV422), true, -EINVAL),
656+
YUV420_ALLOWED_TEST(BIT(HDMI_COLORSPACE_YUV422), false, 0),
657+
};
658+
659+
static void
660+
drm_connector_hdmi_init_formats_yuv420_allowed_desc(const struct drm_connector_hdmi_init_formats_yuv420_allowed_test *t,
661+
char *desc)
662+
{
663+
sprintf(desc, "supported_formats=0x%lx yuv420_allowed=%d",
664+
t->supported_formats, t->yuv420_allowed);
665+
}
666+
667+
KUNIT_ARRAY_PARAM(drm_connector_hdmi_init_formats_yuv420_allowed,
668+
drm_connector_hdmi_init_formats_yuv420_allowed_tests,
669+
drm_connector_hdmi_init_formats_yuv420_allowed_desc);
670+
671+
/*
672+
* Test that the registration of an HDMI connector succeeds only when
673+
* the presence of YUV420 in the supported formats matches the value
674+
* of the ycbcr_420_allowed flag.
675+
*/
676+
static void drm_test_connector_hdmi_init_formats_yuv420_allowed(struct kunit *test)
677+
{
678+
const struct drm_connector_hdmi_init_formats_yuv420_allowed_test *params;
679+
struct drm_connector_init_priv *priv = test->priv;
680+
int ret;
681+
682+
params = test->param_value;
683+
priv->connector.ycbcr_420_allowed = params->yuv420_allowed;
684+
685+
ret = drmm_connector_hdmi_init(&priv->drm, &priv->connector,
686+
"Vendor", "Product",
687+
&dummy_funcs,
688+
&dummy_hdmi_funcs,
689+
DRM_MODE_CONNECTOR_HDMIA,
690+
&priv->ddc,
691+
params->supported_formats,
692+
8);
693+
KUNIT_EXPECT_EQ(test, ret, params->expected_result);
694+
}
695+
638696
/*
639697
* Test that the registration of an HDMI connector with an HDMI
640698
* connector type succeeds.
@@ -726,6 +784,8 @@ static struct kunit_case drmm_connector_hdmi_init_tests[] = {
726784
KUNIT_CASE(drm_test_connector_hdmi_init_bpc_null),
727785
KUNIT_CASE(drm_test_connector_hdmi_init_formats_empty),
728786
KUNIT_CASE(drm_test_connector_hdmi_init_formats_no_rgb),
787+
KUNIT_CASE_PARAM(drm_test_connector_hdmi_init_formats_yuv420_allowed,
788+
drm_connector_hdmi_init_formats_yuv420_allowed_gen_params),
729789
KUNIT_CASE(drm_test_connector_hdmi_init_null_ddc),
730790
KUNIT_CASE(drm_test_connector_hdmi_init_null_product),
731791
KUNIT_CASE(drm_test_connector_hdmi_init_null_vendor),

drivers/gpu/drm/tests/drm_kunit_helpers.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ static void kunit_action_drm_mode_destroy(void *ptr)
320320
}
321321

322322
/**
323-
* drm_kunit_display_mode_from_cea_vic() - return a mode for CEA VIC
324-
for a KUnit test
323+
* drm_kunit_display_mode_from_cea_vic() - return a mode for CEA VIC for a KUnit test
325324
* @test: The test context object
326325
* @dev: DRM device
327326
* @video_code: CEA VIC of the mode

drivers/gpu/drm/v3d/v3d_irq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ v3d_irq(int irq, void *arg)
108108
v3d_job_update_stats(&v3d->bin_job->base, V3D_BIN);
109109
trace_v3d_bcl_irq(&v3d->drm, fence->seqno);
110110
dma_fence_signal(&fence->base);
111+
v3d->bin_job = NULL;
111112
status = IRQ_HANDLED;
112113
}
113114

@@ -118,6 +119,7 @@ v3d_irq(int irq, void *arg)
118119
v3d_job_update_stats(&v3d->render_job->base, V3D_RENDER);
119120
trace_v3d_rcl_irq(&v3d->drm, fence->seqno);
120121
dma_fence_signal(&fence->base);
122+
v3d->render_job = NULL;
121123
status = IRQ_HANDLED;
122124
}
123125

@@ -128,6 +130,7 @@ v3d_irq(int irq, void *arg)
128130
v3d_job_update_stats(&v3d->csd_job->base, V3D_CSD);
129131
trace_v3d_csd_irq(&v3d->drm, fence->seqno);
130132
dma_fence_signal(&fence->base);
133+
v3d->csd_job = NULL;
131134
status = IRQ_HANDLED;
132135
}
133136

@@ -165,6 +168,7 @@ v3d_hub_irq(int irq, void *arg)
165168
v3d_job_update_stats(&v3d->tfu_job->base, V3D_TFU);
166169
trace_v3d_tfu_irq(&v3d->drm, fence->seqno);
167170
dma_fence_signal(&fence->base);
171+
v3d->tfu_job = NULL;
168172
status = IRQ_HANDLED;
169173
}
170174

drivers/gpu/drm/vmwgfx/vmwgfx_bo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ int vmw_bo_pin_in_start_of_vram(struct vmw_private *dev_priv,
228228
VMW_BO_DOMAIN_VRAM,
229229
VMW_BO_DOMAIN_VRAM);
230230
buf->places[0].lpfn = PFN_UP(bo->resource->size);
231-
buf->busy_places[0].lpfn = PFN_UP(bo->resource->size);
232231
ret = ttm_bo_validate(bo, &buf->placement, &ctx);
233232

234233
/* For some reason we didn't end up at the start of vram */
@@ -443,7 +442,8 @@ static int vmw_bo_init(struct vmw_private *dev_priv,
443442

444443
if (params->pin)
445444
ttm_bo_pin(&vmw_bo->tbo);
446-
ttm_bo_unreserve(&vmw_bo->tbo);
445+
if (!params->keep_resv)
446+
ttm_bo_unreserve(&vmw_bo->tbo);
447447

448448
return 0;
449449
}

0 commit comments

Comments
 (0)