<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 12 (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;}
@font-face
        {font-family:"Courrier New";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* 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:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.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;}
--></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="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hello folks,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am seeing corruption when running spectex from mesa demos which looks like vertex being randomly clipped on Valleyview, however spectex works fine on Ivy Bridge.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">After tracing down the codes I realize that the current Mesa driver would program the maximum number or URB entries (512 Valleyview)  whenever possible. This conflict with the 3D pipeline PRM where it states there is a programming restriction
 if the URB Entry Allocation Size is less than 9 URB entries then total entries should be program to 32. After modifying the codes to meet the restriction I was able to run spectex without corruption on Valleyview, pretty surprise that Ivy Bridge did not have
 this problem.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Here is the code snippet that I have changed which is at this point a quick hack and not upstream worthy as you can see the macro is not even properly defined in brw_defeines.h. Appreciate if I could get opinions from folks who are more
 familiar with Mesa and more experience with the graphic core.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New";color:#307F30">static</span><span style="font-size:9.0pt;font-family:"Courrier New"">
<span style="color:#307F30">void<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">gen7_upload_urb(<span style="color:#307F30">struct</span> brw_context *brw)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">  
<span style="color:#307F30">struct</span> intel_context *intel = &brw->intel;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">  
<span style="color:#30307F">/* Total space for entries is URB size - 16kB for push constants */<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">  
<span style="color:#307F30">int</span> handle_region_size = (brw->urb.size - <span style="color:#7F3030">
16</span>) * <span style="color:#7F3030">1024</span>; <span style="color:#30307F">
/* bytes */<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New";color:#30307F"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">  
<span style="color:#30307F">/* CACHE_NEW_VS_PROG */<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">   brw->urb.vs_size =
<span style="color:black;background:olive;mso-highlight:olive">MAX</span>2(brw->vs.prog_data->urb_entry_size,
<span style="color:#7F3030">1</span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">  
<span style="color:#307F30">int</span> nr_vs_entries = handle_region_size / (brw->urb.vs_size *
<span style="color:#7F3030">64</span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">  
<span style="color:#7F7F1B">if</span> (nr_vs_entries > brw->urb.max_vs_entries)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">      nr_vs_entries = brw->urb.max_vs_entries;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">  
<span style="color:#30307F">/* If the number of URB Allocation Size is smaller than 9 512 bit<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New";color:#30307F">    * units set the number or URB to Entries to 32<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New";color:#30307F">    */<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New";color:#7F1B7F">#define GEN7_URB_VS_MIN_ENTRIES
</span><span style="font-size:9.0pt;font-family:"Courrier New";color:#7F3030">32<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">  
<span style="color:#7F7F1B">if</span>(brw->urb.vs_size < <span style="color:#7F3030">
9</span>)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courrier New"">        nr_vs_entries = GEN7_URB_VS_MIN_ENTRIES;<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Douglas<o:p></o:p></p>
</div>
</body>
</html>