Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3628255rdh; Thu, 28 Sep 2023 18:58:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGmq2X9XeAd62oaTRKwUIOkpbDNqRstOL29UE66hoqeixvoxh6b3vHK2eQe7Ma6GHmdII3b X-Received: by 2002:a17:902:d902:b0:1c6:1901:ed26 with SMTP id c2-20020a170902d90200b001c61901ed26mr2500944plz.69.1695952707344; Thu, 28 Sep 2023 18:58:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695952707; cv=none; d=google.com; s=arc-20160816; b=G/r73vwHNZwBjEdBTNdxBt0eeQoDh0bv9R6z3mkKUudtKoTaEPK8j/zgw34osxRqd0 0YIKwaxlorQod5Av1g+ieal7JDuh0jJ+w034ps4LIultXmoIAlc+2IiCNJysqVjEPnt7 Bho1yvrMuBRgBvKuE+PmmvCQ5EN1ASJcA7kd8rc+iVEDdJrA1jeTrRxT5VZebitIfDol kQgwP6ogdg1TtPUUacecFw/QpF/Pgc4juEN+XIHUSNOq+1bAtEcYiIqUyZPlpw1IjwKQ frH+aCR7yBxZBGkgtAEXar7MyaOmnqCloq97lTnHghxpKTP3sHIY/4ztLsbNyYRv7ajX qLqg== 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=0oLww7t8NDTz6izW9MTTTB5935394WQk9q/qSKmqzyc=; fh=h7qU5fspdOU2y40hULAa6AL6l1E80wvlvBv2V+GJu6E=; b=S3AajagfZKafReOtZFo25W7yQMItqiPKc0rvlwKn32Hiq0i6zAoDobK2NuQnJ1XmfN bNQGrBucx3fjCex5V2PojWDXleVvzTQkge1LiTCAGsCvcUBnZ5Oa+l9Hoj1NLPFQFKrk 6FeKGejOb0LfFNU6ECc/36TFynH+wPQa6hUtYuoWJBuRCbYWFDSNPXJIRfWPLIQ8yjO9 RCMvbLz/y975nhem100wokn8s29CemL4MsPnOxmTBLtaeeLUG7WSRCXMbuQmfLT2SmwB 8dP8AssiHAl85VGsfUpi8kXDgN9TgY3PryOnZ8srviFtduOQrOEEaccgzYM9bYVmC6wx SmDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Ts92vjeV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id kl8-20020a170903074800b001bc74f6a951si18849289plb.250.2023.09.28.18.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 18:58:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Ts92vjeV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 610AD80779BD; Thu, 28 Sep 2023 15:36:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231689AbjI1WgY (ORCPT + 99 others); Thu, 28 Sep 2023 18:36:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbjI1WgW (ORCPT ); Thu, 28 Sep 2023 18:36:22 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5F4419D; Thu, 28 Sep 2023 15:36:20 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38SLYRRB023964; Thu, 28 Sep 2023 22:35:55 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=0oLww7t8NDTz6izW9MTTTB5935394WQk9q/qSKmqzyc=; b=Ts92vjeVu9hrV6OvcFfsTQ6n19jahFEaBO1FxeOMc4eHXNNTkskYJjhanq81fnWvB0LG YwMxsxo+zlf1rPtfVMlvzyJ5SG1PNztSKusr5LGho7G5SmX9Rjh0ow5akA47tnxlgcaj EhU0/RlWNu1Xxds2algjTGI7OXJoy3Fb84eRECKKjrqQzGD0mJDNeBKmkgzCx6wAdCeR 5pEfcFy74YM+H8dTFyJYAFhKMUk7HyfbJ5BpFPkWgmq+nBdWI8VaUOGmwt9/stmKn+Wt v+o8DzbBZSALETLo3vgw/rK+r6toBSflsrEVUB+K3wT/O2z4xq2HkLbighr1haVoqMQE aw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tcpkguvc4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Sep 2023 22:35:55 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38SMZsD0031313 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Sep 2023 22:35:54 GMT Received: from [10.110.70.158] (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.1118.36; Thu, 28 Sep 2023 15:35:51 -0700 Message-ID: <15ccacce-c20b-5fe2-5d89-a0627bd4a9e0@quicinc.com> Date: Thu, 28 Sep 2023 15:35:49 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v3 6/7] drm/msm/dp: add pm_runtime_force_suspend()/resume() Content-Language: en-US To: Stephen Boyd , Dmitry Baryshkov , Kuogee Hsieh CC: , , , , , , , , , , , , , , References: <1694813901-26952-1-git-send-email-quic_khsieh@quicinc.com> <1694813901-26952-7-git-send-email-quic_khsieh@quicinc.com> <2f98d5f1-57c1-d9fe-cb1c-b975db057287@quicinc.com> <65566a68-3510-2e5f-7d57-e4dba08c008c@quicinc.com> From: Abhinav Kumar In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: V3j7udvTMQzgURdnq_tEUPI5YIRroyh7 X-Proofpoint-ORIG-GUID: V3j7udvTMQzgURdnq_tEUPI5YIRroyh7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-28_22,2023-09-28_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 phishscore=0 spamscore=0 malwarescore=0 impostorscore=0 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309280193 X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 28 Sep 2023 15:36:38 -0700 (PDT) On 9/27/2023 2:41 PM, Stephen Boyd wrote: > Quoting Abhinav Kumar (2023-09-22 18:35:27) >> On 9/22/2023 2:54 PM, Stephen Boyd wrote: >>> Quoting Dmitry Baryshkov (2023-09-19 02:50:12) >>>> >>>> This should be hpd_notify, who starts link training, not some event. >>> >>> I think this driver should train the link during atomic_enable(), not >>> hpd_notify() (or directly from the irq handler). The drm_bridge_funcs >>> talk a bit about when the clocks and timing signals are supposed to be >>> enabled. For example, struct drm_bridge_funcs::atomic_pre_enable() says >>> the "display pipe (i.e. clocks and timing signals) feeding this bridge >>> will not yet be running when this callback is called". And struct >>> drm_bridge_funcs::atomic_enable() says "this callback must enable the >>> display link feeding the next bridge in the chain if there is one." >>> >>> That looks to me like link training, i.e. the display link, should >>> happen in the enable path and not hpd_notify. It looks like link >>> training could fail, but when that happens I believe the driver should >>> call drm_connector_set_link_status_property() with >>> DRM_MODE_LINK_STATUS_BAD. The two callers of that which exist in the >>> tree also call drm_kms_helper_hotplug_event() or >>> drm_kms_helper_connector_hotplug_event() after updating the link so that >>> userspace knows to try again. >>> >>> It would be nice if there was some drm_bridge_set_link_status_bad() API >>> that bridge drivers could use to signal that the link status is bad and >>> call the hotplug helper. Maybe it could also record some diagnostics >>> about which bridge failed to setup the link and stop the atomic_enable() >>> chain for that connector. >> >> Doing link training when we get hpd instead of atomic_enable() is a >> design choice we have been following for a while because for the case >> when link training fails in atomic_enable() and setting the link status >> property as you mentioned, the compositor needs to be able to handle >> that and also needs to try with a different resolution or take some >> other corrective action. We have seen many compositors not able to >> handle this complexity. > > The chrome compositor handles this case[1]. If the link status is set to > bad and there are non-zero number of modes on a connected connector it > resets the status to good to try again. > Thanks for the link. Just resetting the property alone and trying again is going to lead to the same failure again. So that alone is insufficient and doesn't sound right. As documented here: https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties "When user-space receives the hotplug uevent and detects a "BAD" link-status, the sink doesn't receive pixels anymore (e.g. the screen becomes completely black). The list of available modes may have changed. User-space is expected to pick a new mode if the current one has disappeared and perform a new modeset with link-status set to "GOOD" to re-enable the connector." Picking a different mode is a reasonable attempt to try again but even that might fail again if it picks a mode which falls in the same link rate. Thats why, to re-iterate what i mentioned, we need to see if some sort of a handshake fallback exists or can be implemented. It will need compositor support as well as driver change to maybe remove that mode etc. We prioritized user experience here to make sure display_enable() wont fail otherwise the user might keep waiting for the screen to come up forever. With the driver ensuring link is trained and then reporting to usermode, its a safer option as the driver will train with the highest link rate / lane combination supported and also remove modes which dont fall in this bucket in dp_bridge_mode_valid. Till we validate this, I would prefer to keep this change out of this series. >> So the design sends the hotplug to usermode only >> after link training succeeds. > > I suspect this is why my trogdor device turns off after rebooting when I > apply a ChromeOS update with the lid closed and DP connected. Userspace > wants to know that a display is connected, but this driver is still link > training by the time userspace boots up so we don't see any drm > connector indicating status is connected. No drm connectors connected > means the OS should shutdown. > Interesting use case but I am not sure if thats whats happening till we debug that. Why should OS shutdown if connectors are not in "connected" state? Agreed, display will be off. But shouldnt compositor be alive in case it receives hotplug? The user (in this case you) never turned the device off so why should the OS shutdown? >> >> I do not think we should change this design unless prototyped with an >> existing compositor such as chrome or android at this point. > > Is this driver used with android? > There are some internal efforts ongoing with prototyping this but I cannot comment more on this right now. > [1] https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.cc;l=114;drc=67520ac99db89395b10f2ab728b540eef0da8292