<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>  static int</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>  skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state)</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>  {</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> @@ -4606,22 +4618,29 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state)</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>         */</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>        for (level = ilk_wm_max_level(dev_priv); level >= 0; level--) {</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>                blocks = 0;</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> +</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>                for_each_plane_id_on_crtc(crtc, plane_id) {</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> -                     const struct skl_plane_wm *wm =</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> -                             &crtc_state->wm.skl.optimal.planes[plane_id];</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> +                     const struct skl_wm_level *wm_level;</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> +                     const struct skl_wm_level *wm_uv_level;</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> +                     int color_plane = 0;</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>These color_plane variables seems kinda pointless. I'd just pass 0/1 directly</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>(pretty sure that's what we do elsewhere too).</span><br>
</p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><br>
</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">Nope. I have a different view - if this is allowed here. 0/1 passed into function are just a magic</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">numbers with no meaning - that way you see at least what's the param name and it's meaning.</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><br>
</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">Again, _absolutely_ pointless arguing and potentially waste of time instead of fixing some real thing. Whether
 those are variables or constants, doesn't make this code better or worse.</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><br>
</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>                       
 /*</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>                         * We only disable the watermarks for each plane if</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> @@ -4732,9 +4765,10 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state)</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>                         *  planes must be enabled before the level will be used."</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>                         * So this is actually safe to do.</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>>                         */</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> -                     if (wm->wm[level].min_ddb_alloc > total[plane_id] ||</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> -                         wm->uv_wm[level].min_ddb_alloc > uv_total[plane_id])</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> -                             memset(&wm->wm[level], 0, sizeof(wm->wm[level]));</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> +                     if (wm_level->min_ddb_alloc > total[plane_id] ||</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> +                         wm_uv_level->min_ddb_alloc > uv_total[plane_id])</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> +                             memset(&wm->wm[level], 0,</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>> +                                    sizeof(struct skl_wm_level));</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">> memset(wm_level, 0, sizeof(*wm_level)) ?</span><br>
</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><br>
</span></span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">Again
 - <span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">memset(wm_level, 0, sizeof(*wm_level)) and <span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">memset(wm_level,
 0, sizeof(struct skl_wm_level)) are absolutely identical constructs according to C standard.</span></span></span></span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">And
 I know that you are going to say that sizeof(*wm_level) won't require to change type - </span></span></span></span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">well
 if you are changing the code anyway, this is trivial.  </span></span></span></span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">If
 I have any freedom to express my point of view at all, I'm not going to fix that.</span></span></span></span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><br>
</span></span></span></span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">Why
 are we even wasting time for this kind of stuff? Aren't there more serious problems no?</span></span></span></span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">I
 myself have already decades of experience in coding in a rather big projects and big companies and can say </span></span></span></span><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">that
 those kind of nitpicks are completely useless waste of time.</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><br>
</span></span></span></span></p>
<p><br>
</p>
<div id="x_Signature">
<div style="font-family:Tahoma; font-size:13px"><font size="2"><span style="font-size:10pt">Best Regards,<br>
<br>
Lisovskiy Stanislav <br>
</span></font></div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Ville Syrjälä <ville.syrjala@linux.intel.com><br>
<b>Sent:</b> Wednesday, March 11, 2020 6:07:27 PM<br>
<b>To:</b> Lisovskiy, Stanislav<br>
<b>Cc:</b> intel-gfx@lists.freedesktop.org; Ausmus, James; Saarinen, Jani; Roper, Matthew D<br>
<b>Subject:</b> Re: [PATCH v19 2/8] drm/i915: Introduce skl_plane_wm_level accessor.</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">On Mon, Mar 09, 2020 at 06:11:58PM +0200, Stanislav Lisovskiy wrote:<br>
> For future Gen12 SAGV implementation we need to<br>
> seemlessly alter wm levels calculated, depending<br>
> on whether we are allowed to enable SAGV or not.<br>
> <br>
> So this accessor will give additional flexibility<br>
> to do that.<br>
> <br>
> Currently this accessor is still simply working<br>
> as "pass-through" function. This will be changed<br>
> in next coming patches from this series.<br>
> <br>
> v2: - plane_id -> plane->id(Ville Syrjälä)<br>
>     - Moved wm_level var to have more local scope<br>
>       (Ville Syrjälä)<br>
>     - Renamed yuv to color_plane(Ville Syrjälä) in<br>
>       skl_plane_wm_level<br>
> <br>
> v3: - plane->id -> plane_id(this time for real, Ville Syrjälä)<br>
>     - Changed colorplane id type from boolean to int as index<br>
>       (Ville Syrjälä)<br>
>     - Moved crtc_state param so that it is first now<br>
>       (Ville Syrjälä)<br>
>     - Moved wm_level declaration to tigher scope in<br>
>       skl_write_plane_wm(Ville Syrjälä)<br>
> <br>
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com><br>
> ---<br>
>  drivers/gpu/drm/i915/intel_pm.c | 85 ++++++++++++++++++++++++++-------<br>
>  1 file changed, 67 insertions(+), 18 deletions(-)<br>
> <br>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c<br>
> index c7928c870b0a..c72fa59a8302 100644<br>
> --- a/drivers/gpu/drm/i915/intel_pm.c<br>
> +++ b/drivers/gpu/drm/i915/intel_pm.c<br>
> @@ -4547,6 +4547,18 @@ icl_get_total_relative_data_rate(struct intel_crtc_state *crtc_state,<br>
>        return total_data_rate;<br>
>  }<br>
>  <br>
> +static const struct skl_wm_level *<br>
> +skl_plane_wm_level(const struct intel_crtc_state *crtc_state,<br>
> +                enum plane_id plane_id,<br>
> +                int level,<br>
> +                int color_plane)<br>
> +{<br>
> +     const struct skl_plane_wm *wm =<br>
> +             &crtc_state->wm.skl.optimal.planes[plane_id];<br>
> +<br>
> +     return color_plane == 0 ? &wm->wm[level] : &wm->uv_wm[level];<br>
> +}<br>
> +<br>
>  static int<br>
>  skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state)<br>
>  {<br>
> @@ -4606,22 +4618,29 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state)<br>
>         */<br>
>        for (level = ilk_wm_max_level(dev_priv); level >= 0; level--) {<br>
>                blocks = 0;<br>
> +<br>
>                for_each_plane_id_on_crtc(crtc, plane_id) {<br>
> -                     const struct skl_plane_wm *wm =<br>
> -                             &crtc_state->wm.skl.optimal.planes[plane_id];<br>
> +                     const struct skl_wm_level *wm_level;<br>
> +                     const struct skl_wm_level *wm_uv_level;<br>
> +                     int color_plane = 0;<br>
<br>
These color_plane variables seems kinda pointless. I'd just pass 0/1 directly<br>
(pretty sure that's what we do elsewhere too).<br>
<br>
> +<br>
> +                     wm_level = skl_plane_wm_level(crtc_state, plane_id,<br>
> +                                                   level, color_plane);<br>
> +                     wm_uv_level = skl_plane_wm_level(crtc_state, plane_id,<br>
> +                                                      level, color_plane + 1);<br>
>  <br>
>                        if (plane_id == PLANE_CURSOR) {<br>
> -                             if (wm->wm[level].min_ddb_alloc > total[PLANE_CURSOR]) {<br>
> +                             if (wm_level->min_ddb_alloc > total[PLANE_CURSOR]) {<br>
>                                        drm_WARN_ON(&dev_priv->drm,<br>
> -                                                 wm->wm[level].min_ddb_alloc != U16_MAX);<br>
> +                                                 wm_level->min_ddb_alloc != U16_MAX);<br>
>                                        blocks = U32_MAX;<br>
>                                        break;<br>
>                                }<br>
>                                continue;<br>
>                        }<br>
>  <br>
> -                     blocks += wm->wm[level].min_ddb_alloc;<br>
> -                     blocks += wm->uv_wm[level].min_ddb_alloc;<br>
> +                     blocks += wm_level->min_ddb_alloc;<br>
> +                     blocks += wm_uv_level->min_ddb_alloc;<br>
>                }<br>
>  <br>
>                if (blocks <= alloc_size) {<br>
> @@ -4644,10 +4663,16 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state)<br>
>         * proportional to its relative data rate.<br>
>         */<br>
>        for_each_plane_id_on_crtc(crtc, plane_id) {<br>
> -             const struct skl_plane_wm *wm =<br>
> -                     &crtc_state->wm.skl.optimal.planes[plane_id];<br>
> +             const struct skl_wm_level *wm_level;<br>
> +             const struct skl_wm_level *wm_uv_level;<br>
>                u64 rate;<br>
>                u16 extra;<br>
> +             int color_plane = 0;<br>
> +<br>
> +             wm_level = skl_plane_wm_level(crtc_state, plane_id,<br>
> +                                           level, color_plane);<br>
> +             wm_uv_level = skl_plane_wm_level(crtc_state, plane_id,<br>
> +                                              level, color_plane + 1);<br>
>  <br>
>                if (plane_id == PLANE_CURSOR)<br>
>                        continue;<br>
> @@ -4663,7 +4688,7 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state)<br>
>                extra = min_t(u16, alloc_size,<br>
>                              DIV64_U64_ROUND_UP(alloc_size * rate,<br>
>                                                 total_data_rate));<br>
> -             total[plane_id] = wm->wm[level].min_ddb_alloc + extra;<br>
> +             total[plane_id] = wm_level->min_ddb_alloc + extra;<br>
>                alloc_size -= extra;<br>
>                total_data_rate -= rate;<br>
>  <br>
> @@ -4674,7 +4699,7 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state)<br>
>                extra = min_t(u16, alloc_size,<br>
>                              DIV64_U64_ROUND_UP(alloc_size * rate,<br>
>                                                 total_data_rate));<br>
> -             uv_total[plane_id] = wm->uv_wm[level].min_ddb_alloc + extra;<br>
> +             uv_total[plane_id] = wm_uv_level->min_ddb_alloc + extra;<br>
>                alloc_size -= extra;<br>
>                total_data_rate -= rate;<br>
>        }<br>
> @@ -4717,8 +4742,16 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state)<br>
>         */<br>
>        for (level++; level <= ilk_wm_max_level(dev_priv); level++) {<br>
>                for_each_plane_id_on_crtc(crtc, plane_id) {<br>
> +                     const struct skl_wm_level *wm_level;<br>
> +                     const struct skl_wm_level *wm_uv_level;<br>
>                        struct skl_plane_wm *wm =<br>
>                                &crtc_state->wm.skl.optimal.planes[plane_id];<br>
> +                     int color_plane = 0;<br>
> +<br>
> +                     wm_level = skl_plane_wm_level(crtc_state, plane_id,<br>
> +                                                   level, color_plane);<br>
> +                     wm_uv_level = skl_plane_wm_level(crtc_state, plane_id,<br>
> +                                                      level, color_plane + 1);<br>
>  <br>
>                        /*<br>
>                         * We only disable the watermarks for each plane if<br>
> @@ -4732,9 +4765,10 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state)<br>
>                         *  planes must be enabled before the level will be used."<br>
>                         * So this is actually safe to do.<br>
>                         */<br>
> -                     if (wm->wm[level].min_ddb_alloc > total[plane_id] ||<br>
> -                         wm->uv_wm[level].min_ddb_alloc > uv_total[plane_id])<br>
> -                             memset(&wm->wm[level], 0, sizeof(wm->wm[level]));<br>
> +                     if (wm_level->min_ddb_alloc > total[plane_id] ||<br>
> +                         wm_uv_level->min_ddb_alloc > uv_total[plane_id])<br>
> +                             memset(&wm->wm[level], 0,<br>
> +                                    sizeof(struct skl_wm_level));<br>
<br>
memset(wm_level, 0, sizeof(*wm_level)) ?<br>
<br>
Hmm. Also wondering why we're not clearing wm_uv here as well. I suppose<br>
it might not mater since the hw doesn't use wm_uv (and I fixed the<br>
"did the wms change?" check to ignore it too). Bit might be nice to clear<br>
it for consistency. Should be a separate patch though.<br>
<br>
>  <br>
>                        /*<br>
>                         * Wa_1408961008:icl, ehl<br>
> @@ -4742,9 +4776,14 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state)<br>
>                         */<br>
>                        if (IS_GEN(dev_priv, 11) &&<br>
>                            level == 1 && wm->wm[0].plane_en) {<br>
> -                             wm->wm[level].plane_res_b = wm->wm[0].plane_res_b;<br>
> -                             wm->wm[level].plane_res_l = wm->wm[0].plane_res_l;<br>
> -                             wm->wm[level].ignore_lines = wm->wm[0].ignore_lines;<br>
> +                             wm_level = skl_plane_wm_level(crtc_state, plane_id,<br>
> +                                                           0, color_plane);<br>
> +                             wm->wm[level].plane_res_b =<br>
> +                                     wm_level->plane_res_b;<br>
> +                             wm->wm[level].plane_res_l =<br>
> +                                     wm_level->plane_res_l;<br>
> +                             wm->wm[level].ignore_lines =<br>
> +                                     wm_level->ignore_lines;<br>
<br>
I would suggest we want this to read something like:<br>
<br>
const struct skl_wm_level *wm_level0 = skl_plane_wm_level(...)<br>
<br>
wm_level->foo = wm_level0->foo;<br>
...<br>
<br>
And with those we can throw out the 'wm' variable from this loop as<br>
well.<br>
<br>
>                        }<br>
>                }<br>
>        }<br>
> @@ -5358,8 +5397,13 @@ void skl_write_plane_wm(struct intel_plane *plane,<br>
>                &crtc_state->wm.skl.plane_ddb_uv[plane_id];<br>
>  <br>
>        for (level = 0; level <= max_level; level++) {<br>
> +             const struct skl_wm_level *wm_level;<br>
> +             int color_plane = 0;<br>
> +<br>
> +             wm_level = skl_plane_wm_level(crtc_state, plane_id, level, color_plane);<br>
> +<br>
>                skl_write_wm_level(dev_priv, PLANE_WM(pipe, plane_id, level),<br>
> -                                &wm->wm[level]);<br>
> +                                wm_level);<br>
>        }<br>
>        skl_write_wm_level(dev_priv, PLANE_WM_TRANS(pipe, plane_id),<br>
>                           &wm->trans_wm);<br>
> @@ -5392,8 +5436,13 @@ void skl_write_cursor_wm(struct intel_plane *plane,<br>
>                &crtc_state->wm.skl.plane_ddb_y[plane_id];<br>
>  <br>
>        for (level = 0; level <= max_level; level++) {<br>
> +             const struct skl_wm_level *wm_level;<br>
> +             int color_plane = 0;<br>
> +<br>
> +             wm_level = skl_plane_wm_level(crtc_state, plane_id, level, color_plane);<br>
> +<br>
>                skl_write_wm_level(dev_priv, CUR_WM(pipe, level),<br>
> -                                &wm->wm[level]);<br>
> +                                wm_level);<br>
>        }<br>
>        skl_write_wm_level(dev_priv, CUR_WM_TRANS(pipe), &wm->trans_wm);<br>
>  <br>
> -- <br>
> 2.24.1.485.gad05a3d8e5<br>
<br>
-- <br>
Ville Syrjälä<br>
Intel<br>
</div>
</span></font>
</body>
</html>