Mesa (master): 62 new commits

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Apr 10 21:35:25 UTC 2017


URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd84252be62608c0b8e46173a774ec372c9708cc
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sun Apr 9 23:14:56 2017 -0700

    i965/drm: Add stall warnings when mapping or waiting on BOs.
    
    This restores the performance warnings removed in:
    
        i965: Drop brw_bo_map[_gtt] wrappers which issue perf warnings.
    
    but adds them for nearly all BO mapping, and also for wait_rendering.
    
    Because we add this to the core bufmgr, we automatically get stall
    warnings in all callers, unlike before where only a few callsites used
    the wrappers that gave stall warnings.
    
    We also do it a bit differently: we simply measure how long set_domain
    takes (the part that stalls), and complain if it's more than 0.01 ms.
    We don't bother calling brw_bo_busy(), and we don't measure the mmap
    time (which doesn't stall).  This should be more accurate.
    
    Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f053ee78ed2415a91d2960da50ea7c2ff9eddaa5
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sun Apr 9 22:58:57 2017 -0700

    i965/drm: Make a set_domain() helper function.
    
    Less boilerplate.
    
    Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a99a4979fdb84a41cc3626b27695f02b32ebb98a
Author: Daniel Vetter <daniel.vetter at ffwll.ch>
Date:   Thu Apr 6 09:13:47 2017 +0200

    i965/batch: Ensure we use a consistent offset in relocs
    
    In theory gcc is free to re-load them, and if a concurrent
    execbuf races and updates bo->offset64 then we have a problem:
    execbuffer api requires that the ->presumed_offset and the one
    we used for the reloc matches. It does not require that the value
    is sensible, which means no locks needed, just a consistent load.
    
    Ken said his next series will nuke this, so just hand-roll the
    kernel's READ_ONCE idea inline.
    
    FIXME: Most callers of brw_emit_reloc recompute the relocation
    themselves, which means this doesn't really fix the race. But the long
    term plan is to move to per-context relocation handling, which will
    fix this all properly. So leave this for now as just a reminder.
    
    Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
    Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f3c85c21e0e18bbedb2f59ba13838d963f0a106
Author: Daniel Vetter <daniel.vetter at ffwll.ch>
Date:   Thu Apr 6 08:48:08 2017 +0200

    i965/bufmgr: Garbage-collect vma cache/pruning
    
    This was done because the kernel has 1 global address space, shared
    with all render clients, for gtt mmap offsets, and that address space
    was only 32bit on 32bit kernels.
    
    This was fixed  in
    
    commit 440fd5283a87345cdd4237bdf45fb01130ea0056
    Author: Thierry Reding <treding at nvidia.com>
    Date:   Fri Jan 23 09:05:06 2015 +0100
    
        drm/mm: Support 4 GiB and larger ranges
    
    which shipped in 4.0. Of course you still want to limit the bo cache
    to a reasonable size on 32bit apps to avoid ENOMEM, but that's better
    solved by tuning the cache a bit. On 64bit, this was never an issue.
    
    On top, mesa never set this, so it's all dead code. Collect an trash it.
    
    Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
    Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f965d3f7ac309f519b0216a8a916cda5cb5d1e3
Author: Daniel Vetter <daniel.vetter at ffwll.ch>
Date:   Thu Apr 6 08:28:51 2017 +0200

    i965/bufmgr: Remove some reuse functions
    
    is_reusable was needed by uxa because it couldn't keep track of its
    scanout buffers and used this as a proxy. Disabling reuse is a silly
    idea, we set this once at start. Remove both.
    
    Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
    Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=edd85c1f040b4d91ae31fd80fbba2554d55bc13d
Author: Daniel Vetter <daniel.vetter at ffwll.ch>
Date:   Thu Apr 6 08:27:47 2017 +0200

    i965/bufmgr: remove start_gtt_access
    
    Iirc this was used by uxa for persistent mmpas of the frontbuffer. For
    mesa all the set_domain stuff needed before a synchronized mmap is handled
    within the bufmgr, so no reason ever to call this.
    
    Inline the implementation into its only internal user.
    
    Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
    Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=439edaa4b516b90d781428703988a200beaf138b
Author: Daniel Vetter <daniel.vetter at ffwll.ch>
Date:   Thu Apr 6 08:25:50 2017 +0200

    i965/bufmgr: Delete set_tiling
    
    Entirely unused, and really shouldn't be used. The alloc functions already
    take care of this. And even in a future where we're not going to
    h/v-align tiled buffers in the bufmgr, but only in isl, I think we
    still want to adjust the tiling mode in the bufmgr, since that ties in
    closely to mmaps and stuff like that.
    
    get_tiling is still needed for the import paths (until we have modifiers
    everywhere).
    
    Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
    Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6308121475d4718c9c543d1f7a95d832ff55c2d7
Author: Daniel Vetter <daniel.vetter at ffwll.ch>
Date:   Thu Apr 6 08:23:28 2017 +0200

    i965/bufmgr: Delete alloc_for_render
    
    Entirely unused, mesa instead used the BO_ALLOC_FOR_RENDER flag.
    
    Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
    Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=538fa87f40709f2cafb561056ea3ca5c46f8c85e
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Apr 5 14:10:36 2017 -0700

    i965/drm: Use list_for_each_entry_safe in a couple of cases.
    
    Suggested by Chris Wilson.  A tiny bit simpler.
    
    Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=10929da5fbe99bd9fb3138917d554f561a2ecd21
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 21:01:51 2017 -0700

    i965/drm: Rename intel_bufmgr_gem.c to brw_bufmgr.c.
    
    Matches the class name and the header file name.
    
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7aa66e64feb320bbc769024e34e0bd4ad6c21271
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 20:54:16 2017 -0700

    i965/drm: Reindent intel_bufmgr_gem.c and brw_bufmgr.h.
    
    indent -i3 -nut -br -brs -npcs -ce --no-tabs -Tuint32_t -Tuint64_t
    plus some manual fixes because those aren't quite the right settings.
    
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d30a92738ce09515cd9ec29e75cb020d1f251767
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 20:13:08 2017 -0700

    i965/drm: Rename drm_bacon_bo to brw_bo.
    
    The bacon is all gone.
    
    This renames both the class and the related functions.  We're about to
    run indent on the bufmgr code, so no need to worry about fixing bad
    indentation.
    
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0d15e9769cdfa887d2580eb50019516e7fda1fe
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 20:22:59 2017 -0700

    i965: Drop brw_bo_map[_gtt] wrappers which issue perf warnings.
    
    The stupid reason for eliminating these functions is that I'm about
    to rename drm_bacon_bo_map() to brw_bo_map(), which makes the real
    function have the short name, rather than the wrapper.
    
    I'm also planning on reworking our mapping code soon, so we use WC
    mappings and proper unsynchronized mappings on non-LLC platforms.
    It will be easier to do that without thinking about the stall
    warnings and wrappers.
    
    My eventual hope is to put the performance warnings in the BO map
    function itself, so all callers gain the warning.
    
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dfd81373b6ae3a8264c36b47722a38e47bfed756
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 20:14:11 2017 -0700

    i965/drm: Rename drm_bacon_reg_read() to brw_reg_read().
    
    Less bacon.
    
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=662a733dbc861f1efbe9128789c17ee6c082db2b
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 18:10:23 2017 -0700

    i965/drm: Rename drm_bacon_bufmgr to struct brw_bufmgr.
    
    Also stop using typedefs, per Mesa coding style.
    
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5216b25e0c2aa16653c5951089ca5f8dfb9b00c
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 17:32:19 2017 -0700

    i965: Just use a uint32_t context handle rather than a malloc'd wrapper.
    
    drm_bacon_context is a malloc'd struct containing a uint32_t context ID
    and a pointer back to the bufmgr.  The bufmgr pointer is pretty useless,
    as everybody already has brw->bufmgr.  At that point...we may as well
    just use the ctx_id handle directly.  A number of places already had to
    call drm_bacon_gem_context_get_id() to extract the ID anyway.  Now they
    just have it.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4cb3e4429d3868ffa2078e4cf772578418028ed1
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 17:44:57 2017 -0700

    i965/drm: Fold drm_bacon_gem_reset_stats into the callers.
    
    We're going to get rid of drm_bacon_context shortly, so we'd have to
    change the interface slightly.  It's basically just an ioctl wrapper
    that isn't terribly bufmgr-related, so We may as well just combine it
    with the code in brw_reset.c that actually uses it.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=414c9343a263c4900287451bd1c8ae09973fbffa
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 17:17:36 2017 -0700

    i965/drm: Rename drm_bacon_gem_bo_bucket to bo_cache_bucket.
    
    No need for a prefix as this struct is local to the .c file.
    
    Less bacon.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e46b74d1b51bca7368d69c4256cfe104f4b59d68
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 16:57:44 2017 -0700

    i965/drm: Drop drm_bacon_* from static functions.
    
    Mesa style is to not use lengthy prefixes for static functions.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=13596ecb6b11be203369ee9a1e89a083d0285a31
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 16:55:06 2017 -0700

    i965/drm: Drop drm_bacon_gem_bo_madvise_internal().
    
    The only difference is that it takes an explicit bufmgr rather than
    using bo->bufmgr, but there is only one bufmgr per screen so they
    should be identical anyway.
    
    Chris says this was added primarly to avoid bo/bo_gem casting,
    which was inconvenient.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9ee252865e064cf4f6e60ed1f4371ab0351d3c10
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 15:55:16 2017 -0700

    i965/drm: Merge drm_bacon_bo_gem into drm_bacon_bo.
    
    The separate class gives us a bit of extra encapsulation, but I don't
    know that it's really worth the boilerplate.  I think we can reasonably
    expect the rest of the driver to be responsible.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=59fdd94b85743655da5a4b492df3bdee0a317e22
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 15:39:09 2017 -0700

    i965/drm: Merge bo->handle and bo_gem->gem_handle.
    
    These fields are the same value.  In the bad old days, bo->handle could
    have been an identifier from the pre-GEM fake bufmgr, but that's long
    gone.  Keep the "gem_handle" name for clarity.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eb41aa82c42c249d0b5c94853f876e3e0d5a6a0e
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 28 20:20:00 2017 -0700

    i965/drm: Rewrite relocation handling.
    
    The execbuf2 kernel API requires us to construct two kinds of lists.
    First is a "validation list" (struct drm_i915_gem_exec_object2[])
    containing each BO referenced by the batch.  (The batch buffer itself
    must be the last entry in this list.)  Each validation list entry
    contains a pointer to the second kind of list: a relocation list.
    The relocation list contains information about pointers to BOs that
    the kernel may need to patch up if it relocates objects within the VMA.
    
    This is a very general mechanism, allowing every BO to contain pointers
    to other BOs.  libdrm_intel models this by giving each drm_intel_bo a
    list of relocations to other BOs.  Together, these form "reloc trees".
    
    Processing relocations involves a depth-first-search of the relocation
    trees, starting from the batch buffer.  Care has to be taken not to
    double-visit buffers.  Creating the validation list has to be deferred
    until the last minute, after all relocations are emitted, so we have the
    full tree present.  Calculating the amount of aperture space required to
    pin those BOs also involves tree walking, which is expensive, so libdrm
    has hacks to try and perform less expensive estimates.
    
    For some reason, it also stored the validation list in the global
    (per-screen) bufmgr structure, rather than as an local variable in the
    execbuffer function, requiring locking for no good reason.
    
    It also assumed that the batch would probably contain a relocation
    every 2 DWords - which is absurdly high - and simply aborted if there
    were more relocations than the max.  This meant the first relocation
    from a BO would allocate 180kB of data structures!
    
    This is way too complicated for our needs.  i965 only emits relocations
    from the batchbuffer - all GPU commands and state such as SURFACE_STATE
    live in the batch BO.  No other buffer uses relocations.  This means we
    can have a single relocation list for the batchbuffer.  We can add a BO
    to the validation list (set) the first time we emit a relocation to it.
    We can easily keep a running tally of the aperture space required for
    that list by adding the BO size when we add it to the validation list.
    
    This patch overhauls the relocation system to do exactly that.  There
    are many nice benefits:
    
    - We have a flat relocation list instead of trees.
    - We can produce the validation list up front.
    - We can allocate smaller arrays and dynamically grow them.
    - Aperture space checks are now (a + b <= c) instead of a tree walk.
    - brw_batch_references() is a trivial validation list walk.
      It should be straightforward to make it O(1) in the future.
    - We don't need to bloat each drm_bacon_bo with 32B of reloc data.
    - We don't need to lock in execbuffer, as the data structures are
      context-local, and not per-screen.
    - Significantly less code and a better match for what we're doing.
    - The simpler system should make it easier to take advantage of
      I915_EXEC_NO_RELOC in a future patch.
    
    Improves performance in Synmark 7.0's OglBatch7:
    
        - Skylake GT4e: 12.1499% +/- 2.29531%  (n=130)
        - Apollolake:   3.89245% +/- 0.598945% (n=35)
    
    Improves performance in GFXBench4's gl_driver2 test:
    
        - Skylake GT4e: 3.18616% +/- 0.867791% (n=229)
        - Apollolake:   4.1776%  +/- 0.240847% (n=120)
    
    v2: Feedback from Chris Wilson:
        - Omit explicit zero initializers for garbage execbuf fields.
        - Use .rsvd1 = ctx_id rather than i915_execbuffer2_set_context_id
        - Drop unnecessary fencing assertions.
        - Only use _WR variant of execbuf ioctl when necessary.
        - Shrink the arrays to be smaller by default.
    
    Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7ab0ea5e7e7a128023928d77c1f1346a27509c2
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 28 16:13:41 2017 -0700

    i965/drm: Make register write check handle execbuffer directly.
    
    I'm about to rewrite how relocation handling works, at which point
    drm_bacon_bo_emit_reloc() and drm_bacon_bo_mrb_exec() won't exist
    anymore.  This code is already largely not using the batchbuffer
    infrastructure, so just go all the way and handle relocations, the
    validation list, and execbuffer ourselves.  That way, we don't have
    to think the weird case where we only have a screen, and no context,
    when redesigning the relocation handling.
    
    v2: Write reloc.presumed_offset + reloc.delta into the batch, rather
        than duplicating the comment, so it's obvious that they match
        (suggested by Chris).  Also add a comment about why we don't do
        any error checking.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6368284a347d511f38109936d6a1b281e69ad782
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Mar 30 22:27:42 2017 -0700

    i965: Make a screen::aperture_threshold field.
    
    This is the threshold after which drm_intel_bufmgr_check_aperture_space
    returns -ENOSPC, signalling that it thinks an execbuf is likely to fail
    and we need to roll back and flush the batch.
    
    We'll need this when we rewrite aperture space checking, shortly.
    In the meantime, we can also use it in GLX_MESA_query_renderer.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6079f4f16e7711a02b85bcd4142ad1f24a4e0a9b
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 28 16:49:35 2017 -0700

    i965: Make/use a brw_batch_references() wrapper.
    
    We'll want to change the implementation of this shortly.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6537a3ca1188e05a753a7e22e69568905ed5dda8
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 28 14:41:39 2017 -0700

    i965: Use brw_emit_reloc() instead of drm_bacon_bo_emit_reloc().
    
    I'm about to make brw_emit_reloc do actual work, so everybody needs
    to start using it and not the raw drm_bacon function.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eadd5d1b51bbcfe5e5bdb9afe01243418c90875c
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 28 15:03:49 2017 -0700

    i965: Change intel_batchbuffer_reloc() into brw_emit_reloc().
    
    This renames intel_batchbuffer_reloc to brw_emit_reloc and changes the
    parameter naming and ordering to match drm_intel_bo_emit_reloc().
    
    For now, it's a trivial wrapper that accesses batch->bo.  When we
    rework relocations, it will start doing actual work.
    
    target_offset should be expanded to a uint64_t to match the kernel,
    but for now we leave it as its original 32-bit type.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fbb32971651e7453498e082cabdd92d789417ab2
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sun Apr 2 23:35:27 2017 -0700

    i965/drm: Drop GEM_SW_FINISH stuff.
    
    This is only useful when doing an incoherent CPU mapping of the current
    scanout buffer.  That's a terrible plan, so we never do it.  We always
    use an uncached GTT map.
    
    So, this is useless.  Drop the code.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=80761a42e0e6a79728b5f9b3d6df0616d64fe45e
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Mar 31 09:44:54 2017 -0700

    i965/drm: Drop code to search for an existing bufmgr.
    
    This functionality was added by libdrm commit
    743af59669386cb6e063fa4bd85f0a0b2da86295 (intel: make bufmgr_gem
    shareable from different API) in an attempt to solve libva/mesa buffer
    sharing problems.  Specifically, this was working around an issue hit
    by Chromium, which used the same drm_fd for multiple APIs, and shared
    buffers between them.
    
    This code attempted to work around that issue by using the same bufmgr
    for both libva and Mesa.  It worked because libdrm_intel was loaded by
    both libraries.  However, now that Mesa has forked, we don't have a
    common library, and this code cannot work.
    
    The correct solution is to have each API open its own file descriptor
    (and get a corresponding buffer manager), and then use PRIME export
    and import to share BOs across those APIs.  Then the kernel can manage
    those shared resources.  According to Chris, the kernel will pass back
    the same handle for a prime FD if the lookup is from the same device FD.
    
    We believe Chromium has since moved to this model.
    
    In Mesa, there is already only one screen per FD, and so there will
    only be one bufmgr per FD.  We don't need any of this code.
    
    v2: Add a big warning comment written by Chris Wilson.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b666654201d893072ca9aad48739d9cbbc537924
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 28 17:25:27 2017 -0700

    i965/drm: Unwrap the unnecessary drm_bacon_reloc_target_info struct.
    
    This used to have another field, but now it's just a BO pointer.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2662894baa99d03003f4d676966e27fb240d7fb6
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Mar 22 17:29:39 2017 -0700

    i965/drm: Switch from uthash to Mesa's hash table.
    
    No performance data has been gathered about this choice.  I just don't
    want that many hash tables.  Chris points out that this is not
    performance critical - we should not be recreating that many handles
    from scratch.  In the past we used a linear list, which became
    unreasonable in stress tests that used hundreds of thousands of BOs.
    In real usage, it shouldn't matter that much.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad1b1cce44a04f68b9e294119e3dd92d996d1ffb
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 00:42:30 2017 -0700

    i965/drm: Drop bo_gem::kflags.
    
    It's always zero now.
    
    Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a972c903cb04808b4e22432d49824209ee212475
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sun Apr 2 23:17:54 2017 -0700

    i965/drm: Drop has_exec_async related API.
    
    Mesa doesn't use this yet.  We'll almost certainly want to, but we can
    add the functionality back after we clean up the messy drm code.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d606f64e2d0d63e149583cbaa5494ac21eed8e31
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Mar 22 12:46:08 2017 -0700

    i965/drm: Drop softpin support for now.
    
    We may want this eventually, but simplify for now.  We can add it back
    later when we actually intend to use it.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0314eed3b12b55a921530c0ba5656c8c7ea27404
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Mar 22 12:42:43 2017 -0700

    i965/drm: Drop userptr support for now.
    
    We'll want userptr support for GL_AMD_pinned_memory support someday,
    and possibly some other upload optimizations.  Chris says "not in this
    form" though.  Drop it and simplify for now - we can add it back later
    when we're ready to hook it up fully.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a460e1eb51406e5ca54abda42112bfb8523ff046
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Mar 22 12:39:44 2017 -0700

    i965/drm: Delete engine checks.
    
    This is basically handholding to prevent a bogus caller from trying to
    execbuffer on a bogus engine.  i965 already does this correctly.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1dc02da6d79eef0450b43a90fddd72342140f0db
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Apr 4 11:45:08 2017 -0700

    i965/drm: Drop intel_chipset.h in favor of using gen_device_info.
    
    This moves the PCI ID detection to intel_screen.c and makes
    drm_bacon_bufmgr_gem_init() take a devinfo pointer.
    
    We also drop the HAS_LLC query stuff - devinfo has that info already,
    without kernel queries, and it makes no sense to have two has_llc flags
    set by different mechanisms.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=55ee8f36a8c68a0c97c837806cd38e660d6e4bf5
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Mar 22 11:39:39 2017 -0700

    i965/drm: Drop deprecated drm_bacon_bo::offset.
    
    This field was the wrong size, so we replaced it with offset64.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a29fb9b2ee49a66332dcb118877fa15eb430608d
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Mar 22 15:28:07 2017 -0700

    i965/drm: Drop has_wait_timeout.
    
    The wait-ioctl was introduced in kernel v3.6 (20120930) and that is our
    current minimum requirement for screen creation.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b97bcf3b6b6fcc66fcfedc4fd21315f69ddd7796
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Mar 23 21:34:23 2017 -0700

    i965/drm: Assume aperture size query will work.
    
    This query has been available since 2.6.28.  We require 3.6.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c28691ab77d432a3351539dd6eca81b53620d4d4
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Mar 22 00:50:21 2017 -0700

    i965/drm: Combine drm_bacon_bufmgr_gem and drm_bacon_bufmgr classes.
    
    The distinction was required when the bufmgr was virtualised, now there
    is only one class, we no longer need the distraction of pretending it is
    a subclass.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3673b89bf32414be4c17e4f8c5d3fffc91c2d3b5
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Mar 30 14:59:23 2017 -0700

    i965/drm: Move _drm_bacon_context to intel_bufmgr_gem.c.
    
    This moves us one step closer to killing off intel_bufmgr_priv.h.
    
    We might want to nuke it altogether, since it's basically just a
    uint32_t handle, but for now, let's focus on removing files.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b0d1c5983b987899bf631cf427fb2de09f27bdf7
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Apr 4 14:51:52 2017 -0700

    i965/drm: Drop cliprects and dr4 from execbuf variants.
    
    Legacy DRI1 leftovers.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c257ff226eb6e42079fadf3c101948d3782e5b6
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 21 17:27:25 2017 -0700

    i965/drm: Devirtualize the bufmgr.
    
    libdrm_bacon used to have a GEM-based bufmgr and a legacy fake bufmgr,
    but that's long since dead (and we never imported it to i965).  So,
    drop the extra layer of function pointers.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dca224a9ef0ebeb6f30c9dca99be9ff81fdafd2a
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 21 22:40:04 2017 -0700

    i965/drm: Check INTEL_DEBUG & DEBUG_BUFMGR directly.
    
    Eliminates some API around this, and more importantly, the last
    field in one bufmgr class.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=68cb0c6d92b82609a4bee97dde3af9db26f8fdf9
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 21 22:42:43 2017 -0700

    i965/drm: Use Mesa's macros.h instead of duplicating them.
    
    Replace the duplicated macros imported from libdrm:
    
       ARRAY_SIZE, MAX2, ALIGN, STATIC_ASSERT
    
    and remove unused ROUND_UP_TO and ROUND_UP_TO_MB.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5cdb0f40574344f1b606fb6978b3714ac82d52a
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Mar 22 11:12:27 2017 -0700

    i965/drm: Use ALIGN, not ROUND_UP_TO.
    
    ROUND_UP_TO handles a NPOT alignment, but all the alignments we use
    are power of two anyway, so there's no need.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d476e64e5e592d0bb85012e408829d54ad36fa7
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 21 17:31:24 2017 -0700

    i965/drm: Delete execbuf1 support.
    
    execbuf2 has been around since v2.6.33.  We require v3.6.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddf01d3f419b8f17c32a2ed376529a48bb9c80db
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Mar 30 11:46:05 2017 -0700

    i965/drm: Remove Gen2-3 fence accounting.
    
    Since gen4, we do not use fence registers for any GPU access and so
    never have to account for the fence during batch construction. All the
    related fence functions are unused.
    
    Based on Kristian Høgsberg's patch; commit message by Chris Wilson.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f698b004907ed2b8e605fe58373cd807377c1d0
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Mar 23 21:19:24 2017 -0700

    i965/drm: Remove some unused functions and macros.
    
    Mesa doesn't use these functions or macros, so we can delete them,
    and save work refactoring and cleaning them up.  We'll delete a lot
    more later, too.
    
    Based on a patch by Kristian Høgsberg.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=09b2f6124a9ad850dcefc18c30462908341b0f7a
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 21 16:10:08 2017 -0700

    i965/drm: Switch to util/list.h instead of libdrm_lists.h.
    
    Both are kernel style lists, so this is trivial.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c64096b2d9bd131a0ece0a5e6f2696b06158380
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 21 14:54:07 2017 -0700

    i965/drm: Port to Mesa's atomic header.
    
    Drop xf86atomic.h in favor of Mesa's util/u_atomic.h.  We replace the
    atomic_t wrapper struct with a bare integer, switch to the 'p_atomic'
    naming conventions, and move over the one extra helper.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eed86b975e4451c9fa85d7aad9fc747e9b941e2a
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Mar 20 16:42:55 2017 -0700

    i965/drm: Use our internal libdrm (drm_bacon) rather than the real one.
    
    Now we can actually test our changes.
    
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=91b973e3a3c967490321a809aa49489cabec0192
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Mar 22 18:51:42 2017 -0700

    i965/drm: s/drm_intel/drm_bacon/g
    
    Using drm_intel_* as a prefix is hazardous - we don't want to conflict
    with the actual libdrm_intel symbols.  In particular, I think we could
    get into trouble during the final megadrivers linking.
    
    So, rename everything to an different yet arbitrary prefix.  bacon and
    intel are the same number of characters, so we don't have to reindent
    the world.  It's also an homage to Ian's "Bacon Trail" platform.
    
    I was going to use "drm_relic" to poke fun at libdrm being ancient,
    and so we could explain the name with a "historical reasons" pun,
    but it sounds too much like ralloc.
    
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4ad0758f516d9e700c002c6f7614da74dea51005
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Mar 23 15:29:43 2017 -0700

    i965/drm: Drop libpciaccess dependencies.
    
    i965 doesn't use drm_intel_get_aperture_sizes(), so we can delete
    support for it.  This avoids a build dependency on libpciaccess.
    
    Chris also notes:
    
    "There's a really old bug that hopefully has been closed already
     (although as far as I can tell, it has never been fixed) about
     how using libpciaccess from libdrm_intel breaks the world (since
     libpciaccess uses a singleton that is torn down at the first request
     rather than upon the last user)."
    
    This bug should go away in two commits when we switch over to our
    internal copy of libdrm_intel.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84325
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d614135e95e8c4daf34e9c2a175baefd5f02f7e6
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 21 15:55:29 2017 -0700

    i965/drm: Make libdrm_lists.h compile by defining typeof.
    
    typeof doesn't seem to exist, so this won't compile (but we don't yet
    try).  Define it to __typeof__.  This code is going to die soon anyway.
    
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b97c7ef4c81b2516a94f73123ca61ec07def5668
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Mar 31 10:06:24 2017 -0700

    i965/drm: remove legacy defines, aub functions, and decoder prototypes
    
    We never imported any of this code, so drop the prototypes, unused
    enums, and defines.
    
    Based on patches by Emil Velikov.
    
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=514db96c117adc84940bb08ebd0e8f84879bd4ad
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Mar 20 16:40:01 2017 -0700

    i965: Import libdrm_intel.
    
    This imports commit 19c4cfc54918d361f2535aec16650e9f0be667cd of
    libdrm/intel/*.[ch], minus a few files that we're never going to use
    (and would immediately delete), plus a few necessary dependencies.
    
    We rename intel_bufmgr.h to brw_bufmgr.h to avoid #include conflicts.
    We also fix UTF-8 symbol problems in intel_bufmgr_gem.c comments
    because vim keeps trying to fix that every time I edit the file,
    and we may as well fix it right away.
    
    Acked-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=915820cc59c3b28754db3ab8eb0f06782506d11d
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Apr 3 00:03:01 2017 -0700

    i965: Make sure we don't use CPU maps for the scanout buffer.
    
    Using an incoherent CPU map on the active scanout buffer is really
    sketchy - we may need extra flushing via GEM_SW_FINISH, or using
    drmModeDirtyFB() and kernel commit a6a7cc4b7db6d (4.10+).
    
    Chris suggests "never ever do that", which seems like a wise plan!
    
    intel_miptree_map_raw() uses CPU maps on linear buffers.
    
    Having a linear scanout buffer should be really rare, and mapping the
    front buffer should be similarly rare.  Together, it should basically
    never happen.  But, in case it does somehow...make sure that mapping
    the scanout buffer always goes through an uncached GTT map.
    
    v2: Add a giant comment written by Chris Wilson.
    
    Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eb28ce2b0bd28296d70ffaa9c7ffb7fd078eb993
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 21 17:08:20 2017 -0700

    i965: Stop calling drm_intel_bufmgr_gem_enable_fenced_relocs().
    
    This does nothing on Gen4+, which is the only hardware we support.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Acked-by: Jason Ekstrand <jason at jlekstrand.net>

URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=034b220dc4e56d3514ebd2931b363ab90baee895
Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Mar 30 13:52:46 2017 -0700

    i965: Fix GLX_MESA_query_renderer video memory on 32-bit.
    
    On modern systems with 4GB apertures, the size in bytes is 4294967296,
    or (1ull << 32).  The kernel gives us the aperture size as a __u64,
    which works out great.
    
    Unfortunately, libdrm "helpfully" returns the data as a size_t, which
    on 32-bit systems means it truncates the aperture size to 0 bytes.
    We've happily reported this value as 0 MB of video memory via
    GLX_MESA_query_renderer since it was originally exposed.
    
    This patch bypasses libdrm and calls the ioctl ourselves so we can
    use a proper uint64_t, avoiding the 32-bit integer overflow.  We now
    report a proper video memory size on 32-bit systems.
    
    Chris points out that the aperture size (CPU mappable size limit)
    isn't really the right thing to be checking.  But libdrm_intel uses
    it to fail execbuffer, so it is an actual limit for now.  Once that's
    fixed we can probably move to something else.  In the meantime, fix
    the obvious typecasting bug.
    
    Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>




More information about the mesa-commit mailing list