From patchwork Fri Jul 24 02:44:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao, Yakui" X-Patchwork-Id: 37053 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6O2i4Gp022287 for ; Fri, 24 Jul 2009 02:44:04 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 072CCA023C; Thu, 23 Jul 2009 19:44:04 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id AC0379E74C for ; Thu, 23 Jul 2009 19:44:02 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 23 Jul 2009 19:43:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.43,259,1246863600"; d="scan'208";a="168402283" Received: from yakui_zhao.sh.intel.com (HELO localhost.localdomain) ([10.239.13.194]) by azsmga001.ch.intel.com with ESMTP; 23 Jul 2009 19:43:51 -0700 From: yakui.zhao@intel.com To: cworth@cworth.org Date: Fri, 24 Jul 2009 10:44:20 +0800 Message-Id: <1248403460-11323-1-git-send-email-yakui.zhao@intel.com> X-Mailer: git-send-email 1.5.4.5 Cc: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [Patch]: Calculate the DVO relative offset in LVDS data entry to get the DVO timing X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org From: Zhao Yakui Now the DVO timing in LVDS data entry is obtained by using the following step: a. get the entry size for every LVDS panel data b. Get the LVDS fp entry for the preferred panel type c. get the DVO timing by using entry->dvo_timing In our driver the entry->dvo_timing is related with the size of lvds_fp_timing. For example: the size is 46. But it seems that the size of lvds_fp_timing varies on the differnt platform. In such case we will get the incorrect DVO timing because of the incorrect DVO offset in LVDS panel data entry. Calculate the DVO timing offset in LVDS data entry to get the DVO timing a. get the DVO timing offset in the LVDS fp data entry by using the pointer definition in LVDS data ptr b. get the LVDS data entry c. get the DVO timing by adding the DVO timing offset to data entry https://bugs.freedesktop.org/show_bug.cgi?id=22787 Signed-off-by: Zhao Yakui Acked-by: Jesse Barnes --- src/bios_reader/bios_reader.c | 20 +++++++++++++++++--- src/i830_bios.c | 6 ++++-- 2 files changed, 21 insertions(+), 5 deletions(-) Index: xf86_video_intel/src/i830_bios.c =================================================================== --- xf86_video_intel.orig/src/i830_bios.c 2009-07-24 10:39:08.000000000 +0800 +++ xf86_video_intel/src/i830_bios.c 2009-07-24 10:40:17.000000000 +0800 @@ -123,6 +123,7 @@ DisplayModePtr fixed_mode; unsigned char *timing_ptr; int lfp_data_size; + int dvo_offset; /* Defaults if we can't find VBT info */ pI830->lvds_dither = 0; @@ -146,10 +147,11 @@ lfp_data_size = lvds_lfp_data_ptrs->ptr[1].dvo_timing_offset - lvds_lfp_data_ptrs->ptr[0].dvo_timing_offset; + dvo_offset = lvds_lfp_data_ptrs->ptr[0].dvo_timing_offset - + lvds_lfp_data_ptrs->ptr[0].fp_timing_offset; entry = (struct bdb_lvds_lfp_data_entry *)((uint8_t *)lvds_data->data + (lfp_data_size * lvds_options->panel_type)); - timing_ptr = (unsigned char *)&entry->dvo_timing; - + timing_ptr = (unsigned char *)entry + dvo_offset; if (pI830->skip_panel_detect) return; Index: xf86_video_intel/src/bios_reader/bios_reader.c =================================================================== --- xf86_video_intel.orig/src/bios_reader/bios_reader.c 2009-07-24 10:39:08.000000000 +0800 +++ xf86_video_intel/src/bios_reader/bios_reader.c 2009-07-24 10:40:17.000000000 +0800 @@ -313,11 +313,23 @@ { struct bdb_block *block; struct bdb_lvds_lfp_data *lvds_data; + struct bdb_lvds_lfp_data_ptrs *ptrs; int num_entries; int i; int hdisplay, hsyncstart, hsyncend, htotal; int vdisplay, vsyncstart, vsyncend, vtotal; float clock; + int lfp_data_size, dvo_offset; + + block = find_section(BDB_LVDS_LFP_DATA_PTRS); + if (!block) { + printf("No LVDS ptr block\n"); + return; + } + ptrs = block->data; + lfp_data_size = ptrs->ptr[1].fp_timing_offset - ptrs->ptr[0].fp_timing_offset; + dvo_offset = ptrs->ptr[0].dvo_timing_offset - ptrs->ptr[0].fp_timing_offset; + free(block); block = find_section(BDB_LVDS_LFP_DATA); if (!block) { @@ -326,14 +338,16 @@ } lvds_data = block->data; - num_entries = block->size / sizeof(struct bdb_lvds_lfp_data_entry); + num_entries = block->size / lfp_data_size; printf("LVDS panel data block (preferred block marked with '*'):\n"); printf(" Number of entries: %d\n", num_entries); for (i = 0; i < num_entries; i++) { - struct bdb_lvds_lfp_data_entry *lfp_data = &lvds_data->data[i]; - uint8_t *timing_data = (uint8_t *)&lfp_data->dvo_timing; + uint8_t *lfp_data_ptr = (uint8_t *)lvds_data->data + lfp_data_size * i; + uint8_t *timing_data = lfp_data_ptr + dvo_offset; + struct bdb_lvds_lfp_data_entry *lfp_data = + (struct bdb_lvds_flp_data_entry *)lfp_data_ptr; char marker; if (i == panel_type)