From 01a2a4d85d71b1b7f6f4d5239d207b821ae01b55 Mon Sep 17 00:00:00 2001 From: Ville Syrjälä Date: Wed, 19 Aug 2015 17:00:09 +0300 Subject: tools/intel_display_poller: Try to fix pipe<->plane handling on gen2/3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check the pipe assignment for each plane (excluding plane C since the kernel doesn't use that one) and pick the first one that's assigned to the target pipe. Signed-off-by: Ville Syrjälä --- tools/intel_display_poller.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/intel_display_poller.c b/tools/intel_display_poller.c index ec3e30e6..8b66b53e 100644 --- a/tools/intel_display_poller.c +++ b/tools/intel_display_poller.c @@ -88,6 +88,11 @@ static void write_reg(uint32_t reg, uint32_t val) OUTREG(vlv_offset + reg, val); } +static char pipe_name(int pipe) +{ + return pipe + 'A'; +} + static int pipe_to_plane(uint32_t devid, int pipe) { if (!IS_GEN2(devid) && !IS_GEN3(devid)) @@ -95,13 +100,21 @@ static int pipe_to_plane(uint32_t devid, int pipe) switch (pipe) { case 0: - if ((read_reg(DSPACNTR) & DISPPLANE_SEL_PIPE_MASK) == DISPPLANE_SEL_PIPE_B) + if ((read_reg(DSPACNTR) & DISPPLANE_SEL_PIPE_MASK) == DISPPLANE_SEL_PIPE_A) + return 0; + if ((read_reg(DSPBCNTR) & DISPPLANE_SEL_PIPE_MASK) == DISPPLANE_SEL_PIPE_A) return 1; - return 0; + fprintf(stderr, "no plane assigned to pipe %c, assuming %c\n", + pipe_name(pipe), pipe_name(pipe)); + return pipe; case 1: - if ((read_reg(DSPACNTR) & DISPPLANE_SEL_PIPE_MASK) == DISPPLANE_SEL_PIPE_A) + if ((read_reg(DSPACNTR) & DISPPLANE_SEL_PIPE_MASK) == DISPPLANE_SEL_PIPE_B) return 0; - return 1; + if ((read_reg(DSPBCNTR) & DISPPLANE_SEL_PIPE_MASK) == DISPPLANE_SEL_PIPE_B) + return 1; + fprintf(stderr, "no plane assigned to pipe %c, assuming %c\n", + pipe_name(pipe), pipe_name(pipe)); + return pipe; } assert(0); @@ -886,11 +899,6 @@ static void poll_dsl_field(int pipe, uint32_t *min, uint32_t *max, const int cou } } -static char pipe_name(int pipe) -{ - return pipe + 'A'; -} - static const char *test_name(enum test test, int pipe, int bit, bool test_pixel_count) { static char str[32]; -- cgit v1.2.3