summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/drmP.h4
-rw-r--r--linux-core/drm_crtc.h1
-rw-r--r--linux-core/drm_crtc_helper.c107
-rw-r--r--linux-core/i915_drv.c2
-rw-r--r--linux-core/intel_fb.c1
5 files changed, 19 insertions, 96 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 9845b5c8..5b2d7829 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -742,10 +742,6 @@ struct drm_driver {
void (*set_version) (struct drm_device *dev,
struct drm_set_version *sv);
- /* FB routines, if present */
- int (*fb_probe)(struct drm_device *dev);
- int (*fb_resize)(struct drm_device *dev, struct drm_crtc *crtc);
-
/* Master routines */
int (*master_create)(struct drm_device *dev, struct drm_master *master);
void (*master_destroy)(struct drm_device *dev, struct drm_master *master);
diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h
index da05ff27..c1d89ee8 100644
--- a/linux-core/drm_crtc.h
+++ b/linux-core/drm_crtc.h
@@ -525,6 +525,7 @@ struct drm_mode_set
struct drm_mode_config_funcs {
bool (*resize_fb)(struct drm_device *dev, struct drm_framebuffer *fb);
struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd);
+ void (*fb_changed)(struct drm_device *dev);
};
struct drm_mode_group {
diff --git a/linux-core/drm_crtc_helper.c b/linux-core/drm_crtc_helper.c
index 3ff7e07e..1b6118de 100644
--- a/linux-core/drm_crtc_helper.c
+++ b/linux-core/drm_crtc_helper.c
@@ -496,6 +496,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
crtc_funcs = set->crtc->helper_private;
DRM_DEBUG("crtc: %p fb: %p connectors: %p num_connectors: %i (x, y) (%i, %i)\n", set->crtc, set->fb, set->connectors, set->num_connectors, set->x, set->y);
+
dev = set->crtc->dev;
/* save previous config */
@@ -532,7 +533,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
struct drm_connector_helper_funcs *connector_funcs = connector->helper_private;
save_encoders[count++] = connector->encoder;
- new_encoder = NULL;
+ new_encoder = connector->encoder;
for (ro = 0; ro < set->num_connectors; ro++) {
if (set->connectors[ro] == connector) {
new_encoder = connector_funcs->best_encoder(connector);
@@ -626,6 +627,20 @@ fail_no_encoder:
}
EXPORT_SYMBOL(drm_crtc_helper_set_config);
+bool drm_helper_plugged_event(struct drm_device *dev)
+{
+ drm_helper_probe_connector_modes(dev, dev->mode_config.max_width, dev->mode_config.max_height);
+
+ drm_pick_crtcs(dev);
+
+ /* alert the driver fb layer */
+ dev->mode_config.funcs->fb_changed(dev);
+
+ drm_helper_disable_unused_functions(dev);
+
+ drm_sysfs_hotplug_event(dev);
+ return true;
+}
/**
* drm_initial_config - setup a sane initial connector configuration
* @dev: DRM device
@@ -645,48 +660,7 @@ bool drm_helper_initial_config(struct drm_device *dev, bool can_grow)
{
int ret = false;
- mutex_lock(&dev->mode_config.mutex);
-
- drm_helper_probe_connector_modes(dev, dev->mode_config.max_width, dev->mode_config.max_height);
-
- drm_pick_crtcs(dev);
-
- /* use all the info we have to setup the fb */
- dev->driver->fb_probe(dev);
-#if 0
- /* have to do a driver pick here */
- /* get the lowest common denom of width height that will fit nicely - size the fb to this
- size, however may need a wider stride for crtc alignment */
- /* This is a little screwy, as we've already walked the connectors
- * above, but it's a little bit of magic too. There's the potential
- * for things not to get setup above if an existing device gets
- * re-assigned thus confusing the hardware. By walking the connectors
- * this fixes up their crtc's.
- */
- list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-
- struct drm_encoder *encoder = connector->encoder;
- struct drm_crtc *crtc;
-
- if (!encoder)
- continue;
-
- crtc = connector->encoder->crtc;
-
- /* can't setup the connector if there's no assigned mode */
- if (!crtc || !crtc->desired_mode)
- continue;
-
- dev->driver->fb_probe(dev, crtc, connector);
-
- /* and needs an attached fb */
- if (crtc->fb)
- drm_crtc_helper_set_mode(crtc, crtc->desired_mode, 0, 0);
- }
-
- drm_helper_disable_unused_functions(dev);
-#endif
- mutex_unlock(&dev->mode_config.mutex);
+ drm_helper_plugged_event(dev);
return ret;
}
EXPORT_SYMBOL(drm_helper_initial_config);
@@ -707,59 +681,14 @@ EXPORT_SYMBOL(drm_helper_initial_config);
int drm_helper_hotplug_stage_two(struct drm_device *dev, struct drm_connector *connector,
bool connected)
{
- int has_config = 0;
-
dev->mode_config.hotplug_counter++;
- /* We might want to do something more here */
- if (!connected) {
- DRM_DEBUG("not connected\n");
- return 0;
- }
-
- if (connector->encoder) {
- if (connector->encoder->crtc && connector->encoder->crtc->desired_mode) {
- DRM_DEBUG("drm thinks that the connector already has a config\n");
- has_config = 1;
- }
- }
-
- drm_helper_probe_connector_modes(dev, 2048, 2048);
-
- if (!has_config)
- drm_pick_crtcs(dev);
-
- if (!connector->encoder) {
- DRM_DEBUG("could not find a desired mode or crtc for connector\n");
- return 1;
- }
-
- if (!connector->encoder->crtc || !connector->encoder->crtc->desired_mode) {
- DRM_DEBUG("could not find a desired mode or crtc for connector\n");
- return 1;
- }
-
- /* We should really check if there is a fb using this crtc */
- if (!has_config)
- dev->driver->fb_probe(dev);
- else {
- dev->driver->fb_resize(dev, connector->encoder->crtc);
-
-#if 0
- if (!drm_crtc_set_mode(connector->encoder->crtc, connector->encoder->crtc->desired_mode, 0, 0))
- DRM_ERROR("failed to set mode after hotplug\n");
-#endif
- }
-
- drm_sysfs_hotplug_event(dev);
-
- drm_helper_disable_unused_functions(dev);
+ drm_helper_plugged_event(dev);
return 0;
}
EXPORT_SYMBOL(drm_helper_hotplug_stage_two);
-
int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
struct drm_mode_fb_cmd *mode_cmd)
{
diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c
index b81db3a6..f4c50752 100644
--- a/linux-core/i915_drv.c
+++ b/linux-core/i915_drv.c
@@ -594,8 +594,6 @@ static struct drm_driver driver = {
.reclaim_buffers = drm_core_reclaim_buffers,
.get_map_ofs = drm_core_get_map_ofs,
.get_reg_ofs = drm_core_get_reg_ofs,
- .fb_probe = intelfb_probe,
- .fb_resize = intelfb_resize,
.master_create = i915_master_create,
.master_destroy = i915_master_destroy,
.ioctls = i915_ioctls,
diff --git a/linux-core/intel_fb.c b/linux-core/intel_fb.c
index 0355e784..9b2e9314 100644
--- a/linux-core/intel_fb.c
+++ b/linux-core/intel_fb.c
@@ -469,7 +469,6 @@ static int intelfb_pan_display(struct fb_var_screeninfo *var,
struct intelfb_par *par = info->par;
struct drm_mode_set *modeset;
int ret = 0;
- DRM_DEBUG("\n");
list_for_each_entry(modeset, &par->mode_set_list, head) {
modeset->x = var->xoffset;