* [PATCH 0/3] eDP DRRS patches with IGT app
@ 2015-03-23 17:42 Ramalingam C
2015-03-23 17:42 ` [PATCH 1/2] drm/i915: Removing the drrs capability enum initialization Ramalingam C
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Ramalingam C @ 2015-03-23 17:42 UTC (permalink / raw)
To: intel-gfx, rodrigo.vivi, daniel; +Cc: paulo.r.zanoni
When multiple eDP connectors are in place, these patches limit
the eDP DRRS to only one eDP panel at a time. And also handles the
issue with the initialization of the DRRS capability enum.
Along with these kernel patches an IGT app is implemented to test
the eDP DRRS.
Ramalingam C (3):
drm/i915: Removing the drrs capability enum initialization
drm/i915: eDP DRRS limited to only one panel at a time
tests/kms_drrs: Test Idleness DRRS
drivers/gpu/drm/i915/intel_dp.c | 7 +++++--
tests/Makefile.sources | 1 +
tests/kms_drrs.c | 376 +++++++++++++++++++++++++++++++++++++++
3 file changed, 382 insertions(+), 2 deletions(-)
create mode 100644 tests/kms_drrs.c
--
1.7.9.5
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 1/2] drm/i915: Removing the drrs capability enum initialization 2015-03-23 17:42 [PATCH 0/3] eDP DRRS patches with IGT app Ramalingam C @ 2015-03-23 17:42 ` Ramalingam C 2015-03-24 1:51 ` Sivakumar Thulasimani 2015-03-23 17:42 ` [PATCH 2/2] drm/i915: eDP DRRS limited to only one panel at a time Ramalingam C 2015-03-23 17:42 ` [PATCH] tests/kms_drrs: Test Idleness DRRS Ramalingam C 2 siblings, 1 reply; 10+ messages in thread From: Ramalingam C @ 2015-03-23 17:42 UTC (permalink / raw) To: intel-gfx, rodrigo.vivi, daniel; +Cc: paulo.r.zanoni As part of allocation of the drm_i915_private variable, drrs capability enum is initialized to DRRS_NOT_SUPPORTED. Hence need not initialize at each connector init. Moreover initializing this enum at connector init will reset the successful DRRS initialization of previous connector, as we have the DRRS support for only one panel at a time. Signed-off-by: Ramalingam C <ramalingam.c@intel.com> --- drivers/gpu/drm/i915/intel_dp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 637dd53..0b26df9 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -5337,8 +5337,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, struct edid *edid; enum pipe pipe = INVALID_PIPE; - dev_priv->drrs.type = DRRS_NOT_SUPPORTED; - if (!is_edp(intel_dp)) return true; -- 1.7.9.5 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] drm/i915: Removing the drrs capability enum initialization 2015-03-23 17:42 ` [PATCH 1/2] drm/i915: Removing the drrs capability enum initialization Ramalingam C @ 2015-03-24 1:51 ` Sivakumar Thulasimani 0 siblings, 0 replies; 10+ messages in thread From: Sivakumar Thulasimani @ 2015-03-24 1:51 UTC (permalink / raw) To: intel-gfx Reviewed-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com> On 3/23/2015 11:12 PM, Ramalingam C wrote: > As part of allocation of the drm_i915_private variable, drrs capability > enum is initialized to DRRS_NOT_SUPPORTED. Hence need not initialize at > each connector init. > > Moreover initializing this enum at connector init will reset > the successful DRRS initialization of previous connector, as we have > the DRRS support for only one panel at a time. > > Signed-off-by: Ramalingam C <ramalingam.c@intel.com> > --- > drivers/gpu/drm/i915/intel_dp.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > index 637dd53..0b26df9 100644 > --- a/drivers/gpu/drm/i915/intel_dp.c > +++ b/drivers/gpu/drm/i915/intel_dp.c > @@ -5337,8 +5337,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, > struct edid *edid; > enum pipe pipe = INVALID_PIPE; > > - dev_priv->drrs.type = DRRS_NOT_SUPPORTED; > - > if (!is_edp(intel_dp)) > return true; > _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/2] drm/i915: eDP DRRS limited to only one panel at a time 2015-03-23 17:42 [PATCH 0/3] eDP DRRS patches with IGT app Ramalingam C 2015-03-23 17:42 ` [PATCH 1/2] drm/i915: Removing the drrs capability enum initialization Ramalingam C @ 2015-03-23 17:42 ` Ramalingam C 2015-03-24 2:03 ` Sivakumar Thulasimani 2015-03-24 23:08 ` shuang.he 2015-03-23 17:42 ` [PATCH] tests/kms_drrs: Test Idleness DRRS Ramalingam C 2 siblings, 2 replies; 10+ messages in thread From: Ramalingam C @ 2015-03-23 17:42 UTC (permalink / raw) To: intel-gfx, rodrigo.vivi, daniel; +Cc: paulo.r.zanoni In case of multiple eDP panels, only one can have the DRRS enabled on it. In future eDP DRRS will be extended for multiple panels. Signed-off-by: Ramalingam C <ramalingam.c@intel.com> --- drivers/gpu/drm/i915/intel_dp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 0b26df9..ec40d19 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -5311,6 +5311,11 @@ intel_dp_drrs_init(struct intel_connector *intel_connector, return NULL; } + if (dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) { + DRM_DEBUG_KMS("DRRS already enabled on previous connector\n"); + return NULL; + } + INIT_DELAYED_WORK(&dev_priv->drrs.work, intel_edp_drrs_downclock_work); mutex_init(&dev_priv->drrs.mutex); -- 1.7.9.5 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] drm/i915: eDP DRRS limited to only one panel at a time 2015-03-23 17:42 ` [PATCH 2/2] drm/i915: eDP DRRS limited to only one panel at a time Ramalingam C @ 2015-03-24 2:03 ` Sivakumar Thulasimani 2015-03-24 5:45 ` Ramalingam C 2015-03-24 23:08 ` shuang.he 1 sibling, 1 reply; 10+ messages in thread From: Sivakumar Thulasimani @ 2015-03-24 2:03 UTC (permalink / raw) To: Ramalingam C, intel-gfx, rodrigo.vivi, daniel; +Cc: paulo.r.zanoni since drrs struct is used primarily in intel_dp.c file alone can it be moved to intel_dp ? On 3/23/2015 11:12 PM, Ramalingam C wrote: > In case of multiple eDP panels, only one can have > the DRRS enabled on it. > > In future eDP DRRS will be extended for multiple panels. > > Signed-off-by: Ramalingam C <ramalingam.c@intel.com> > --- > drivers/gpu/drm/i915/intel_dp.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > index 0b26df9..ec40d19 100644 > --- a/drivers/gpu/drm/i915/intel_dp.c > +++ b/drivers/gpu/drm/i915/intel_dp.c > @@ -5311,6 +5311,11 @@ intel_dp_drrs_init(struct intel_connector *intel_connector, > return NULL; > } > > + if (dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) { > + DRM_DEBUG_KMS("DRRS already enabled on previous connector\n"); > + return NULL; > + } > + > INIT_DELAYED_WORK(&dev_priv->drrs.work, intel_edp_drrs_downclock_work); > > mutex_init(&dev_priv->drrs.mutex); _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] drm/i915: eDP DRRS limited to only one panel at a time 2015-03-24 2:03 ` Sivakumar Thulasimani @ 2015-03-24 5:45 ` Ramalingam C 2015-03-24 9:33 ` Daniel Vetter 0 siblings, 1 reply; 10+ messages in thread From: Ramalingam C @ 2015-03-24 5:45 UTC (permalink / raw) To: Sivakumar Thulasimani, intel-gfx, rodrigo.vivi, daniel; +Cc: paulo.r.zanoni Hi Siva, Since the same structure will be used to implement DRRS on DSI also we have placed it at i915_dev_priv. I am working on the RFC for the DRRS on DSI. On Tuesday 24 March 2015 07:33 AM, Sivakumar Thulasimani wrote: > since drrs struct is used primarily in intel_dp.c file alone can it be > moved to intel_dp ? > > On 3/23/2015 11:12 PM, Ramalingam C wrote: >> In case of multiple eDP panels, only one can have >> the DRRS enabled on it. >> >> In future eDP DRRS will be extended for multiple panels. >> >> Signed-off-by: Ramalingam C <ramalingam.c@intel.com> >> --- >> drivers/gpu/drm/i915/intel_dp.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/drivers/gpu/drm/i915/intel_dp.c >> b/drivers/gpu/drm/i915/intel_dp.c >> index 0b26df9..ec40d19 100644 >> --- a/drivers/gpu/drm/i915/intel_dp.c >> +++ b/drivers/gpu/drm/i915/intel_dp.c >> @@ -5311,6 +5311,11 @@ intel_dp_drrs_init(struct intel_connector >> *intel_connector, >> return NULL; >> } >> + if (dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) { >> + DRM_DEBUG_KMS("DRRS already enabled on previous connector\n"); >> + return NULL; >> + } >> + >> INIT_DELAYED_WORK(&dev_priv->drrs.work, >> intel_edp_drrs_downclock_work); >> mutex_init(&dev_priv->drrs.mutex); > -- Ram _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] drm/i915: eDP DRRS limited to only one panel at a time 2015-03-24 5:45 ` Ramalingam C @ 2015-03-24 9:33 ` Daniel Vetter 2015-03-25 10:41 ` Ramalingam C 0 siblings, 1 reply; 10+ messages in thread From: Daniel Vetter @ 2015-03-24 9:33 UTC (permalink / raw) To: Ramalingam C; +Cc: intel-gfx, paulo.r.zanoni, rodrigo.vivi On Tue, Mar 24, 2015 at 11:15:00AM +0530, Ramalingam C wrote: > Hi Siva, > > Since the same structure will be used to implement DRRS on DSI also we have > placed it at i915_dev_priv. > I am working on the RFC for the DRRS on DSI. I think a better approach would be to make an array of dev_priv->drrs->dp pointers, so that we can support one drrs instance per pipe. Well maybe we need to change it from dp to intel_encoder so that it also works for dsi ports. Aside since I just again looked at the code: The locking for drrs is still a bit broken: - A few places check for ->drrs.dp != NULL without holding drrs.mutex. - Imo we should add a WARN_ON(!mutex_locked(drrs.mutex)) to drrs_set_state function. Ramalingam can you please take care of that? Thanks, Daniel > > On Tuesday 24 March 2015 07:33 AM, Sivakumar Thulasimani wrote: > >since drrs struct is used primarily in intel_dp.c file alone can it be > >moved to intel_dp ? > > > >On 3/23/2015 11:12 PM, Ramalingam C wrote: > >>In case of multiple eDP panels, only one can have > >>the DRRS enabled on it. > >> > >>In future eDP DRRS will be extended for multiple panels. > >> > >>Signed-off-by: Ramalingam C <ramalingam.c@intel.com> > >>--- > >> drivers/gpu/drm/i915/intel_dp.c | 5 +++++ > >> 1 file changed, 5 insertions(+) > >> > >>diff --git a/drivers/gpu/drm/i915/intel_dp.c > >>b/drivers/gpu/drm/i915/intel_dp.c > >>index 0b26df9..ec40d19 100644 > >>--- a/drivers/gpu/drm/i915/intel_dp.c > >>+++ b/drivers/gpu/drm/i915/intel_dp.c > >>@@ -5311,6 +5311,11 @@ intel_dp_drrs_init(struct intel_connector > >>*intel_connector, > >> return NULL; > >> } > >> + if (dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) { > >>+ DRM_DEBUG_KMS("DRRS already enabled on previous connector\n"); > >>+ return NULL; > >>+ } > >>+ > >> INIT_DELAYED_WORK(&dev_priv->drrs.work, > >>intel_edp_drrs_downclock_work); > >> mutex_init(&dev_priv->drrs.mutex); > > > > -- > Ram > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] drm/i915: eDP DRRS limited to only one panel at a time 2015-03-24 9:33 ` Daniel Vetter @ 2015-03-25 10:41 ` Ramalingam C 0 siblings, 0 replies; 10+ messages in thread From: Ramalingam C @ 2015-03-25 10:41 UTC (permalink / raw) To: Daniel Vetter; +Cc: intel-gfx, paulo.r.zanoni, rodrigo.vivi On Tuesday 24 March 2015 03:03 PM, Daniel Vetter wrote: > On Tue, Mar 24, 2015 at 11:15:00AM +0530, Ramalingam C wrote: >> Hi Siva, >> >> Since the same structure will be used to implement DRRS on DSI also we have >> placed it at i915_dev_priv. >> I am working on the RFC for the DRRS on DSI. > I think a better approach would be to make an array of dev_priv->drrs->dp > pointers, so that we can support one drrs instance per pipe. Well maybe we > need to change it from dp to intel_encoder so that it also works for dsi > ports. > > Aside since I just again looked at the code: The locking for drrs is still > a bit broken: > - A few places check for ->drrs.dp != NULL without holding drrs.mutex. > - Imo we should add a WARN_ON(!mutex_locked(drrs.mutex)) to drrs_set_state > function. > > Ramalingam can you please take care of that? Sure I will look into it Daniel. > > Thanks, Daniel > >> On Tuesday 24 March 2015 07:33 AM, Sivakumar Thulasimani wrote: >>> since drrs struct is used primarily in intel_dp.c file alone can it be >>> moved to intel_dp ? >>> >>> On 3/23/2015 11:12 PM, Ramalingam C wrote: >>>> In case of multiple eDP panels, only one can have >>>> the DRRS enabled on it. >>>> >>>> In future eDP DRRS will be extended for multiple panels. >>>> >>>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com> >>>> --- >>>> drivers/gpu/drm/i915/intel_dp.c | 5 +++++ >>>> 1 file changed, 5 insertions(+) >>>> >>>> diff --git a/drivers/gpu/drm/i915/intel_dp.c >>>> b/drivers/gpu/drm/i915/intel_dp.c >>>> index 0b26df9..ec40d19 100644 >>>> --- a/drivers/gpu/drm/i915/intel_dp.c >>>> +++ b/drivers/gpu/drm/i915/intel_dp.c >>>> @@ -5311,6 +5311,11 @@ intel_dp_drrs_init(struct intel_connector >>>> *intel_connector, >>>> return NULL; >>>> } >>>> + if (dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) { >>>> + DRM_DEBUG_KMS("DRRS already enabled on previous connector\n"); >>>> + return NULL; >>>> + } >>>> + >>>> INIT_DELAYED_WORK(&dev_priv->drrs.work, >>>> intel_edp_drrs_downclock_work); >>>> mutex_init(&dev_priv->drrs.mutex); >> -- >> Ram >> -- Thanks --Ram _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] drm/i915: eDP DRRS limited to only one panel at a time 2015-03-23 17:42 ` [PATCH 2/2] drm/i915: eDP DRRS limited to only one panel at a time Ramalingam C 2015-03-24 2:03 ` Sivakumar Thulasimani @ 2015-03-24 23:08 ` shuang.he 1 sibling, 0 replies; 10+ messages in thread From: shuang.he @ 2015-03-24 23:08 UTC (permalink / raw) To: shuang.he, ethan.gao, intel-gfx, ramalingam.c Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com) Task id: 6031 -------------------------------------Summary------------------------------------- Platform Delta drm-intel-nightly Series Applied PNV -2 275/275 273/275 ILK -1 303/303 302/303 SNB 304/304 304/304 IVB 339/339 339/339 BYT 287/287 287/287 HSW 361/361 361/361 BDW 310/310 310/310 -------------------------------------Detailed------------------------------------- Platform Test drm-intel-nightly Series Applied *PNV igt@gem_userptr_blits@minor-sync-interruptible PASS(3) DMESG_WARN(1)PASS(1) *PNV igt@gem_userptr_blits@minor-unsync-normal PASS(2) DMESG_WARN(2) *ILK igt@gem_unfence_active_buffers PASS(2) DMESG_WARN(2) Note: You need to pay more attention to line start with '*' _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] tests/kms_drrs: Test Idleness DRRS 2015-03-23 17:42 [PATCH 0/3] eDP DRRS patches with IGT app Ramalingam C 2015-03-23 17:42 ` [PATCH 1/2] drm/i915: Removing the drrs capability enum initialization Ramalingam C 2015-03-23 17:42 ` [PATCH 2/2] drm/i915: eDP DRRS limited to only one panel at a time Ramalingam C @ 2015-03-23 17:42 ` Ramalingam C 2 siblings, 0 replies; 10+ messages in thread From: Ramalingam C @ 2015-03-23 17:42 UTC (permalink / raw) To: intel-gfx, rodrigo.vivi, daniel; +Cc: paulo.r.zanoni Idleness DRRS: By default the DRRS state will be at DRRS_HIGH_RR. When a Display content is Idle for more than 1Sec Idleness will be declared and DRRS_LOW_RR will be invoked. And as soon as there is a display content change there will be a DRRS state transition as DRRS_LOW_RR--> DRRS_HIGH_RR. To test this Idleness DRRS IGT will probe the DRRS state at below instances and compare with the expected state. Instance Expected State 1. Immediately after rendering the still image DRRS_HIGH_RR 2. After a delay of 1.2Sec DRRS_LOW_RR 3. After changing the frame buffer DRRS_HIGH_RR 4. After a delay of 1.2Sec DRRS_LOW_RR 5. After changing the frame buffer DRRS_HIGH_RR 6. After a delay of 1.2Sec DRRS_LOW_RR Signed-off-by: Ramalingam C <ramalingam.c@intel.com> Signed-off-by: Vandana Kannan <vandana.kannan@intel.com> --- tests/Makefile.sources | 1 + tests/kms_drrs.c | 376 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 377 insertions(+) create mode 100644 tests/kms_drrs.c diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 74deec3..2305cd4 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -65,6 +65,7 @@ TESTS_progs_M = \ gem_write_read_ring_switch \ kms_addfb \ kms_cursor_crc \ + kms_drrs \ kms_fbc_crc \ kms_flip \ kms_flip_event_leak \ diff --git a/tests/kms_drrs.c b/tests/kms_drrs.c new file mode 100644 index 0000000..91bda5c --- /dev/null +++ b/tests/kms_drrs.c @@ -0,0 +1,376 @@ +/* + * Copyright © 2015 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ + +#include "drmtest.h" +#include "igt_debugfs.h" +#include "igt_kms.h" +#include "intel_chipset.h" +#include "intel_batchbuffer.h" +#include "ioctl_wrappers.h" +#include <time.h> + +IGT_TEST_DESCRIPTION( +"Performs write operations and then waits for DRRS to invoke the" +"Low Refresh Rate and then disturbs the contents of the screen once" +"again hence DRRS revert back to High Refresh Rate(Default)."); + +#define DRRS_STATUS_BYTES_CNT 1000 + +typedef struct { + int drm_fd; + uint32_t devid; + uint32_t handle[2]; + igt_display_t display; + igt_output_t *output; + enum pipe pipe; + igt_plane_t *primary; + struct igt_fb fb[2]; + uint32_t fb_id[2]; +} data_t; + +struct __attribute__((packed, aligned(16))) fb_status { + bool rendered; + unsigned fb_bits; +}; + +/* + * print_date_and_time : Func to print the date and time + */ +static void print_date_and_time(void) +{ + time_t curtime; + struct tm *loctime; + + curtime = time(NULL); + loctime = localtime(&curtime); + fputs (asctime (loctime), stdout); +} + +/* + * read_drrs_status : Func to read the DRRS status from debugfs + */ +static bool read_drrs_status(data_t *data, char *str) +{ + FILE *status; + int cnt; + + status = igt_debugfs_fopen("i915_drrs_status", "r"); + igt_assert(status); + + cnt = fread(str, DRRS_STATUS_BYTES_CNT - 1, 1, status); + if (!cnt) { + if (!feof(status)) { + igt_info("Err %d at fread\n", ferror(status)); + return false; + } + clearerr(status); + } + + fclose(status); + return true; +} + +/* + * is_drrs_enabled : Func to check for DRRS support + */ +static bool is_drrs_enabled(data_t *data) +{ + char str[DRRS_STATUS_BYTES_CNT] = {}; + + read_drrs_status(data, str); + return strstr(str, "DRRS Supported: Yes") != NULL; +} + +/* + * print_drrs_status : Func to print the DRRS status from the debugfs + */ +static bool print_drrs_status(data_t *data) +{ + char str[DRRS_STATUS_BYTES_CNT] = {}; + + read_drrs_status(data, str); + igt_info("%s\n", str); + + return true; +} + +/* + * is_drrs_state : Func to check the DRRS state + */ +static bool is_drrs_state(data_t *data, const char str[15]) +{ + char status[DRRS_STATUS_BYTES_CNT] = {}; + + read_drrs_status(data, status); + return strstr(status, str) != NULL; + +} + +static bool prepare_crtc(data_t *data) +{ + igt_display_t *display = &data->display; + igt_output_t *output = data->output; + + /* select the pipe we want to use */ + igt_output_set_pipe(output, data->pipe); + igt_display_commit(display); + + if (!output->valid) { + igt_output_set_pipe(output, PIPE_ANY); + igt_display_commit(display); + return false; + } + + return true; +} + +/* + * execute_test: + * + * This function creates two different Framebuffer fb0, fb1 + * and apply them in the interval of 1.2Sec. So between FB change + * DRRS should toggle from DRRS_HIGH_RR -> DRRS_LOW_RR. + * And on next FB change DRRS_LOW_RR -> DRRS_HIGH_RR. + * + * These expected transistions are verified using the kernel debugfs + */ +static bool execute_test(data_t *data) +{ + igt_display_t *display = &data->display; + igt_output_t *output = data->output; + drmModeModeInfo *mode; + bool test_failed = false; + + data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY); + mode = igt_output_get_mode(data->output); + + data->fb_id[0] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, + DRM_FORMAT_XRGB8888, + I915_TILING_X, + 0.0, 100.1, 0.0, &data->fb[0]); + igt_assert(data->fb_id[0]); + data->fb_id[1] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, + DRM_FORMAT_XRGB8888, + I915_TILING_X, + 100.1, 0.0, 0.0, + &data->fb[1]); + igt_assert(data->fb_id[1]); + + data->handle[0] = data->fb[0].gem_handle; + data->handle[1] = data->fb[1].gem_handle; + + /* scanout = fb[1] */ + igt_plane_set_fb(data->primary, &data->fb[1]); + igt_display_commit(display); + + if (!is_drrs_enabled(data)) { + igt_info("DRRS not enabled\n"); + + igt_plane_set_fb(data->primary, NULL); + igt_output_set_pipe(output, PIPE_ANY); + igt_display_commit(display); + + igt_remove_fb(data->drm_fd, &data->fb[0]); + igt_remove_fb(data->drm_fd, &data->fb[1]); + return false; + } + + igt_wait_for_vblank(data->drm_fd, data->pipe); + + + if (is_drrs_state(data, "DRRS_HIGH_RR")) { + igt_info("Expected DRRS_HIGH_RR : PASSED\n"); + } else { + igt_info("Expected DRRS_HIGH_RR : FAILED\n"); + test_failed = true; + } + + /* 1.2Sec to Enter the Idleness */ + usleep(1200000); + + if (is_drrs_state(data, "DRRS_LOW_RR")) { + igt_info("Expected DRRS_LOW_RR : PASSED\n"); + } else { + igt_info("Expected DRRS_LOW_RR : FAILED\n"); + test_failed = true; + } + + igt_wait_for_vblank(data->drm_fd, data->pipe); + + /* scanout = fb[0] */ + igt_plane_set_fb(data->primary, &data->fb[0]); + igt_display_commit(display); + + igt_wait_for_vblank(data->drm_fd, data->pipe); + + if (is_drrs_state(data, "DRRS_HIGH_RR")) { + igt_info("Expected DRRS_HIGH_RR : PASSED\n"); + } else { + igt_info("Expected DRRS_HIGH_RR : FAILED\n"); + test_failed = true; + } + + /* 1.2Sec to Enter the Idleness */ + usleep(1200000); + + if (is_drrs_state(data, "DRRS_LOW_RR")) { + igt_info("Expected DRRS_LOW_RR : PASSED\n"); + } else { + igt_info("Expected DRRS_LOW_RR : FAILED\n"); + test_failed = true; + } + + igt_wait_for_vblank(data->drm_fd, data->pipe); + + igt_plane_set_fb(data->primary, &data->fb[1]); + igt_display_commit(display); + + igt_wait_for_vblank(data->drm_fd, data->pipe); + + if (is_drrs_state(data, "DRRS_HIGH_RR")) { + igt_info("Expected DRRS_HIGH_RR : PASSED\n"); + } else { + igt_info("Expected DRRS_HIGH_RR : FAILED\n"); + test_failed = true; + } + + /* 1.2Sec to Enter the Idleness */ + usleep(1200000); + + if (is_drrs_state(data, "DRRS_LOW_RR")) { + igt_info("Expected DRRS_LOW_RR : PASSED\n"); + } else { + igt_info("Expected DRRS_LOW_RR : FAILED\n"); + test_failed = true; + } + + igt_wait_for_vblank(data->drm_fd, data->pipe); + + igt_assert(!test_failed); + return true; +} + +static void finish_crtc(data_t *data) +{ + igt_plane_set_fb(data->primary, NULL); + igt_output_set_pipe(data->output, PIPE_ANY); + igt_display_commit(&data->display); + + igt_remove_fb(data->drm_fd, &data->fb[0]); + igt_remove_fb(data->drm_fd, &data->fb[1]); +} + +static void reset_display(data_t *data) +{ + igt_display_t *display = &data->display; + + for_each_connected_output(display, data->output) { + if (data->output->valid) { + data->primary = igt_output_get_plane(data->output, + IGT_PLANE_PRIMARY); + igt_plane_set_fb(data->primary, NULL); + } + igt_output_set_pipe(data->output, PIPE_ANY); + } +} + +static void run_test(data_t *data) +{ + igt_display_t *display = &data->display; + int valid_tests = 0; + + reset_display(data); + + for_each_connected_output(display, data->output) { + for_each_pipe(display, data->pipe) { + if (!prepare_crtc(data)) + continue; + + igt_info("Beginning %s on pipe %s, connector %s\n", + igt_subtest_name(), + kmstest_pipe_name(data->pipe), + igt_output_name(data->output)); + + if (!execute_test(data)) { + igt_info("%s on pipe %s, connector %s: SKIPPED\n", + igt_subtest_name(), + kmstest_pipe_name(data->pipe), + igt_output_name(data->output)); + continue; + } + + valid_tests++; + + igt_info("%s on pipe %s, connector %s: PASSED\n", + igt_subtest_name(), + kmstest_pipe_name(data->pipe), + igt_output_name(data->output)); + + finish_crtc(data); + } + } + + igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); +} + +igt_main +{ + data_t data = {}; + + igt_skip_on_simulation(); + + igt_fixture { + char buf[64]; + int cnt; + FILE *status; + + data.drm_fd = drm_open_any_master(); + + data.devid = intel_get_drm_devid(data.drm_fd); + + status = igt_debugfs_fopen("i915_drrs_status", "r"); + igt_require_f(status, "No i915_drrs_status found\n"); + cnt = fread(buf, sizeof(buf), 1, status); + if (!cnt) { + igt_info("fread failed\n"); + return; + } + fclose(status); + buf[sizeof(buf) - 1] = '\0'; + igt_require_f(!strstr(buf, "disabled"), + "DRRS not supported:check VBT/panel caps\n"); + + /* Check if the DRRS is supported. + * If yes call the Idleness DRRS test */ + + igt_display_init(&data.display, data.drm_fd); + } + + igt_subtest_f("Idleness DRRS") + run_test(&data); + + igt_fixture { + igt_display_fini(&data.display); + } +} -- 1.7.9.5 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-03-25 10:47 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-03-23 17:42 [PATCH 0/3] eDP DRRS patches with IGT app Ramalingam C 2015-03-23 17:42 ` [PATCH 1/2] drm/i915: Removing the drrs capability enum initialization Ramalingam C 2015-03-24 1:51 ` Sivakumar Thulasimani 2015-03-23 17:42 ` [PATCH 2/2] drm/i915: eDP DRRS limited to only one panel at a time Ramalingam C 2015-03-24 2:03 ` Sivakumar Thulasimani 2015-03-24 5:45 ` Ramalingam C 2015-03-24 9:33 ` Daniel Vetter 2015-03-25 10:41 ` Ramalingam C 2015-03-24 23:08 ` shuang.he 2015-03-23 17:42 ` [PATCH] tests/kms_drrs: Test Idleness DRRS Ramalingam C
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox