Skip to content

Commit 8cb3ed1

Browse files
committed
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: drm: Remove duplicate "return" statement drm/nv04/crtc: Bail out if FB is not bound to crtc drm/nouveau: fix nv04_sgdma_bind on non-"4kB pages" archs drm/nouveau: properly handle allocation failure in nouveau_sgdma_populate drm/nouveau: fix oops on pre-semaphore hardware drm/nv50/crtc: Bail out if FB is not bound to crtc drm/radeon/kms: fix DP detect and EDID fetch for DP bridges
2 parents 4c75278 + 55a01f6 commit 8cb3ed1

File tree

7 files changed

+66
-28
lines changed

7 files changed

+66
-28
lines changed

drivers/gpu/drm/drm_fb_helper.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed,
256256
{
257257
printk(KERN_ERR "panic occurred, switching back to text console\n");
258258
return drm_fb_helper_force_kernel_mode();
259-
return 0;
260259
}
261260
EXPORT_SYMBOL(drm_fb_helper_panic);
262261

drivers/gpu/drm/nouveau/nouveau_fence.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ nouveau_fence_channel_init(struct nouveau_channel *chan)
530530
nouveau_gpuobj_ref(NULL, &obj);
531531
if (ret)
532532
return ret;
533-
} else {
533+
} else
534+
if (USE_SEMA(dev)) {
534535
/* map fence bo into channel's vm */
535536
ret = nouveau_bo_vma_add(dev_priv->fence.bo, chan->vm,
536537
&chan->fence.vma);

drivers/gpu/drm/nouveau/nouveau_sgdma.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages,
3737
return -ENOMEM;
3838

3939
nvbe->ttm_alloced = kmalloc(sizeof(bool) * num_pages, GFP_KERNEL);
40-
if (!nvbe->ttm_alloced)
40+
if (!nvbe->ttm_alloced) {
41+
kfree(nvbe->pages);
42+
nvbe->pages = NULL;
4143
return -ENOMEM;
44+
}
4245

4346
nvbe->nr_pages = 0;
4447
while (num_pages--) {
@@ -126,7 +129,7 @@ nv04_sgdma_bind(struct ttm_backend *be, struct ttm_mem_reg *mem)
126129

127130
for (j = 0; j < PAGE_SIZE / NV_CTXDMA_PAGE_SIZE; j++, pte++) {
128131
nv_wo32(gpuobj, (pte * 4) + 0, offset_l | 3);
129-
dma_offset += NV_CTXDMA_PAGE_SIZE;
132+
offset_l += NV_CTXDMA_PAGE_SIZE;
130133
}
131134
}
132135

drivers/gpu/drm/nouveau/nv04_crtc.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,11 +781,20 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc,
781781
struct drm_device *dev = crtc->dev;
782782
struct drm_nouveau_private *dev_priv = dev->dev_private;
783783
struct nv04_crtc_reg *regp = &dev_priv->mode_reg.crtc_reg[nv_crtc->index];
784-
struct drm_framebuffer *drm_fb = nv_crtc->base.fb;
785-
struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb);
784+
struct drm_framebuffer *drm_fb;
785+
struct nouveau_framebuffer *fb;
786786
int arb_burst, arb_lwm;
787787
int ret;
788788

789+
NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
790+
791+
/* no fb bound */
792+
if (!atomic && !crtc->fb) {
793+
NV_DEBUG_KMS(dev, "No FB bound\n");
794+
return 0;
795+
}
796+
797+
789798
/* If atomic, we want to switch to the fb we were passed, so
790799
* now we update pointers to do that. (We don't pin; just
791800
* assume we're already pinned and update the base address.)
@@ -794,6 +803,8 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc,
794803
drm_fb = passed_fb;
795804
fb = nouveau_framebuffer(passed_fb);
796805
} else {
806+
drm_fb = crtc->fb;
807+
fb = nouveau_framebuffer(crtc->fb);
797808
/* If not atomic, we can go ahead and pin, and unpin the
798809
* old fb we were passed.
799810
*/

drivers/gpu/drm/nouveau/nv50_crtc.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,12 +519,18 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc,
519519
struct drm_device *dev = nv_crtc->base.dev;
520520
struct drm_nouveau_private *dev_priv = dev->dev_private;
521521
struct nouveau_channel *evo = nv50_display(dev)->master;
522-
struct drm_framebuffer *drm_fb = nv_crtc->base.fb;
523-
struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb);
522+
struct drm_framebuffer *drm_fb;
523+
struct nouveau_framebuffer *fb;
524524
int ret;
525525

