[Development] drawhelpers thread-safe?

gunnar.sletta at nokia.com gunnar.sletta at nokia.com
Mon Jan 2 07:38:17 CET 2012


On Dec 30, 2011, at 6:34 PM, ext Thiago Macieira wrote:

> They don't look like they are thread-safe, at least not the qInitDrawHelperAsm 
> function.
> 
> Is that function supposed to be thread-safe?

It is supposed to be and originally was. 

The qInitDrawHelperAsm function should only be called from the QGuiApplication / QApplication constructor before any drawing happens and then never again so it is safe.

However, I notice that the qInitDrawHelperAsm function is also called from qt_memfill32/16_seutp, used for instance by QImage::fill(), which is there used to replace the implementation of the qt_memfill32/16 with a SIMD version of itself before calling itself again. Given that QApp already ran once and replaced the qt_memfill with another function this code is in practice almost never run. My guess is that someone added this so that one could start fiddling with images before the QApplication was constructed and still get the benefits of SSE. 

In practice I doubt we'll run into a problem with it, but a saner solution would be to initialize the two setup function pointers to the the non-simd defaults and rely on QApp to get SSE.

cheers,
Gunnar

> 
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel Open Source Technology Center
>     Intel Sweden AB - Registration Number: 556189-6027
>     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development




More information about the Development mailing list