[Intel-gfx] [PATCH 1/2] drm/i915: Fetch mode lines from VBT, then reserve them
Jesse Barnes
jbarnes at virtuousgeek.org
Tue May 12 03:37:09 CEST 2009
On Fri, 08 May 2009 18:38:16 +0800
Ma Ling <ling.ma at intel.com> wrote:
> Intends to fetch mode lines in VBT
>
> Signed-off-by: Ma Ling <ling.ma at intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/intel_bios.c | 113
> +++++++++++++++++++++++++++---------- 2 files changed, 84
> insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h
> b/drivers/gpu/drm/i915/i915_drv.h index 2506592..ef156e3 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -181,6 +181,7 @@ typedef struct drm_i915_private {
> bool panel_wants_dither;
> struct drm_display_mode *panel_fixed_mode;
> struct drm_display_mode *vbt_mode; /* if any */
> + struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
Seems like we should rename the other fields to make it clear that we
have several potential VBT builtin modes.
The timing data vs. LFP data fetch split looks good.
> +/* Try to find sdvo panel data */
> +static void
> +parse_sdvo_panel_data(struct drm_i915_private *dev_priv,
> + struct bdb_header *bdb)
> +{
> + struct lvds_dvo_timing *dvo_timing, *dvo_timing_end;
> + struct drm_display_mode *panel_fixed_mode;
> + char *parse;
> + uint16_t dvo_size, dvo_num;
> +
> + dev_priv->sdvo_lvds_vbt_mode = NULL;
> +
> + dvo_timing = find_section(bdb, BDB_SDVO_PANEL_DTDS);
> + if (dvo_timing == NULL)
> + return;
> +
> + parse = ((char *)dvo_timing) - 2;
> +
> + dvo_size = parse[0] | (parse[1] << 8);
> + dvo_num = dvo_size / sizeof(struct lvds_dvo_timing);
> + if (dvo_size == 0 || dvo_num == 0)
> + return;
> +
> + dvo_timing_end = dvo_timing + dvo_num;
> +
> + for (; dvo_timing < dvo_timing_end; dvo_timing = dvo_timing
> + 1) {
> + panel_fixed_mode = drm_calloc(1,
> sizeof(*panel_fixed_mode),
> + DRM_MEM_DRIVER);
> + if (panel_fixed_mode == NULL)
> + break;
> +
> + fill_detail_timing_data(panel_fixed_mode,
> dvo_timing); +
> + if (dev_priv->sdvo_lvds_vbt_mode == NULL) {
> + dev_priv->sdvo_lvds_vbt_mode =
> panel_fixed_mode;
> +
> INIT_LIST_HEAD(&dev_priv->sdvo_lvds_vbt_mode->head);
> + } else
> + list_add(&panel_fixed_mode->head,
> +
> &dev_priv->sdvo_lvds_vbt_mode->head);
> + }
> +
I didn't check the VBT definitions, I'll assume this part is correct. :)
> + return;
> +}
> +
> static void
> parse_general_features(struct drm_i915_private *dev_priv,
> struct bdb_header *bdb)
> @@ -199,7 +251,8 @@ intel_init_bios(struct drm_device *dev)
>
> /* Grab useful general definitions */
> parse_general_features(dev_priv, bdb);
> - parse_panel_data(dev_priv, bdb);
> + parse_integrated_panel_data(dev_priv, bdb);
> + parse_sdvo_panel_data(dev_priv, bdb);
parse_lfp_panel_data would be shorter than integrated, but that's no
big deal.
Reviewed-by: Jesse Barnes <jbarnes at virtuousgeek.org>
--
Jesse Barnes, Intel Open Source Technology Center
More information about the Intel-gfx
mailing list