Re: [PATCH 15/81] drm/amd/display: Re-enable Vsync Interrupts for Gradual Refresh Ramp

2017-07-26 Thread Michel Dänzer
On 26/07/17 10:34 PM, Harry Wentland wrote:
> On 2017-07-25 09:34 PM, Michel Dänzer wrote:
>> On 25/07/17 10:53 PM, sunpeng...@amd.com wrote:
>>> From: Amy Zhang 
>>>
>>> - Make sure Vsync interrupts are disabled in static screen case
>>>   and enabled when not to save power
>>
>> What exactly does this mean? FWIW, the interrupt whose handler calls
>> drm_handle_vblank() must be enabled from when the
>> drm_driver::enable_vblank hook is called until when the
>> drm_driver::disable_vblank hook is called.
> 
> This comment is misleading and should've been trimmed when preparing the
> patches for the open tree. This change should not have an impact on
> vblank interrupts on Linux.

That's good to know.

> Sorry for the confusion.

No worries, just making sure.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 15/81] drm/amd/display: Re-enable Vsync Interrupts for Gradual Refresh Ramp

2017-07-26 Thread Harry Wentland
On 2017-07-25 09:34 PM, Michel Dänzer wrote:
> On 25/07/17 10:53 PM, sunpeng...@amd.com wrote:
>> From: Amy Zhang 
>>
>> - Make sure Vsync interrupts are disabled in static screen case
>>   and enabled when not to save power
> 
> What exactly does this mean? FWIW, the interrupt whose handler calls
> drm_handle_vblank() must be enabled from when the
> drm_driver::enable_vblank hook is called until when the
> drm_driver::disable_vblank hook is called.
> 
> 

This comment is misleading and should've been trimmed when preparing the
patches for the open tree. This change should not have an impact on
vblank interrupts on Linux. Sorry for the confusion.

Harry
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 15/81] drm/amd/display: Re-enable Vsync Interrupts for Gradual Refresh Ramp

2017-07-25 Thread Michel Dänzer
On 25/07/17 10:53 PM, sunpeng...@amd.com wrote:
> From: Amy Zhang 
> 
> - Make sure Vsync interrupts are disabled in static screen case
>   and enabled when not to save power

What exactly does this mean? FWIW, the interrupt whose handler calls
drm_handle_vblank() must be enabled from when the
drm_driver::enable_vblank hook is called until when the
drm_driver::disable_vblank hook is called.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 15/81] drm/amd/display: Re-enable Vsync Interrupts for Gradual Refresh Ramp

2017-07-25 Thread sunpeng.li
From: Amy Zhang 

- Make sure Vsync interrupts are disabled in static screen case
  and enabled when not to save power
- Create no_static_for_external_dp debug option

Change-Id: I29c90dcd6ea43e15e52a4dacf1e5ce91d32ac9a1
Signed-off-by: Amy Zhang 
Reviewed-by: Anthony Koo 
Acked-by: Harry Wentland 
---
 drivers/gpu/drm/amd/display/dc/dc.h|  1 +
 .../drm/amd/display/modules/freesync/freesync.c| 38 --
 .../gpu/drm/amd/display/modules/inc/mod_freesync.h |  5 +++
 3 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index 3e2ed3d..93aff82 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -188,6 +188,7 @@ struct dc_debug {
bool disable_dmcu;
bool disable_psr;
bool force_abm_enable;
+   bool no_static_for_external_dp;
 };
 
 struct dc {
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c 
b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index c7da90f..4df79f7 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -440,14 +440,11 @@ static void calc_freesync_range(struct core_freesync 
*core_freesync,
}
 
/* Determine whether BTR can be supported */
-   //if (max_frame_duration_in_ns >=
-   //  2 * min_frame_duration_in_ns)
-   //  core_freesync->map[index].caps->btr_supported = true;
-   //else
-   //  core_freesync->map[index].caps->btr_supported = false;
-
-   /* Temp, keep btr disabled */
-   core_freesync->map[index].caps->btr_supported = false;
+   if (max_frame_duration_in_ns >=
+   2 * min_frame_duration_in_ns)
+   core_freesync->map[index].caps->btr_supported = true;
+   else
+   core_freesync->map[index].caps->btr_supported = false;
 
/* Cache the time variables */
state->time.max_render_time_in_us =
@@ -882,8 +879,10 @@ void mod_freesync_update_state(struct mod_freesync 
*mod_freesync,
 * panels. Also change core variables only if there
 * is a change.
 */
-   if (dc_is_embedded_signal(
-   streams[stream_index]->sink->sink_signal) &&
+   if ((dc_is_embedded_signal(
+   streams[stream_index]->sink->sink_signal) ||
+   core_freesync->map[map_index].caps->
+   no_static_for_external_dp == false) &&
state->static_screen !=
freesync_params->enable) {
 
@@ -1035,6 +1034,25 @@ bool mod_freesync_get_user_enable(struct mod_freesync 
*mod_freesync,
return true;
 }
 
+bool mod_freesync_get_static_ramp_active(struct mod_freesync *mod_freesync,
+   const struct dc_stream *stream,
+   bool *is_ramp_active)
+{
+   unsigned int index = 0;
+   struct core_freesync *core_freesync = NULL;
+
+   if (mod_freesync == NULL)
+   return false;
+
+   core_freesync = MOD_FREESYNC_TO_CORE(mod_freesync);
+   index = map_index_from_stream(core_freesync, stream);
+
+   *is_ramp_active =
+   core_freesync->map[index].state.static_ramp.ramp_is_active;
+
+   return true;
+}
+
 bool mod_freesync_override_min_max(struct mod_freesync *mod_freesync,
const struct dc_stream *streams,
unsigned int min_refresh,
diff --git a/drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h 
b/drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h
index f7f5a2c..eae1b34 100644
--- a/drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h
+++ b/drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h
@@ -88,6 +88,7 @@ struct mod_freesync_caps {
unsigned int max_refresh_in_micro_hz;
 
bool btr_supported;
+   bool no_static_for_external_dp;
 };
 
 struct mod_freesync_params {
@@ -129,6 +130,10 @@ bool mod_freesync_get_user_enable(struct mod_freesync 
*mod_freesync,
const struct dc_stream *stream,
struct mod_freesync_user_enable *user_enable);
 
+bool mod_freesync_get_static_ramp_active(struct mod_freesync *mod_freesync,
+   const struct dc_stream *stream,
+   bool *is_ramp_active);
+
 bool mod_freesync_override_min_max(struct mod_freesync *mod_freesync,
const struct dc_stream *streams,
unsigned int min_refresh,
-- 
2.7.4

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx