Skip to content

Commit 687a0ed

Browse files
committed
Merge tag 'drm-misc-fixes-2020-06-25' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
Short summary of fixes pull (less than what git shortlog provides): * In mcde, set up fbdev after device registration and removde the last access to dev->dev_private. Fixes an error message and a segmentation fault. * Set the connector type for LogicPT Type 28 and newhaven_nhd_43_480272ef_atxl panels. * In uvesafb, fix the handling of the noblank option. * Fix panel orientation for Asus T101HA and Acer S1003. * Fix DMA configuration for sun4i if IOMMU is present. * Fix regression in VT restoration. Unbreaks userspace (i.e., Xorg) VT handling. Signed-off-by: Dave Airlie <[email protected]> From: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20200625082717.GA14856@linux-uq9g
2 parents 5b83c25 + dc5bdb6 commit 687a0ed

File tree

11 files changed

+83
-26
lines changed

11 files changed

+83
-26
lines changed

drivers/gpu/drm/drm_fb_helper.c

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,18 +227,9 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
227227
}
228228
EXPORT_SYMBOL(drm_fb_helper_debug_leave);
229229

230-
/**
231-
* drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
232-
* @fb_helper: driver-allocated fbdev helper, can be NULL
233-
*
234-
* This should be called from driver's drm &drm_driver.lastclose callback
235-
* when implementing an fbcon on top of kms using this helper. This ensures that
236-
* the user isn't greeted with a black screen when e.g. X dies.
237-
*
238-
* RETURNS:
239-
* Zero if everything went ok, negative error code otherwise.
240-
*/
241-
int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
230+
static int
231+
__drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper,
232+
bool force)
242233
{
243234
bool do_delayed;
244235
int ret;
@@ -250,7 +241,16 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
250241
return 0;
251242

252243
mutex_lock(&fb_helper->lock);
253-
ret = drm_client_modeset_commit(&fb_helper->client);
244+
if (force) {
245+
/*
246+
* Yes this is the _locked version which expects the master lock
247+
* to be held. But for forced restores we're intentionally
248+
* racing here, see drm_fb_helper_set_par().
249+
*/
250+
ret = drm_client_modeset_commit_locked(&fb_helper->client);
251+
} else {
252+
ret = drm_client_modeset_commit(&fb_helper->client);
253+
}
254254

255255
do_delayed = fb_helper->delayed_hotplug;
256256
if (do_delayed)
@@ -262,6 +262,22 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
262262

263263
return ret;
264264
}
265+
266+
/**
267+
* drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
268+
* @fb_helper: driver-allocated fbdev helper, can be NULL
269+
*
270+
* This should be called from driver's drm &drm_driver.lastclose callback
271+
* when implementing an fbcon on top of kms using this helper. This ensures that
272+
* the user isn't greeted with a black screen when e.g. X dies.
273+
*
274+
* RETURNS:
275+
* Zero if everything went ok, negative error code otherwise.
276+
*/
277+
int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
278+
{
279+
return __drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper, false);
280+
}
265281
EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked);
266282

267283
#ifdef CONFIG_MAGIC_SYSRQ
@@ -1318,6 +1334,7 @@ int drm_fb_helper_set_par(struct fb_info *info)
13181334
{
13191335
struct drm_fb_helper *fb_helper = info->par;
13201336
struct fb_var_screeninfo *var = &info->var;
1337+
bool force;
13211338

13221339
if (oops_in_progress)
13231340
return -EBUSY;
@@ -1327,7 +1344,25 @@ int drm_fb_helper_set_par(struct fb_info *info)
13271344
return -EINVAL;
13281345
}
13291346

1330-
drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
1347+
/*
1348+
* Normally we want to make sure that a kms master takes precedence over
1349+
* fbdev, to avoid fbdev flickering and occasionally stealing the
1350+
* display status. But Xorg first sets the vt back to text mode using
1351+
* the KDSET IOCTL with KD_TEXT, and only after that drops the master
1352+
* status when exiting.
1353+
*
1354+
* In the past this was caught by drm_fb_helper_lastclose(), but on
1355+
* modern systems where logind always keeps a drm fd open to orchestrate
1356+
* the vt switching, this doesn't work.
1357+
*
1358+
* To not break the userspace ABI we have this special case here, which
1359+
* is only used for the above case. Everything else uses the normal
1360+
* commit function, which ensures that we never steal the display from
1361+
* an active drm master.
1362+
*/
1363+
force = var->activate & FB_ACTIVATE_KD_TEXT;
1364+
1365+
__drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper, force);
13311366

13321367
return 0;
13331368
}

drivers/gpu/drm/drm_panel_orientation_quirks.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ struct drm_dmi_panel_orientation_data {
3030
int orientation;
3131
};
3232

