All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/omap: fix for connectors not enabled at bootup
@ 2011-12-11 21:13 Rob Clark
  2011-12-13  0:39 ` [PATCH] staging: " Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Clark @ 2011-12-11 21:13 UTC (permalink / raw)
  To: dri-devel; +Cc: Greg KH, Rob Clark, patches

From: Rob Clark <rob@ti.com>

The connector's dpms fxn is only triggered by userspace.  When the
driver is loaded and detected displays configured, drm core only
calls the crtc and encoder's dpms functions.

Signed-off-by: Rob Clark <rob@ti.com>
---
Arguably, this could be called a work-around, and instead drm core
should call connector's dpms functions and rely on
drm_helper_connector_dpms to call encoder and crtc dpms functions.
If people think it is better to fix this in drm core, and don't
mind me making that change, then I will do that instead.

 drivers/staging/omapdrm/omap_connector.c |   15 ++-------------
 drivers/staging/omapdrm/omap_drv.h       |    1 +
 drivers/staging/omapdrm/omap_encoder.c   |   16 ++++++++++++++++
 3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/omapdrm/omap_connector.c b/drivers/staging/omapdrm/omap_connector.c
index 6177f30..1c1db90 100644
--- a/drivers/staging/omapdrm/omap_connector.c
+++ b/drivers/staging/omapdrm/omap_connector.c
@@ -74,20 +74,13 @@ static inline void copy_timings_drm_to_omap(struct omap_video_timings *timings,
 	timings->vbp = mode->vtotal - mode->vsync_end;
 }
 
-static void omap_connector_dpms(struct drm_connector *connector, int mode)
+void omap_connector_dpms(struct drm_connector *connector, int mode)
 {
 	struct omap_connector *omap_connector = to_omap_connector(connector);
 	struct omap_dss_device *dssdev = omap_connector->dssdev;
-	int old_dpms;
 
 	DBG("%s: %d", dssdev->name, mode);
 
-	old_dpms = connector->dpms;
-
-	/* from off to on, do from crtc to connector */
-	if (mode < old_dpms)
-		drm_helper_connector_dpms(connector, mode);
-
 	if (mode == DRM_MODE_DPMS_ON) {
 		/* store resume info for suspended displays */
 		switch (dssdev->state) {
@@ -109,10 +102,6 @@ static void omap_connector_dpms(struct drm_connector *connector, int mode)
 	} else {
 		/* TODO */
 	}
-
-	/* from on to off, do from connector to crtc */
-	if (mode > old_dpms)
-		drm_helper_connector_dpms(connector, mode);
 }
 
 enum drm_connector_status omap_connector_detect(
@@ -378,7 +367,7 @@ struct drm_encoder *omap_connector_attached_encoder(
 }
 
 static const struct drm_connector_funcs omap_connector_funcs = {
-	.dpms = omap_connector_dpms,
+	.dpms = drm_helper_connector_dpms,
 	.detect = omap_connector_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = omap_connector_destroy,
diff --git a/drivers/staging/omapdrm/omap_drv.h b/drivers/staging/omapdrm/omap_drv.h
index 263057a..8dd7d74 100644
--- a/drivers/staging/omapdrm/omap_drv.h
+++ b/drivers/staging/omapdrm/omap_drv.h
@@ -73,6 +73,7 @@ void omap_connector_mode_set(struct drm_connector *connector,
 		struct drm_display_mode *mode);
 void omap_connector_flush(struct drm_connector *connector,
 		int x, int y, int w, int h);
+void omap_connector_dpms(struct drm_connector *connector, int mode);
 
 struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev,
 		struct drm_file *file, struct drm_mode_fb_cmd *mode_cmd);
diff --git a/drivers/staging/omapdrm/omap_encoder.c b/drivers/staging/omapdrm/omap_encoder.c
index 06c52cb..af39dc3 100644
--- a/drivers/staging/omapdrm/omap_encoder.c
+++ b/drivers/staging/omapdrm/omap_encoder.c
@@ -44,7 +44,23 @@ static void omap_encoder_destroy(struct drm_encoder *encoder)
 static void omap_encoder_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
+	struct drm_device *dev = encoder->dev;
+	struct omap_drm_private *priv = dev->dev_private;
+	int i;
+
 	DBG("%s: %d", omap_encoder->mgr->name, mode);
+
+	/* Note: the connector DPMS fxn is only called from userspace
+	 * ioctl, and not at bootup.  But the encoder dpms function is.
+	 * Ensure that our connector gets notified of the DPMS state
+	 * change:
+	 */
+	for (i = 0; i < priv->num_connectors; i++) {
+		struct drm_connector *connector = priv->connectors[i];
+		if (connector->encoder == encoder) {
+			omap_connector_dpms(connector, mode);
+		}
+	}
 }
 
 static bool omap_encoder_mode_fixup(struct drm_encoder *encoder,
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: drm/omap: fix for connectors not enabled at bootup
  2011-12-11 21:13 [PATCH] drm/omap: fix for connectors not enabled at bootup Rob Clark
@ 2011-12-13  0:39 ` Greg KH
  2011-12-15 20:51   ` Rob Clark
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2011-12-13  0:39 UTC (permalink / raw)
  To: Rob Clark; +Cc: Rob Clark, dri-devel, patches

On Sun, Dec 11, 2011 at 03:13:17PM -0600, Rob Clark wrote:
> From: Rob Clark <rob@ti.com>
> 
> The connector's dpms fxn is only triggered by userspace.  When the
> driver is loaded and detected displays configured, drm core only
> calls the crtc and encoder's dpms functions.
> 
> Signed-off-by: Rob Clark <rob@ti.com>
> ---
> Arguably, this could be called a work-around, and instead drm core
> should call connector's dpms functions and rely on
> drm_helper_connector_dpms to call encoder and crtc dpms functions.
> If people think it is better to fix this in drm core, and don't
> mind me making that change, then I will do that instead.

Sounds like you should do that in the drm core itself, so I'll not queue
up this patch for now.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: drm/omap: fix for connectors not enabled at bootup
  2011-12-13  0:39 ` [PATCH] staging: " Greg KH
