Commit c8a04cbe authored by Daniel Vetter's avatar Daniel Vetter

Merge tag 'drm-misc-next-2021-11-29' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for 5.17:

UAPI Changes:

Cross-subsystem Changes:

 * Move 'nomodeset' kernel boot option into DRM subsystem

Core Changes:

 * Replace several DRM_*() logging macros with drm_*() equivalents
 * panel: Add quirk for Lenovo Yoga Book X91F/L
 * ttm: Documentation fixes

Driver Changes:

 * Cleanup nomodeset handling in drivers
 * Fixes
 * bridge/anx7625: Fix reading EDID; Fix error code
 * bridge/megachips: Probe both bridges before registering
 * vboxvideo: Fix ERR_PTR usage
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/YaSVz15Q7dAlEevU@linux-uq9g.fritz.box
parents c305ae99 69d84612
...@@ -3545,6 +3545,13 @@ ...@@ -3545,6 +3545,13 @@
shutdown the other cpus. Instead use the REBOOT_VECTOR shutdown the other cpus. Instead use the REBOOT_VECTOR
irq. irq.
nomodeset Disable kernel modesetting. DRM drivers will not perform
display-mode changes or accelerated rendering. Only the
system framebuffer will be available for use if this was
set-up by the firmware or boot loader.
Useful as fallback, or for testing and debugging.
nomodule Disable module load nomodule Disable module load
nopat [X86] Disable PAT (page attribute table extension of nopat [X86] Disable PAT (page attribute table extension of
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
menuconfig DRM menuconfig DRM
tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
select DRM_NOMODESET
select DRM_PANEL_ORIENTATION_QUIRKS select DRM_PANEL_ORIENTATION_QUIRKS
select HDMI select HDMI
select FB_CMDLINE select FB_CMDLINE
...@@ -492,6 +493,11 @@ config DRM_EXPORT_FOR_TESTS ...@@ -492,6 +493,11 @@ config DRM_EXPORT_FOR_TESTS
config DRM_PANEL_ORIENTATION_QUIRKS config DRM_PANEL_ORIENTATION_QUIRKS
tristate tristate
# Separate option because nomodeset parameter is global and expected built-in
config DRM_NOMODESET
bool
default n
config DRM_LIB_RANDOM config DRM_LIB_RANDOM
bool bool
default n default n
......
...@@ -33,6 +33,8 @@ drm-$(CONFIG_DRM_PRIVACY_SCREEN) += drm_privacy_screen.o drm_privacy_screen_x86. ...@@ -33,6 +33,8 @@ drm-$(CONFIG_DRM_PRIVACY_SCREEN) += drm_privacy_screen.o drm_privacy_screen_x86.
obj-$(CONFIG_DRM_DP_AUX_BUS) += drm_dp_aux_bus.o obj-$(CONFIG_DRM_DP_AUX_BUS) += drm_dp_aux_bus.o
obj-$(CONFIG_DRM_NOMODESET) += drm_nomodeset.o
drm_cma_helper-y := drm_gem_cma_helper.o drm_cma_helper-y := drm_gem_cma_helper.o
obj-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_cma_helper.o obj-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_cma_helper.o
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "amdgpu_drv.h" #include "amdgpu_drv.h"
#include <drm/drm_pciids.h> #include <drm/drm_pciids.h>
#include <linux/console.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/vga_switcheroo.h> #include <linux/vga_switcheroo.h>
...@@ -2516,10 +2515,8 @@ static int __init amdgpu_init(void) ...@@ -2516,10 +2515,8 @@ static int __init amdgpu_init(void)
{ {
int r; int r;
if (vgacon_text_force()) { if (drm_firmware_drivers_only())
DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
return -EINVAL; return -EINVAL;
}
r = amdgpu_sync_init(); r = amdgpu_sync_init();
if (r) if (r)
......
...@@ -116,17 +116,8 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, ...@@ -116,17 +116,8 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
abo = ttm_to_amdgpu_bo(bo); abo = ttm_to_amdgpu_bo(bo);
if (abo->flags & AMDGPU_AMDKFD_CREATE_SVM_BO) { if (abo->flags & AMDGPU_AMDKFD_CREATE_SVM_BO) {
struct dma_fence *fence;
struct dma_resv *resv = &bo->base._resv;
rcu_read_lock();
fence = rcu_dereference(resv->fence_excl);
if (fence && !fence->ops->signaled)
dma_fence_enable_sw_signaling(fence);
placement->num_placement = 0; placement->num_placement = 0;
placement->num_busy_placement = 0; placement->num_busy_placement = 0;
rcu_read_unlock();
return; return;
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
* Authors: Dave Airlie <airlied@redhat.com> * Authors: Dave Airlie <airlied@redhat.com>
*/ */
#include <linux/console.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -233,7 +232,7 @@ static struct pci_driver ast_pci_driver = { ...@@ -233,7 +232,7 @@ static struct pci_driver ast_pci_driver = {
static int __init ast_init(void) static int __init ast_init(void)
{ {
if (vgacon_text_force() && ast_modeset == -1) if (drm_firmware_drivers_only() && ast_modeset == -1)
return -EINVAL; return -EINVAL;
if (ast_modeset == 0) if (ast_modeset == 0)
......
...@@ -850,7 +850,7 @@ static int sp_tx_edid_read(struct anx7625_data *ctx, ...@@ -850,7 +850,7 @@ static int sp_tx_edid_read(struct anx7625_data *ctx,
int count, blocks_num; int count, blocks_num;
u8 pblock_buf[MAX_DPCD_BUFFER_SIZE]; u8 pblock_buf[MAX_DPCD_BUFFER_SIZE];
u8 i, j; u8 i, j;
u8 g_edid_break = 0; int g_edid_break = 0;
int ret; int ret;
struct device *dev = &ctx->client->dev; struct device *dev = &ctx->client->dev;
...@@ -881,7 +881,7 @@ static int sp_tx_edid_read(struct anx7625_data *ctx, ...@@ -881,7 +881,7 @@ static int sp_tx_edid_read(struct anx7625_data *ctx,
g_edid_break = edid_read(ctx, offset, g_edid_break = edid_read(ctx, offset,
pblock_buf); pblock_buf);
if (g_edid_break) if (g_edid_break < 0)
break; break;
memcpy(&pedid_blocks_buf[offset], memcpy(&pedid_blocks_buf[offset],
...@@ -1636,7 +1636,7 @@ static int anx7625_register_audio(struct device *dev, struct anx7625_data *ctx) ...@@ -1636,7 +1636,7 @@ static int anx7625_register_audio(struct device *dev, struct anx7625_data *ctx)
sizeof(codec_data)); sizeof(codec_data));
if (IS_ERR(ctx->audio_pdev)) if (IS_ERR(ctx->audio_pdev))
return IS_ERR(ctx->audio_pdev); return PTR_ERR(ctx->audio_pdev);
DRM_DEV_DEBUG_DRIVER(dev, "bound to %s", HDMI_CODEC_DRV_NAME); DRM_DEV_DEBUG_DRIVER(dev, "bound to %s", HDMI_CODEC_DRV_NAME);
......
...@@ -306,19 +306,10 @@ static void ge_b850v3_lvds_remove(void) ...@@ -306,19 +306,10 @@ static void ge_b850v3_lvds_remove(void)
mutex_unlock(&ge_b850v3_lvds_dev_mutex); mutex_unlock(&ge_b850v3_lvds_dev_mutex);
} }
static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, static int ge_b850v3_register(void)
const struct i2c_device_id *id)
{ {
struct i2c_client *stdp4028_i2c = ge_b850v3_lvds_ptr->stdp4028_i2c;
struct device *dev = &stdp4028_i2c->dev; struct device *dev = &stdp4028_i2c->dev;
int ret;
ret = ge_b850v3_lvds_init(dev);
if (ret)
return ret;
ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c;
i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr);
/* drm bridge initialization */ /* drm bridge initialization */
ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs; ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs;
...@@ -343,6 +334,27 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, ...@@ -343,6 +334,27 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c,
"ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr); "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr);
} }
static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c,
const struct i2c_device_id *id)
{
struct device *dev = &stdp4028_i2c->dev;
int ret;
ret = ge_b850v3_lvds_init(dev);
if (ret)
return ret;
ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c;
i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr);
/* Only register after both bridges are probed */
if (!ge_b850v3_lvds_ptr->stdp2690_i2c)
return 0;
return ge_b850v3_register();
}
static int stdp4028_ge_b850v3_fw_remove(struct i2c_client *stdp4028_i2c) static int stdp4028_ge_b850v3_fw_remove(struct i2c_client *stdp4028_i2c)
{ {
ge_b850v3_lvds_remove(); ge_b850v3_lvds_remove();
...@@ -386,7 +398,11 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_client *stdp2690_i2c, ...@@ -386,7 +398,11 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_client *stdp2690_i2c,
ge_b850v3_lvds_ptr->stdp2690_i2c = stdp2690_i2c; ge_b850v3_lvds_ptr->stdp2690_i2c = stdp2690_i2c;
i2c_set_clientdata(stdp2690_i2c, ge_b850v3_lvds_ptr); i2c_set_clientdata(stdp2690_i2c, ge_b850v3_lvds_ptr);
return 0; /* Only register after both bridges are probed */
if (!ge_b850v3_lvds_ptr->stdp4028_i2c)
return 0;
return ge_b850v3_register();
} }
static int stdp2690_ge_b850v3_fw_remove(struct i2c_client *stdp2690_i2c) static int stdp2690_ge_b850v3_fw_remove(struct i2c_client *stdp2690_i2c)
......
...@@ -74,7 +74,7 @@ int drm_crtc_commit_wait(struct drm_crtc_commit *commit) ...@@ -74,7 +74,7 @@ int drm_crtc_commit_wait(struct drm_crtc_commit *commit)
ret = wait_for_completion_timeout(&commit->hw_done, timeout); ret = wait_for_completion_timeout(&commit->hw_done, timeout);
if (!ret) { if (!ret) {
DRM_ERROR("hw_done timed out\n"); drm_err(commit->crtc->dev, "hw_done timed out\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -84,7 +84,7 @@ int drm_crtc_commit_wait(struct drm_crtc_commit *commit) ...@@ -84,7 +84,7 @@ int drm_crtc_commit_wait(struct drm_crtc_commit *commit)
*/ */
ret = wait_for_completion_timeout(&commit->flip_done, timeout); ret = wait_for_completion_timeout(&commit->flip_done, timeout);
if (!ret) { if (!ret) {
DRM_ERROR("flip_done timed out\n"); drm_err(commit->crtc->dev, "flip_done timed out\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -140,7 +140,7 @@ drm_atomic_state_init(struct drm_device *dev, struct drm_atomic_state *state) ...@@ -140,7 +140,7 @@ drm_atomic_state_init(struct drm_device *dev, struct drm_atomic_state *state)
state->dev = dev; state->dev = dev;
DRM_DEBUG_ATOMIC("Allocated atomic state %p\n", state); drm_dbg_atomic(dev, "Allocated atomic state %p\n", state);
return 0; return 0;
fail: fail:
...@@ -191,7 +191,7 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) ...@@ -191,7 +191,7 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
struct drm_mode_config *config = &dev->mode_config; struct drm_mode_config *config = &dev->mode_config;
int i; int i;
DRM_DEBUG_ATOMIC("Clearing atomic state %p\n", state); drm_dbg_atomic(dev, "Clearing atomic state %p\n", state);
for (i = 0; i < state->num_connector; i++) { for (i = 0; i < state->num_connector; i++) {
struct drm_connector *connector = state->connectors[i].ptr; struct drm_connector *connector = state->connectors[i].ptr;
...@@ -301,7 +301,7 @@ void __drm_atomic_state_free(struct kref *ref) ...@@ -301,7 +301,7 @@ void __drm_atomic_state_free(struct kref *ref)
drm_atomic_state_clear(state); drm_atomic_state_clear(state);
DRM_DEBUG_ATOMIC("Freeing atomic state %p\n", state); drm_dbg_atomic(state->dev, "Freeing atomic state %p\n", state);
if (config->funcs->atomic_state_free) { if (config->funcs->atomic_state_free) {
config->funcs->atomic_state_free(state); config->funcs->atomic_state_free(state);
...@@ -358,8 +358,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state, ...@@ -358,8 +358,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
state->crtcs[index].ptr = crtc; state->crtcs[index].ptr = crtc;
crtc_state->state = state; crtc_state->state = state;
DRM_DEBUG_ATOMIC("Added [CRTC:%d:%s] %p state to %p\n", drm_dbg_atomic(state->dev, "Added [CRTC:%d:%s] %p state to %p\n",
crtc->base.id, crtc->name, crtc_state, state); crtc->base.id, crtc->name, crtc_state, state);
return crtc_state; return crtc_state;
} }
...@@ -379,8 +379,9 @@ static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state, ...@@ -379,8 +379,9 @@ static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state,
*/ */
if (new_crtc_state->active && !new_crtc_state->enable) { if (new_crtc_state->active && !new_crtc_state->enable) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] active without enabled\n", drm_dbg_atomic(crtc->dev,
crtc->base.id, crtc->name); "[CRTC:%d:%s] active without enabled\n",
crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
} }
...@@ -390,15 +391,17 @@ static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state, ...@@ -390,15 +391,17 @@ static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state,
*/ */
if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) && if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) &&
WARN_ON(new_crtc_state->enable && !new_crtc_state->mode_blob)) { WARN_ON(new_crtc_state->enable && !new_crtc_state->mode_blob)) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] enabled without mode blob\n", drm_dbg_atomic(crtc->dev,
crtc->base.id, crtc->name); "[CRTC:%d:%s] enabled without mode blob\n",
crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
} }
if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) && if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) &&
WARN_ON(!new_crtc_state->enable && new_crtc_state->mode_blob)) { WARN_ON(!new_crtc_state->enable && new_crtc_state->mode_blob)) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] disabled with mode blob\n", drm_dbg_atomic(crtc->dev,
crtc->base.id, crtc->name); "[CRTC:%d:%s] disabled with mode blob\n",
crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
} }
...@@ -414,8 +417,9 @@ static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state, ...@@ -414,8 +417,9 @@ static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state,
*/ */
if (new_crtc_state->event && if (new_crtc_state->event &&
!new_crtc_state->active && !old_crtc_state->active) { !new_crtc_state->active && !old_crtc_state->active) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requesting event but off\n", drm_dbg_atomic(crtc->dev,
crtc->base.id, crtc->name); "[CRTC:%d:%s] requesting event but off\n",
crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
} }
...@@ -460,8 +464,9 @@ static int drm_atomic_connector_check(struct drm_connector *connector, ...@@ -460,8 +464,9 @@ static int drm_atomic_connector_check(struct drm_connector *connector,
return 0; return 0;
if (writeback_job->fb && !state->crtc) { if (writeback_job->fb && !state->crtc) {
DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] framebuffer without CRTC\n", drm_dbg_atomic(connector->dev,
connector->base.id, connector->name); "[CONNECTOR:%d:%s] framebuffer without CRTC\n",
connector->base.id, connector->name);
return -EINVAL; return -EINVAL;
} }
...@@ -470,16 +475,18 @@ static int drm_atomic_connector_check(struct drm_connector *connector, ...@@ -470,16 +475,18 @@ static int drm_atomic_connector_check(struct drm_connector *connector,
state->crtc); state->crtc);
if (writeback_job->fb && !crtc_state->active) { if (writeback_job->fb && !crtc_state->active) {
DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] has framebuffer, but [CRTC:%d] is off\n", drm_dbg_atomic(connector->dev,
connector->base.id, connector->name, "[CONNECTOR:%d:%s] has framebuffer, but [CRTC:%d] is off\n",
state->crtc->base.id); connector->base.id, connector->name,
state->crtc->base.id);
return -EINVAL; return -EINVAL;
} }
if (!writeback_job->fb) { if (!writeback_job->fb) {
if (writeback_job->out_fence) { if (writeback_job->out_fence) {
DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n", drm_dbg_atomic(connector->dev,
connector->base.id, connector->name); "[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n",
connector->base.id, connector->name);
return -EINVAL; return -EINVAL;
} }
...@@ -537,8 +544,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, ...@@ -537,8 +544,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
state->planes[index].new_state = plane_state; state->planes[index].new_state = plane_state;
plane_state->state = state; plane_state->state = state;
DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n", drm_dbg_atomic(plane->dev, "Added [PLANE:%d:%s] %p state to %p\n",
plane->base.id, plane->name, plane_state, state); plane->base.id, plane->name, plane_state, state);
if (plane_state->crtc) { if (plane_state->crtc) {
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
...@@ -594,12 +601,12 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state, ...@@ -594,12 +601,12 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
/* either *both* CRTC and FB must be set, or neither */ /* either *both* CRTC and FB must be set, or neither */
if (crtc && !fb) { if (crtc && !fb) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] CRTC set but no FB\n", drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] CRTC set but no FB\n",
plane->base.id, plane->name); plane->base.id, plane->name);
return -EINVAL; return -EINVAL;
} else if (fb && !crtc) { } else if (fb && !crtc) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] FB set but no CRTC\n", drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] FB set but no CRTC\n",
plane->base.id, plane->name); plane->base.id, plane->name);
return -EINVAL; return -EINVAL;
} }
...@@ -609,9 +616,10 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state, ...@@ -609,9 +616,10 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
/* Check whether this plane is usable on this CRTC */ /* Check whether this plane is usable on this CRTC */
if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) { if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
DRM_DEBUG_ATOMIC("Invalid [CRTC:%d:%s] for [PLANE:%d:%s]\n", drm_dbg_atomic(plane->dev,
crtc->base.id, crtc->name, "Invalid [CRTC:%d:%s] for [PLANE:%d:%s]\n",
plane->base.id, plane->name); crtc->base.id, crtc->name,
plane->base.id, plane->name);
return -EINVAL; return -EINVAL;
} }
...@@ -619,9 +627,10 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state, ...@@ -619,9 +627,10 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
ret = drm_plane_check_pixel_format(plane, fb->format->format, ret = drm_plane_check_pixel_format(plane, fb->format->format,
fb->modifier); fb->modifier);
if (ret) { if (ret) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] invalid pixel format %p4cc, modifier 0x%llx\n", drm_dbg_atomic(plane->dev,
plane->base.id, plane->name, "[PLANE:%d:%s] invalid pixel format %p4cc, modifier 0x%llx\n",
&fb->format->format, fb->modifier); plane->base.id, plane->name,
&fb->format->format, fb->modifier);
return ret; return ret;
} }
...@@ -630,10 +639,11 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state, ...@@ -630,10 +639,11 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
new_plane_state->crtc_x > INT_MAX - (int32_t) new_plane_state->crtc_w || new_plane_state->crtc_x > INT_MAX - (int32_t) new_plane_state->crtc_w ||
new_plane_state->crtc_h > INT_MAX || new_plane_state->crtc_h > INT_MAX ||
new_plane_state->crtc_y > INT_MAX - (int32_t) new_plane_state->crtc_h) { new_plane_state->crtc_y > INT_MAX - (int32_t) new_plane_state->crtc_h) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] invalid CRTC coordinates %ux%u+%d+%d\n", drm_dbg_atomic(plane->dev,
plane->base.id, plane->name, "[PLANE:%d:%s] invalid CRTC coordinates %ux%u+%d+%d\n",
new_plane_state->crtc_w, new_plane_state->crtc_h, plane->base.id, plane->name,
new_plane_state->crtc_x, new_plane_state->crtc_y); new_plane_state->crtc_w, new_plane_state->crtc_h,
new_plane_state->crtc_x, new_plane_state->crtc_y);
return -ERANGE; return -ERANGE;
} }
...@@ -645,18 +655,19 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state, ...@@ -645,18 +655,19 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
new_plane_state->src_x > fb_width - new_plane_state->src_w || new_plane_state->src_x > fb_width - new_plane_state->src_w ||
new_plane_state->src_h > fb_height || new_plane_state->src_h > fb_height ||
new_plane_state->src_y > fb_height - new_plane_state->src_h) { new_plane_state->src_y > fb_height - new_plane_state->src_h) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] invalid source coordinates " drm_dbg_atomic(plane->dev,
"%u.%06ux%u.%06u+%u.%06u+%u.%06u (fb %ux%u)\n", "[PLANE:%d:%s] invalid source coordinates "
plane->base.id, plane->name, "%u.%06ux%u.%06u+%u.%06u+%u.%06u (fb %ux%u)\n",
new_plane_state->src_w >> 16, plane->base.id, plane->name,
((new_plane_state->src_w & 0xffff) * 15625) >> 10, new_plane_state->src_w >> 16,
new_plane_state->src_h >> 16, ((new_plane_state->src_w & 0xffff) * 15625) >> 10,
((new_plane_state->src_h & 0xffff) * 15625) >> 10, new_plane_state->src_h >> 16,
new_plane_state->src_x >> 16, ((new_plane_state->src_h & 0xffff) * 15625) >> 10,
((new_plane_state->src_x & 0xffff) * 15625) >> 10, new_plane_state->src_x >> 16,
new_plane_state->src_y >> 16, ((new_plane_state->src_x & 0xffff) * 15625) >> 10,
((new_plane_state->src_y & 0xffff) * 15625) >> 10, new_plane_state->src_y >> 16,
fb->width, fb->height); ((new_plane_state->src_y & 0xffff) * 15625) >> 10,
fb->width, fb->height);
return -ENOSPC; return -ENOSPC;
} }
...@@ -671,9 +682,10 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state, ...@@ -671,9 +682,10 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
clips->y1 < 0 || clips->y1 < 0 ||
clips->x2 > fb_width || clips->x2 > fb_width ||
clips->y2 > fb_height) { clips->y2 > fb_height) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] invalid damage clip %d %d %d %d\n", drm_dbg_atomic(plane->dev,
plane->base.id, plane->name, clips->x1, "[PLANE:%d:%s] invalid damage clip %d %d %d %d\n",
clips->y1, clips->x2, clips->y2); plane->base.id, plane->name, clips->x1,
clips->y1, clips->x2, clips->y2);
return -EINVAL; return -EINVAL;
} }
clips++; clips++;
...@@ -681,8 +693,9 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state, ...@@ -681,8 +693,9 @@ static int drm_atomic_plane_check(const struct drm_plane_state *old_plane_state,
} }
if (plane_switching_crtc(old_plane_state, new_plane_state)) { if (plane_switching_crtc(old_plane_state, new_plane_state)) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] switching CRTC directly\n", drm_dbg_atomic(plane->dev,
plane->base.id, plane->name); "[PLANE:%d:%s] switching CRTC directly\n",
plane->base.id, plane->name);
return -EINVAL; return -EINVAL;
} }
...@@ -846,8 +859,9 @@ drm_atomic_get_private_obj_state(struct drm_atomic_state *state, ...@@ -846,8 +859,9 @@ drm_atomic_get_private_obj_state(struct drm_atomic_state *state,
state->num_private_objs = num_objs; state->num_private_objs = num_objs;
DRM_DEBUG_ATOMIC("Added new private object %p state %p to %p\n", drm_dbg_atomic(state->dev,
obj, obj_state, state); "Added new private object %p state %p to %p\n",
obj, obj_state, state);
return obj_state; return obj_state;
} }
...@@ -1027,7 +1041,7 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state, ...@@ -1027,7 +1041,7 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
state->connectors[index].ptr = connector; state->connectors[index].ptr = connector;
connector_state->state = state; connector_state->state = state;
DRM_DEBUG_ATOMIC("Added [CONNECTOR:%d:%s] %p state to %p\n", drm_dbg_atomic(connector->dev, "Added [CONNECTOR:%d:%s] %p state to %p\n",
connector->base.id, connector->name, connector->base.id, connector->name,
connector_state, state); connector_state, state);
...@@ -1160,8 +1174,9 @@ drm_atomic_add_encoder_bridges(struct drm_atomic_state *state, ...@@ -1160,8 +1174,9 @@ drm_atomic_add_encoder_bridges(struct drm_atomic_state *state,
if (!encoder) if (!encoder)
return 0; return 0;
DRM_DEBUG_ATOMIC("Adding all bridges for [encoder:%d:%s] to %p\n", drm_dbg_atomic(encoder->dev,
encoder->base.id, encoder->name, state); "Adding all bridges for [encoder:%d:%s] to %p\n",
encoder->base.id, encoder->name, state);
drm_for_each_bridge_in_chain(encoder, bridge) { drm_for_each_bridge_in_chain(encoder, bridge) {
/* Skip bridges that don't implement the atomic state hooks. */ /* Skip bridges that don't implement the atomic state hooks. */
...@@ -1213,8 +1228,9 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state, ...@@ -1213,8 +1228,9 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state,
if (ret) if (ret)
return ret; return ret;
DRM_DEBUG_ATOMIC("Adding all current connectors for [CRTC:%d:%s] to %p\n", drm_dbg_atomic(crtc->dev,
crtc->base.id, crtc->name, state); "Adding all current connectors for [CRTC:%d:%s] to %p\n",
crtc->base.id, crtc->name, state);
/* /*
* Changed connectors are already in @state, so only need to look * Changed connectors are already in @state, so only need to look
...@@ -1267,8 +1283,9 @@ drm_atomic_add_affected_planes(struct drm_atomic_state *state, ...@@ -1267,8 +1283,9 @@ drm_atomic_add_affected_planes(struct drm_atomic_state *state,
WARN_ON(!drm_atomic_get_new_crtc_state(state, crtc)); WARN_ON(!drm_atomic_get_new_crtc_state(state, crtc));
DRM_DEBUG_ATOMIC("Adding all current planes for [CRTC:%d:%s] to %p\n", drm_dbg_atomic(crtc->dev,
crtc->base.id, crtc->name, state); "Adding all current planes for [CRTC:%d:%s] to %p\n",
crtc->base.id, crtc->name, state);
drm_for_each_plane_mask(plane, state->dev, old_crtc_state->plane_mask) { drm_for_each_plane_mask(plane, state->dev, old_crtc_state->plane_mask) {
struct drm_plane_state *plane_state = struct drm_plane_state *plane_state =
...@@ -1308,7 +1325,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ...@@ -1308,7 +1325,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
unsigned int affected_crtc = 0; unsigned int affected_crtc = 0;
int i, ret = 0; int i, ret = 0;
DRM_DEBUG_ATOMIC("checking %p\n", state); drm_dbg_atomic(dev, "checking %p\n", state);
for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
requested_crtc |= drm_crtc_mask(crtc); requested_crtc |= drm_crtc_mask(crtc);
...@@ -1316,8 +1333,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ...@@ -1316,8 +1333,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
ret = drm_atomic_plane_check(old_plane_state, new_plane_state); ret = drm_atomic_plane_check(old_plane_state, new_plane_state);
if (ret) { if (ret) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic core check failed\n", drm_dbg_atomic(dev, "[PLANE:%d:%s] atomic core check failed\n",
plane->base.id, plane->name); plane->base.id, plane->name);
return ret; return ret;
} }
} }
...@@ -1325,8 +1342,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ...@@ -1325,8 +1342,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
ret = drm_atomic_crtc_check(old_crtc_state, new_crtc_state); ret = drm_atomic_crtc_check(old_crtc_state, new_crtc_state);
if (ret) { if (ret) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic core check failed\n", drm_dbg_atomic(dev, "[CRTC:%d:%s] atomic core check failed\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
return ret; return ret;
} }
} }
...@@ -1334,8 +1351,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ...@@ -1334,8 +1351,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
for_each_new_connector_in_state(state, conn, conn_state, i) { for_each_new_connector_in_state(state, conn, conn_state, i) {
ret = drm_atomic_connector_check(conn, conn_state); ret = drm_atomic_connector_check(conn, conn_state);
if (ret) { if (ret) {
DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] atomic core check failed\n", drm_dbg_atomic(dev, "[CONNECTOR:%d:%s] atomic core check failed\n",
conn->base.id, conn->name); conn->base.id, conn->name);
return ret; return ret;
} }
} }
...@@ -1344,8 +1361,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ...@@ -1344,8 +1361,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
ret = config->funcs->atomic_check(state->dev, state); ret = config->funcs->atomic_check(state->dev, state);
if (ret) { if (ret) {
DRM_DEBUG_ATOMIC("atomic driver check for %p failed: %d\n", drm_dbg_atomic(dev, "atomic driver check for %p failed: %d\n",
state, ret); state, ret);
return ret; return ret;
} }
} }
...@@ -1353,8 +1370,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ...@@ -1353,8 +1370,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
if (!state->allow_modeset) { if (!state->allow_modeset) {
for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
if (drm_atomic_crtc_needs_modeset(new_crtc_state)) { if (drm_atomic_crtc_needs_modeset(new_crtc_state)) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requires full modeset\n", drm_dbg_atomic(dev, "[CRTC:%d:%s] requires full modeset\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -1374,8 +1391,9 @@ int drm_atomic_check_only(struct drm_atomic_state *state) ...@@ -1374,8 +1391,9 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
* so compositors know what's going on. * so compositors know what's going on.
*/ */
if (affected_crtc != requested_crtc) { if (affected_crtc != requested_crtc) {
DRM_DEBUG_ATOMIC("driver added CRTC to commit: requested 0x%x, affected 0x%0x\n", drm_dbg_atomic(dev,
requested_crtc, affected_crtc); "driver added CRTC to commit: requested 0x%x, affected 0x%0x\n",
requested_crtc, affected_crtc);
WARN(!state->allow_modeset, "adding CRTC not allowed without modesets: requested 0x%x, affected 0x%0x\n", WARN(!state->allow_modeset, "adding CRTC not allowed without modesets: requested 0x%x, affected 0x%0x\n",
requested_crtc, affected_crtc); requested_crtc, affected_crtc);
} }
...@@ -1407,7 +1425,7 @@ int drm_atomic_commit(struct drm_atomic_state *state) ...@@ -1407,7 +1425,7 @@ int drm_atomic_commit(struct drm_atomic_state *state)
if (ret) if (ret)
return ret; return ret;
DRM_DEBUG_ATOMIC("committing %p\n", state); drm_dbg_atomic(state->dev, "committing %p\n", state);
return config->funcs->atomic_commit(state->dev, state, false); return config->funcs->atomic_commit(state->dev, state, false);
} }
...@@ -1436,7 +1454,7 @@ int drm_atomic_nonblocking_commit(struct drm_atomic_state *state) ...@@ -1436,7 +1454,7 @@ int drm_atomic_nonblocking_commit(struct drm_atomic_state *state)
if (ret) if (ret)
return ret; return ret;
DRM_DEBUG_ATOMIC("committing %p nonblocking\n", state); drm_dbg_atomic(state->dev, "committing %p nonblocking\n", state);
return config->funcs->atomic_commit(state->dev, state, true); return config->funcs->atomic_commit(state->dev, state, true);
} }
...@@ -1633,11 +1651,11 @@ void drm_atomic_print_new_state(const struct drm_atomic_state *state, ...@@ -1633,11 +1651,11 @@ void drm_atomic_print_new_state(const struct drm_atomic_state *state,
int i; int i;
if (!p) { if (!p) {
DRM_ERROR("invalid drm printer\n"); drm_err(state->dev, "invalid drm printer\n");
return; return;
} }
DRM_DEBUG_ATOMIC("checking %p\n", state); drm_dbg_atomic(state->dev, "checking %p\n", state);
for_each_new_plane_in_state(state, plane, plane_state, i) for_each_new_plane_in_state(state, plane, plane_state, i)
drm_atomic_plane_print_state(p, plane_state); drm_atomic_plane_print_state(p, plane_state);
......
...@@ -132,9 +132,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state, ...@@ -132,9 +132,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
if (new_encoder) { if (new_encoder) {
if (encoder_mask & drm_encoder_mask(new_encoder)) { if (encoder_mask & drm_encoder_mask(new_encoder)) {
DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] on [CONNECTOR:%d:%s] already assigned\n", drm_dbg_atomic(connector->dev,
new_encoder->base.id, new_encoder->name, "[ENCODER:%d:%s] on [CONNECTOR:%d:%s] already assigned\n",
connector->base.id, connector->name); new_encoder->base.id, new_encoder->name,
connector->base.id, connector->name);
return -EINVAL; return -EINVAL;
} }
...@@ -169,11 +170,12 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state, ...@@ -169,11 +170,12 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
continue; continue;
if (!disable_conflicting_encoders) { if (!disable_conflicting_encoders) {
DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] in use on [CRTC:%d:%s] by [CONNECTOR:%d:%s]\n", drm_dbg_atomic(connector->dev,
encoder->base.id, encoder->name, "[ENCODER:%d:%s] in use on [CRTC:%d:%s] by [CONNECTOR:%d:%s]\n",
connector->state->crtc->base.id, encoder->base.id, encoder->name,
connector->state->crtc->name, connector->state->crtc->base.id,
connector->base.id, connector->name); connector->state->crtc->name,
connector->base.id, connector->name);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -184,10 +186,11 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state, ...@@ -184,10 +186,11 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
goto out; goto out;
} }
DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] in use on [CRTC:%d:%s], disabling [CONNECTOR:%d:%s]\n", drm_dbg_atomic(connector->dev,
encoder->base.id, encoder->name, "[ENCODER:%d:%s] in use on [CRTC:%d:%s], disabling [CONNECTOR:%d:%s]\n",
new_conn_state->crtc->base.id, new_conn_state->crtc->name, encoder->base.id, encoder->name,
connector->base.id, connector->name); new_conn_state->crtc->base.id, new_conn_state->crtc->name,
connector->base.id, connector->name);
crtc_state = drm_atomic_get_new_crtc_state(state, new_conn_state->crtc); crtc_state = drm_atomic_get_new_crtc_state(state, new_conn_state->crtc);
...@@ -268,9 +271,10 @@ steal_encoder(struct drm_atomic_state *state, ...@@ -268,9 +271,10 @@ steal_encoder(struct drm_atomic_state *state,
encoder_crtc = old_connector_state->crtc; encoder_crtc = old_connector_state->crtc;
DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] in use on [CRTC:%d:%s], stealing it\n", drm_dbg_atomic(encoder->dev,
encoder->base.id, encoder->name, "[ENCODER:%d:%s] in use on [CRTC:%d:%s], stealing it\n",
encoder_crtc->base.id, encoder_crtc->name); encoder->base.id, encoder->name,
encoder_crtc->base.id, encoder_crtc->name);
set_best_encoder(state, new_connector_state, NULL); set_best_encoder(state, new_connector_state, NULL);
...@@ -291,9 +295,8 @@ update_connector_routing(struct drm_atomic_state *state, ...@@ -291,9 +295,8 @@ update_connector_routing(struct drm_atomic_state *state,
struct drm_encoder *new_encoder; struct drm_encoder *new_encoder;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
DRM_DEBUG_ATOMIC("Updating routing for [CONNECTOR:%d:%s]\n", drm_dbg_atomic(connector->dev, "Updating routing for [CONNECTOR:%d:%s]\n",
connector->base.id, connector->base.id, connector->name);
connector->name);
if (old_connector_state->crtc != new_connector_state->crtc) { if (old_connector_state->crtc != new_connector_state->crtc) {
if (old_connector_state->crtc) { if (old_connector_state->crtc) {
...@@ -308,9 +311,8 @@ update_connector_routing(struct drm_atomic_state *state, ...@@ -308,9 +311,8 @@ update_connector_routing(struct drm_atomic_state *state,
} }
if (!new_connector_state->crtc) { if (!new_connector_state->crtc) {
DRM_DEBUG_ATOMIC("Disabling [CONNECTOR:%d:%s]\n", drm_dbg_atomic(connector->dev, "Disabling [CONNECTOR:%d:%s]\n",
connector->base.id, connector->base.id, connector->name);
connector->name);
set_best_encoder(state, new_connector_state, NULL); set_best_encoder(state, new_connector_state, NULL);
...@@ -339,8 +341,9 @@ update_connector_routing(struct drm_atomic_state *state, ...@@ -339,8 +341,9 @@ update_connector_routing(struct drm_atomic_state *state,
*/ */
if (!state->duplicated && drm_connector_is_unregistered(connector) && if (!state->duplicated && drm_connector_is_unregistered(connector) &&
crtc_state->active) { crtc_state->active) {
DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] is not registered\n", drm_dbg_atomic(connector->dev,
connector->base.id, connector->name); "[CONNECTOR:%d:%s] is not registered\n",
connector->base.id, connector->name);
return -EINVAL; return -EINVAL;
} }
...@@ -354,31 +357,33 @@ update_connector_routing(struct drm_atomic_state *state, ...@@ -354,31 +357,33 @@ update_connector_routing(struct drm_atomic_state *state,
new_encoder = drm_connector_get_single_encoder(connector); new_encoder = drm_connector_get_single_encoder(connector);
if (!new_encoder) { if (!new_encoder) {
DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n", drm_dbg_atomic(connector->dev,
connector->base.id, "No suitable encoder found for [CONNECTOR:%d:%s]\n",
connector->name); connector->base.id, connector->name);
return -EINVAL; return -EINVAL;
} }
if (!drm_encoder_crtc_ok(new_encoder, new_connector_state->crtc)) { if (!drm_encoder_crtc_ok(new_encoder, new_connector_state->crtc)) {
DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] incompatible with [CRTC:%d:%s]\n", drm_dbg_atomic(connector->dev,
new_encoder->base.id, "[ENCODER:%d:%s] incompatible with [CRTC:%d:%s]\n",
new_encoder->name, new_encoder->base.id,
new_connector_state->crtc->base.id, new_encoder->name,
new_connector_state->crtc->name); new_connector_state->crtc->base.id,
new_connector_state->crtc->name);
return -EINVAL; return -EINVAL;
} }
if (new_encoder == new_connector_state->best_encoder) { if (new_encoder == new_connector_state->best_encoder) {
set_best_encoder(state, new_connector_state, new_encoder); set_best_encoder(state, new_connector_state, new_encoder);
DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] keeps [ENCODER:%d:%s], now on [CRTC:%d:%s]\n", drm_dbg_atomic(connector->dev,
connector->base.id, "[CONNECTOR:%d:%s] keeps [ENCODER:%d:%s], now on [CRTC:%d:%s]\n",
connector->name, connector->base.id,
new_encoder->base.id, connector->name,
new_encoder->name, new_encoder->base.id,
new_connector_state->crtc->base.id, new_encoder->name,
new_connector_state->crtc->name); new_connector_state->crtc->base.id,
new_connector_state->crtc->name);
return 0; return 0;
} }
...@@ -389,13 +394,14 @@ update_connector_routing(struct drm_atomic_state *state, ...@@ -389,13 +394,14 @@ update_connector_routing(struct drm_atomic_state *state,
crtc_state->connectors_changed = true; crtc_state->connectors_changed = true;
DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d:%s]\n", drm_dbg_atomic(connector->dev,
connector->base.id, "[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d:%s]\n",
connector->name, connector->base.id,
new_encoder->base.id, connector->name,
new_encoder->name, new_encoder->base.id,
new_connector_state->crtc->base.id, new_encoder->name,
new_connector_state->crtc->name); new_connector_state->crtc->base.id,
new_connector_state->crtc->name);
return 0; return 0;
} }
...@@ -443,7 +449,7 @@ mode_fixup(struct drm_atomic_state *state) ...@@ -443,7 +449,7 @@ mode_fixup(struct drm_atomic_state *state)
new_crtc_state, new_crtc_state,
new_conn_state); new_conn_state);
if (ret) { if (ret) {
DRM_DEBUG_ATOMIC("Bridge atomic check failed\n"); drm_dbg_atomic(encoder->dev, "Bridge atomic check failed\n");
return ret; return ret;
} }
...@@ -451,16 +457,18 @@ mode_fixup(struct drm_atomic_state *state) ...@@ -451,16 +457,18 @@ mode_fixup(struct drm_atomic_state *state)
ret = funcs->atomic_check(encoder, new_crtc_state, ret = funcs->atomic_check(encoder, new_crtc_state,
new_conn_state); new_conn_state);
if (ret) { if (ret) {
DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] check failed\n", drm_dbg_atomic(encoder->dev,
encoder->base.id, encoder->name); "[ENCODER:%d:%s] check failed\n",
encoder->base.id, encoder->name);
return ret; return ret;
} }
} else if (funcs && funcs->mode_fixup) { } else if (funcs && funcs->mode_fixup) {
ret = funcs->mode_fixup(encoder, &new_crtc_state->mode, ret = funcs->mode_fixup(encoder, &new_crtc_state->mode,
&new_crtc_state->adjusted_mode); &new_crtc_state->adjusted_mode);
if (!ret) { if (!ret) {
DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] fixup failed\n", drm_dbg_atomic(encoder->dev,
encoder->base.id, encoder->name); "[ENCODER:%d:%s] fixup failed\n",
encoder->base.id, encoder->name);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -483,8 +491,8 @@ mode_fixup(struct drm_atomic_state *state) ...@@ -483,8 +491,8 @@ mode_fixup(struct drm_atomic_state *state)
ret = funcs->mode_fixup(crtc, &new_crtc_state->mode, ret = funcs->mode_fixup(crtc, &new_crtc_state->mode,
&new_crtc_state->adjusted_mode); &new_crtc_state->adjusted_mode);
if (!ret) { if (!ret) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] fixup failed\n", drm_dbg_atomic(crtc->dev, "[CRTC:%d:%s] fixup failed\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -502,8 +510,9 @@ static enum drm_mode_status mode_valid_path(struct drm_connector *connector, ...@@ -502,8 +510,9 @@ static enum drm_mode_status mode_valid_path(struct drm_connector *connector,
ret = drm_encoder_mode_valid(encoder, mode); ret = drm_encoder_mode_valid(encoder, mode);
if (ret != MODE_OK) { if (ret != MODE_OK) {
DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] mode_valid() failed\n", drm_dbg_atomic(encoder->dev,
encoder->base.id, encoder->name); "[ENCODER:%d:%s] mode_valid() failed\n",
encoder->base.id, encoder->name);
return ret; return ret;
} }
...@@ -511,14 +520,14 @@ static enum drm_mode_status mode_valid_path(struct drm_connector *connector, ...@@ -511,14 +520,14 @@ static enum drm_mode_status mode_valid_path(struct drm_connector *connector,
ret = drm_bridge_chain_mode_valid(bridge, &connector->display_info, ret = drm_bridge_chain_mode_valid(bridge, &connector->display_info,
mode); mode);
if (ret != MODE_OK) { if (ret != MODE_OK) {
DRM_DEBUG_ATOMIC("[BRIDGE] mode_valid() failed\n"); drm_dbg_atomic(encoder->dev, "[BRIDGE] mode_valid() failed\n");
return ret; return ret;
} }
ret = drm_crtc_mode_valid(crtc, mode); ret = drm_crtc_mode_valid(crtc, mode);
if (ret != MODE_OK) { if (ret != MODE_OK) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] mode_valid() failed\n", drm_dbg_atomic(encoder->dev, "[CRTC:%d:%s] mode_valid() failed\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
return ret; return ret;
} }
...@@ -619,14 +628,14 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, ...@@ -619,14 +628,14 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); WARN_ON(!drm_modeset_is_locked(&crtc->mutex));
if (!drm_mode_equal(&old_crtc_state->mode, &new_crtc_state->mode)) { if (!drm_mode_equal(&old_crtc_state->mode, &new_crtc_state->mode)) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] mode changed\n", drm_dbg_atomic(dev, "[CRTC:%d:%s] mode changed\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
new_crtc_state->mode_changed = true; new_crtc_state->mode_changed = true;
} }
if (old_crtc_state->enable != new_crtc_state->enable) { if (old_crtc_state->enable != new_crtc_state->enable) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] enable changed\n", drm_dbg_atomic(dev, "[CRTC:%d:%s] enable changed\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
/* /*
* For clarity this assignment is done here, but * For clarity this assignment is done here, but
...@@ -641,14 +650,14 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, ...@@ -641,14 +650,14 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
} }
if (old_crtc_state->active != new_crtc_state->active) { if (old_crtc_state->active != new_crtc_state->active) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] active changed\n", drm_dbg_atomic(dev, "[CRTC:%d:%s] active changed\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
new_crtc_state->active_changed = true; new_crtc_state->active_changed = true;
} }
if (new_crtc_state->enable != has_connectors) { if (new_crtc_state->enable != has_connectors) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] enabled/connectors mismatch\n", drm_dbg_atomic(dev, "[CRTC:%d:%s] enabled/connectors mismatch\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
} }
...@@ -708,10 +717,11 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, ...@@ -708,10 +717,11 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
if (!drm_atomic_crtc_needs_modeset(new_crtc_state)) if (!drm_atomic_crtc_needs_modeset(new_crtc_state))
continue; continue;
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] needs all connectors, enable: %c, active: %c\n", drm_dbg_atomic(dev,
crtc->base.id, crtc->name, "[CRTC:%d:%s] needs all connectors, enable: %c, active: %c\n",
new_crtc_state->enable ? 'y' : 'n', crtc->base.id, crtc->name,
new_crtc_state->active ? 'y' : 'n'); new_crtc_state->enable ? 'y' : 'n',
new_crtc_state->active ? 'y' : 'n');
ret = drm_atomic_add_affected_connectors(state, crtc); ret = drm_atomic_add_affected_connectors(state, crtc);
if (ret != 0) if (ret != 0)
...@@ -818,7 +828,8 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, ...@@ -818,7 +828,8 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
} }
if (!crtc_state->enable && !can_update_disabled) { if (!crtc_state->enable && !can_update_disabled) {
DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n"); drm_dbg_kms(plane_state->crtc->dev,
"Cannot update plane of a disabled CRTC.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -828,7 +839,8 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, ...@@ -828,7 +839,8 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale); hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale); vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
if (hscale < 0 || vscale < 0) { if (hscale < 0 || vscale < 0) {
DRM_DEBUG_KMS("Invalid scaling of plane\n"); drm_dbg_kms(plane_state->crtc->dev,
"Invalid scaling of plane\n");
drm_rect_debug_print("src: ", &plane_state->src, true); drm_rect_debug_print("src: ", &plane_state->src, true);
drm_rect_debug_print("dst: ", &plane_state->dst, false); drm_rect_debug_print("dst: ", &plane_state->dst, false);
return -ERANGE; return -ERANGE;
...@@ -852,7 +864,8 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, ...@@ -852,7 +864,8 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
return 0; return 0;
if (!can_position && !drm_rect_equals(dst, &clip)) { if (!can_position && !drm_rect_equals(dst, &clip)) {
DRM_DEBUG_KMS("Plane must cover entire CRTC\n"); drm_dbg_kms(plane_state->crtc->dev,
"Plane must cover entire CRTC\n");
drm_rect_debug_print("dst: ", dst, false); drm_rect_debug_print("dst: ", dst, false);
drm_rect_debug_print("clip: ", &clip, false); drm_rect_debug_print("clip: ", &clip, false);
return -EINVAL; return -EINVAL;
...@@ -904,8 +917,9 @@ drm_atomic_helper_check_planes(struct drm_device *dev, ...@@ -904,8 +917,9 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
ret = funcs->atomic_check(plane, state); ret = funcs->atomic_check(plane, state);
if (ret) { if (ret) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic driver check failed\n", drm_dbg_atomic(plane->dev,
plane->base.id, plane->name); "[PLANE:%d:%s] atomic driver check failed\n",
plane->base.id, plane->name);
return ret; return ret;
} }
} }
...@@ -920,8 +934,9 @@ drm_atomic_helper_check_planes(struct drm_device *dev, ...@@ -920,8 +934,9 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
ret = funcs->atomic_check(crtc, state); ret = funcs->atomic_check(crtc, state);
if (ret) { if (ret) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic driver check failed\n", drm_dbg_atomic(crtc->dev,
crtc->base.id, crtc->name); "[CRTC:%d:%s] atomic driver check failed\n",
crtc->base.id, crtc->name);
return ret; return ret;
} }
} }
...@@ -1049,8 +1064,8 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) ...@@ -1049,8 +1064,8 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
funcs = encoder->helper_private; funcs = encoder->helper_private;
DRM_DEBUG_ATOMIC("disabling [ENCODER:%d:%s]\n", drm_dbg_atomic(dev, "disabling [ENCODER:%d:%s]\n",
encoder->base.id, encoder->name); encoder->base.id, encoder->name);
/* /*
* Each encoder has at most one connector (since we always steal * Each encoder has at most one connector (since we always steal
...@@ -1087,8 +1102,8 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) ...@@ -1087,8 +1102,8 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
funcs = crtc->helper_private; funcs = crtc->helper_private;
DRM_DEBUG_ATOMIC("disabling [CRTC:%d:%s]\n", drm_dbg_atomic(dev, "disabling [CRTC:%d:%s]\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
/* Right function depends upon target state. */ /* Right function depends upon target state. */
...@@ -1229,8 +1244,8 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) ...@@ -1229,8 +1244,8 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
funcs = crtc->helper_private; funcs = crtc->helper_private;
if (new_crtc_state->enable && funcs->mode_set_nofb) { if (new_crtc_state->enable && funcs->mode_set_nofb) {
DRM_DEBUG_ATOMIC("modeset on [CRTC:%d:%s]\n", drm_dbg_atomic(dev, "modeset on [CRTC:%d:%s]\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
funcs->mode_set_nofb(crtc); funcs->mode_set_nofb(crtc);
} }
...@@ -1254,8 +1269,8 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) ...@@ -1254,8 +1269,8 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
if (!new_crtc_state->mode_changed) if (!new_crtc_state->mode_changed)
continue; continue;
DRM_DEBUG_ATOMIC("modeset on [ENCODER:%d:%s]\n", drm_dbg_atomic(dev, "modeset on [ENCODER:%d:%s]\n",
encoder->base.id, encoder->name); encoder->base.id, encoder->name);
/* /*
* Each encoder has at most one connector (since we always steal * Each encoder has at most one connector (since we always steal
...@@ -1357,8 +1372,8 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, ...@@ -1357,8 +1372,8 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
funcs = crtc->helper_private; funcs = crtc->helper_private;
if (new_crtc_state->enable) { if (new_crtc_state->enable) {
DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n", drm_dbg_atomic(dev, "enabling [CRTC:%d:%s]\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
if (funcs->atomic_enable) if (funcs->atomic_enable)
funcs->atomic_enable(crtc, old_state); funcs->atomic_enable(crtc, old_state);
else if (funcs->commit) else if (funcs->commit)
...@@ -1381,8 +1396,8 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, ...@@ -1381,8 +1396,8 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
encoder = new_conn_state->best_encoder; encoder = new_conn_state->best_encoder;
funcs = encoder->helper_private; funcs = encoder->helper_private;
DRM_DEBUG_ATOMIC("enabling [ENCODER:%d:%s]\n", drm_dbg_atomic(dev, "enabling [ENCODER:%d:%s]\n",
encoder->base.id, encoder->name); encoder->base.id, encoder->name);
/* /*
* Each encoder has at most one connector (since we always steal * Each encoder has at most one connector (since we always steal
...@@ -1551,8 +1566,8 @@ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev, ...@@ -1551,8 +1566,8 @@ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev,
ret = wait_for_completion_timeout(&commit->flip_done, 10 * HZ); ret = wait_for_completion_timeout(&commit->flip_done, 10 * HZ);
if (ret == 0) if (ret == 0)
DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n", drm_err(dev, "[CRTC:%d:%s] flip_done timed out\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
} }
if (old_state->fake_commit) if (old_state->fake_commit)
...@@ -1739,8 +1754,9 @@ int drm_atomic_helper_async_check(struct drm_device *dev, ...@@ -1739,8 +1754,9 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
*/ */
if (old_plane_state->commit && if (old_plane_state->commit &&
!try_wait_for_completion(&old_plane_state->commit->hw_done)) { !try_wait_for_completion(&old_plane_state->commit->hw_done)) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] inflight previous commit preventing async commit\n", drm_dbg_atomic(dev,
plane->base.id, plane->name); "[PLANE:%d:%s] inflight previous commit preventing async commit\n",
plane->base.id, plane->name);
return -EBUSY; return -EBUSY;
} }
...@@ -1962,8 +1978,9 @@ static int stall_checks(struct drm_crtc *crtc, bool nonblock) ...@@ -1962,8 +1978,9 @@ static int stall_checks(struct drm_crtc *crtc, bool nonblock)
*/ */
if (!completed && nonblock) { if (!completed && nonblock) {
spin_unlock(&crtc->commit_lock); spin_unlock(&crtc->commit_lock);
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] busy with a previous commit\n", drm_dbg_atomic(crtc->dev,
crtc->base.id, crtc->name); "[CRTC:%d:%s] busy with a previous commit\n",
crtc->base.id, crtc->name);
return -EBUSY; return -EBUSY;
} }
...@@ -1985,8 +2002,8 @@ static int stall_checks(struct drm_crtc *crtc, bool nonblock) ...@@ -1985,8 +2002,8 @@ static int stall_checks(struct drm_crtc *crtc, bool nonblock)
ret = wait_for_completion_interruptible_timeout(&stall_commit->cleanup_done, ret = wait_for_completion_interruptible_timeout(&stall_commit->cleanup_done,
10*HZ); 10*HZ);
if (ret == 0) if (ret == 0)
DRM_ERROR("[CRTC:%d:%s] cleanup_done timed out\n", drm_err(crtc->dev, "[CRTC:%d:%s] cleanup_done timed out\n",
crtc->base.id, crtc->name); crtc->base.id, crtc->name);
drm_crtc_commit_put(stall_commit); drm_crtc_commit_put(stall_commit);
...@@ -2150,8 +2167,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, ...@@ -2150,8 +2167,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
*/ */
if (nonblock && old_conn_state->commit && if (nonblock && old_conn_state->commit &&
!try_wait_for_completion(&old_conn_state->commit->flip_done)) { !try_wait_for_completion(&old_conn_state->commit->flip_done)) {
DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] busy with a previous commit\n", drm_dbg_atomic(conn->dev,
conn->base.id, conn->name); "[CONNECTOR:%d:%s] busy with a previous commit\n",
conn->base.id, conn->name);
return -EBUSY; return -EBUSY;
} }
...@@ -2171,8 +2189,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, ...@@ -2171,8 +2189,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
*/ */
if (nonblock && old_plane_state->commit && if (nonblock && old_plane_state->commit &&
!try_wait_for_completion(&old_plane_state->commit->flip_done)) { !try_wait_for_completion(&old_plane_state->commit->flip_done)) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] busy with a previous commit\n", drm_dbg_atomic(plane->dev,
plane->base.id, plane->name); "[PLANE:%d:%s] busy with a previous commit\n",
plane->base.id, plane->name);
return -EBUSY; return -EBUSY;
} }
...@@ -2218,22 +2237,25 @@ void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *old_state) ...@@ -2218,22 +2237,25 @@ void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *old_state)
for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) { for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) {
ret = drm_crtc_commit_wait(old_crtc_state->commit); ret = drm_crtc_commit_wait(old_crtc_state->commit);
if (ret) if (ret)
DRM_ERROR("[CRTC:%d:%s] commit wait timed out\n", drm_err(crtc->dev,
crtc->base.id, crtc->name); "[CRTC:%d:%s] commit wait timed out\n",
crtc->base.id, crtc->name);
} }
for_each_old_connector_in_state(old_state, conn, old_conn_state, i) { for_each_old_connector_in_state(old_state, conn, old_conn_state, i) {
ret = drm_crtc_commit_wait(old_conn_state->commit); ret = drm_crtc_commit_wait(old_conn_state->commit);
if (ret) if (ret)
DRM_ERROR("[CONNECTOR:%d:%s] commit wait timed out\n", drm_err(conn->dev,
conn->base.id, conn->name); "[CONNECTOR:%d:%s] commit wait timed out\n",
conn->base.id, conn->name);
} }
for_each_old_plane_in_state(old_state, plane, old_plane_state, i) { for_each_old_plane_in_state(old_state, plane, old_plane_state, i) {
ret = drm_crtc_commit_wait(old_plane_state->commit); ret = drm_crtc_commit_wait(old_plane_state->commit);
if (ret) if (ret)
DRM_ERROR("[PLANE:%d:%s] commit wait timed out\n", drm_err(plane->dev,
plane->base.id, plane->name); "[PLANE:%d:%s] commit wait timed out\n",
plane->base.id, plane->name);
} }
} }
EXPORT_SYMBOL(drm_atomic_helper_wait_for_dependencies); EXPORT_SYMBOL(drm_atomic_helper_wait_for_dependencies);
...@@ -3120,7 +3142,9 @@ void drm_atomic_helper_shutdown(struct drm_device *dev) ...@@ -3120,7 +3142,9 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
ret = drm_atomic_helper_disable_all(dev, &ctx); ret = drm_atomic_helper_disable_all(dev, &ctx);
if (ret) if (ret)
DRM_ERROR("Disabling all crtc's during unload failed with %i\n", ret); drm_err(dev,
"Disabling all crtc's during unload failed with %i\n",
ret);
DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
} }
...@@ -3380,8 +3404,9 @@ static int page_flip_common(struct drm_atomic_state *state, ...@@ -3380,8 +3404,9 @@ static int page_flip_common(struct drm_atomic_state *state,
/* Make sure we don't accidentally do a full modeset. */ /* Make sure we don't accidentally do a full modeset. */
state->allow_modeset = false; state->allow_modeset = false;
if (!crtc_state->active) { if (!crtc_state->active) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] disabled, rejecting legacy flip\n", drm_dbg_atomic(crtc->dev,
crtc->base.id, crtc->name); "[CRTC:%d:%s] disabled, rejecting legacy flip\n",
crtc->base.id, crtc->name);
return -EINVAL; return -EINVAL;
} }
......
...@@ -773,7 +773,7 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, ...@@ -773,7 +773,7 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
state->scaling_mode = val; state->scaling_mode = val;
} else if (property == config->content_protection_property) { } else if (property == config->content_protection_property) {
if (val == DRM_MODE_CONTENT_PROTECTION_ENABLED) { if (val == DRM_MODE_CONTENT_PROTECTION_ENABLED) {
DRM_DEBUG_KMS("only drivers can set CP Enabled\n"); drm_dbg_kms(dev, "only drivers can set CP Enabled\n");
return -EINVAL; return -EINVAL;
} }
state->content_protection = val; state->content_protection = val;
......
...@@ -106,7 +106,7 @@ int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv) ...@@ -106,7 +106,7 @@ int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
auth->magic = file_priv->magic; auth->magic = file_priv->magic;
mutex_unlock(&dev->master_mutex); mutex_unlock(&dev->master_mutex);
DRM_DEBUG("%u\n", auth->magic); drm_dbg_core(dev, "%u\n", auth->magic);
return ret < 0 ? ret : 0; return ret < 0 ? ret : 0;
} }
...@@ -117,7 +117,7 @@ int drm_authmagic(struct drm_device *dev, void *data, ...@@ -117,7 +117,7 @@ int drm_authmagic(struct drm_device *dev, void *data,
struct drm_auth *auth = data; struct drm_auth *auth = data;
struct drm_file *file; struct drm_file *file;
DRM_DEBUG("%u\n", auth->magic); drm_dbg_core(dev, "%u\n", auth->magic);
mutex_lock(&dev->master_mutex); mutex_lock(&dev->master_mutex);
file = idr_find(&file_priv->master->magic_map, auth->magic); file = idr_find(&file_priv->master->magic_map, auth->magic);
...@@ -274,7 +274,9 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, ...@@ -274,7 +274,9 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
} }
if (file_priv->master->lessor != NULL) { if (file_priv->master->lessor != NULL) {
DRM_DEBUG_LEASE("Attempt to set lessee %d as master\n", file_priv->master->lessee_id); drm_dbg_lease(dev,
"Attempt to set lessee %d as master\n",
file_priv->master->lessee_id);
ret = -EINVAL; ret = -EINVAL;
goto out_unlock; goto out_unlock;
} }
...@@ -315,7 +317,9 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data, ...@@ -315,7 +317,9 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
} }
if (file_priv->master->lessor != NULL) { if (file_priv->master->lessor != NULL) {
DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", file_priv->master->lessee_id); drm_dbg_lease(dev,
"Attempt to drop lessee %d as master\n",
file_priv->master->lessee_id);
ret = -EINVAL; ret = -EINVAL;
goto out_unlock; goto out_unlock;
} }
......
// SPDX-License-Identifier: GPL-2.0
#include <linux/module.h>
#include <linux/types.h>
static bool drm_nomodeset;
bool drm_firmware_drivers_only(void)
{
return drm_nomodeset;
}
EXPORT_SYMBOL(drm_firmware_drivers_only);
static int __init disable_modeset(char *str)
{
drm_nomodeset = true;
pr_warn("Booted with the nomodeset parameter. Only the system framebuffer will be available\n");
return 1;
}
/* Disable kernel modesetting */
__setup("nomodeset", disable_modeset);
...@@ -262,6 +262,12 @@ static const struct dmi_system_id orientation_data[] = { ...@@ -262,6 +262,12 @@ static const struct dmi_system_id orientation_data[] = {
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"),
}, },
.driver_data = (void *)&lcd1200x1920_rightside_up, .driver_data = (void *)&lcd1200x1920_rightside_up,
}, { /* Lenovo Yoga Book X90F / X91F / X91L */
.matches = {
/* Non exact match to match all versions */
DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"),
},
.driver_data = (void *)&lcd1200x1920_rightside_up,
}, { /* OneGX1 Pro */ }, { /* OneGX1 Pro */
.matches = { .matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"), DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"),
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright © 2021 Intel Corporation * Copyright © 2021 Intel Corporation
*/ */
#include <linux/console.h> #include <drm/drm_drv.h>
#include "gem/i915_gem_context.h" #include "gem/i915_gem_context.h"
#include "gem/i915_gem_object.h" #include "gem/i915_gem_object.h"
...@@ -31,7 +31,7 @@ static int i915_check_nomodeset(void) ...@@ -31,7 +31,7 @@ static int i915_check_nomodeset(void)
if (i915_modparams.modeset == 0) if (i915_modparams.modeset == 0)
use_kms = false; use_kms = false;
if (vgacon_text_force() && i915_modparams.modeset == -1) if (drm_firmware_drivers_only() && i915_modparams.modeset == -1)
use_kms = false; use_kms = false;
if (!use_kms) { if (!use_kms) {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
* Dave Airlie * Dave Airlie
*/ */
#include <linux/console.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
...@@ -378,7 +377,7 @@ static struct pci_driver mgag200_pci_driver = { ...@@ -378,7 +377,7 @@ static struct pci_driver mgag200_pci_driver = {
static int __init mgag200_init(void) static int __init mgag200_init(void)
{ {
if (vgacon_text_force() && mgag200_modeset == -1) if (drm_firmware_drivers_only() && mgag200_modeset == -1)
return -EINVAL; return -EINVAL;
if (mgag200_modeset == 0) if (mgag200_modeset == 0)
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include <linux/console.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -32,6 +31,7 @@ ...@@ -32,6 +31,7 @@
#include <drm/drm_aperture.h> #include <drm/drm_aperture.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_gem_ttm_helper.h> #include <drm/drm_gem_ttm_helper.h>
#include <drm/drm_ioctl.h> #include <drm/drm_ioctl.h>
#include <drm/drm_vblank.h> #include <drm/drm_vblank.h>
...@@ -1358,7 +1358,7 @@ nouveau_drm_init(void) ...@@ -1358,7 +1358,7 @@ nouveau_drm_init(void)
nouveau_display_options(); nouveau_display_options();
if (nouveau_modeset == -1) { if (nouveau_modeset == -1) {
if (vgacon_text_force()) if (drm_firmware_drivers_only())
nouveau_modeset = 0; nouveau_modeset = 0;
} }
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "qxl_drv.h" #include "qxl_drv.h"
#include <linux/console.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/vgaarb.h> #include <linux/vgaarb.h>
...@@ -295,7 +294,7 @@ static struct drm_driver qxl_driver = { ...@@ -295,7 +294,7 @@ static struct drm_driver qxl_driver = {
static int __init qxl_init(void) static int __init qxl_init(void)
{ {
if (vgacon_text_force() && qxl_modeset == -1) if (drm_firmware_drivers_only() && qxl_modeset == -1)
return -EINVAL; return -EINVAL;
if (qxl_modeset == 0) if (qxl_modeset == 0)
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/console.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/vga_switcheroo.h> #include <linux/vga_switcheroo.h>
...@@ -637,15 +636,11 @@ static struct pci_driver radeon_kms_pci_driver = { ...@@ -637,15 +636,11 @@ static struct pci_driver radeon_kms_pci_driver = {
static int __init radeon_module_init(void) static int __init radeon_module_init(void)
{ {
if (vgacon_text_force() && radeon_modeset == -1) { if (drm_firmware_drivers_only() && radeon_modeset == -1)
DRM_INFO("VGACON disable radeon kernel modesetting.\n");
radeon_modeset = 0; radeon_modeset = 0;
}
if (radeon_modeset == 0) { if (radeon_modeset == 0)
DRM_ERROR("No UMS support in radeon module!\n");
return -EINVAL; return -EINVAL;
}
DRM_INFO("radeon kernel modesetting enabled.\n"); DRM_INFO("radeon kernel modesetting enabled.\n");
radeon_register_atpx_handler(); radeon_register_atpx_handler();
......
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <linux/console.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <drm/drm_aperture.h> #include <drm/drm_aperture.h>
...@@ -719,7 +718,7 @@ static struct pci_driver bochs_pci_driver = { ...@@ -719,7 +718,7 @@ static struct pci_driver bochs_pci_driver = {
static int __init bochs_init(void) static int __init bochs_init(void)
{ {
if (vgacon_text_force() && bochs_modeset == -1) if (drm_firmware_drivers_only() && bochs_modeset == -1)
return -EINVAL; return -EINVAL;
if (bochs_modeset == 0) if (bochs_modeset == 0)
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
* Copyright 1999-2001 Jeff Garzik <jgarzik@pobox.com> * Copyright 1999-2001 Jeff Garzik <jgarzik@pobox.com>
*/ */
#include <linux/console.h>
#include <linux/dma-buf-map.h> #include <linux/dma-buf-map.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -636,8 +635,9 @@ static struct pci_driver cirrus_pci_driver = { ...@@ -636,8 +635,9 @@ static struct pci_driver cirrus_pci_driver = {
static int __init cirrus_init(void) static int __init cirrus_init(void)
{ {
if (vgacon_text_force()) if (drm_firmware_drivers_only())
return -EINVAL; return -EINVAL;
return pci_register_driver(&cirrus_pci_driver); return pci_register_driver(&cirrus_pci_driver);
} }
......
...@@ -128,15 +128,17 @@ static const struct ttm_resource_manager_func ttm_range_manager_func = { ...@@ -128,15 +128,17 @@ static const struct ttm_resource_manager_func ttm_range_manager_func = {
}; };
/** /**
* ttm_range_man_init * ttm_range_man_init_nocheck - Initialise a generic range manager for the
* selected memory type.
* *
* @bdev: ttm device * @bdev: ttm device
* @type: memory manager type * @type: memory manager type
* @use_tt: if the memory manager uses tt * @use_tt: if the memory manager uses tt
* @p_size: size of area to be managed in pages. * @p_size: size of area to be managed in pages.
* *
* Initialise a generic range manager for the selected memory type.
* The range manager is installed for this device in the type slot. * The range manager is installed for this device in the type slot.
*
* Return: %0 on success or a negative error code on failure
*/ */
int ttm_range_man_init_nocheck(struct ttm_device *bdev, int ttm_range_man_init_nocheck(struct ttm_device *bdev,
unsigned type, bool use_tt, unsigned type, bool use_tt,
...@@ -166,12 +168,13 @@ int ttm_range_man_init_nocheck(struct ttm_device *bdev, ...@@ -166,12 +168,13 @@ int ttm_range_man_init_nocheck(struct ttm_device *bdev,
EXPORT_SYMBOL(ttm_range_man_init_nocheck); EXPORT_SYMBOL(ttm_range_man_init_nocheck);
/** /**
* ttm_range_man_fini * ttm_range_man_fini_nocheck - Remove the generic range manager from a slot
* and tear it down.
* *
* @bdev: ttm device * @bdev: ttm device
* @type: memory manager type * @type: memory manager type
* *
* Remove the generic range manager from a slot and tear it down. * Return: %0 on success or a negative error code on failure
*/ */
int ttm_range_man_fini_nocheck(struct ttm_device *bdev, int ttm_range_man_fini_nocheck(struct ttm_device *bdev,
unsigned type) unsigned type)
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* Michael Thayer <michael.thayer@oracle.com, * Michael Thayer <michael.thayer@oracle.com,
* Hans de Goede <hdegoede@redhat.com> * Hans de Goede <hdegoede@redhat.com>
*/ */
#include <linux/console.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/vt_kern.h> #include <linux/vt_kern.h>
...@@ -193,10 +192,8 @@ static const struct drm_driver driver = { ...@@ -193,10 +192,8 @@ static const struct drm_driver driver = {
static int __init vbox_init(void) static int __init vbox_init(void)
{ {
#ifdef CONFIG_VGA_CONSOLE if (drm_firmware_drivers_only() && vbox_modeset == -1)
if (vgacon_text_force() && vbox_modeset == -1)
return -EINVAL; return -EINVAL;
#endif
if (vbox_modeset == 0) if (vbox_modeset == 0)
return -EINVAL; return -EINVAL;
......
...@@ -127,8 +127,8 @@ int vbox_hw_init(struct vbox_private *vbox) ...@@ -127,8 +127,8 @@ int vbox_hw_init(struct vbox_private *vbox)
/* Create guest-heap mem-pool use 2^4 = 16 byte chunks */ /* Create guest-heap mem-pool use 2^4 = 16 byte chunks */
vbox->guest_pool = devm_gen_pool_create(vbox->ddev.dev, 4, -1, vbox->guest_pool = devm_gen_pool_create(vbox->ddev.dev, 4, -1,
"vboxvideo-accel"); "vboxvideo-accel");
if (!vbox->guest_pool) if (IS_ERR(vbox->guest_pool))
return -ENOMEM; return PTR_ERR(vbox->guest_pool);
ret = gen_pool_add_virt(vbox->guest_pool, ret = gen_pool_add_virt(vbox->guest_pool,
(unsigned long)vbox->guest_heap, (unsigned long)vbox->guest_heap,
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/console.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/wait.h> #include <linux/wait.h>
...@@ -104,7 +103,7 @@ static int virtio_gpu_probe(struct virtio_device *vdev) ...@@ -104,7 +103,7 @@ static int virtio_gpu_probe(struct virtio_device *vdev)
struct drm_device *dev; struct drm_device *dev;
int ret; int ret;
if (vgacon_text_force() && virtio_gpu_modeset == -1) if (drm_firmware_drivers_only() && virtio_gpu_modeset == -1)
return -EINVAL; return -EINVAL;
if (virtio_gpu_modeset == 0) if (virtio_gpu_modeset == 0)
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
* *
**************************************************************************/ **************************************************************************/
#include <linux/console.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -1651,7 +1650,7 @@ static int __init vmwgfx_init(void) ...@@ -1651,7 +1650,7 @@ static int __init vmwgfx_init(void)
{ {
int ret; int ret;
if (vgacon_text_force()) if (drm_firmware_drivers_only())
return -EINVAL; return -EINVAL;
ret = pci_register_driver(&vmw_pci_driver); ret = pci_register_driver(&vmw_pci_driver);
......
...@@ -97,30 +97,9 @@ static int vga_video_font_height; ...@@ -97,30 +97,9 @@ static int vga_video_font_height;
static int vga_scan_lines __read_mostly; static int vga_scan_lines __read_mostly;
static unsigned int vga_rolled_over; /* last vc_origin offset before wrap */ static unsigned int vga_rolled_over; /* last vc_origin offset before wrap */
static bool vgacon_text_mode_force;
static bool vga_hardscroll_enabled; static bool vga_hardscroll_enabled;
static bool vga_hardscroll_user_enable = true; static bool vga_hardscroll_user_enable = true;
bool vgacon_text_force(void)
{
return vgacon_text_mode_force;
}
EXPORT_SYMBOL(vgacon_text_force);
static int __init text_mode(char *str)
{
vgacon_text_mode_force = true;
pr_warn("You have booted with nomodeset. This means your GPU drivers are DISABLED\n");
pr_warn("Any video related functionality will be severely degraded, and you may not even be able to suspend the system properly\n");
pr_warn("Unless you actually understand what nomodeset does, you should reboot without enabling it\n");
return 1;
}
/* force text mode - used by kernel modesetting */
__setup("nomodeset", text_mode);
static int __init no_scroll(char *str) static int __init no_scroll(char *str)
{ {
/* /*
......
...@@ -601,5 +601,6 @@ static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev) ...@@ -601,5 +601,6 @@ static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)
int drm_dev_set_unique(struct drm_device *dev, const char *name); int drm_dev_set_unique(struct drm_device *dev, const char *name);
extern bool drm_firmware_drivers_only(void);
#endif #endif
...@@ -219,12 +219,6 @@ extern atomic_t ignore_console_lock_warning; ...@@ -219,12 +219,6 @@ extern atomic_t ignore_console_lock_warning;
#define VESA_HSYNC_SUSPEND 2 #define VESA_HSYNC_SUSPEND 2
#define VESA_POWERDOWN 3 #define VESA_POWERDOWN 3
#ifdef CONFIG_VGA_CONSOLE
extern bool vgacon_text_force(void);
#else
static inline bool vgacon_text_force(void) { return false; }
#endif
extern void console_init(void); extern void console_init(void);
/* For deferred console takeover */ /* For deferred console takeover */
......
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