drm/fb-helper: Add module option to disable fbdev emulation
Faster than recompiling. Note that restore_fbdev_mode_unlocked is a bit special and the only one which returns an error code when fbdev isn't there - i915 needs that one to not fall over with some additional fbcon related restore code. Everyone else just ignores the return value or only prints a DRM_DEBUG level message. Reviewed-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
a39a357c6c
commit
f64c5573d2
@ -39,6 +39,11 @@
|
|||||||
#include <drm/drm_fb_helper.h>
|
#include <drm/drm_fb_helper.h>
|
||||||
#include <drm/drm_crtc_helper.h>
|
#include <drm/drm_crtc_helper.h>
|
||||||
|
|
||||||
|
static bool drm_fbdev_emulation = true;
|
||||||
|
module_param_named(fbdev_emulation, drm_fbdev_emulation, bool, 0600);
|
||||||
|
MODULE_PARM_DESC(fbdev_emulation,
|
||||||
|
"Enable legacy fbdev emulation [default=true]");
|
||||||
|
|
||||||
static LIST_HEAD(kernel_fb_helper_list);
|
static LIST_HEAD(kernel_fb_helper_list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,6 +104,9 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
|
|||||||
struct drm_connector *connector;
|
struct drm_connector *connector;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!drm_fbdev_emulation)
|
||||||
|
return 0;
|
||||||
|
|
||||||
mutex_lock(&dev->mode_config.mutex);
|
mutex_lock(&dev->mode_config.mutex);
|
||||||
drm_for_each_connector(connector, dev) {
|
drm_for_each_connector(connector, dev) {
|
||||||
struct drm_fb_helper_connector *fb_helper_connector;
|
struct drm_fb_helper_connector *fb_helper_connector;
|
||||||
@ -129,6 +137,9 @@ int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_
|
|||||||
struct drm_fb_helper_connector **temp;
|
struct drm_fb_helper_connector **temp;
|
||||||
struct drm_fb_helper_connector *fb_helper_connector;
|
struct drm_fb_helper_connector *fb_helper_connector;
|
||||||
|
|
||||||
|
if (!drm_fbdev_emulation)
|
||||||
|
return 0;
|
||||||
|
|
||||||
WARN_ON(!mutex_is_locked(&fb_helper->dev->mode_config.mutex));
|
WARN_ON(!mutex_is_locked(&fb_helper->dev->mode_config.mutex));
|
||||||
if (fb_helper->connector_count + 1 > fb_helper->connector_info_alloc_count) {
|
if (fb_helper->connector_count + 1 > fb_helper->connector_info_alloc_count) {
|
||||||
temp = krealloc(fb_helper->connector_info, sizeof(struct drm_fb_helper_connector *) * (fb_helper->connector_count + 1), GFP_KERNEL);
|
temp = krealloc(fb_helper->connector_info, sizeof(struct drm_fb_helper_connector *) * (fb_helper->connector_count + 1), GFP_KERNEL);
|
||||||
@ -184,6 +195,9 @@ int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
|
|||||||
struct drm_fb_helper_connector *fb_helper_connector;
|
struct drm_fb_helper_connector *fb_helper_connector;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
if (!drm_fbdev_emulation)
|
||||||
|
return 0;
|
||||||
|
|
||||||
WARN_ON(!mutex_is_locked(&fb_helper->dev->mode_config.mutex));
|
WARN_ON(!mutex_is_locked(&fb_helper->dev->mode_config.mutex));
|
||||||
|
|
||||||
for (i = 0; i < fb_helper->connector_count; i++) {
|
for (i = 0; i < fb_helper->connector_count; i++) {
|
||||||
@ -375,6 +389,9 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
|
|||||||
bool do_delayed;
|
bool do_delayed;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!drm_fbdev_emulation)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
drm_modeset_lock_all(dev);
|
drm_modeset_lock_all(dev);
|
||||||
ret = restore_fbdev_mode(fb_helper);
|
ret = restore_fbdev_mode(fb_helper);
|
||||||
|
|
||||||
@ -591,6 +608,9 @@ int drm_fb_helper_init(struct drm_device *dev,
|
|||||||
struct drm_crtc *crtc;
|
struct drm_crtc *crtc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!drm_fbdev_emulation)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!max_conn_count)
|
if (!max_conn_count)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -713,6 +733,9 @@ EXPORT_SYMBOL(drm_fb_helper_release_fbi);
|
|||||||
|
|
||||||
void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
|
void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
|
||||||
{
|
{
|
||||||
|
if (!drm_fbdev_emulation)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!list_empty(&fb_helper->kernel_fb_list)) {
|
if (!list_empty(&fb_helper->kernel_fb_list)) {
|
||||||
list_del(&fb_helper->kernel_fb_list);
|
list_del(&fb_helper->kernel_fb_list);
|
||||||
if (list_empty(&kernel_fb_helper_list)) {
|
if (list_empty(&kernel_fb_helper_list)) {
|
||||||
@ -1933,6 +1956,9 @@ int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel)
|
|||||||
struct drm_device *dev = fb_helper->dev;
|
struct drm_device *dev = fb_helper->dev;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
if (!drm_fbdev_emulation)
|
||||||
|
return 0;
|
||||||
|
|
||||||
mutex_lock(&dev->mode_config.mutex);
|
mutex_lock(&dev->mode_config.mutex);
|
||||||
count = drm_fb_helper_probe_connector_modes(fb_helper,
|
count = drm_fb_helper_probe_connector_modes(fb_helper,
|
||||||
dev->mode_config.max_width,
|
dev->mode_config.max_width,
|
||||||
@ -1976,6 +2002,9 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
|
|||||||
struct drm_device *dev = fb_helper->dev;
|
struct drm_device *dev = fb_helper->dev;
|
||||||
u32 max_width, max_height;
|
u32 max_width, max_height;
|
||||||
|
|
||||||
|
if (!drm_fbdev_emulation)
|
||||||
|
return 0;
|
||||||
|
|
||||||
mutex_lock(&fb_helper->dev->mode_config.mutex);
|
mutex_lock(&fb_helper->dev->mode_config.mutex);
|
||||||
if (!fb_helper->fb || !drm_fb_helper_is_bound(fb_helper)) {
|
if (!fb_helper->fb || !drm_fb_helper_is_bound(fb_helper)) {
|
||||||
fb_helper->delayed_hotplug = true;
|
fb_helper->delayed_hotplug = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user