[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28411] trunk/blender/source/blender: Fix #22123 and #22124: some problems with mutex locks, also tweak to

Tamito KAJIYAMA rd6t-kjym at asahi-net.or.jp
Wed May 5 02:17:45 CEST 2010


Hi Brecht,

I have a problem with the changes in revision 28411.  The problem is that
soon after Blender has started, any interaction with the GUI results in a
freeze of the program.  I found that a call of GPU_free_unused_buffers()
leads to two successive calls of BLI_lock_thread(LOCK_OPENGL),
which seems to cause of the blocking on my test platform (64-bit Windows
Vista; the code is compled with Visual Studio 2008 and CMake).

My understanding is that the images listed in the mutexed image_free_queue
should be freed by the main thread, so a possible fix of the issue is to
add to the beginning of GPU_free_unused_buffers() a check if the caller
is the main thread and just return if that is not the case, i.e.:

void GPU_free_unused_buffers(void)
{
    Image *ima;

    // ADDITION BEGIN
    if (!BLI_thread_is_main())
        return;
    // ADDITION END

    BLI_lock_thread(LOCK_OPENGL);

    for(ima=image_free_queue.first; ima; ima=ima->id.next)
        GPU_free_image(ima);

    BLI_freelistN(&image_free_queue);

    BLI_unlock_thread(LOCK_OPENGL);
 }

This fixes the blocking issue.

I am sending this to the list because the Blender 2.5 bug tracker seemed not
to have the referred entries #22123 and #22124 to which I wanted to file this
problem report.  Please let me know if I am missing something.

With best regards,

-- 
KAJIYAMA, Tamito <rd6t-kjym at asahi-net.or.jp>


----- Original Message ----- 
From: "Brecht Van Lommel" <brecht at blender.org>
To: <bf-blender-cvs at blender.org>
Sent: Sunday, April 25, 2010 11:49 AM
Subject: [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28411] trunk/blender/source/blender: Fix #22123 and #22124: some 
problems with mutex locks, also tweak to


> Revision: 28411
>          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28411
> Author:   blendix
> Date:     2010-04-25 12:49:13 +0200 (Sun, 25 Apr 2010)
>
> Log Message:
> -----------
> Fix #22123 and #22124: some problems with mutex locks, also tweak to
> how removing opengl textures from outside main thread is done so it
> happens as part of the main loop.
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/blenlib/BLI_threads.h
>    trunk/blender/source/blender/blenlib/intern/threads.c
>    trunk/blender/source/blender/gpu/GPU_draw.h
>    trunk/blender/source/blender/gpu/intern/gpu_draw.c
>    trunk/blender/source/blender/windowmanager/intern/wm_draw.c
>    trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c



More information about the Bf-committers mailing list