526526
NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
527527

528+
/* no fb bound */
529+
if (!atomic && !crtc->fb) {
530+
NV_DEBUG_KMS(dev, "No FB bound\n");
531+
return 0;
532+
}
533+
528534
/* If atomic, we want to switch to the fb we were passed, so
529535
* now we update pointers to do that. (We don't pin; just
530536
* assume we're already pinned and update the base address.)
@@ -533,6 +539,8 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc,
533539
drm_fb = passed_fb;
534540
fb = nouveau_framebuffer(passed_fb);
535541
} else {
542+
drm_fb = crtc->fb;
543+
fb = nouveau_framebuffer(crtc->fb);
536544
/* If not atomic, we can go ahead and pin, and unpin the
537545
* old fb we were passed.
538546
*/

drivers/gpu/drm/radeon/radeon_connectors.c

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,12 +1297,33 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
12971297
if (!radeon_dig_connector->edp_on)
12981298
atombios_set_edp_panel_power(connector,
12991299
ATOM_TRANSMITTER_ACTION_POWER_OFF);
1300-
} else {
1301-
/* need to setup ddc on the bridge */
1302-
if (radeon_connector_encoder_is_dp_bridge(connector)) {
1300+
} else if (radeon_connector_encoder_is_dp_bridge(connector)) {
1301+
/* DP bridges are always DP */
1302+
radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT;
1303+
/* get the DPCD from the bridge */
1304+
radeon_dp_getdpcd(radeon_connector);
1305+
1306+
if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
1307+
ret = connector_status_connected;
1308+
else {
1309+
/* need to setup ddc on the bridge */
13031310
if (encoder)
13041311
radeon_atom_ext_encoder_setup_ddc(encoder);
1312+
if (radeon_ddc_probe(radeon_connector,
1313+
radeon_connector->requires_extended_probe))
1314+
ret = connector_status_connected;
1315+
}
1316+
1317+
if ((ret == connector_status_disconnected) &&
1318+
radeon_connector->dac_load_detect) {
1319+
struct drm_encoder *encoder = radeon_best_single_encoder(connector);
1320+
struct drm_encoder_helper_funcs *encoder_funcs;
1321+
if (encoder) {
1322+
encoder_funcs = encoder->helper_private;
1323+
ret = encoder_funcs->detect(encoder, connector);
1324+
}
13051325
}
1326+
} else {
13061327
radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector);
13071328
if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
13081329
ret = connector_status_connected;
@@ -1318,16 +1339,6 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
13181339
ret = connector_status_connected;
13191340
}
13201341
}
1321-
1322-
if ((ret == connector_status_disconnected) &&
1323-
radeon_connector->dac_load_detect) {
1324-
struct drm_encoder *encoder = radeon_best_single_encoder(connector);
1325-
struct drm_encoder_helper_funcs *encoder_funcs;
1326-
if (encoder) {
1327-
encoder_funcs = encoder->helper_private;
1328-
ret = encoder_funcs->detect(encoder, connector);
1329-
}
1330-
}
13311342
}
13321343

13331344
radeon_connector_update_scratch_regs(connector, ret);

drivers/gpu/drm/radeon/radeon_display.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -707,16 +707,21 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
707707
radeon_router_select_ddc_port(radeon_connector);
708708

709709
if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
710-
(radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) {
710+
(radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) ||
711+
radeon_connector_encoder_is_dp_bridge(&radeon_connector->base)) {
711712
struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
713+
712714
if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT ||
713715
dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) && dig->dp_i2c_bus)
714-
radeon_connector->edid = drm_get_edid(&radeon_connector->base, &dig->dp_i2c_bus->adapter);
715-
}
716-
if (!radeon_connector->ddc_bus)
717-
return -1;
718-
if (!radeon_connector->edid) {
719-
radeon_connector->edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter);
716+
radeon_connector->edid = drm_get_edid(&radeon_connector->base,
717+
&dig->dp_i2c_bus->adapter);
718+
else if (radeon_connector->ddc_bus && !radeon_connector->edid)
719+
radeon_connector->edid = drm_get_edid(&radeon_connector->base,
720+
&radeon_connector->ddc_bus->adapter);
721+
} else {
722+
if (radeon_connector->ddc_bus && !radeon_connector->edid)
723+
radeon_connector->edid = drm_get_edid(&radeon_connector->base,
724+
&radeon_connector->ddc_bus->adapter);
720725
}
721726

722727
if (!radeon_connector->edid) {

0 commit comments

Comments
 (0)