33-
static const struct drm_dmi_panel_orientation_data acer_s1003 = {
34-
.width = 800,
35-
.height = 1280,
36-
.orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
37-
};
38-
3933
static const struct drm_dmi_panel_orientation_data asus_t100ha = {
4034
.width = 800,
4135
.height = 1280,
@@ -114,13 +108,19 @@ static const struct dmi_system_id orientation_data[] = {
114108
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"),
115109
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"),
116110
},
117-
.driver_data = (void *)&acer_s1003,
111+
.driver_data = (void *)&lcd800x1280_rightside_up,
118112
}, { /* Asus T100HA */
119113
.matches = {
120114
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
121115
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100HAN"),
122116
},
123117
.driver_data = (void *)&asus_t100ha,
118+
}, { /* Asus T101HA */
119+
.matches = {
120+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
121+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T101HA"),
122+
},
123+
.driver_data = (void *)&lcd800x1280_rightside_up,
124124
}, { /* GPD MicroPC (generic strings, also match on bios date) */
125125
.matches = {
126126
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"),

drivers/gpu/drm/mcde/mcde_display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ static void mcde_display_enable(struct drm_simple_display_pipe *pipe,
812812
struct drm_crtc *crtc = &pipe->crtc;
813813
struct drm_plane *plane = &pipe->plane;
814814
struct drm_device *drm = crtc->dev;
815-
struct mcde *mcde = drm->dev_private;
815+
struct mcde *mcde = to_mcde(drm);
816816
const struct drm_display_mode *mode = &cstate->mode;
817817
struct drm_framebuffer *fb = plane->state->fb;
818818
u32 format = fb->format->format;

drivers/gpu/drm/mcde/mcde_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ static int mcde_modeset_init(struct drm_device *drm)
209209

210210
drm_mode_config_reset(drm);
211211
drm_kms_helper_poll_init(drm);
212-
drm_fbdev_generic_setup(drm, 32);
213212

214213
return 0;
215214
}
@@ -264,6 +263,8 @@ static int mcde_drm_bind(struct device *dev)
264263
if (ret < 0)
265264
goto unbind;
266265

266+
drm_fbdev_generic_setup(drm, 32);
267+
267268
return 0;
268269

269270
unbind:

drivers/gpu/drm/panel/panel-simple.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,6 +2495,7 @@ static const struct panel_desc logicpd_type_28 = {
24952495
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
24962496
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE |
24972497
DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE,
2498+
.connector_type = DRM_MODE_CONNECTOR_DPI,
24982499
};
24992500

25002501
static const struct panel_desc mitsubishi_aa070mc01 = {
@@ -2663,6 +2664,7 @@ static const struct panel_desc newhaven_nhd_43_480272ef_atxl = {
26632664
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
26642665
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE |
26652666
DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
2667+
.connector_type = DRM_MODE_CONNECTOR_DPI,
26662668
};
26672669

26682670
static const struct display_timing nlt_nl192108ac18_02d_timing = {

drivers/gpu/drm/sun4i/sun8i_mixer.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,19 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
363363
mixer->engine.ops = &sun8i_engine_ops;
364364
mixer->engine.node = dev->of_node;
365365

366+
if (of_find_property(dev->of_node, "iommus", NULL)) {
367+
/*
368+
* This assume we have the same DMA constraints for
369+
* all our the mixers in our pipeline. This sounds
370+
* bad, but it has always been the case for us, and
371+
* DRM doesn't do per-device allocation either, so we
372+
* would need to fix DRM first...
373+
*/
374+
ret = of_dma_configure(drm->dev, dev->of_node, true);
375+
if (ret)
376+
return ret;
377+
}
378+
366379
/*
367380
* While this function can fail, we shouldn't do anything
368381
* if this happens. Some early DE2 DT entries don't provide

drivers/gpu/drm/ttm/ttm_bo.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,10 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
883883
if (!fence)
884884
return 0;
885885

886-
if (no_wait_gpu)
886+
if (no_wait_gpu) {
887+
dma_fence_put(fence);
887888
return -EBUSY;
889+
}
888890

889891
dma_resv_add_shared_fence(bo->base.resv, fence);
890892

drivers/gpu/drm/ttm/ttm_bo_vm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,10 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
300300
break;
301301
case -EBUSY:
302302
case -ERESTARTSYS:
303+
dma_fence_put(moving);
303304
return VM_FAULT_NOPAGE;
304305
default:
306+
dma_fence_put(moving);
305307
return VM_FAULT_SIGBUS;
306308
}
307309

drivers/video/fbdev/core/fbcon.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2402,7 +2402,8 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
24022402
ops->graphics = 1;
24032403

24042404
if (!blank) {
2405-
var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
2405+
var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE |
2406+
FB_ACTIVATE_KD_TEXT;
24062407
fb_set_var(info, &var);
24072408
ops->graphics = 0;
24082409
ops->var = info->var;

drivers/video/fbdev/uvesafb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1836,7 +1836,7 @@ static int uvesafb_setup(char *options)
18361836
else if (!strcmp(this_opt, "noedid"))
18371837
noedid = true;
18381838
else if (!strcmp(this_opt, "noblank"))
1839-
blank = true;
1839+
blank = false;
18401840
else if (!strncmp(this_opt, "vtotal:", 7))
18411841
vram_total = simple_strtoul(this_opt + 7, NULL, 0);
18421842
else if (!strncmp(this_opt, "vremap:", 7))

0 commit comments

Comments
 (0)