From patchwork Wed Nov 1 17:50:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 10036831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D424C6032D for ; Wed, 1 Nov 2017 17:50:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C26371FF87 for ; Wed, 1 Nov 2017 17:50:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4A7628C2C; Wed, 1 Nov 2017 17:50:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E7DC31FF87 for ; Wed, 1 Nov 2017 17:50:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF3C26E016; Wed, 1 Nov 2017 17:50:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oi0-f66.google.com (mail-oi0-f66.google.com [209.85.218.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id D57A56E016 for ; Wed, 1 Nov 2017 17:50:06 +0000 (UTC) Received: by mail-oi0-f66.google.com with SMTP id a132so5682271oih.11 for ; Wed, 01 Nov 2017 10:50:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=J4a4m/mG6ewvDFiwJkIgZ1cmS7ZoM3AIqTWmsIEjaFs=; b=oeD9iRuowcR3CvTs91Wfp/3KnARnuVPYQFdmS6ppxt+xr4fYVtwAW37oqYGPBsxzq+ r9mgIW4vu9eyXU+gJj7GUk1M6ker4oRJA+yUoMQY90wxLM80yntUpRtPOMZNnEZonaFs 75PqcnEIZc7MNHA1zx18iNofbY5jyIJck4StRRjulPR5D+NG1Gs99Izr3I2UjwxlA7/v 70ZMxS3pAiOxwZ6nzKvX6OhA4jdpMZW10n8RjQwy+JGsq5mR5BSKbUsp0cYS44pCAlix lqfYjgOPnNPBHO4pao2aWqKd9mjPol3JFBqFo1rzV/brEfEeFHqFUxkpROIznKVb9B1B x/zw== X-Gm-Message-State: AMCzsaX6bjkzYjI+ybR/Ywhb5poXcQWOTWfiQL7iJ/jWUnf4HnhIAYRV BmvD7V9p3RoTeT/rM6xE6Ke2Wh8= X-Google-Smtp-Source: ABhQp+QAZQSa/TwV7ndu51xKQlS4OoqR71wr1PZL6s0/HGxQxnYMzacFsJbhbidjLx3dyB2CpdoLiA== X-Received: by 10.202.252.132 with SMTP id a126mr410574oii.36.1509558605798; Wed, 01 Nov 2017 10:50:05 -0700 (PDT) Received: from xps15.herring.priv (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id g6sm486826otb.24.2017.11.01.10.50.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Nov 2017 10:50:05 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH hwc] drm_hwcomposer: Add HDMI connector as a valid type Date: Wed, 1 Nov 2017 12:50:04 -0500 Message-Id: <20171101175004.21282-1-robh@kernel.org> X-Mailer: git-send-email 2.14.1 Cc: Robert Foss X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Robert Foss Accept DRM_MODE_CONNECTOR_HDMIA connector type. Look for primary DrmConnector amongst external connectors after looking for primary amongst internal ones first. Signed-off-by: Robert Foss Signed-off-by: Rob Herring --- This is needed to get dev boards like DB410c to work. drmconnector.cpp | 10 +++++++++- drmconnector.h | 4 +++- drmresources.cpp | 16 ++++++++++++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drmconnector.cpp b/drmconnector.cpp index ccb38e2f00dc..247f56bde748 100644 --- a/drmconnector.cpp +++ b/drmconnector.cpp @@ -67,11 +67,19 @@ void DrmConnector::set_display(int display) { display_ = display; } -bool DrmConnector::built_in() const { +bool DrmConnector::internal() const { return type_ == DRM_MODE_CONNECTOR_LVDS || type_ == DRM_MODE_CONNECTOR_eDP || type_ == DRM_MODE_CONNECTOR_DSI || type_ == DRM_MODE_CONNECTOR_VIRTUAL; } +bool DrmConnector::external() const { + return type_ == DRM_MODE_CONNECTOR_HDMIA; +} + +bool DrmConnector::valid_type() const { + return internal() || external(); +} + int DrmConnector::UpdateModes() { int fd = drm_->fd(); diff --git a/drmconnector.h b/drmconnector.h index e1488bb42a9a..5601e069f003 100644 --- a/drmconnector.h +++ b/drmconnector.h @@ -44,7 +44,9 @@ class DrmConnector { int display() const; void set_display(int display); - bool built_in() const; + bool internal() const; + bool external() const; + bool valid_type() const; int UpdateModes(); diff --git a/drmresources.cpp b/drmresources.cpp index 67a853c587b3..32dd37636e73 100644 --- a/drmresources.cpp +++ b/drmresources.cpp @@ -154,16 +154,28 @@ int DrmResources::Init() { break; } - if (conn->built_in() && !found_primary) { + connectors_.emplace_back(std::move(conn)); + } + + // First look for primary amongst internal connectors + for (auto &conn : connectors_) { + if (conn->internal() && !found_primary) { conn->set_display(0); found_primary = true; } else { conn->set_display(display_num); ++display_num; } + } - connectors_.emplace_back(std::move(conn)); + // Then look for primary amongst external connectors + for (auto &conn : connectors_) { + if (conn->external() && !found_primary) { + conn->set_display(0); + found_primary = true; + } } + if (res) drmModeFreeResources(res);