Hello all,

I have an use-case, where a buffer "B" needs to be further operated upon by an additional operator (ex, CPU or 2D HW). The further operation is typically in smaller subrects of "B".

While looking through the dma-buf API, I do not see a way by which I can specify properties of subrects in a buffer which can be specified as "read-only" to one user of the buffer, while the other user can go ahead and update it.  If we have this mechanism, we can do below steps to reduce latency of locking/waiting for one full buffer update, and then making it available to the next consumer.

(1) Create dma-buf using usual methods

(2) Exported to 2 users - ex GPU, and 2D HW

(3) GPU updates specific subrects

(4) 2D HW updates specific subrects

(5) When both (3) and (4) are complete, the buffer is available to next consumer. Since (3) and (4) can run in parallel, latency can be reduced.

If there is a way by which this can already be done, I would appreciate if someone can point me to it.