@ 2011-12-15 20:51   ` Rob Clark
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Clark @ 2011-12-15 20:51 UTC (permalink / raw)
  To: Greg KH; +Cc: dri-devel, patches

On Mon, Dec 12, 2011 at 6:39 PM, Greg KH <greg@kroah.com> wrote:
> On Sun, Dec 11, 2011 at 03:13:17PM -0600, Rob Clark wrote:
>> From: Rob Clark <rob@ti.com>
>>
>> The connector's dpms fxn is only triggered by userspace.  When the
>> driver is loaded and detected displays configured, drm core only
>> calls the crtc and encoder's dpms functions.
>>
>> Signed-off-by: Rob Clark <rob@ti.com>
>> ---
>> Arguably, this could be called a work-around, and instead drm core
>> should call connector's dpms functions and rely on
>> drm_helper_connector_dpms to call encoder and crtc dpms functions.
>> If people think it is better to fix this in drm core, and don't
>> mind me making that change, then I will do that instead.
>
> Sounds like you should do that in the drm core itself, so I'll not queue
> up this patch for now.

Ok, seems to be a one line change in drm core, which I'm about to send
a patch for:

diff --git a/drivers/gpu/drm/drm_crtc_helper.c
b/drivers/gpu/drm/drm_crtc_helper.c
index d2619d7..2f1ec7c 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -710,7 +710,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
                        for (i = 0; i < set->num_connectors; i++) {
                                DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set
DPMS on\n", set->connectors[i]->base.id,

drm_get_connector_name(set->connectors[i]));
-                               set->connectors[i]->dpms = DRM_MODE_DPMS_ON;
+
set->connectors[i]->funcs->dpms(set->connectors[i], DRM_MODE_DPMS_ON);
                        }
                }
                drm_helper_disable_unused_functions(dev);



> thanks,
>
> greg k-h
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-15 20:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-11 21:13 [PATCH] drm/omap: fix for connectors not enabled at bootup Rob Clark
2011-12-13  0:39 ` [PATCH] staging: " Greg KH
2011-12-15 20:51   ` Rob Clark

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.