Skip to content

tu,freedreno: Implement VK_KHR_shader_clock

What does this MR do and why?

There is a special address defined in kernel from which ALWAYSON counter could be read.

Blob uses this sequence to read it:

  getone #l15
  mov.s32s32 r2.y, -4096
  mov.s32s32 r2.z, 131071
  (rpt5)nop
  ldg.u32 r2.w, g[r2.y], 1
  ldg.u32 r2.y, g[r2.y+4], 1
  (sy)(ss)mov.s32s32 r48.x, (last)r2.w
  mov.s32s32 r48.y, (last)r2.y
  l15:

Compared to prop driver we have a check for wrap around of LO part.

Our assembly:

  getone #l66
  l57:
  (ss)mov.u32u32 r1.z, 0xfffff000
  mov.u32u32 r1.w, 0x1ffff
  (rpt5)nop
  ldg.u32 r2.x, g[r1.z], 2
  ldg.u32 r2.z, g[r1.z], 2
  (sy)(nop3) cmps.s.eq p0.x, r2.y, r2.w
  (rpt5)nop
  br p0.x, #l68
  (jp)jump #l57
  l66:
  (jp)mov.u32u32 r2.x, 0
  mov.u32u32 r2.y, 0
  l68:
  (jp)(rpt2)nop
  mov.u32u32 r51.w, r2.y
  mov.u32u32 r51.z, r2.x

There are two useless movs, but it doesn't matter.

Merge request reports