Commit 687a0ed3 authored by Dave Airlie's avatar Dave Airlie

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: default avatarDave Airlie <airlied@redhat.com>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20200625082717.GA14856@linux-uq9g
parents 5b83c254 dc5bdb68
...@@ -227,18 +227,9 @@ int drm_fb_helper_debug_leave(struct fb_info *info) ...@@ -227,18 +227,9 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
} }
EXPORT_SYMBOL(drm_fb_helper_debug_leave); EXPORT_SYMBOL(drm_fb_helper_debug_leave);
/** static int
* drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration __drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper,
* @fb_helper: driver-allocated fbdev helper, can be NULL bool force)
*
* This should be called from driver's drm &drm_driver.lastclose callback
* when implementing an fbcon on top of kms using this helper. This ensures that
* the user isn't greeted with a black screen when e.g. X dies.
*
* RETURNS:
* Zero if everything went ok, negative error code otherwise.
*/
int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
{ {
bool do_delayed; bool do_delayed;
int ret; int ret;
...@@ -250,7 +241,16 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper) ...@@ -250,7 +241,16 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
return 0; return 0;
mutex_lock(&fb_helper->lock); mutex_lock(&fb_helper->lock);
if (force) {
/*
* Yes this is the _locked version which expects the master lock
* to be held. But for forced restores we're intentionally
* racing here, see drm_fb_helper_set_par().
*/
ret = drm_client_modeset_commit_locked(&fb_helper->client);
} else {
ret = drm_client_modeset_commit(&fb_helper->client); ret = drm_client_modeset_commit(&fb_helper->client);
}
do_delayed = fb_helper->delayed_hotplug; do_delayed = fb_helper->delayed_hotplug;
if (do_delayed) if (do_delayed)
...@@ -262,6 +262,22 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper) ...@@ -262,6 +262,22 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
return ret; return ret;
} }
/**
* drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
* @fb_helper: driver-allocated fbdev helper, can be NULL
*
* This should be called from driver's drm &drm_driver.lastclose callback
* when implementing an fbcon on top of kms using this helper. This ensures that
* the user isn't greeted with a black screen when e.g. X dies.
*
* RETURNS:
* Zero if everything went ok, negative error code otherwise.
*/
int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
{
return __drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper, false);
}
EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked); EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked);
#ifdef CONFIG_MAGIC_SYSRQ #ifdef CONFIG_MAGIC_SYSRQ
...@@ -1318,6 +1334,7 @@ int drm_fb_helper_set_par(struct fb_info *info) ...@@ -1318,6 +1334,7 @@ int drm_fb_helper_set_par(struct fb_info *info)
{ {
struct drm_fb_helper *fb_helper = info->par; struct drm_fb_helper *fb_helper = info->par;
struct fb_var_screeninfo *var = &info->var; struct fb_var_screeninfo *var = &info->var;
bool force;
if (oops_in_progress) if (oops_in_progress)
return -EBUSY; return -EBUSY;
...@@ -1327,7 +1344,25 @@ int drm_fb_helper_set_par(struct fb_info *info) ...@@ -1327,7 +1344,25 @@ int drm_fb_helper_set_par(struct fb_info *info)
return -EINVAL; return -EINVAL;
} }
drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper); /*
* Normally we want to make sure that a kms master takes precedence over
* fbdev, to avoid fbdev flickering and occasionally stealing the
* display status. But Xorg first sets the vt back to text mode using
* the KDSET IOCTL with KD_TEXT, and only after that drops the master
* status when exiting.
*
* In the past this was caught by drm_fb_helper_lastclose(), but on
* modern systems where logind always keeps a drm fd open to orchestrate
* the vt switching, this doesn't work.
*
* To not break the userspace ABI we have this special case here, which
* is only used for the above case. Everything else uses the normal
* commit function, which ensures that we never steal the display from
* an active drm master.
*/
force = var->activate & FB_ACTIVATE_KD_TEXT;
__drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper, force);
return 0; return 0;
} }
......
...@@ -30,12 +30,6 @@ struct drm_dmi_panel_orientation_data { ...@@ -30,12 +30,6 @@ struct drm_dmi_panel_orientation_data {
int orientation; int orientation;
}; };
static const struct drm_dmi_panel_orientation_data acer_s1003 = {
.width = 800,
.height = 1280,
.orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
};
static const struct drm_dmi_panel_orientation_data asus_t100ha = { static const struct drm_dmi_panel_orientation_data asus_t100ha = {
.width = 800, .width = 800,
.height = 1280, .height = 1280,
...@@ -114,13 +108,19 @@ static const struct dmi_system_id orientation_data[] = { ...@@ -114,13 +108,19 @@ static const struct dmi_system_id orientation_data[] = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"), DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"),
}, },
.driver_data = (void *)&acer_s1003, .driver_data = (void *)&lcd800x1280_rightside_up,
}, { /* Asus T100HA */ }, { /* Asus T100HA */
.matches = { .matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100HAN"), DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100HAN"),
}, },
.driver_data = (void *)&asus_t100ha, .driver_data = (void *)&asus_t100ha,
}, { /* Asus T101HA */
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T101HA"),
},
.driver_data = (void *)&lcd800x1280_rightside_up,
}, { /* GPD MicroPC (generic strings, also match on bios date) */ }, { /* GPD MicroPC (generic strings, also match on bios date) */
.matches = { .matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"), DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"),
......
...@@ -812,7 +812,7 @@ static void mcde_display_enable(struct drm_simple_display_pipe *pipe, ...@@ -812,7 +812,7 @@ static void mcde_display_enable(struct drm_simple_display_pipe *pipe,
struct drm_crtc *crtc = &pipe->crtc; struct drm_crtc *crtc = &pipe->crtc;
struct drm_plane *plane = &pipe->plane; struct drm_plane *plane = &pipe->plane;
struct drm_device *drm = crtc->dev; struct drm_device *drm = crtc->dev;
struct mcde *mcde = drm->dev_private; struct mcde *mcde = to_mcde(drm);
const struct drm_display_mode *mode = &cstate->mode; const struct drm_display_mode *mode = &cstate->mode;
struct drm_framebuffer *fb = plane->state->fb; struct drm_framebuffer *fb = plane->state->fb;
u32 format = fb->format->format; u32 format = fb->format->format;
......
...@@ -209,7 +209,6 @@ static int mcde_modeset_init(struct drm_device *drm) ...@@ -209,7 +209,6 @@ static int mcde_modeset_init(struct drm_device *drm)
drm_mode_config_reset(drm); drm_mode_config_reset(drm);
drm_kms_helper_poll_init(drm); drm_kms_helper_poll_init(drm);
drm_fbdev_generic_setup(drm, 32);
return 0; return 0;
} }
...@@ -264,6 +263,8 @@ static int mcde_drm_bind(struct device *dev) ...@@ -264,6 +263,8 @@ static int mcde_drm_bind(struct device *dev)
if (ret < 0) if (ret < 0)
goto unbind; goto unbind;
drm_fbdev_generic_setup(drm, 32);
return 0; return 0;
unbind: unbind:
......
...@@ -2495,6 +2495,7 @@ static const struct panel_desc logicpd_type_28 = { ...@@ -2495,6 +2495,7 @@ static const struct panel_desc logicpd_type_28 = {
.bus_format = MEDIA_BUS_FMT_RGB888_1X24, .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE | .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE |
DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE, DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE,
.connector_type = DRM_MODE_CONNECTOR_DPI,
}; };
static const struct panel_desc mitsubishi_aa070mc01 = { static const struct panel_desc mitsubishi_aa070mc01 = {
...@@ -2663,6 +2664,7 @@ static const struct panel_desc newhaven_nhd_43_480272ef_atxl = { ...@@ -2663,6 +2664,7 @@ static const struct panel_desc newhaven_nhd_43_480272ef_atxl = {
.bus_format = MEDIA_BUS_FMT_RGB888_1X24, .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE | .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE |
DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE, DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
.connector_type = DRM_MODE_CONNECTOR_DPI,
}; };
static const struct display_timing nlt_nl192108ac18_02d_timing = { static const struct display_timing nlt_nl192108ac18_02d_timing = {
......
...@@ -363,6 +363,19 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, ...@@ -363,6 +363,19 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
mixer->engine.ops = &sun8i_engine_ops; mixer->engine.ops = &sun8i_engine_ops;
mixer->engine.node = dev->of_node; mixer->engine.node = dev->of_node;
if (of_find_property(dev->of_node, "iommus", NULL)) {
/*
* This assume we have the same DMA constraints for
* all our the mixers in our pipeline. This sounds
* bad, but it has always been the case for us, and
* DRM doesn't do per-device allocation either, so we
* would need to fix DRM first...
*/
ret = of_dma_configure(drm->dev, dev->of_node, true);
if (ret)
return ret;
}
/* /*
* While this function can fail, we shouldn't do anything * While this function can fail, we shouldn't do anything
* if this happens. Some early DE2 DT entries don't provide * if this happens. Some early DE2 DT entries don't provide
......
...@@ -883,8 +883,10 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, ...@@ -883,8 +883,10 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
if (!fence) if (!fence)
return 0; return 0;
if (no_wait_gpu) if (no_wait_gpu) {
dma_fence_put(fence);
return -EBUSY; return -EBUSY;
}
dma_resv_add_shared_fence(bo->base.resv, fence); dma_resv_add_shared_fence(bo->base.resv, fence);
......
...@@ -300,8 +300,10 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, ...@@ -300,8 +300,10 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
break; break;
case -EBUSY: case -EBUSY:
case -ERESTARTSYS: case -ERESTARTSYS:
dma_fence_put(moving);
return VM_FAULT_NOPAGE; return VM_FAULT_NOPAGE;
default: default:
dma_fence_put(moving);
return VM_FAULT_SIGBUS; return VM_FAULT_SIGBUS;
} }
......
...@@ -2402,7 +2402,8 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) ...@@ -2402,7 +2402,8 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
ops->graphics = 1; ops->graphics = 1;
if (!blank) { if (!blank) {
var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE; var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE |
FB_ACTIVATE_KD_TEXT;
fb_set_var(info, &var); fb_set_var(info, &var);
ops->graphics = 0; ops->graphics = 0;
ops->var = info->var; ops->var = info->var;
......
...@@ -1836,7 +1836,7 @@ static int uvesafb_setup(char *options) ...@@ -1836,7 +1836,7 @@ static int uvesafb_setup(char *options)
else if (!strcmp(this_opt, "noedid")) else if (!strcmp(this_opt, "noedid"))
noedid = true; noedid = true;
else if (!strcmp(this_opt, "noblank")) else if (!strcmp(this_opt, "noblank"))
blank = true; blank = false;
else if (!strncmp(this_opt, "vtotal:", 7)) else if (!strncmp(this_opt, "vtotal:", 7))
vram_total = simple_strtoul(this_opt + 7, NULL, 0); vram_total = simple_strtoul(this_opt + 7, NULL, 0);
else if (!strncmp(this_opt, "vremap:", 7)) else if (!strncmp(this_opt, "vremap:", 7))
......
...@@ -205,6 +205,7 @@ struct fb_bitfield { ...@@ -205,6 +205,7 @@ struct fb_bitfield {
#define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */ #define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */
#define FB_ACTIVATE_FORCE 128 /* force apply even when no change*/ #define FB_ACTIVATE_FORCE 128 /* force apply even when no change*/
#define FB_ACTIVATE_INV_MODE 256 /* invalidate videomode */ #define FB_ACTIVATE_INV_MODE 256 /* invalidate videomode */
#define FB_ACTIVATE_KD_TEXT 512 /* for KDSET vt ioctl */
#define FB_ACCELF_TEXT 1 /* (OBSOLETE) see fb_info.flags and vc_mode */ #define FB_ACCELF_TEXT 1 /* (OBSOLETE) see fb_info.flags and vc_mode */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment