Skip to content
  • Kenneth Graunke's avatar
    iris: Fix resource tracking for CS thread ID buffer · 340df53d
    Kenneth Graunke authored
    Today, we stream the compute shader thread IDs simply because they're
    (annoyingly) relative to dynamic state base address.  We could upload
    them once at compile time, but we'd need a separate non-streaming
    uploader for IRIS_MEMZONE_DYNAMIC, and I'm not sure it's worth it.
    
    stream_state pins the buffer for use in the current batch, but also
    returns a reference to the pipe_resource.  We dropped this reference
    on the floor, leaking a reference basically every time we dispatched
    a compute shader after switching to a new one.
    
    The reason it returns a reference is so that we can hold on to it and
    re-pin it in iris_restore_compute_saved_bos, which we were also failing
    to do.  So if we actually filled up a batch with repeated dispatches to
    the same compute shader, and flushed, then continued dispatching, we
    would fail to pin it and likely GPU hang.
    340df53d