drm/exynos: fixed duplicated mode setting.
this patch fixes that when drm_crtc_helper_set_mode() is called, mode data for hardware overlay and conntroller are updated two times. for example, in case that drm_crtc_helper_set_mode() is called, overlay_ops->commit() and manager_ops->commit() callbacks can be called two times, first at drm_crtc_helper_set_mode() and second at drm_helper_connector_dpms(). Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
This commit is contained in:
parent
5d55393a85
commit
50caf25c58
|
@ -40,6 +40,7 @@ struct exynos_drm_connector {
|
|||
struct drm_connector drm_connector;
|
||||
uint32_t encoder_id;
|
||||
struct exynos_drm_manager *manager;
|
||||
uint32_t dpms;
|
||||
};
|
||||
|
||||
/* convert exynos_video_timings to drm_display_mode */
|
||||
|
@ -224,6 +225,43 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = {
|
|||
.best_encoder = exynos_drm_best_encoder,
|
||||
};
|
||||
|
||||
void exynos_drm_display_power(struct drm_connector *connector, int mode)
|
||||
{
|
||||
struct drm_encoder *encoder = connector->encoder;
|
||||
struct exynos_drm_connector *exynos_connector;
|
||||
struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
|
||||
struct exynos_drm_display_ops *display_ops = manager->display_ops;
|
||||
|
||||
exynos_connector = to_exynos_connector(connector);
|
||||
|
||||
if (exynos_connector->dpms == mode) {
|
||||
DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (display_ops && display_ops->power_on)
|
||||
display_ops->power_on(manager->dev, mode);
|
||||
|
||||
exynos_connector->dpms = mode;
|
||||
}
|
||||
|
||||
static void exynos_drm_connector_dpms(struct drm_connector *connector,
|
||||
int mode)
|
||||
{
|
||||
DRM_DEBUG_KMS("%s\n", __FILE__);
|
||||
|
||||
/*
|
||||
* in case that drm_crtc_helper_set_mode() is called,
|
||||
* encoder/crtc->funcs->dpms() will be just returned
|
||||
* because they already were DRM_MODE_DPMS_ON so only
|
||||
* exynos_drm_display_power() will be called.
|
||||
*/
|
||||
drm_helper_connector_dpms(connector, mode);
|
||||
|
||||
exynos_drm_display_power(connector, mode);
|
||||
|
||||
}
|
||||
|
||||
static int exynos_drm_connector_fill_modes(struct drm_connector *connector,
|
||||
unsigned int max_width, unsigned int max_height)
|
||||
{
|
||||
|
@ -283,7 +321,7 @@ static void exynos_drm_connector_destroy(struct drm_connector *connector)
|
|||
}
|
||||
|
||||
static struct drm_connector_funcs exynos_connector_funcs = {
|
||||
.dpms = drm_helper_connector_dpms,
|
||||
.dpms = exynos_drm_connector_dpms,
|
||||
.fill_modes = exynos_drm_connector_fill_modes,
|
||||
.detect = exynos_drm_connector_detect,
|
||||
.destroy = exynos_drm_connector_destroy,
|
||||
|
@ -332,6 +370,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
|
|||
|
||||
exynos_connector->encoder_id = encoder->base.id;
|
||||
exynos_connector->manager = manager;
|
||||
exynos_connector->dpms = DRM_MODE_DPMS_OFF;
|
||||
connector->encoder = encoder;
|
||||
|
||||
err = drm_mode_connector_attach_encoder(connector, encoder);
|
||||
|
|
|
@ -31,4 +31,6 @@
|
|||
struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
|
||||
struct drm_encoder *encoder);
|
||||
|
||||
void exynos_drm_display_power(struct drm_connector *connector, int mode);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -97,6 +97,7 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
|
|||
|
||||
DRM_DEBUG_KMS("%s\n", __FILE__);
|
||||
|
||||
exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
|
||||
exynos_plane_commit(exynos_crtc->plane);
|
||||
exynos_plane_dpms(exynos_crtc->plane, DRM_MODE_DPMS_ON);
|
||||
}
|
||||
|
@ -126,8 +127,6 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
|
|||
|
||||
DRM_DEBUG_KMS("%s\n", __FILE__);
|
||||
|
||||
exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
|
||||
|
||||
/*
|
||||
* copy the mode data adjusted by mode_fixup() into crtc->mode
|
||||
* so that hardware can be seet to proper mode.
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "exynos_drm_drv.h"
|
||||
#include "exynos_drm_encoder.h"
|
||||
#include "exynos_drm_connector.h"
|
||||
|
||||
#define to_exynos_encoder(x) container_of(x, struct exynos_drm_encoder,\
|
||||
drm_encoder)
|
||||
|
@ -49,21 +50,17 @@ struct exynos_drm_encoder {
|
|||
int dpms;
|
||||
};
|
||||
|
||||
static void exynos_drm_display_power(struct drm_encoder *encoder, int mode)
|
||||
static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode)
|
||||
{
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_connector *connector;
|
||||
struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
|
||||
|
||||
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
|
||||
if (connector->encoder == encoder) {
|
||||
struct exynos_drm_display_ops *display_ops =
|
||||
manager->display_ops;
|
||||
|
||||
DRM_DEBUG_KMS("connector[%d] dpms[%d]\n",
|
||||
connector->base.id, mode);
|
||||
if (display_ops && display_ops->power_on)
|
||||
display_ops->power_on(manager->dev, mode);
|
||||
|
||||
exynos_drm_display_power(connector, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,13 +85,13 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
|
|||
case DRM_MODE_DPMS_ON:
|
||||
if (manager_ops && manager_ops->apply)
|
||||
manager_ops->apply(manager->dev);
|
||||
exynos_drm_display_power(encoder, mode);
|
||||
exynos_drm_connector_power(encoder, mode);
|
||||
exynos_encoder->dpms = mode;
|
||||
break;
|
||||
case DRM_MODE_DPMS_STANDBY:
|
||||
case DRM_MODE_DPMS_SUSPEND:
|
||||
case DRM_MODE_DPMS_OFF:
|
||||
exynos_drm_display_power(encoder, mode);
|
||||
exynos_drm_connector_power(encoder, mode);
|
||||
exynos_encoder->dpms = mode;
|
||||
break;
|
||||
default:
|
||||
|
@ -138,8 +135,6 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder,
|
|||
|
||||
DRM_DEBUG_KMS("%s\n", __FILE__);
|
||||
|
||||
exynos_drm_encoder_dpms(encoder, DRM_MODE_DPMS_ON);
|
||||
|
||||
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
|
||||
if (connector->encoder == encoder)
|
||||
if (manager_ops && manager_ops->mode_set)
|
||||
|
@ -337,6 +332,19 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data)
|
|||
if (manager_ops && manager_ops->dpms)
|
||||
manager_ops->dpms(manager->dev, mode);
|
||||
|
||||
/*
|
||||
* set current mode to new one so that data aren't updated into
|
||||
* registers by drm_helper_connector_dpms two times.
|
||||
*
|
||||
* in case that drm_crtc_helper_set_mode() is called,
|
||||
* overlay_ops->commit() and manager_ops->commit() callbacks
|
||||
* can be called two times, first at drm_crtc_helper_set_mode()
|
||||
* and second at drm_helper_connector_dpms().
|
||||
* so with this setting, when drm_helper_connector_dpms() is called
|
||||
* encoder->funcs->dpms() will be ignored.
|
||||
*/
|
||||
exynos_encoder->dpms = mode;
|
||||
|
||||
/*
|
||||
* if this condition is ok then it means that the crtc is already
|
||||
* detached from encoder and last function for detaching is properly
|
||||
|
|
Loading…
Reference in New Issue