From patchwork Wed Nov 21 15:39:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 1781441 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 92DB83FCA5 for ; Wed, 21 Nov 2012 15:41:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 80BBAE6525 for ; Wed, 21 Nov 2012 07:41:17 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-gg0-f177.google.com (mail-gg0-f177.google.com [209.85.161.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 0CD1FE6528; Wed, 21 Nov 2012 07:40:25 -0800 (PST) Received: by mail-gg0-f177.google.com with SMTP id y3so859341ggc.36 for ; Wed, 21 Nov 2012 07:40:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=fhXkhC6acKfILHeMdjiWuyUgtP3brx4kPYSoho4Beb8=; b=ALlFFnb7YLDTsXk5uQ25N6bFX86DRBV89kutoqSU49vrmObbZyQHVGJwA3f4PSqWuY 7rnx8pim6a1fvVr6UWyxoYWkOTy2wuK+nacZ5r9s+0YoZu03m4a8Vh3kXslpOSfhciQo gEF9nZ7ZewZEip3ArT9qqgVUUsdrEUbOkgbbfJ7WlI5em1tPjZeU3JJVLty2jJYRsZDl Qb0I5ORS5womh/0D+nHK1suQkZxyCoHh2Y4PD8BfmIuQUDskNmkSrORt3z6WvCYtW1/8 OVCVkd6CIM8Ix8YVT+5BuY1pE9kQmJiaD1LVno12bxE+BREDlB2KBtCQTltgbxGBZTDn JnvA== Received: by 10.236.114.84 with SMTP id b60mr19127439yhh.42.1353512425356; Wed, 21 Nov 2012 07:40:25 -0800 (PST) Received: from vicky.domain.invalid ([177.156.19.106]) by mx.google.com with ESMTPS id s1sm419948anj.1.2012.11.21.07.40.22 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Nov 2012 07:40:24 -0800 (PST) From: Paulo Zanoni To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/i915: set the AVI VIC of the HDMI mode Date: Wed, 21 Nov 2012 13:39:48 -0200 Message-Id: <1353512389-16261-1-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.7.10.4 Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Paulo Zanoni We currently set "0" as the VIC value of the AVI InfoFrames. According to the specs this should be fine and work for every mode, so to my point of view we can't consider the current behavior as a bug. The problem is that we recently received a bug report (Kernel bug #50371) from a user that has an AV receiver that gives a black screen for any mode with VIC set to 0. So in order to make at least some modes work for him, this patch sets the correct VIC number when sending AVI InfoFrames. We add a generic drm function to calculate the VIC number and then call it from the i915 driver. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50371 Cc: Thierry Reding Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/drm_edid.c | 19 +++++++++++++++++++ drivers/gpu/drm/drm_modes.c | 3 ++- drivers/gpu/drm/i915/intel_hdmi.c | 2 ++ include/drm/drm_crtc.h | 4 +++- 4 files changed, 26 insertions(+), 2 deletions(-) Patch applies on top of Daniel's drm-intel-next-queued. I'm not sure who exactly is going to merge this (Dave or Daniel). diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index fadcd44..c57fc46 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2062,3 +2062,22 @@ int drm_add_modes_noedid(struct drm_connector *connector, return num_modes; } EXPORT_SYMBOL(drm_add_modes_noedid); + +/** + * drm_mode_vic - return the CEA-861 VIC of a given mode + * @mode: mode + * + * RETURNS: + * The VIC number, 0 in case it's not a CEA-861 mode. + */ +uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode) +{ + uint8_t i; + + for (i = 0; i < drm_num_cea_modes; i++) + if (drm_mode_equal(mode, &edid_cea_modes[i])) + return i + 1; + + return 0; +} +EXPORT_SYMBOL(drm_mode_cea_vic); diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 59450f3..9ef6750 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -768,7 +768,8 @@ EXPORT_SYMBOL(drm_mode_duplicate); * RETURNS: * True if the modes are equal, false otherwise. */ -bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2) +bool drm_mode_equal(const struct drm_display_mode *mode1, + const struct drm_display_mode *mode2) { /* do clock check convert to PICOS so fb modes get matched * the same */ diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 1dcfd5b..eaf70d6 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -340,6 +340,8 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder, if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) avi_if.body.avi.YQ_CN_PR |= DIP_AVI_PR_2; + avi_if.body.avi.VIC = drm_mode_cea_vic(adjusted_mode); + intel_set_infoframe(encoder, &avi_if); } diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 3fa18b7..245220e 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -892,7 +892,8 @@ extern void drm_mode_config_init(struct drm_device *dev); extern void drm_mode_config_reset(struct drm_device *dev); extern void drm_mode_config_cleanup(struct drm_device *dev); extern void drm_mode_set_name(struct drm_display_mode *mode); -extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2); +extern bool drm_mode_equal(const struct drm_display_mode *mode1, + const struct drm_display_mode *mode2); extern int drm_mode_width(struct drm_display_mode *mode); extern int drm_mode_height(struct drm_display_mode *mode); @@ -1053,6 +1054,7 @@ extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev, int GTF_2C, int GTF_K, int GTF_2J); extern int drm_add_modes_noedid(struct drm_connector *connector, int hdisplay, int vdisplay); +extern uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode); extern int drm_edid_header_is_valid(const u8 *raw_edid); extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid);