i965: Use atomic ops in get_new_program_id().
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Sep 2017 20:45:27 +0000 (13:45 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 25 Sep 2017 22:15:09 +0000 (15:15 -0700)
commit962cc1bd17cbe34101c647c3e8bb72986810c652
tree3faa4fdf81d2a645882674884f834feb1a0922f3
parent2eb26a99869ee4784f3b4a00115480808a7fcfb3
i965: Use atomic ops in get_new_program_id().

We have a nice utility function for this, which eliminates the need for
locking stuff.  This isn't really performance critical, but it's less
code to use the atomic.

p_atomic_inc_return does pre-increment rather than post-increment, so we
change screen->program_id to be initialized to 0 instead of 1.  At which
point, we can just delete the initialization because intel_screen is
rzalloc'd.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/intel_screen.c