Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <airlied@redhat.com>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20200625082717.GA14856@linux-uq9g

+91 -34
+57 -22
drivers/gpu/drm/drm_fb_helper.c
··· 227 227 } 228 228 EXPORT_SYMBOL(drm_fb_helper_debug_leave); 229 229 230 + static int 231 + __drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper, 232 + bool force) 233 + { 234 + bool do_delayed; 235 + int ret; 236 + 237 + if (!drm_fbdev_emulation || !fb_helper) 238 + return -ENODEV; 239 + 240 + if (READ_ONCE(fb_helper->deferred_setup)) 241 + return 0; 242 + 243 + mutex_lock(&fb_helper->lock); 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 + } 254 + 255 + do_delayed = fb_helper->delayed_hotplug; 256 + if (do_delayed) 257 + fb_helper->delayed_hotplug = false; 258 + mutex_unlock(&fb_helper->lock); 259 + 260 + if (do_delayed) 261 + drm_fb_helper_hotplug_event(fb_helper); 262 + 263 + return ret; 264 + } 265 + 230 266 /** 231 267 * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration 232 268 * @fb_helper: driver-allocated fbdev helper, can be NULL ··· 276 240 */ 277 241 int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper) 278 242 { 279 - bool do_delayed; 280 - int ret; 281 - 282 - if (!drm_fbdev_emulation || !fb_helper) 283 - return -ENODEV; 284 - 285 - if (READ_ONCE(fb_helper->deferred_setup)) 286 - return 0; 287 - 288 - mutex_lock(&fb_helper->lock); 289 - ret = drm_client_modeset_commit(&fb_helper->client); 290 - 291 - do_delayed = fb_helper->delayed_hotplug; 292 - if (do_delayed) 293 - fb_helper->delayed_hotplug = false; 294 - mutex_unlock(&fb_helper->lock); 295 - 296 - if (do_delayed) 297 - drm_fb_helper_hotplug_event(fb_helper); 298 - 299 - return ret; 243 + return __drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper, false); 300 244 } 301 245 EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked); 302 246 ··· 1334 1318 { 1335 1319 struct drm_fb_helper *fb_helper = info->par; 1336 1320 struct fb_var_screeninfo *var = &info->var; 1321 + bool force; 1337 1322 1338 1323 if (oops_in_progress) 1339 1324 return -EBUSY; ··· 1344 1327 return -EINVAL; 1345 1328 } 1346 1329 1347 - drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper); 1330 + /* 1331 + * Normally we want to make sure that a kms master takes precedence over 1332 + * fbdev, to avoid fbdev flickering and occasionally stealing the 1333 + * display status. But Xorg first sets the vt back to text mode using 1334 + * the KDSET IOCTL with KD_TEXT, and only after that drops the master 1335 + * status when exiting. 1336 + * 1337 + * In the past this was caught by drm_fb_helper_lastclose(), but on 1338 + * modern systems where logind always keeps a drm fd open to orchestrate 1339 + * the vt switching, this doesn't work. 1340 + * 1341 + * To not break the userspace ABI we have this special case here, which 1342 + * is only used for the above case. Everything else uses the normal 1343 + * commit function, which ensures that we never steal the display from 1344 + * an active drm master. 1345 + */ 1346 + force = var->activate & FB_ACTIVATE_KD_TEXT; 1347 + 1348 + __drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper, force); 1348 1349 1349 1350 return 0; 1350 1351 }
+7 -7
drivers/gpu/drm/drm_panel_orientation_quirks.c
··· 30 30 int orientation; 31 31 }; 32 32 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 - 39 33 static const struct drm_dmi_panel_orientation_data asus_t100ha = { 40 34 .width = 800, 41 35 .height = 1280, ··· 108 114 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"), 109 115 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), 110 116 }, 111 - .driver_data = (void *)&acer_s1003, 117 + .driver_data = (void *)&lcd800x1280_rightside_up, 112 118 }, { /* Asus T100HA */ 113 119 .matches = { 114 120 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 115 121 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100HAN"), 116 122 }, 117 123 .driver_data = (void *)&asus_t100ha, 124 + }, { /* Asus T101HA */ 125 + .matches = { 126 + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 127 + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T101HA"), 128 + }, 129 + .driver_data = (void *)&lcd800x1280_rightside_up, 118 130 }, { /* GPD MicroPC (generic strings, also match on bios date) */ 119 131 .matches = { 120 132 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"),
+1 -1
drivers/gpu/drm/mcde/mcde_display.c
··· 812 812 struct drm_crtc *crtc = &pipe->crtc; 813 813 struct drm_plane *plane = &pipe->plane; 814 814 struct drm_device *drm = crtc->dev; 815 - struct mcde *mcde = drm->dev_private; 815 + struct mcde *mcde = to_mcde(drm); 816 816 const struct drm_display_mode *mode = &cstate->mode; 817 817 struct drm_framebuffer *fb = plane->state->fb; 818 818 u32 format = fb->format->format;
+2 -1
drivers/gpu/drm/mcde/mcde_drv.c
··· 209 209 210 210 drm_mode_config_reset(drm); 211 211 drm_kms_helper_poll_init(drm); 212 - drm_fbdev_generic_setup(drm, 32); 213 212 214 213 return 0; 215 214 } ··· 262 263 ret = drm_dev_register(drm, 0); 263 264 if (ret < 0) 264 265 goto unbind; 266 + 267 + drm_fbdev_generic_setup(drm, 32); 265 268 266 269 return 0; 267 270
+2
drivers/gpu/drm/panel/panel-simple.c
··· 2495 2495 .bus_format = MEDIA_BUS_FMT_RGB888_1X24, 2496 2496 .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE | 2497 2497 DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE, 2498 + .connector_type = DRM_MODE_CONNECTOR_DPI, 2498 2499 }; 2499 2500 2500 2501 static const struct panel_desc mitsubishi_aa070mc01 = { ··· 2664 2663 .bus_format = MEDIA_BUS_FMT_RGB888_1X24, 2665 2664 .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE | 2666 2665 DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE, 2666 + .connector_type = DRM_MODE_CONNECTOR_DPI, 2667 2667 }; 2668 2668 2669 2669 static const struct display_timing nlt_nl192108ac18_02d_timing = {
+13
drivers/gpu/drm/sun4i/sun8i_mixer.c
··· 363 363 mixer->engine.ops = &sun8i_engine_ops; 364 364 mixer->engine.node = dev->of_node; 365 365 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 + 366 379 /* 367 380 * While this function can fail, we shouldn't do anything 368 381 * if this happens. Some early DE2 DT entries don't provide
+3 -1
drivers/gpu/drm/ttm/ttm_bo.c
··· 883 883 if (!fence) 884 884 return 0; 885 885 886 - if (no_wait_gpu) 886 + if (no_wait_gpu) { 887 + dma_fence_put(fence); 887 888 return -EBUSY; 889 + } 888 890 889 891 dma_resv_add_shared_fence(bo->base.resv, fence); 890 892
+2
drivers/gpu/drm/ttm/ttm_bo_vm.c
··· 300 300 break; 301 301 case -EBUSY: 302 302 case -ERESTARTSYS: 303 + dma_fence_put(moving); 303 304 return VM_FAULT_NOPAGE; 304 305 default: 306 + dma_fence_put(moving); 305 307 return VM_FAULT_SIGBUS; 306 308 } 307 309
+2 -1
drivers/video/fbdev/core/fbcon.c
··· 2402 2402 ops->graphics = 1; 2403 2403 2404 2404 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; 2406 2407 fb_set_var(info, &var); 2407 2408 ops->graphics = 0; 2408 2409 ops->var = info->var;
+1 -1
drivers/video/fbdev/uvesafb.c
··· 1836 1836 else if (!strcmp(this_opt, "noedid")) 1837 1837 noedid = true; 1838 1838 else if (!strcmp(this_opt, "noblank")) 1839 - blank = true; 1839 + blank = false; 1840 1840 else if (!strncmp(this_opt, "vtotal:", 7)) 1841 1841 vram_total = simple_strtoul(this_opt + 7, NULL, 0); 1842 1842 else if (!strncmp(this_opt, "vremap:", 7))
+1
include/uapi/linux/fb.h
··· 205 205 #define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */ 206 206 #define FB_ACTIVATE_FORCE 128 /* force apply even when no change*/ 207 207 #define FB_ACTIVATE_INV_MODE 256 /* invalidate videomode */ 208 + #define FB_ACTIVATE_KD_TEXT 512 /* for KDSET vt ioctl */ 208 209 209 210 #define FB_ACCELF_TEXT 1 /* (OBSOLETE) see fb_info.flags and vc_mode */ 210 211