Re-factor ~inexcusible copy/paste coding away.

Change-Id: I2ad27cb09031dfadaa628939c191ccc5d88ecffe
fdo#83716 - fix deadlock holding mutex required by rendering thread.

Change-Id: I7195bba02474ac1c00fce0a93f59be622a920686