[PATCH -v3 11/11] drm/exynos: atomic dpms support

2015-04-07 Thread Joonyoung Shim
Hi,

On 04/07/2015 03:26 AM, Gustavo Padovan wrote:
> Hi Inki,
> 
> 2015-04-05 Inki Dae :
> 
>> Hi,
>>
>> 2015-04-04 3:09 GMT+09:00 Gustavo Padovan :
>>> From: Gustavo Padovan 
>>>
>>> Run dpms operations through the atomic intefaces. This basically removes
>>> the .dpms() callback from econders and crtcs and use .disable() and
>>> .enable() to turn the crtc on and off.
>>>
>>> v2: Address comments by Joonyoung:
>>> - make hdmi code call ->disable() instead of ->dpms()
>>> - do not use WARN_ON on crtc enable/disable
>>>
>>> Signed-off-by: Gustavo Padovan 
>>> ---
>>>  drivers/gpu/drm/exynos/exynos_dp_core.c   |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_connector.c |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 99 
>>> +++
>>>  drivers/gpu/drm/exynos/exynos_drm_dpi.c   |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_drv.h   |  4 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_dsi.c   |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 27 ++--
>>>  drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  2 +-
>>>  drivers/gpu/drm/exynos/exynos_hdmi.c  |  6 +-
>>>  9 files changed, 70 insertions(+), 76 deletions(-)
>>>
>>
>> ...snip...
>>
>>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
>>> b/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> index 5b597bc..2ea7d01 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>>> @@ -1051,7 +1051,7 @@ static void hdmi_connector_destroy(struct 
>>> drm_connector *connector)
>>>  }
>>>
>>>  static struct drm_connector_funcs hdmi_connector_funcs = {
>>> -   .dpms = drm_helper_connector_dpms,
>>> +   .dpms = drm_atomic_helper_connector_dpms,
>>> .fill_modes = drm_helper_probe_single_connector_modes,
>>> .detect = hdmi_detect,
>>> .destroy = hdmi_connector_destroy,
>>> @@ -2127,8 +2127,8 @@ static void hdmi_dpms(struct exynos_drm_display 
>>> *display, int mode)
>>>  */
>>> if (crtc)
>>> funcs = crtc->helper_private;
>>> -   if (funcs && funcs->dpms)
>>> -   (*funcs->dpms)(crtc, mode);
>>> +   if (funcs && funcs->disable)
>>> +   (*funcs->disable)(crtc, mode);
>>
>> This patch makes funcs->disable callback to be called instead of
>> funcs->dpms callback. However, funcs->disable callback isn't required
>> for second argument so the build is failed like below,
>>
>> drivers/gpu/drm/exynos/exynos_hdmi.c: In function 'hdmi_dpms':
>> drivers/gpu/drm/exynos/exynos_hdmi.c:2131:4: error: too many arguments
>> to function 'funcs->disable'
>>

You needs to rebase patchset from latest repository of Inki Dae with
this fix because i got some conflict to apply this patchset.

Anyway, i just tested it from hdmi output part on odroid-xu3 board.

Tested-by: Joonyoung Shim 

Thanks.

>> Please, keep in mind that you should build it and at least have a
>> basic test before posting.
> 
> Sure, I think this happened because I've been using exynos_defconfig to test
> my kernels and HDMI is not there. Maybe should we add the EXYNOS_DRM_HDMI to
> defconfig? What do you think?
> 
>   Gustavo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
> in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



[PATCH -v3 11/11] drm/exynos: atomic dpms support

2015-04-06 Thread Gustavo Padovan
Hi Inki,

2015-04-05 Inki Dae :

> Hi,
> 
> 2015-04-04 3:09 GMT+09:00 Gustavo Padovan :
> > From: Gustavo Padovan 
> >
> > Run dpms operations through the atomic intefaces. This basically removes
> > the .dpms() callback from econders and crtcs and use .disable() and
> > .enable() to turn the crtc on and off.
> >
> > v2: Address comments by Joonyoung:
> > - make hdmi code call ->disable() instead of ->dpms()
> > - do not use WARN_ON on crtc enable/disable
> >
> > Signed-off-by: Gustavo Padovan 
> > ---
> >  drivers/gpu/drm/exynos/exynos_dp_core.c   |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_connector.c |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 99 
> > +++
> >  drivers/gpu/drm/exynos/exynos_drm_dpi.c   |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_drv.h   |  4 +-
> >  drivers/gpu/drm/exynos/exynos_drm_dsi.c   |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 27 ++--
> >  drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  2 +-
> >  drivers/gpu/drm/exynos/exynos_hdmi.c  |  6 +-
> >  9 files changed, 70 insertions(+), 76 deletions(-)
> >
> 
> ...snip...
> 
> > diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
> > b/drivers/gpu/drm/exynos/exynos_hdmi.c
> > index 5b597bc..2ea7d01 100644
> > --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> > +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> > @@ -1051,7 +1051,7 @@ static void hdmi_connector_destroy(struct 
> > drm_connector *connector)
> >  }
> >
> >  static struct drm_connector_funcs hdmi_connector_funcs = {
> > -   .dpms = drm_helper_connector_dpms,
> > +   .dpms = drm_atomic_helper_connector_dpms,
> > .fill_modes = drm_helper_probe_single_connector_modes,
> > .detect = hdmi_detect,
> > .destroy = hdmi_connector_destroy,
> > @@ -2127,8 +2127,8 @@ static void hdmi_dpms(struct exynos_drm_display 
> > *display, int mode)
> >  */
> > if (crtc)
> > funcs = crtc->helper_private;
> > -   if (funcs && funcs->dpms)
> > -   (*funcs->dpms)(crtc, mode);
> > +   if (funcs && funcs->disable)
> > +   (*funcs->disable)(crtc, mode);
> 
> This patch makes funcs->disable callback to be called instead of
> funcs->dpms callback. However, funcs->disable callback isn't required
> for second argument so the build is failed like below,
> 
> drivers/gpu/drm/exynos/exynos_hdmi.c: In function 'hdmi_dpms':
> drivers/gpu/drm/exynos/exynos_hdmi.c:2131:4: error: too many arguments
> to function 'funcs->disable'
> 
> Please, keep in mind that you should build it and at least have a
> basic test before posting.

Sure, I think this happened because I've been using exynos_defconfig to test
my kernels and HDMI is not there. Maybe should we add the EXYNOS_DRM_HDMI to
defconfig? What do you think?

Gustavo


[PATCH -v3 11/11] drm/exynos: atomic dpms support

2015-04-06 Thread Inki Dae
Hi,

2015-04-04 3:09 GMT+09:00 Gustavo Padovan :
> From: Gustavo Padovan 
>
> Run dpms operations through the atomic intefaces. This basically removes
> the .dpms() callback from econders and crtcs and use .disable() and
> .enable() to turn the crtc on and off.
>
> v2: Address comments by Joonyoung:
> - make hdmi code call ->disable() instead of ->dpms()
> - do not use WARN_ON on crtc enable/disable
>
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/gpu/drm/exynos/exynos_dp_core.c   |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_connector.c |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 99 
> +++
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c   |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_drv.h   |  4 +-
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c   |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 27 ++--
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  2 +-
>  drivers/gpu/drm/exynos/exynos_hdmi.c  |  6 +-
>  9 files changed, 70 insertions(+), 76 deletions(-)
>

...snip...

> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 5b597bc..2ea7d01 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -1051,7 +1051,7 @@ static void hdmi_connector_destroy(struct drm_connector 
> *connector)
>  }
>
>  static struct drm_connector_funcs hdmi_connector_funcs = {
> -   .dpms = drm_helper_connector_dpms,
> +   .dpms = drm_atomic_helper_connector_dpms,
> .fill_modes = drm_helper_probe_single_connector_modes,
> .detect = hdmi_detect,
> .destroy = hdmi_connector_destroy,
> @@ -2127,8 +2127,8 @@ static void hdmi_dpms(struct exynos_drm_display 
> *display, int mode)
>  */
> if (crtc)
> funcs = crtc->helper_private;
> -   if (funcs && funcs->dpms)
> -   (*funcs->dpms)(crtc, mode);
> +   if (funcs && funcs->disable)
> +   (*funcs->disable)(crtc, mode);

This patch makes funcs->disable callback to be called instead of
funcs->dpms callback. However, funcs->disable callback isn't required
for second argument so the build is failed like below,

drivers/gpu/drm/exynos/exynos_hdmi.c: In function 'hdmi_dpms':
drivers/gpu/drm/exynos/exynos_hdmi.c:2131:4: error: too many arguments
to function 'funcs->disable'

Please, keep in mind that you should build it and at least have a
basic test before posting.

Thanks,
Inki Dae

>
> hdmi_poweroff(hdata);
> break;
> --
> 2.1.0
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH -v3 11/11] drm/exynos: atomic dpms support

