[Intel-gfx] Command parser breaks the 3D driver.

Kenneth Graunke kenneth at whitecape.org
Wed Mar 26 06:12:07 CET 2014


Hello,

The version of the command parser which landed in drm-intel-nightly (and
is now enabled by default) completely breaks the 3D driver.  Running any
program - glxgears, KDE, GNOME, whatever - results in:

    intel_do_flush_locked failed: Invalid argument

and then Mesa aborts the program.

When Mesa initializes, it tries to submit several small batches to see
if it can write various registers.  For example:

    MI_LOAD_REGISTER_IMM | (3 - 2)
        OACONTROL
        0x31337000 (expected value)
    <various pipe controls>
    MI_STORE_REGISTER_MEM
        OACONTROL
        <address>
    MI_LOAD_REGISTER_IMM | (3 - 2)
        OACONTROL
        0
    MI_BATCH_BUFFER_END

We then map the buffer to see what the value is.  If it's our expected
value, we know we can write that register, and enable features.  If not,
we disable the functionality and never write that register again.

This works because the hardware validator implicitly converts privileged
commands (like MI_LOAD_REGISTER_IMM) to MI_NOOP, but otherwise accepts
and processes the batch.  This is well-documented behavior, and we've
been relying on it since May 2013.

In contrast, the software validator returns -EINVAL and skips executing
the batch.  It rejects this particular batch since OACONTROL is not in
the kernel's register whitelist.

I'm not sure I'm quite comfortable with the software validator
implementing different behavior than the hardware validator.  Then
again, it's probably better behavior...

Also, I'm surprised to see that the software validator is always enabled
on Haswell.  The hardware validator actually works on Haswell, and the
majority of our batches don't need to run privileged commands, so it
seems like we're just burning CPU pointlessly.  I thought the plan was
to have userspace add an execbuf flag to explicitly request software
scanning when it emits privileged commands, and (on Haswell) use the
hardware scanner normally.

--Ken

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20140325/580b6eb1/attachment.sig>


More information about the Intel-gfx mailing list