* [PATCH 1/2] drm/exynos: calculate vrefresh instead of use a fixed value
@ 2015-06-18 20:50 Gustavo Padovan
2015-06-18 20:50 ` [PATCH 2/2] drm/exynos: use KMS version of DRM vblanks functions Gustavo Padovan
0 siblings, 1 reply; 6+ messages in thread
From: Gustavo Padovan @ 2015-06-18 20:50 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, inki.dae, jy0922.shim, tjakobi, Gustavo Padovan
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
When mode's vrefresh is zero we should ask DRM core to calculate vrefresh
for us so we can get the correct value instead of relying on fixed value
defined in a macro. But if vrefresh is still zero we should fail the
update.
Suggested-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 1e3bb72..7ba348e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -41,7 +41,6 @@
* CPU Interface.
*/
-#define FIMD_DEFAULT_FRAMERATE 60
#define MIN_FB_WIDTH_FOR_16WORD_BURST 128
/* position control register for hardware window 0, 2 ~ 4.*/
@@ -403,7 +402,9 @@ static bool fimd_mode_fixup(struct exynos_drm_crtc *crtc,
struct drm_display_mode *adjusted_mode)
{
if (adjusted_mode->vrefresh == 0)
- adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE;
+ adjusted_mode->vrefresh = drm_mode_vrefresh(mode);
+ if (adjusted_mode->vrefresh == 0)
+ return false;
return true;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] drm/exynos: use KMS version of DRM vblanks functions
2015-06-18 20:50 [PATCH 1/2] drm/exynos: calculate vrefresh instead of use a fixed value Gustavo Padovan
@ 2015-06-18 20:50 ` Gustavo Padovan
0 siblings, 0 replies; 6+ messages in thread
From: Gustavo Padovan @ 2015-06-18 20:50 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, inki.dae, jy0922.shim, tjakobi, Gustavo Padovan
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Get rid of legacy DRM vblank function that are less clear to use.
The new only basically requires only the crtc as paramenters.
It also clean ups exynos_drm_crtc_finish_pageflip() parameters as a
consequence.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 4 ++--
drivers/gpu/drm/exynos/exynos_drm_crtc.c | 14 ++++++--------
drivers/gpu/drm/exynos/exynos_drm_crtc.h | 2 +-
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 8 ++++----
drivers/gpu/drm/exynos/exynos_drm_vidi.c | 4 ++--
drivers/gpu/drm/exynos/exynos_mixer.c | 4 ++--
6 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 2b9221c..43c0ab7 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -652,8 +652,8 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
goto out;
if (!ctx->i80_if) {
- drm_handle_vblank(ctx->drm_dev, ctx->pipe);
- exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe);
+ drm_crtc_handle_vblank(&ctx->crtc->base);
+ exynos_drm_crtc_finish_pageflip(ctx->crtc);
/* set wait vsync event to zero and wake up queue. */
if (atomic_read(&ctx->wait_vsync_event)) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 22b9ca0..e9c291f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -193,24 +193,22 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe)
exynos_crtc->ops->disable_vblank(exynos_crtc);
}
-void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe)
+void exynos_drm_crtc_finish_pageflip(struct exynos_drm_crtc *exynos_crtc)
{
- struct exynos_drm_private *dev_priv = dev->dev_private;
- struct drm_crtc *drm_crtc = dev_priv->crtc[pipe];
- struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(drm_crtc);
+ struct drm_crtc *crtc = &exynos_crtc->base;
unsigned long flags;
- spin_lock_irqsave(&dev->event_lock, flags);
+ spin_lock_irqsave(&crtc->dev->event_lock, flags);
if (exynos_crtc->event) {
- drm_send_vblank_event(dev, pipe, exynos_crtc->event);
- drm_vblank_put(dev, pipe);
+ drm_crtc_send_vblank_event(crtc, exynos_crtc->event);
+ drm_crtc_vblank_put(crtc);
wake_up(&exynos_crtc->pending_flip_queue);
}
exynos_crtc->event = NULL;
- spin_unlock_irqrestore(&dev->event_lock, flags);
+ spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
}
void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 0f3aa70..d01d49a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -25,7 +25,7 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
void *context);
int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe);
void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe);
-void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe);
+void exynos_drm_crtc_finish_pageflip(struct exynos_drm_crtc *exynos_crtc);
void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb);
/* This function gets pipe value to crtc device matched with out_type. */
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 7ba348e..659976c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -886,7 +886,7 @@ static void fimd_te_handler(struct exynos_drm_crtc *crtc)
}
if (test_bit(0, &ctx->irq_flags))
- drm_handle_vblank(ctx->drm_dev, ctx->pipe);
+ drm_crtc_handle_vblank(&ctx->crtc->base);
}
static void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable)
@@ -936,13 +936,13 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
goto out;
if (ctx->i80_if) {
- exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe);
+ exynos_drm_crtc_finish_pageflip(ctx->crtc);
/* Exits triggering mode */
atomic_set(&ctx->triggering, 0);
} else {
- drm_handle_vblank(ctx->drm_dev, ctx->pipe);
- exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe);
+ drm_crtc_handle_vblank(&ctx->crtc->base);
+ exynos_drm_crtc_finish_pageflip(ctx->crtc);
/* set wait vsync event to zero and wake up queue. */
if (atomic_read(&ctx->wait_vsync_event)) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index 4706d45..5f74d6c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -193,7 +193,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work)
/* refresh rate is about 50Hz. */
usleep_range(16000, 20000);
- drm_handle_vblank(ctx->drm_dev, ctx->pipe);
+ drm_crtc_handle_vblank(&ctx->crtc->base);
mutex_lock(&ctx->lock);
@@ -205,7 +205,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work)
mutex_unlock(&ctx->lock);
- exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe);
+ exynos_drm_crtc_finish_pageflip(ctx->crtc);
}
static int vidi_show_connection(struct device *dev,
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index f570687..bbcbcbc 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -731,8 +731,8 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg)
goto out;
}
- drm_handle_vblank(ctx->drm_dev, ctx->pipe);
- exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe);
+ drm_crtc_handle_vblank(&ctx->crtc->base);
+ exynos_drm_crtc_finish_pageflip(ctx->crtc);
/* set wait vsync event to zero and wake up queue. */
if (atomic_read(&ctx->wait_vsync_event)) {
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] drm/exynos: calculate vrefresh instead of use a fixed value
2015-05-20 17:16 ` Daniel Stone
@ 2015-05-20 18:46 ` Gustavo Padovan
0 siblings, 0 replies; 6+ messages in thread
From: Gustavo Padovan @ 2015-05-20 18:46 UTC (permalink / raw)
To: Daniel Stone; +Cc: linux-samsung-soc, dri-devel, Tobias Jakobi, Gustavo Padovan
Hi,
2015-05-20 Daniel Stone <daniel@fooishbar.org>:
> Hi,
>
> On 20 May 2015 at 17:58, Tobias Jakobi <tjakobi@math.uni-bielefeld.de> wrote:
> > On 2015-05-20 16:33, Gustavo Padovan wrote:
> >> When mode's vrefresh is zero we should ask DRM core to calculate vrefresh
> >> for us so we can get the correct value instead of relying on fixed value
> >> defined in a macro.
> >>
> >> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >> ---
> >> drivers/gpu/drm/exynos/exynos_drm_fimd.c | 3 +--
> >> 1 file changed, 1 insertion(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> >> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> >> index 9819fa6..08f7197 100644
> >> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> >> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> >> @@ -42,7 +42,6 @@
> >> * CPU Interface.
> >> */
> >>
> >> -#define FIMD_DEFAULT_FRAMERATE 60
> >> #define MIN_FB_WIDTH_FOR_16WORD_BURST 128
> >>
> >> /* position control register for hardware window 0, 2 ~ 4.*/
> >> @@ -329,7 +328,7 @@ static bool fimd_mode_fixup(struct exynos_drm_crtc
> >> *crtc,
> >> struct drm_display_mode *adjusted_mode)
> >> {
> >> if (adjusted_mode->vrefresh == 0)
> >
> > Well, I'm not completly sure how this all works, but shouldn't we check
> > 'mode' here, and not 'adjusted_mode'?
>
> adjusted_mode is fine; it is pre-populated with the value from mode.
> 'mode' itself _must not_ be modified.
>
> Mind you, this is missing a hunk to reject entirely invalid modes, i.e.:
> if (adjusted_mode->vrefresh == 0)
> adjusted_mode->vrefresh = drm_mode_vrefresh(adjusted_mode);
> if (adjusted_mode->vrefresh == 0)
> return false;
I have sent a v2 with the proposed change. I can't really test this here
as I don't have the hardware where it fails. So in v1 I was just
guessing that it would fix the issue.
Gustavo
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] drm/exynos: calculate vrefresh instead of use a fixed value
2015-05-20 16:58 ` Tobias Jakobi
@ 2015-05-20 17:16 ` Daniel Stone
2015-05-20 18:46 ` Gustavo Padovan
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Stone @ 2015-05-20 17:16 UTC (permalink / raw)
To: Tobias Jakobi
Cc: Gustavo Padovan, linux-samsung-soc, dri-devel, InKi Dae,
Joonyoung Shim, Gustavo Padovan
Hi,
On 20 May 2015 at 17:58, Tobias Jakobi <tjakobi@math.uni-bielefeld.de> wrote:
> On 2015-05-20 16:33, Gustavo Padovan wrote:
>> When mode's vrefresh is zero we should ask DRM core to calculate vrefresh
>> for us so we can get the correct value instead of relying on fixed value
>> defined in a macro.
>>
>> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>> ---
>> drivers/gpu/drm/exynos/exynos_drm_fimd.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index 9819fa6..08f7197 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -42,7 +42,6 @@
>> * CPU Interface.
>> */
>>
>> -#define FIMD_DEFAULT_FRAMERATE 60
>> #define MIN_FB_WIDTH_FOR_16WORD_BURST 128
>>
>> /* position control register for hardware window 0, 2 ~ 4.*/
>> @@ -329,7 +328,7 @@ static bool fimd_mode_fixup(struct exynos_drm_crtc
>> *crtc,
>> struct drm_display_mode *adjusted_mode)
>> {
>> if (adjusted_mode->vrefresh == 0)
>
> Well, I'm not completly sure how this all works, but shouldn't we check
> 'mode' here, and not 'adjusted_mode'?
adjusted_mode is fine; it is pre-populated with the value from mode.
'mode' itself _must not_ be modified.
Mind you, this is missing a hunk to reject entirely invalid modes, i.e.:
if (adjusted_mode->vrefresh == 0)
adjusted_mode->vrefresh = drm_mode_vrefresh(adjusted_mode);
if (adjusted_mode->vrefresh == 0)
return false;
Cheers,
Daniel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] drm/exynos: calculate vrefresh instead of use a fixed value
2015-05-20 14:33 [PATCH 1/2] drm/exynos: calculate vrefresh instead of use a fixed value Gustavo Padovan
@ 2015-05-20 16:58 ` Tobias Jakobi
2015-05-20 17:16 ` Daniel Stone
0 siblings, 1 reply; 6+ messages in thread
From: Tobias Jakobi @ 2015-05-20 16:58 UTC (permalink / raw)
To: Gustavo Padovan; +Cc: linux-samsung-soc, dri-devel, Gustavo Padovan
On 2015-05-20 16:33, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> When mode's vrefresh is zero we should ask DRM core to calculate
> vrefresh
> for us so we can get the correct value instead of relying on fixed
> value
> defined in a macro.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
> drivers/gpu/drm/exynos/exynos_drm_fimd.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 9819fa6..08f7197 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -42,7 +42,6 @@
> * CPU Interface.
> */
>
> -#define FIMD_DEFAULT_FRAMERATE 60
> #define MIN_FB_WIDTH_FOR_16WORD_BURST 128
>
> /* position control register for hardware window 0, 2 ~ 4.*/
> @@ -329,7 +328,7 @@ static bool fimd_mode_fixup(struct exynos_drm_crtc
> *crtc,
> struct drm_display_mode *adjusted_mode)
> {
> if (adjusted_mode->vrefresh == 0)
Well, I'm not completly sure how this all works, but shouldn't we check
'mode' here, and not 'adjusted_mode'?
With best wishes,
Tobias
> - adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE;
> + adjusted_mode->vrefresh = drm_mode_vrefresh(mode);
>
> return true;
> }
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] drm/exynos: calculate vrefresh instead of use a fixed value
@ 2015-05-20 14:33 Gustavo Padovan
2015-05-20 16:58 ` Tobias Jakobi
0 siblings, 1 reply; 6+ messages in thread
From: Gustavo Padovan @ 2015-05-20 14:33 UTC (permalink / raw)
To: linux-samsung-soc
Cc: dri-devel, inki.dae, jy0922.shim, daniel, tjakobi, Gustavo Padovan
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
When mode's vrefresh is zero we should ask DRM core to calculate vrefresh
for us so we can get the correct value instead of relying on fixed value
defined in a macro.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9819fa6..08f7197 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -42,7 +42,6 @@
* CPU Interface.
*/
-#define FIMD_DEFAULT_FRAMERATE 60
#define MIN_FB_WIDTH_FOR_16WORD_BURST 128
/* position control register for hardware window 0, 2 ~ 4.*/
@@ -329,7 +328,7 @@ static bool fimd_mode_fixup(struct exynos_drm_crtc *crtc,
struct drm_display_mode *adjusted_mode)
{
if (adjusted_mode->vrefresh == 0)
- adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE;
+ adjusted_mode->vrefresh = drm_mode_vrefresh(mode);
return true;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-06-18 20:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18 20:50 [PATCH 1/2] drm/exynos: calculate vrefresh instead of use a fixed value Gustavo Padovan
2015-06-18 20:50 ` [PATCH 2/2] drm/exynos: use KMS version of DRM vblanks functions Gustavo Padovan
-- strict thread matches above, loose matches on Subject: below --
2015-05-20 14:33 [PATCH 1/2] drm/exynos: calculate vrefresh instead of use a fixed value Gustavo Padovan
2015-05-20 16:58 ` Tobias Jakobi
2015-05-20 17:16 ` Daniel Stone
2015-05-20 18:46 ` Gustavo Padovan
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.