2015-04-03 Thread Gustavo Padovan
From: Gustavo Padovan 

Run dpms operations through the atomic intefaces. This basically removes
the .dpms() callback from econders and crtcs and use .disable() and
.enable() to turn the crtc on and off.

v2: Address comments by Joonyoung:
- make hdmi code call ->disable() instead of ->dpms()
- do not use WARN_ON on crtc enable/disable

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_dp_core.c   |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_connector.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 99 +++
 drivers/gpu/drm/exynos/exynos_drm_dpi.c   |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  4 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c   |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 27 ++--
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c  |  6 +-
 9 files changed, 70 insertions(+), 76 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 6704d5c..e030d16 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -949,7 +949,7 @@ static void exynos_dp_connector_destroy(struct 
drm_connector *connector)
 }

 static struct drm_connector_funcs exynos_dp_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = exynos_dp_detect,
.destroy = exynos_dp_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c 
b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index 980b085..e459e64 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -179,7 +179,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   = drm_atomic_helper_connector_dpms,
.fill_modes = exynos_drm_connector_fill_modes,
.detect = exynos_drm_connector_detect,
.destroy= exynos_drm_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 0db7b91..519c569 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -22,51 +22,57 @@
 #include "exynos_drm_encoder.h"
 #include "exynos_drm_plane.h"

