<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Mesa tries to detect AVX support and fails horribly"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=68297">68297</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Mesa tries to detect AVX support and fails horribly
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>major
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>delroth@gmail.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr></table>
      <p>
        <div>
        <pre>src/gallium/auxiliary/util/u_cpu_detect.c:         util_cpu_caps.has_avx    =
((regs2[2] >> 28) & 1) && // AVX

This is wrong. To check for AVX support, you need to:
1. Check if the AVX bit is set in cpuid (DONE)
2. Check if the XSAVE bit is set in cpuid (NOT DONE)
3. Check if xgetbv with ecx=0 & XFEATURE_ENABLED_MASK == XFEATURE_ENABLED_MASK
(NOT DONE)

See, for example:
<a href="https://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?r1=180991&r2=180990&pathrev=180991">https://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?r1=180991&r2=180990&pathrev=180991</a>
<a href="https://code.google.com/p/dolphin-emu/source/detail?r=377202b9f6154ae56c5b2f0a45e235ceaeb6da9c">https://code.google.com/p/dolphin-emu/source/detail?r=377202b9f6154ae56c5b2f0a45e235ceaeb6da9c</a>

Intel have some reference material about that but software.intel.com seems to
be down at the moment.

When trying to run llvmpipe on a machine with hardware AVX support but no
kernel support for it, it currently SIGILLs.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>