*/
uint32_t bo_space;
+ /* Last BO hindex referenced from VC4_PACKET_GEM_HANDLES. */
+ uint32_t last_gem_handle_hindex;
+
/** @{ Surfaces to submit rendering for. */
struct pipe_surface *color_read;
struct pipe_surface *color_write;
* to perform the relocation in the IB packet (without
* emitting to the actual HW).
*/
- cl_u8(&bcl, VC4_PACKET_GEM_HANDLES);
- cl_u32(&bcl, vc4_gem_hindex(job, rsc->bo));
- cl_u32(&bcl, 0);
+ uint32_t hindex = vc4_gem_hindex(job, rsc->bo);
+ if (job->last_gem_handle_hindex != hindex) {
+ cl_u8(&bcl, VC4_PACKET_GEM_HANDLES);
+ cl_u32(&bcl, hindex);
+ cl_u32(&bcl, 0);
+ job->last_gem_handle_hindex = hindex;
+ }
cl_u8(&bcl, VC4_PACKET_GL_INDEXED_PRIMITIVE);
cl_u8(&bcl,