-static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
+static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);

-   DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
-
-   if (exynos_crtc->dpms == mode) {
-   DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
+   if (exynos_crtc->enabled)
return;
-   }
-
-   if (mode > DRM_MODE_DPMS_ON) {
-   /* wait for the completion of page flip. */
-   if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
-   (exynos_crtc->event == NULL), HZ/20))
-   exynos_crtc->event = NULL;
-   drm_crtc_vblank_off(crtc);
-   }

if (exynos_crtc->ops->dpms)
-   exynos_crtc->ops->dpms(exynos_crtc, mode);
+   exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_ON);

-   exynos_crtc->dpms = mode;
+   exynos_crtc->enabled = true;

-   if (mode == DRM_MODE_DPMS_ON)
-   drm_crtc_vblank_on(crtc);
-}
+   drm_crtc_vblank_on(crtc);

-static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
-{
-   /* drm framework doesn't check NULL. */
+   if (exynos_crtc->ops->win_commit)
+   exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
+
+   if (exynos_crtc->ops->commit)
+   exynos_crtc->ops->commit(exynos_crtc);
 }

-static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
+static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
+   struct drm_plane *plane;
+   int ret;
+
+   if (!exynos_crtc->enabled)
+   return;

-   exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
+   /* wait for the completion of page flip. */
+   if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
+   (exynos_crtc->event == NULL), HZ/20))
+   exynos_crtc->event = NULL;

-   if (exynos_crtc->ops->win_commit)
-   exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
+