From: Dhinakaran Pandiyan <dhinakaran.pandiyan@xxxxxxxxx> Having registers for nonexistent planes in the dumpo might end up being rather confusing. Try to only include real planes. Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> --- tools/intel_watermark.c | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/tools/intel_watermark.c b/tools/intel_watermark.c index ce920192295b..d81e95771efb 100644 --- a/tools/intel_watermark.c +++ b/tools/intel_watermark.c @@ -135,23 +135,42 @@ static int is_hsw_plus(uint32_t d) return !(IS_GEN5(d) || IS_GEN6(d) || IS_IVYBRIDGE(d)); } +static int skl_num_planes(uint32_t d, int pipe) +{ + if (IS_GEN10(d) || IS_GEMINILAKE(d)) + return 5; + else if (IS_BROXTON(d)) + return pipe == 2 ? 4 : 5; + else + return 4; +} + +static int skl_max_planes(uint32_t d) +{ + if (IS_GEN10(d) || IS_GEMINILAKE(d) || IS_BROXTON(d)) + return 5; + else + return 4; +} static void skl_wm_dump(void) { int pipe, plane, level; int num_pipes = 3; - int num_planes = 5; + int max_planes = skl_max_planes(devid); int num_levels = 8; uint32_t base_addr = 0x70000, addr, wm_offset; - uint32_t wm[num_levels][num_pipes][num_planes]; - uint32_t wm_trans[num_pipes][num_planes]; - uint32_t buf_cfg[num_pipes][num_planes]; + uint32_t wm[num_levels][num_pipes][max_planes]; + uint32_t wm_trans[num_pipes][max_planes]; + uint32_t buf_cfg[num_pipes][max_planes]; uint32_t wm_linetime[num_pipes]; char reg_name[20]; intel_register_access_init(intel_get_pci_device(), 0, drm_fd); for (pipe = 0; pipe < num_pipes; pipe++) { + int num_planes = skl_num_planes(devid, pipe); + wm_linetime[pipe] = read_reg(0x45270 + pipe * 0x4); for (plane = 0; plane < num_planes; plane++) { @@ -173,9 +192,11 @@ static void skl_wm_dump(void) } printf("\n\n"); - for (plane = 0; plane < num_planes; plane++) { + for (plane = 0; plane < max_planes; plane++) { for (level = 0; level < num_levels; level++) { for (pipe = 0; pipe < num_pipes; pipe++) { + if (plane >= skl_num_planes(devid, pipe)) + break; if (plane == 0) snprintf(reg_name, sizeof(reg_name), "CUR_WM_%c_%1d", pipe_name(pipe), level); @@ -190,8 +211,10 @@ static void skl_wm_dump(void) printf("\n"); } - for (plane = 0; plane < num_planes; plane++) { + for (plane = 0; plane < max_planes; plane++) { for (pipe = 0; pipe < num_pipes; pipe++) { + if (plane >= skl_num_planes(devid, pipe)) + break; if (plane == 0) snprintf(reg_name, sizeof(reg_name), "CUR_WM_TRANS_%c", pipe_name(pipe)); @@ -205,8 +228,10 @@ static void skl_wm_dump(void) } printf("\n"); - for (plane = 0; plane < num_planes; plane++) { + for (plane = 0; plane < max_planes; plane++) { for (pipe = 0; pipe < num_pipes; pipe++) { + if (plane >= skl_num_planes(devid, pipe)) + break; if (plane == 0) snprintf(reg_name, sizeof(reg_name), "CUR_BUF_CFG_%c", pipe_name(pipe)); @@ -224,6 +249,7 @@ static void skl_wm_dump(void) uint32_t start, end, size; uint32_t lines, blocks, enable; uint32_t linetime; + int num_planes = skl_num_planes(devid, pipe); printf("PIPE_%c\n", pipe_name(pipe)); -- 2.13.5 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx