From: Jani Nikula <jani.nikula@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 10/20] tools/intel_vbt_decode: Reuse print_detail_timing_data()
Date: Fri, 31 May 2024 17:50:54 +0300 [thread overview]
Message-ID: <87h6eedohd.fsf@intel.com> (raw)
In-Reply-To: <20240531142354.16528-11-ville.syrjala@linux.intel.com>
On Fri, 31 May 2024, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We currently have two copies of code to decode the basic EDID
> defined DTD. Get rid of the ad-hoc variant in dump_lfp_data()
> and just reuse print_detail_timing_data() for it.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> tools/intel_vbt_decode.c | 106 ++++++++++++++-------------------------
> 1 file changed, 39 insertions(+), 67 deletions(-)
>
> diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
> index 2a11490eed22..ed18a156c1ee 100644
> --- a/tools/intel_vbt_decode.c
> +++ b/tools/intel_vbt_decode.c
> @@ -53,17 +53,6 @@ typedef uint64_t u64;
> #define _INTEL_BIOS_PRIVATE
> #include "intel_vbt_defs.h"
>
> -/* no bother to include "edid.h" */
> -#define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4))
> -#define _H_SYNC_OFF(x) (x[8] + ((x[11] & 0xC0) << 2))
> -#define _H_SYNC_WIDTH(x) (x[9] + ((x[11] & 0x30) << 4))
> -#define _H_BLANK(x) (x[3] + ((x[4] & 0x0F) << 8))
> -#define _V_ACTIVE(x) (x[5] + ((x[7] & 0xF0) << 4))
> -#define _V_SYNC_OFF(x) ((x[10] >> 4) + ((x[11] & 0x0C) << 2))
> -#define _V_SYNC_WIDTH(x) ((x[10] & 0x0F) + ((x[11] & 0x03) << 4))
> -#define _V_BLANK(x) (x[6] + ((x[7] & 0x0F) << 8))
> -#define _PIXEL_CLOCK(x) (x[0] + (x[1] << 8)) * 10000
> -
> #define YESNO(val) ((val) ? "yes" : "no")
>
> /* This is not for mapping to memory layout. */
> @@ -1382,6 +1371,38 @@ static void dump_lfp_data_ptrs(struct context *context,
> }
> }
>
> +static void
> +print_detail_timing_data(const struct bdb_edid_dtd *dvo_timing)
Here too params for "heading" line and indent/prefix might be
appropriate. Again, can be improved in follow-up.
> +{
> + int display, sync_start, sync_end, total;
> +
> + display = (dvo_timing->hactive_hi << 8) | dvo_timing->hactive_lo;
> + sync_start = display +
> + ((dvo_timing->hsync_off_hi << 8) | dvo_timing->hsync_off_lo);
> + sync_end = sync_start + ((dvo_timing->hsync_pulse_width_hi << 8) |
> + dvo_timing->hsync_pulse_width_lo);
> + total = display +
> + ((dvo_timing->hblank_hi << 8) | dvo_timing->hblank_lo);
> + printf("\t\t hdisplay: %d\n", display);
> + printf("\t\t hsync [%d, %d] %s\n", sync_start, sync_end,
> + dvo_timing->hsync_positive ? "+sync" : "-sync");
> + printf("\t\t htotal: %d\n", total);
> +
> + display = (dvo_timing->vactive_hi << 8) | dvo_timing->vactive_lo;
> + sync_start = display + ((dvo_timing->vsync_off_hi << 8) |
> + dvo_timing->vsync_off_lo);
> + sync_end = sync_start + ((dvo_timing->vsync_pulse_width_hi << 8) |
> + dvo_timing->vsync_pulse_width_lo);
> + total = display +
> + ((dvo_timing->vblank_hi << 8) | dvo_timing->vblank_lo);
> + printf("\t\t vdisplay: %d\n", display);
> + printf("\t\t vsync [%d, %d] %s\n", sync_start, sync_end,
> + dvo_timing->vsync_positive ? "+sync" : "-sync");
> + printf("\t\t vtotal: %d\n", total);
> +
> + printf("\t\t clock: %d\n", dvo_timing->clock * 10);
> +}
> +
> static char *decode_pnp_id(u16 mfg_name, char str[4])
> {
> mfg_name = ntohs(mfg_name);
> @@ -1412,9 +1433,6 @@ static void dump_lfp_data(struct context *context,
> struct bdb_block *ptrs_block;
> const struct bdb_lfp_data_ptrs *ptrs;
> int i;
> - int hdisplay, hsyncstart, hsyncend, htotal;
> - int vdisplay, vsyncstart, vsyncend, vtotal;
> - float clock;
>
> ptrs_block = find_section(context, BDB_LFP_DATA_PTRS);
> if (!ptrs_block)
> @@ -1425,7 +1443,7 @@ static void dump_lfp_data(struct context *context,
> for (i = 0; i < 16; i++) {
> const struct fp_timing *fp_timing =
> block_data(block) + ptrs->ptr[i].fp_timing.offset;
> - const uint8_t *timing_data =
> + const struct bdb_edid_dtd *dvo_timing =
> block_data(block) + ptrs->ptr[i].dvo_timing.offset;
> const struct bdb_edid_pnp_id *pnp_id =
> block_data(block) + ptrs->ptr[i].panel_pnp_id.offset;
> @@ -1435,22 +1453,10 @@ static void dump_lfp_data(struct context *context,
> if (!dump_panel(context, i))
> continue;
>
> - hdisplay = _H_ACTIVE(timing_data);
> - hsyncstart = hdisplay + _H_SYNC_OFF(timing_data);
> - hsyncend = hsyncstart + _H_SYNC_WIDTH(timing_data);
> - htotal = hdisplay + _H_BLANK(timing_data);
> -
> - vdisplay = _V_ACTIVE(timing_data);
> - vsyncstart = vdisplay + _V_SYNC_OFF(timing_data);
> - vsyncend = vsyncstart + _V_SYNC_WIDTH(timing_data);
> - vtotal = vdisplay + _V_BLANK(timing_data);
> - clock = _PIXEL_CLOCK(timing_data) / 1000;
> -
> printf("\tPanel %d%s\n", i, panel_str(context, i));
> - printf("\t\t%dx%d clock %d\n",
> - fp_timing->x_res, fp_timing->y_res,
> - _PIXEL_CLOCK(timing_data));
> - printf("\t\tinfo:\n");
> + printf("\t\tResolution: %dx%d\n",
> + fp_timing->x_res, fp_timing->y_res);
> + printf("\t\tFP timing data:\n");
> printf("\t\t LVDS: 0x%08lx\n",
> (unsigned long)fp_timing->lvds_reg_val);
> printf("\t\t PP_ON_DELAYS: 0x%08lx\n",
> @@ -1461,11 +1467,9 @@ static void dump_lfp_data(struct context *context,
> (unsigned long)fp_timing->pp_cycle_reg_val);
> printf("\t\t PFIT: 0x%08lx\n",
> (unsigned long)fp_timing->pfit_reg_val);
> - printf("\t\ttimings: %d %d %d %d %d %d %d %d %.2f (%s)\n",
> - hdisplay, hsyncstart, hsyncend, htotal,
> - vdisplay, vsyncstart, vsyncend, vtotal, clock,
> - (hsyncend > htotal || vsyncend > vtotal) ?
> - "BAD!" : "good");
> +
> + printf("\t\tDVO timing:\n");
> + print_detail_timing_data(dvo_timing);
>
> printf("\t\tPnP ID:\n");
> dump_pnp_id(pnp_id);
> @@ -1926,38 +1930,6 @@ static void dump_lfp_power(struct context *context,
> }
> }
>
> -static void
> -print_detail_timing_data(const struct bdb_edid_dtd *dvo_timing)
> -{
> - int display, sync_start, sync_end, total;
> -
> - display = (dvo_timing->hactive_hi << 8) | dvo_timing->hactive_lo;
> - sync_start = display +
> - ((dvo_timing->hsync_off_hi << 8) | dvo_timing->hsync_off_lo);
> - sync_end = sync_start + ((dvo_timing->hsync_pulse_width_hi << 8) |
> - dvo_timing->hsync_pulse_width_lo);
> - total = display +
> - ((dvo_timing->hblank_hi << 8) | dvo_timing->hblank_lo);
> - printf("\thdisplay: %d\n", display);
> - printf("\thsync [%d, %d] %s\n", sync_start, sync_end,
> - dvo_timing->hsync_positive ? "+sync" : "-sync");
> - printf("\thtotal: %d\n", total);
> -
> - display = (dvo_timing->vactive_hi << 8) | dvo_timing->vactive_lo;
> - sync_start = display + ((dvo_timing->vsync_off_hi << 8) |
> - dvo_timing->vsync_off_lo);
> - sync_end = sync_start + ((dvo_timing->vsync_pulse_width_hi << 8) |
> - dvo_timing->vsync_pulse_width_lo);
> - total = display +
> - ((dvo_timing->vblank_hi << 8) | dvo_timing->vblank_lo);
> - printf("\tvdisplay: %d\n", display);
> - printf("\tvsync [%d, %d] %s\n", sync_start, sync_end,
> - dvo_timing->vsync_positive ? "+sync" : "-sync");
> - printf("\tvtotal: %d\n", total);
> -
> - printf("\tclock: %d\n", dvo_timing->clock * 10);
> -}
> -
> static void dump_sdvo_lvds_dtd(struct context *context,
> const struct bdb_block *block)
> {
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-05-31 14:51 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 14:23 [PATCH i-g-t 00/20] tools/intel_vbt_decode: Refactoring and prep work for decoding more blocks Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 01/20] tools/intel_vbt_decode: Finish the s/lvds/lfp/ rename Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 02/20] tools/intel_vbt_decode: s/dump_sdvo_panel_dtd()/dump_sdvo_lvds_dtd()/ Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 03/20] lib: Define DIV_ROUND_CLOSEST() Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 04/20] tools/intel_vbt_decode: Fix some tabs Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 05/20] tools/intel_vbt_decode: Add missing newline Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 06/20] tools/intel_vbt_decode: Indent ALS dump Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 07/20] tools/intel_vbt_decode: Use "(LFP<n>)" to indicate LFP panel type Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 08/20] tools/intel_vbt_decode: Decode the "not HDMI" bit right way up Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 09/20] tools/intel_vbt_decode: Extract dump_pnp_id() Ville Syrjala
2024-05-31 14:48 ` Jani Nikula
2024-06-05 11:41 ` Ville Syrjälä
2024-05-31 14:23 ` [PATCH i-g-t 10/20] tools/intel_vbt_decode: Reuse print_detail_timing_data() Ville Syrjala
2024-05-31 14:50 ` Jani Nikula [this message]
2024-05-31 14:23 ` [PATCH i-g-t 11/20] tools/intel_vbt_decode: Dump the new eDP DSC disable bit Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 12/20] tools/intel_vbt_decode: Allow dumpers to delcate min version for the block Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 13/20] tools/intel_vbt_decode: Use .min_bdb_version to filter out PSR block on pre-165 VBTs Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 14/20] tools/intel_vbt_decode: Sort dumper table Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 15/20] tools/intel_vbt_decode: Use struct bdb_sdvo_lvds_dtd Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 16/20] tools/intel_vbt_decode: Track the SDVO panel type Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 17/20] tools/intel_vbt_decode: Use find_raw_section() to determine block presence Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 18/20] tools/intel_vbt_decode: Make device handle names more compact Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 19/20] tools/intel_vbt_decode: Declare min/max version for child dev handles Ville Syrjala
2024-05-31 14:23 ` [PATCH i-g-t 20/20] tools/intel_vbt_decode: Decode device handle as a bitmask Ville Syrjala
2024-05-31 15:10 ` Jani Nikula
2024-05-31 15:11 ` [PATCH i-g-t 00/20] tools/intel_vbt_decode: Refactoring and prep work for decoding more blocks Jani Nikula
2024-05-31 16:53 ` ✗ GitLab.Pipeline: warning for " Patchwork
2024-05-31 17:19 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-05-31 17:24 ` ✓ CI.xeBAT: success " Patchwork
2024-05-31 19:02 ` ✗ CI.xeFULL: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h6eedohd.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.