From patchwork Fri Nov 29 15:33:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 3258871 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 28238BEEAD for ; Fri, 29 Nov 2013 15:34:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7DABB2068B for ; Fri, 29 Nov 2013 15:34:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D63982053C for ; Fri, 29 Nov 2013 15:34:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 703B3FAB8A; Fri, 29 Nov 2013 07:34:16 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 2715EFAD42 for ; Fri, 29 Nov 2013 07:34:02 -0800 (PST) Received: by mail-wg0-f49.google.com with SMTP id x12so9295784wgg.4 for ; Fri, 29 Nov 2013 07:34:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=UsdkhqIl1GCpzMAVKwUYSH4H/6wWGrM/Y5FFA6mHxXM=; b=J9xIV8RlYBsQ8tbvPe2UQ1Jb1bnvM0fzkzusLuyib1lHu7ljv9ZOMg8QJwHKqateUF IsvYBCkN4nHKwITfNJiNxDllD6syRpq8B2Xvz7vLlkHhtEex69hEeM0Fk/aOwPwWeexo JtFWFnx6zc03X9eeDGTfpzAM1iDHGyB8m231hQdh8G4R2LTn2T7lcH5LVdQfywoQoFz9 1WeuiTne6G6MpCW9AfTAArCbzahipSjqwJWWZilzTSInyUvuKgTdpNEulEBEVPavv4e5 JWq/+JGsGLtLnYl8MMxy+gE0VUxS/2kNnI7Z+iSgzL7UUXy8lHqjL+MzoHLdHDMTR6/d t79g== X-Gm-Message-State: ALoCoQlcBEu3j4+HrsvBQaHu242e9d+ixta9n32NlTOiC37tBe4L330caAgJkaEOBgewPan50cBh X-Received: by 10.194.62.8 with SMTP id u8mr3507431wjr.68.1385739242414; Fri, 29 Nov 2013 07:34:02 -0800 (PST) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id e10sm71093140wiy.7.2013.11.29.07.34.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Nov 2013 07:34:01 -0800 (PST) From: Thomas Wood To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Fri, 29 Nov 2013 15:33:28 +0000 Message-Id: <1385739208-19958-4-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1385739208-19958-1-git-send-email-thomas.wood@intel.com> References: <1385739208-19958-1-git-send-email-thomas.wood@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 3/3] drm/edid: parse the list of additional 3D modes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Parse 2D_VIC_order_X and 3D_Structure_X from the list at the end of the HDMI Vendor Specific Data Block. v2: Use an offset value depending on 3D_Multi_present and add detail_present. (Ville Syrjälä) Signed-off-by: Thomas Wood --- drivers/gpu/drm/drm_edid.c | 64 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index f1d6e1e..9426563 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2734,7 +2734,7 @@ static int do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len, const u8 *video_db, u8 video_len) { - int modes = 0, offset = 0, i, multi_present = 0; + int modes = 0, offset = 0, i, multi_present = 0, multi_len; u8 vic_len, hdmi_3d_len = 0; u16 mask; u16 structure_all; @@ -2783,12 +2783,15 @@ do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len, if (!(multi_present == 1 || multi_present == 2)) goto out; - if ((multi_present == 1 && len < (9 + offset)) || - (multi_present == 2 && len < (11 + offset))) + if (multi_present == 1) + multi_len = 2; + else + multi_len = 4; + + if (len < (offset + hdmi_3d_len)) goto out; - if ((multi_present == 1 && hdmi_3d_len < 2) || - (multi_present == 2 && hdmi_3d_len < 4)) + if (hdmi_3d_len < multi_len) goto out; /* 3D_Structure_ALL */ @@ -2808,6 +2811,57 @@ do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len, video_len, i); } + if (hdmi_3d_len <= multi_len) + goto out; + + offset += multi_len; + + for (i = 0; i < (hdmi_3d_len - multi_len); i++) { + int vic_index; + struct drm_display_mode *newmode = NULL; + unsigned int newflag = 0; + bool detail_present; + + detail_present = ((db[8 + offset + i] & 0x0f) > 7); + + if (detail_present && (i + 1 == hdmi_3d_len - multi_len)) + break; + + /* 2D_VIC_order_X */ + vic_index = db[8 + offset + i] >> 4; + + /* 3D_Structure_X */ + switch (db[8 + offset + i] & 0x0f) { + case 0: + newflag = DRM_MODE_FLAG_3D_FRAME_PACKING; + break; + case 6: + newflag = DRM_MODE_FLAG_3D_TOP_AND_BOTTOM; + break; + case 8: + /* 3D_Detail_X */ + if ((db[9 + offset + i] >> 4) == 1) + newflag = DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF; + break; + } + + if (newflag != 0) { + newmode = drm_display_mode_from_vic_index(connector, + video_db, + video_len, + vic_index); + + if (newmode) { + newmode->flags |= newflag; + drm_mode_probed_add(connector, newmode); + modes++; + } + } + + if (detail_present) + i++; + } + out: return modes; }