Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp790123rwb; Wed, 16 Nov 2022 07:42:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf7WxOi/yocwnl6xsITIcf0RjFuWOoqRTimfwjDi0bISI5nK1wUhIy9oV7Uq9r+0znImi2c0 X-Received: by 2002:a05:6a00:23cd:b0:571:8e02:54af with SMTP id g13-20020a056a0023cd00b005718e0254afmr23988039pfc.53.1668613355757; Wed, 16 Nov 2022 07:42:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668613355; cv=none; d=google.com; s=arc-20160816; b=rBq0wPjitHjejDZJuj3yAouq9dSGMMi7NtYZCBrsXa3IZEVNYgYt167bMCsto4hlEx NNXqk8Smi3khH7BfnaAIa5pSBWB2vGu5ARKr1TnSWm6A3NxuHrUzT7htsdPN/TLYiUXV jwuZjT9MhcTos12xDGn6qjXArnGgzi4kMv3KUedC6GCFjYwnrpddVxZph6Yt1ke45Pj5 ZVfsfHXPfyBwqogFcoeNNYFgh66GW1WvNOUAZvIr1mVNmm9JG+68AZBSVViZHbA0rCRs HZjHk/hO8+/x61cp5Slv9EHrUtjbHheFY/p4VBV5BLXUXTQTC5W+9skqw4PPgMH9SRtR s3bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=4bgSVWe2DupxOwRr4EOFbsHDsofmk+PFg9oISOvq07w=; b=h39JpWIuUMfcaUvDa5+18aFm3Scg+ObFZI7CrdMLoLAi5LoBZYrO9yhm0yowJdRvzY oUPRp/2NU0FgFYT50n3qAUBod0mQSlBpV3/puQQyliJXVHqkXJCsdegbIlZTNBFnYfON aCumLLZ1FvIRpMtXjZbWHvVPGF6QKzJ32IIsZPBAz+69t+1T50Kc6mxhXOtzriSvyj/M oYdTKS3QgmkpK7sOcsUPbOgQ9XFjmC5CBC9nnkIHWrc6IyiES+KOxigR8vE82qE1w7PL C4KyLN/DXOpnAdTZPYh6OcxYjbQATynkSmynLvOCdV7GGu9rvpPr02uKZq8J4zow2w8g zRyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=AcC0d+H6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j27-20020a63595b000000b0046f3dfb97a5si15528715pgm.660.2022.11.16.07.42.24; Wed, 16 Nov 2022 07:42:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=AcC0d+H6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232097AbiKPPfb (ORCPT + 92 others); Wed, 16 Nov 2022 10:35:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiKPPf2 (ORCPT ); Wed, 16 Nov 2022 10:35:28 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C0F11180B; Wed, 16 Nov 2022 07:35:27 -0800 (PST) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AGDFiDp027890; Wed, 16 Nov 2022 15:35:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=4bgSVWe2DupxOwRr4EOFbsHDsofmk+PFg9oISOvq07w=; b=AcC0d+H6Ykx45QyKTs91JvR5oMly//xnEMmuafbJ+4j5AFxQqRpBhfUI3lY3qBvo35U+ w2tVbt3T66tD+Ep+qW3ZkpgjSikFo66wyZtdYgGVaD8PwpvmkCCd336cOSdWyxZfnQ4M Ar3WwuMqL9aOOQhxnO41GD6zp+hpdLrdriRjtnOdgSkQj4uC7LndSiM0kvzTHbMqXHzZ XVR9iQerh42i3I0+TNT2BrflTvF4cOOEGaFDyOhGC8PPouo4Op2/OMHyryA6juE16+27 Vxnx1ZDH/LaQunuf9GW73GokZgHsU1esihFCQnR4bvRdhIBM/6n/Bcl6DxIl7L3kXSd1 Dw== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3kw03a8bcj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 15:35:24 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2AGFZNNY015031 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 15:35:23 GMT Received: from [10.216.25.63] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Wed, 16 Nov 2022 07:35:19 -0800 Message-ID: <0dd3e096-84ac-da81-ad43-bf07485e7b65@quicinc.com> Date: Wed, 16 Nov 2022 07:35:16 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH v2 2/3] drm/msm/disp/dpu1: add helper to know if display is pluggable Content-Language: en-US To: Dmitry Baryshkov , Kalyan Thota , , , , CC: , , , , References: <1668609040-2549-1-git-send-email-quic_kalyant@quicinc.com> <1668609040-2549-3-git-send-email-quic_kalyant@quicinc.com> <6b1907db-3fdb-8fe0-e5e3-21ea17021925@quicinc.com> From: Abhinav Kumar In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: nvibYndKs-Sx2SNACmfVRs8TtFf1DTqK X-Proofpoint-ORIG-GUID: nvibYndKs-Sx2SNACmfVRs8TtFf1DTqK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-16_03,2022-11-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 impostorscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211160107 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/16/2022 7:18 AM, Dmitry Baryshkov wrote: > On 16/11/2022 18:11, Abhinav Kumar wrote: >> >> >> On 11/16/2022 7:08 AM, Dmitry Baryshkov wrote: >>> On 16/11/2022 17:30, Kalyan Thota wrote: >>>> Since DRM encoder type for few encoders can be similar >>>> (like eDP and DP) find out if the interface supports HPD >>>> from encoder bridge to differentiate between builtin >>>> and pluggable displays. >>>> >>>> Changes in v1: >>>> - add connector type in the disp_info (Dmitry) >>>> - add helper functions to know encoder type >>>> - update commit text reflecting the change >>>> >>>> Changes in v2: >>>> - avoid hardcode of connector type for DSI as it may not be true >>>> (Dmitry) >>>> - get the HPD information from encoder bridge >>>> >>>> Signed-off-by: Kalyan Thota >>>> --- >>>>   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 16 ++++++++++++++++ >>>>   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  6 ++++++ >>>>   2 files changed, 22 insertions(+) >>>> >>>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c >>>> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c >>>> index 9c6817b..be93269 100644 >>>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c >>>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c >>>> @@ -15,6 +15,7 @@ >>>>   #include >>>>   #include >>>>   #include >>>> +#include >>>>   #include "msm_drv.h" >>>>   #include "dpu_kms.h" >>>> @@ -217,6 +218,21 @@ static u32 dither_matrix[DITHER_MATRIX_SZ] = { >>>>       15, 7, 13, 5, 3, 11, 1, 9, 12, 4, 14, 6, 0, 8, 2, 10 >>>>   }; >>>> +bool dpu_encoder_is_pluggable(struct drm_encoder *encoder) >>>> +{ >>>> +    struct drm_bridge *bridge; >>>> +    int ops = 0; >>>> + >>>> +    if (!encoder) >>>> +        return false; >>>> + >>>> +    /* Get last bridge in the chain to determine pluggable state */ >>>> +    drm_for_each_bridge_in_chain(encoder, bridge) >>>> +        if (!drm_bridge_get_next_bridge(bridge)) >>>> +            ops = bridge->ops; >>>> + >>>> +    return ops & DRM_BRIDGE_OP_HPD; >>> >>> No. This is not what you should be checking (hint: polled connectors >>> also can be pluggable). >>> >>> Please check the type of the actual connector connected to this encoder. >>> >> >> Even if we check the connector type as DSI or eDP that does not >> necessarily mean its built-in. >> >> We can even use DSI or eDP as a pluggable display. > > Well, I don't think so. eDP and DSI connectors are not pluggable per > design. One can use them so, but they are not thought to be used this > way. Unlike e.g. HDMI, DP, VGA, etc. > We have had many products where we used HDMI as the primary display where the HPD line was disconnected in the design, so now if we generalize all HDMI connectors to be pluggable we can never enable color management on those even though DSI is not even used in that product. Thats why I felt we should rely on the HPD_OPS as that way we know that it will be set only if HPD will be used. Wouldnt it be just better to also check polling displays to complete this check? Is there a way to do it? > I would say LVDS, eDP, DSI, DPI and SPI can be assumed to be constantly > plugged. > > Compare this with Composite, SVIDEO, 9PinDIN, TV. They can be assumed to > be external even if they do not have the HPD (or even polling). And > these connectors usually don't have it. > >> >> Thats why we thought of this check. >>