1 /* 2 * SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 * SPDX-License-Identifier: MIT 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be included in 13 * all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 * DEALINGS IN THE SOFTWARE. 22 */ 23 24 /******************************* DisplayPort********************************\ 25 * * 26 * Module: dp_connectorimpl.cpp * 27 * DP connector implementation * 28 * * 29 \***************************************************************************/ 30 #ifndef INCLUDED_DP_CONNECTORIMPL_H 31 #define INCLUDED_DP_CONNECTORIMPL_H 32 33 #include "dp_internal.h" 34 #include "dp_guid.h" 35 #include "dp_connector.h" 36 #include "dp_configcaps.h" 37 #include "dp_list.h" 38 #include "dp_buffer.h" 39 #include "dp_auxdefs.h" 40 #include "dp_watermark.h" 41 #include "dp_edid.h" 42 #include "dp_discovery.h" 43 #include "dp_groupimpl.h" 44 #include "dp_deviceimpl.h" 45 #include "./dptestutil/dp_testmessage.h" 46 47 // HDCP abort codes 48 #define HDCP_FLAGS_ABORT_DEVICE_REVOKED 0x00000800 // Abort due to a revoked device in DP1.2 topology 49 #define HDCP_FLAGS_ABORT_DEVICE_INVALID 0x00080000 // Abort due to an invalid device in DP1.2 topology 50 #define HDCP_FLAGS_ABORT_HOP_LIMIT_EXCEEDED 0x80000000 // Abort, number of devices in DP1.2 topology exceeds supported limit 51 52 static inline unsigned getDataClockMultiplier(NvU64 linkRate, NvU64 laneCount) 53 { 54 // 55 // To get the clock multiplier: 56 // - Convert the linkRate from Hz to 10kHz by dividing it by 10000. 57 // - Multiply the 10kHz linkRate by the laneCount. 58 // - Multiply by 10.0/8, to account for the 8b/10b encoding overhead in the DP protocol layer. 59 // 60 // Avoid floating point in the arithmetic in the calculation 61 // through the following conversions: 62 // linkRate/10000.0 * laneCount * 10.0/8 63 // (linkRate * laneCount * 10) / (10000 * 8) 64 // (linkRate * laneCount) / (1000 * 8) 65 // 66 return (unsigned) DisplayPort::axb_div_c_64(linkRate, laneCount, 8000); 67 } 68 69 namespace DisplayPort 70 { 71 72 typedef enum 73 { 74 DP_TRANSPORT_MODE_INIT = 0, 75 DP_TRANSPORT_MODE_SINGLE_STREAM = 1, 76 DP_TRANSPORT_MODE_MULTI_STREAM = 2, 77 } DP_TRANSPORT_MODE; 78 79 // Information required during compound query attach for MST 80 typedef struct _CompoundQueryAttachMSTInfo 81 { 82 ModesetInfo localModesetInfo; 83 LinkConfiguration lc; 84 } CompoundQueryAttachMSTInfo; 85 86 struct ConnectorImpl : public Connector, DiscoveryManager::DiscoveryManagerEventSink, Timer::TimerCallback, MessageManager::MessageReceiver::MessageReceiverEventSink 87 { 88 // DPCD HAL Layer - We should use this in place of direct register accesses 89 DPCDHAL * hal; 90 91 MainLink * main; // Main link controls 92 AuxBus * auxBus; 93 94 TestMessage testMessage; // TestMessage instance 95 96 Timer * timer; // OS provided timer services 97 Connector::EventSink * sink; // Event Sink 98 99 // Cached Source OUI for restoring eDP OUI when powering up 100 unsigned cachedSourceOUI; 101 char cachedSourceModelName[NV_DPCD_SOURCE_DEV_ID_STRING__SIZE + 1]; 102 NvU8 cachedSourceChipRevision; 103 bool bOuiCached; 104 105 unsigned ouiId; // Sink ouiId 106 char modelName[NV_DPCD_SOURCE_DEV_ID_STRING__SIZE + 1]; // Device Model-name 107 bool bIgnoreSrcOuiHandshake; // Skip writing source OUI 108 109 LinkPolicy linkPolicy; 110 111 bool linkGuessed; // True when link was "guessed" during HPD in TMDS mode 112 bool isLinkQuiesced; // True when link was set to quiet mode by TMDS modeset 113 114 bool bNoLtDoneAfterHeadDetach; // True when head is disconnected in NDE 115 116 bool isDP12AuthCap; // To tell whether this DP1.2 connector/ upmost device has the authentication Cap. 117 bool isHDCPAuthOn; // To tell whether this connector has the authentication on. 118 bool isHDCPReAuthPending; // To tell whether HDCP Auth is pending (at every stream addition and cleared at handler). 119 bool isHDCPAuthTriggered; // To tell whether HDCP Auth is triggered and only cleared at unplug/device detach for MST. 120 bool isHopLimitExceeded; // To tell the current topology is over limitation. 121 bool bIsDiscoveryDetectActive; // To tell device discovery is active ( isDiscoveryDetectComplete is also used as DD notify and not want to impacts that. ) 122 bool isDiscoveryDetectComplete; // To tell device discovery is finished. 123 bool bDeferNotifyLostDevice; // To tell if we should defer notify lost device event to client. 124 125 HDCPValidateData hdcpValidateData; // Cache the HDCP ValidateData. 126 unsigned authRetries; // Retry counter for the authentication. 127 unsigned retryLT; // Retry counter for link training in case of link lost in PostLQA 128 unsigned hdcpCapsRetries; // Retry counter for Hdcp Caps read. 129 unsigned hdcpCpIrqRxStatusRetries; // Retry counter for CPIRQ RxStatus read. 130 bool bLTPhyRepeater; // Link Train PHY Repeaters between Source and Sink 131 bool bFromResumeToNAB; // True if from resume to NAB, WAR flag for unblocking GA1.5 132 bool bAttachOnResume; // True if notifyLongPulse is called for resume (reboot/S3/S4) 133 bool bSkipAssessLinkForEDP; // Skip assessLink() for eDP. Assuming max is reachable. 134 bool bPConConnected; // HDMI2.1-Protocol Converter (Support SRC control mode) connected. 135 bool bSkipAssessLinkForPCon; // Skip assessLink() for PCON. DD will call assessFRLLink later. 136 bool bHdcpAuthOnlyOnDemand; // True if only initiate Hdcp authentication on demand and MST won't auto-trigger authenticate at device attach. 137 bool bReassessMaxLink; // Retry assessLink() if the first assessed link config is lower than the panel max config. 138 139 bool constructorFailed; 140 141 // 142 // OS Modeset Order mitigation causes the library to delay the reporting 143 // of new devices until they can be safely turned on. 144 // When enabled the library client will not see connection events until 145 // MustDisconnect messages are processed. 146 // 147 // Policy state should be set before the library is brought out of 148 // the suspended state. 149 // 150 bool policyModesetOrderMitigation; 151 152 // 153 // force LT at NAB for compliance test (Power Management) in Win10 RS2+ (WDDM 2.2) 154 // 155 // RS2 no longer sends an explicit call for setPanelPowerParams during the Resume. 156 // It does that by specifying an additional flag during the call to SetTimings. Due to 157 // this DP lib doesn't get chance to perform this transition from setPanelPowerParams 158 // and since it was already skipping LT in NAB/modeswitch, so LT get missed out on the 159 // compliance device during resume from S3/S4. 160 // 161 bool policyForceLTAtNAB; 162 163 // 164 // There are cases where OS does not detach heads from connector immediately after hot-unplug, 165 // on next hot-plug there is no guarantee that newly connected sink is capable to drive existing 166 // raster timings. Flush mode has following restriction 167 // When exiting flush mode S/W should ensure that the final 168 // link clock & lane count should be able to support existing raster. 169 // If we run into this situation and use flush mode then that will cause display engine to hang. 170 // This variable ensures to assess link safely in this situation: if newly connected sink is 171 // not capable to drive existing raster then just restore link configuration which was there 172 // before enabling flush mode, through fake link training. 173 // 174 bool policyAssessLinkSafely; 175 176 bool bDisableVbiosScratchRegisterUpdate; 177 178 // Only works when policyModesetOrderMitigation is true. 179 // To record if we should report newDevice. 180 bool modesetOrderMitigation; 181 182 List deviceList; 183 List activeGroups; 184 LinkedList<GroupImpl> intransitionGroups; 185 LinkedList<GroupImpl> addStreamMSTIntransitionGroups; 186 List inactiveGroups; 187 188 LinkedList<Device> dscEnabledDevices; 189 190 // Compound query 191 bool compoundQueryActive; 192 bool compoundQueryResult; 193 unsigned compoundQueryCount; 194 unsigned compoundQueryLocalLinkPBN; 195 bool compoundQueryForceEnableFEC; 196 197 unsigned freeSlots; 198 unsigned maximumSlots; 199 int firstFreeSlot; 200 201 // Multistream messaging 202 MessageManager * messageManager; 203 DiscoveryManager * discoveryManager; 204 205 // Multistream timeslot management (on local link) 206 LinkConfiguration highestAssessedLC; // As of last assess, the highest possible link configuration 207 208 LinkConfiguration activeLinkConfig; // Current link config. 209 210 // this is the link config requested by a client. 211 // can be set and reset by the client for a given operation. 212 LinkConfiguration preferredLinkConfig; 213 214 // 215 // Desired link configuration of single head multiple sst secondary connector. 216 // 217 LinkConfiguration oneHeadSSTSecPrefLnkCfg; 218 219 // All possible link configs 220 LinkConfiguration * allPossibleLinkCfgs; 221 unsigned numPossibleLnkCfg; 222 223 PCONLinkControl activePConLinkControl; 224 225 // 226 // We're waiting for an MST<->SST transition 227 // The transition cannot be made without the DD 228 // disconnecting all heads. All devices are reported 229 // as must_disconnect. Once the last device blocking 230 // the transition is deattached from a head - we transition. 231 // 232 bool linkAwaitingTransition; 233 234 // Unless we're awaiting transition this is identical to hal->getSupportsMultistream() 235 DP_TRANSPORT_MODE linkState; 236 237 bool bAudioOverRightPanel; 238 239 bool previousPlugged; 240 bool connectorActive; // Keep track of if connector is active to serve any IRQ 241 242 Group * firmwareGroup; // The group used for book-keeping when we're in firmware mode 243 244 List pendingEdidReads; // List of DevicePendingEDIDRead structures. 245 // This list tracks the currently in progress MST Edid Reads 246 247 Device * lastDeviceSetForVbios; 248 249 // Flag which gets set when ACPI init is done. DD calls notifyAcpiInitDone to tell client that ACPI init is completed 250 // & client can now initiate DDC EDID read for a device which supports EDID through SBIOS 251 bool bAcpiInitDone; 252 253 // Flag to check if the system is UEFI. 254 bool bIsUefiSystem; 255 256 // Flag to check if LT should be skipped. 257 bool bSkipLt; 258 259 // Flag to make sure that zombie gets triggred when a powerChange event happens 260 bool bMitigateZombie; 261 262 // 263 // HP Valor QHD+ N15P-Q3 EDP needs 50ms delay after D3 264 // during trainLinkOptimized to come up on S4 265 // 266 bool bDelayAfterD3; 267 268 // 269 // ASUS and Samsung monitors have inconsistent behavior when 270 // DPCD 0x600 updated to D3. Skip D3 only in case these monitors 271 // are driven in SST config 272 // 273 bool bKeepLinkAlive; 274 275 // 276 // HP Trump dock link training is unstable during S4 resume, which causes 277 // system to hang. Keep the link alive to increase stability. 278 // See Bug 2109823. 279 // 280 bool bKeepLinkAliveMST; 281 282 // Keep the link alive when connector is in SST 283 bool bKeepLinkAliveSST; 284 285 // 286 // HTC Vive Link box is not happy when we power down the link 287 // during link training when there is no stream present. It requests 288 // for a link retraining pulse which is not required. 289 // WAR to address this - NV Bug# 1793084 290 // 291 bool bKeepOptLinkAlive; 292 293 // Keep both DP and FRL link alive to save time. 294 bool bKeepLinkAliveForPCON; 295 296 // 297 // Remote HDCP DCPD access should be D0 but won't introduce extra Dx 298 // state toggle. Use the counter to avoid powerdownlink when HDCP probe. 299 // 300 unsigned pendingRemoteHdcpDetections; 301 302 // 303 // ASUS PQ 321 tiled monitor sometimes loses link while assessing link 304 // or link training .So if we lower config from HBR2 to HBR and when 305 // we retrain the link , we see black screen. 306 // So WAR is to retry link training with same config for 3 times before 307 // lowering link config. NV Bug #1846925 308 // 309 bool bNoFallbackInPostLQA; 310 311 bool bReportDeviceLostBeforeNew; 312 bool bEnableAudioBeyond48K; 313 bool bDisableSSC; 314 bool bEnableFastLT; 315 NvU32 maxLinkRateFromRegkey; 316 317 // 318 // Latency(ms) to apply between link-train and FEC enable for bug 319 // 2561206. 320 // 321 NvU32 LT2FecLatencyMs; 322 323 // 324 // Dual SST Partner connector object pointer 325 ConnectorImpl *pCoupledConnector; 326 327 // Set to true when a DSC mode is requested. 328 bool bFECEnable; 329 330 // Save link config before entering PSR. 331 LinkConfiguration psrLinkConfig; 332 333 // 334 // Apply MST DSC caps WAR based on OUI ID of sink 335 // 336 bool bDscMstCapBug3143315; 337 338 // 339 // Synaptics branch device doesn't support Virtual Peer Devices so DSC 340 // capability of downstream device should be decided based on device's own 341 // and its parent's DSC capability 342 // 343 bool bDscCapBasedOnParent; 344 345 // 346 // MST device connnected to dock may issue IRQ for link lost. 347 // Send PowerDown path msg to suppress that. 348 // 349 bool bPowerDownPhyBeforeD3; 350 351 // 352 // Reset the MSTM_CTRL registers on branch device irrespective of 353 // IRQ VECTOR register having stale message. Certain branch devices 354 // need to reset the topology before issuing new discovery commands 355 // as there can be case where previous is still in process and a 356 // possibility that clearPendingMessage() might not be able to catch 357 // the stale messages from previous discovery. 358 // 359 bool bForceClearPendingMsg; 360 361 362 Group *perHeadAttachedGroup[NV_MAX_HEADS]; 363 NvU32 inTransitionHeadMask; 364 365 void sharedInit(); 366 ConnectorImpl(MainLink * main, AuxBus * auxBus, Timer * timer, Connector::EventSink * sink); 367 void setPolicyModesetOrderMitigation(bool enabled); 368 void setPolicyForceLTAtNAB(bool enabled); 369 void setPolicyAssessLinkSafely(bool enabled); 370 371 void discoveryDetectComplete(); 372 void discoveryNewDevice(const DiscoveryManager::Device & device); 373 void discoveryLostDevice(const Address & address); 374 void processNewDevice(const DiscoveryManager::Device & device, 375 const Edid & edid, 376 bool isMultistream, 377 DwnStreamPortType portType, 378 DwnStreamPortAttribute portAttribute, 379 bool isCompliance = false); 380 381 void applyEdidWARs(Edid & edid, DiscoveryManager::Device device); 382 void applyRegkeyOverrides(const DP_REGKEY_DATABASE& dpRegkeyDatabase); 383 384 ResStatusNotifyMessage ResStatus; 385 386 void messageProcessed(MessageManager::MessageReceiver * from); 387 388 ~ConnectorImpl(); 389 390 // 391 // Utility functions 392 // 393 virtual void hardwareWasReset(); 394 virtual LinkConfiguration getMaxLinkConfig(); 395 virtual LinkConfiguration getActiveLinkConfig(); 396 virtual void powerdownLink(bool bPowerdownPanel = false); 397 398 GroupImpl * getActiveGroupForSST(); 399 bool detectSinkCountChange(); 400 bool handlePhyPatternRequest(); 401 void applyOuiWARs(); 402 bool linkUseMultistream() 403 { 404 return (linkState == DP_TRANSPORT_MODE_MULTI_STREAM); 405 } 406 407 void populateAllDpConfigs(); 408 virtual LinkRates* importDpLinkRates(); 409 410 // 411 // Suspend resume API 412 // 413 virtual Group * resume(bool firmwareLinkHandsOff, 414 bool firmwareDPActive, 415 bool plugged, 416 bool isUefiSystem = false, 417 unsigned firmwareHead = 0, 418 bool bFirmwareLinkUseMultistream = false, 419 bool bDisableVbiosScratchRegisterUpdate = false, 420 bool bAllowMST = true); 421 virtual void pause(); 422 423 virtual Device * enumDevices(Device * previousDevice) ; 424 425 426 virtual void beginCompoundQuery(const bool bForceEnableFEC = false) ; 427 virtual bool compoundQueryAttach(Group * target, 428 unsigned twoChannelAudioHz, // if you need 192khz stereo specify 192000 here 429 unsigned eightChannelAudioHz, // Same setting for multi channel audio. 430 // DisplayPort encodes 3-8 channel streams as 8 channel 431 NvU64 pixelClockHz, // Requested pixel clock for the mode 432 unsigned rasterWidth, 433 unsigned rasterHeight, 434 unsigned rasterBlankStartX, 435 unsigned rasterBlankEndX, 436 unsigned depth, 437 DP_IMP_ERROR *errorStatus = NULL); 438 439 virtual bool compoundQueryAttach(Group * target, 440 const DpModesetParams &modesetParams, // Modeset info 441 DscParams *pDscParams = NULL, // DSC parameters 442 DP_IMP_ERROR *pErrorCode = NULL); // Error Status code 443 444 virtual bool endCompoundQuery(); 445 446 virtual bool dpLinkIsModePossible(const DpLinkIsModePossibleParams ¶ms); 447 448 virtual bool compoundQueryAttachMST(Group * target, 449 const DpModesetParams &modesetParams, // Modeset info 450 DscParams *pDscParams = NULL, // DSC parameters 451 DP_IMP_ERROR *pErrorCode = NULL); // Error Status code 452 453 virtual bool compoundQueryAttachMSTIsDscPossible 454 ( 455 Group * target, 456 const DpModesetParams &modesetParams, // Modeset info 457 DscParams *pDscParams = NULL // DSC parameters 458 ); 459 460 // Calculate and Configure SW state based on DSC 461 virtual bool compoundQueryAttachMSTDsc 462 ( 463 Group * target, 464 const DpModesetParams &modesetParams, // Modeset info 465 CompoundQueryAttachMSTInfo * info, // local info to update for later use 466 DscParams *pDscParams = NULL, // DSC parameters 467 DP_IMP_ERROR *pErrorCode = NULL // Error Status code 468 ); 469 470 // General part of CQA MST for DSC/non-DSC 471 virtual bool compoundQueryAttachMSTGeneric 472 ( 473 Group * target, 474 const DpModesetParams &modesetParams, // Modeset info 475 CompoundQueryAttachMSTInfo * info, // local info with updates for DSC 476 DscParams *pDscParams = NULL, // DSC parameters 477 DP_IMP_ERROR *pErrorCode = NULL // Error Status code 478 ); 479 480 virtual bool compoundQueryAttachSST(Group * target, 481 const DpModesetParams &modesetParams, // Modeset info 482 DscParams *pDscParams = NULL, // DSC parameters 483 DP_IMP_ERROR *pErrorCode = NULL); // Error Status code 484 485 486 // 487 // Timer callback tags. 488 // (we pass the address of these variables as context to ::expired) 489 char tagFireEvents; 490 char tagDelayedLinkTrain; 491 char tagHDCPReauthentication; 492 char tagDelayedHdcpCapRead; 493 char tagDelayedHDCPCPIrqHandling; 494 495 // 496 // Enable disable TMDS mode 497 // 498 virtual void enableLinkHandsOff(); 499 virtual void releaseLinkHandsOff(); 500 501 // 502 // Timer callback for event management 503 // Uses: fireEvents() 504 virtual void expired(const void * tag); 505 506 // Generate Events. 507 // useTimer specifies whether we fire the events on the timer 508 // context, or this context. 509 void fireEvents(); 510 511 // returns the number of pending notifications. 512 void fireEventsInternal(); 513 514 virtual bool isHeadShutDownNeeded(Group * target, // Group of panels we're attaching to this head 515 unsigned headIndex, 516 ModesetInfo modesetInfo); 517 518 virtual bool isLinkTrainingNeededForModeset(ModesetInfo modesetInfo); 519 520 virtual bool notifyAttachBegin(Group * target, // Group of panels we're attaching to this head 521 const DpModesetParams &modesetParams); 522 523 bool needToEnableFEC(const DpPreModesetParams ¶ms); 524 525 virtual void dpPreModeset(const DpPreModesetParams &modesetParams); 526 virtual void dpPostModeset(void); 527 528 virtual bool isHeadShutDownNeeded(Group * target, // Group of panels we're attaching to this head 529 unsigned headIndex, 530 unsigned twoChannelAudioHz, // if you need 192khz stereo specify 192000 here 531 unsigned eightChannelAudioHz, // Same setting for multi channel audio. DisplayPort encodes 3-8 channel streams as 8 channel 532 NvU64 pixelClockHz, // Requested pixel clock for the mode 533 unsigned rasterWidth, 534 unsigned rasterHeight, 535 unsigned rasterBlankStartX, 536 unsigned rasterBlankEndX, 537 unsigned depth) ; 538 539 virtual bool notifyAttachBegin(Group * target, // Group of panels we're attaching to this head 540 unsigned headIndex, 541 unsigned twoChannelAudioHz, // if you need 192khz stereo specify 192000 here 542 unsigned eightChannelAudioHz, // Same setting for multi channel audio. 543 // DisplayPort encodes 3-8 channel streams as 8 channel 544 NvU64 pixelClockHz, // Requested pixel clock for the mode 545 unsigned rasterWidth, 546 unsigned rasterHeight, 547 unsigned rasterBlankStartX, 548 unsigned rasterBlankEndX, 549 unsigned depth) ; 550 551 virtual void readRemoteHdcpCaps(); 552 virtual void notifyAttachEnd(bool modesetCancelled); 553 virtual void notifyDetachBegin(Group * target); 554 virtual void notifyDetachEnd(bool bKeepOdAlive = false); 555 556 bool performIeeeOuiHandshake(); 557 void setIgnoreSourceOuiHandshake(bool bIgnore); 558 bool getIgnoreSourceOuiHandshake(); 559 bool willLinkSupportModeSST(const LinkConfiguration & linkConfig, const ModesetInfo & modesetInfo); 560 void forceLinkTraining(); 561 562 void assessLink(LinkTrainingType trainType = NORMAL_LINK_TRAINING); 563 564 bool isLinkInD3(); 565 bool isLinkActive(); 566 bool isLinkLost(); 567 bool trainSingleHeadMultipleSSTLinkNotAlive(GroupImpl *pGroupAttached); 568 bool isLinkAwaitingTransition(); 569 bool isNoActiveStreamAndPowerdown(); 570 void incPendingRemoteHdcpDetection() 571 { 572 pendingRemoteHdcpDetections++; 573 } 574 void decPendingRemoteHdcpDetection() 575 { 576 if (pendingRemoteHdcpDetections > 0) 577 { 578 pendingRemoteHdcpDetections--; 579 } 580 } 581 bool trainLinkOptimized(LinkConfiguration lConfig); 582 bool trainLinkOptimizedSingleHeadMultipleSST(GroupImpl * group); 583 bool getValidLowestLinkConfig(LinkConfiguration & lConfig, LinkConfiguration & lowestSelected, ModesetInfo queryModesetInfo); 584 bool postLTAdjustment(const LinkConfiguration &, bool force); 585 void populateUpdatedLaneSettings(NvU8* voltageSwingLane, NvU8* preemphasisLane, NvU32 *data); 586 void populateDscCaps(DSC_INFO* dscInfo, DeviceImpl * dev, DSC_INFO::FORCED_DSC_PARAMS* forcedParams); 587 void populateDscGpuCaps(DSC_INFO* dscInfo); 588 void populateForcedDscParams(DSC_INFO* dscInfo, DSC_INFO::FORCED_DSC_PARAMS* forcedParams); 589 void populateDscSinkCaps(DSC_INFO* dscInfo, DeviceImpl * dev); 590 void populateDscBranchCaps(DSC_INFO* dscInfo, DeviceImpl * dev); 591 void populateDscModesetInfo(MODESET_INFO * pModesetInfo, const DpModesetParams * pModesetParams); 592 593 bool train(const LinkConfiguration & lConfig, bool force, LinkTrainingType trainType = NORMAL_LINK_TRAINING); 594 bool validateLinkConfiguration(const LinkConfiguration & lConfig); 595 596 virtual bool assessPCONLinkCapability(PCONLinkControl *params); 597 bool trainPCONFrlLink(PCONLinkControl *pConControl); 598 599 // Set Device DSC state based on current DSC state of all active devices on this connector 600 bool setDeviceDscState(Device * dev, bool bEnableDsc); 601 602 // the lowest level function(nearest to the hal) for the connector. 603 bool rawTrain(const LinkConfiguration & lConfig, bool force, LinkTrainingType linkTrainingType); 604 605 bool enableFlush(); 606 bool beforeAddStream(GroupImpl * group, bool force=false, bool forFlushMode = false); 607 void afterAddStream(GroupImpl * group); 608 void beforeDeleteStream(GroupImpl * group, bool forFlushMode = false); 609 void afterDeleteStream(GroupImpl * group); 610 void disableFlush(bool test=false); 611 612 bool beforeAddStreamMST(GroupImpl * group, bool force = false, bool forFlushMode = false); 613 614 virtual bool checkIsModePossibleMST(GroupImpl * group); 615 616 bool deleteAllVirtualChannels(); 617 void clearTimeslices(); 618 bool allocateTimeslice(GroupImpl * targetGroup); 619 void freeTimeslice(GroupImpl * targetGroup); 620 void flushTimeslotsToHardware(); 621 bool getHDCPAbortCodesDP12(NvU32 &hdcpAbortCodesDP12); 622 bool getOuiSink(unsigned &ouiId, char * modelName, size_t modelNameBufferSize, NvU8 & chipRevision); 623 bool hdcpValidateKsv(const NvU8 *ksv, NvU32 Size); 624 void cancelHdcpCallbacks(); 625 bool handleCPIRQ(); 626 void handleSSC(); 627 void handleMCCSIRQ(); 628 void handleHdmiLinkStatusChanged(); 629 void sortActiveGroups(bool ascending); 630 void configInit(); 631 void handlePanelReplayError(); 632 633 virtual DeviceImpl* findDeviceInList(const Address & address); 634 virtual void disconnectDeviceList(); 635 void notifyLongPulseInternal(bool statusConnected); 636 virtual void notifyLongPulse(bool status); 637 virtual void notifyShortPulse(); 638 virtual Group * newGroup() ; 639 virtual void destroy(); 640 virtual void createFakeMuxDevice(const NvU8 *buffer, NvU32 bufferSize); 641 virtual void deleteFakeMuxDevice(); 642 virtual bool getRawDscCaps(NvU8 *buffer, NvU32 bufferSize); 643 virtual bool isMultiStreamCapable(); 644 virtual bool isFlushSupported(); 645 virtual bool isStreamCloningEnabled(); 646 virtual bool isFECSupported(); 647 virtual bool isFECCapable(); 648 virtual NvU32 maxLinkRateSupported(); 649 virtual bool setPreferredLinkConfig(LinkConfiguration & lc, bool commit, bool force = false, LinkTrainingType trainType = NORMAL_LINK_TRAINING); 650 virtual bool resetPreferredLinkConfig(bool force = false); 651 virtual void setAllowMultiStreaming(bool bAllowMST); 652 virtual bool getAllowMultiStreaming(void); 653 virtual bool getSinkMultiStreamCap(void); 654 virtual void setDp11ProtocolForced(); 655 virtual void resetDp11ProtocolForced(); 656 virtual bool isDp11ProtocolForced(); 657 658 bool isAcpiInitDone(); 659 virtual void notifyAcpiInitDone(); 660 Group * createFirmwareGroup(); 661 virtual void notifyGPUCapabilityChange(); 662 virtual void notifyHBR2WAREngage(); 663 664 bool getTestPattern(NV0073_CTRL_DP_TESTPATTERN *testPattern); 665 bool setTestPattern(NV0073_CTRL_DP_TESTPATTERN testPattern, NvU8 laneMask, NV0073_CTRL_DP_CSTM cstm, NvBool bIsHBR2, NvBool bSkipLaneDataOverride = false); 666 bool getLaneConfig(NvU32 *numLanes, NvU32 *data); // "data" is an array of NV0073_CTRL_MAX_LANES unsigned ints 667 bool setLaneConfig(NvU32 numLanes, NvU32 *data); // "data" is an array of NV0073_CTRL_MAX_LANES unsigned ints 668 void getCurrentLinkConfig(unsigned & laneCount, NvU64 & linkRate); // CurrentLink Configuration 669 unsigned getPanelDataClockMultiplier(); 670 unsigned getGpuDataClockMultiplier(); 671 void configurePowerState(bool bPowerUp); 672 virtual void readPsrCapabilities(vesaPsrSinkCaps *caps); 673 virtual bool updatePsrConfiguration(vesaPsrConfig config); 674 virtual bool readPsrConfiguration(vesaPsrConfig *config); 675 virtual bool readPsrDebugInfo(vesaPsrDebugStatus *psrDbgState); 676 virtual bool writePsrErrorStatus(vesaPsrErrorStatus psrErr); 677 virtual bool readPsrErrorStatus(vesaPsrErrorStatus *psrErr); 678 virtual bool writePsrEvtIndicator(vesaPsrEventIndicator psrErr); 679 virtual bool readPsrEvtIndicator(vesaPsrEventIndicator *psrErr); 680 virtual bool readPsrState(vesaPsrState *psrState); 681 virtual bool updatePsrLinkState(bool bTurnOnLink); 682 683 virtual bool readPrSinkDebugInfo(panelReplaySinkDebugInfo *prDbgInfo); 684 685 // for dp test utility. pBuffer is the request buffer of type DP_STATUS_REQUEST_xxxx 686 DP_TESTMESSAGE_STATUS sendDPTestMessage(void *pBuffer, 687 NvU32 requestSize, 688 NvU32 *pDpStatus); 689 690 DP_TESTMESSAGE_STATUS getStreamIDs(NvU32 *pStreamIDs, NvU32 *pCount); // for dp test utility, called by DD 691 692 // Reset link training counter for the active link configuration. 693 virtual void resetLinkTrainingCounter() 694 { 695 activeLinkConfig.setLTCounter(0); 696 } 697 }; 698 699 // 700 // New devices do not get a DeviceImpl created until after 701 // the EDID read has completed. This object is used 702 // to track the necessary state. 703 // 704 struct DevicePendingEDIDRead : protected EdidReadMultistream::EdidReadMultistreamEventSink, public ListElement 705 { 706 EdidReadMultistream reader; 707 DiscoveryManager::Device device; 708 ConnectorImpl * parent; 709 710 void mstEdidCompleted(EdidReadMultistream * from); 711 void mstEdidReadFailed(EdidReadMultistream * from); 712 713 public: 714 DevicePendingEDIDRead(ConnectorImpl * _parent, MessageManager * manager, DiscoveryManager::Device dev) 715 : reader(_parent->timer, manager, this, dev.address), device(dev), parent(_parent) 716 { 717 } 718 }; 719 } 720 721 #endif //INCLUDED_DP_CONNECTORIMPL_H 722