<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:407961623;
        mso-list-type:hybrid;
        mso-list-template-ids:398112152 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">This seems like a typical atomic modeset requirement.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">IPC should not impact register programming.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Vblank evasion only works if you have a guarantee on worst case interrupts/delays.  I think locks is part of the guarantee.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Double buffer control should guarantee safe alignment of programming across planes on the same pipe.  Multiple pipes will still require a wait for vblank.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><a name="_____replyseparator"></a><b>From:</b> Vyas, Tarun <br>
<b>Sent:</b> Thursday, 12 April, 2018 9:57 AM<br>
<b>To:</b> intel-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Runyan, Arthur J <arthur.j.runyan@intel.com>; Shaikh, Azhar <azhar.shaikh@intel.com>; Herbert, Marc <marc.herbert@intel.com>; Ciobanu, Nathan D <nathan.d.ciobanu@intel.com>; Lankhorst, Maarten <maarten.lankhorst@intel.com><br>
<b>Subject:</b> Incorrect plane programming sequence results into a corrupted display/hard hung system<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">On KBL platforms, with HW overlay and/or PSR2, a hard hang with corrupted display is observed while running tests that frequently disable/re-enable primary/overlay planes. Details recorded in this FDO bug:
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=104975">https://bugs.freedesktop.org/show_bug.cgi?id=104975</a>.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The issue has been root caused as a race where only partial register updates get latched on the next vblank, specifically, the updates that give the buffer allocation of the current plane before disabling it (again, details captured in
 the FDO bug above). There have been several optimizations to work around this bug:<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">      
</span></span><![endif]>Enable Isochronous priority control (IPC)<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">      
</span></span><![endif]>Increase the vblank evasion time to 250 usec (We have tried 500 usec but that doesn’t helps).<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">      
</span></span><![endif]>Disable DOUBLE_BUFFER_CTL while the updates are done, inside intel_pipe_update_start and intel_pipe_update_end (doesn’t helps)<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="mso-list:Ignore">4.<span style="font:7.0pt "Times New Roman"">      
</span></span><![endif]>Grab all the required locks before starting the pipe_update.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Per Ville, none of the above optimizations guarantee a *<b>full</b>* update before the vblank. As a result, to fix this issue the right way, the plane programming sequence needs to be altered in the driver as mentioned below:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB">“Buffer allocation overlap among enabled planes will cause a full frame underrun, and that becomes a hard hange if pkgC or SAGV are enabled. 
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">You need to make sure the plane is disabled before reallocating the buffer it uses.  For a single pipe it is sufficient to initiate the disabling of the plane before the reallocation.  For multiple pipes it can be more
 complex<span style="color:#1F497D;background:white">.</span><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">In this case you should be doing something like this to ensure plane 2A turns off before plane 1A steals the buffer<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"> <o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;background:white"><span lang="EN-GB" style="color:#1F497D">1.</span><span lang="EN-GB" style="font-size:7.0pt;font-family:"Arial",sans-serif;color:#1F497D">        
</span><span lang="EN-GB">PLANE_CTL_2A -> disabled<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;background:white;box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px">
<span lang="EN-GB">2.       PLANE_SURF_2A:  touch to arm double buffer update<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;background:white;box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px">
<span lang="EN-GB">3.       PLANE_BUF_CFG_1A -> (0-860)<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-.25in;background:white;box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px">
<span lang="EN-GB">4.       PLANE_SURF_1A: touch to arm double buffer update<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">If the planes are on different pipes there needs to be a wait for vblank between step 2 and 3 to ensure the plane 2A disable completed."<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Please comment as required. </span><o:p></o:p></p>
</div>
</div>
</body>
</html>