Hi there-
I'm trying to use sawman as a window manager for directfb. However, if
I try to put two programs in two different dfb layers, sawman seems to
lock up. From inspecting the stack trace (see below), it looks like
there might be a lock inversion problem.
Everything is fine for the first process attaching to the window
manager. Also for a second process running in the same layer as the
first. However, if the second process is in a *different* layer than
the first, everything comes to a halt.
The deadlock might be here:
- process #3 starts up and sets its window opacity
- in the process of doing so, it grabs a lock on the layer context
when it locks the window stack
- it then does a fusion call to have the wm act on the request
- process #1 gets the request and figures out what its going
to do.
- in the process, it grabs the sawman manager lock
- when calling ISawmanManager::ProcessUpdates, the
code eventually tries to lock the layer context when
setting its position, but it is already locked by process #3
--> DEADLOCK
- process #2 is just doing its thing and eventually wants
to update its window, thus it attempts to grabs the
sawman manager lock. However process #1 and #3 are
deadlocked, so it hangs, too.
It seems to me that this deadlock should happen regardless of whether
the windows are in the same or different layers, but it only seems to
happen if the layers are different. Something special must happen in
this case and I don't yet fully understand the code.
Any help would be appreciated!
Richard
process #1 (slightly modified testman):
--------------------------
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb7da7329 in ioctl () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libc.so.6
#2 0xb7e62123 in fusion_skirmish_prevail () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libfusion-1.2.so.0
#3 0xb7f01eb2 in dfb_layer_context_lock () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libdirectfb-1.2.so.0
#4 0xb7f03f3d in dfb_layer_context_set_screenposition () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libdirectfb-1.2.so.0
#5 0xb7e24046 in sawman_process_updates (sawman=0x2012b000,
flags=DSFLIP_WAITFORSYNC) at
/home/trees/neo/proto/srcroot/opensource/sawman/SaWMan-1.4.0/src/sawman.c:2446
#6 0xb7e218c7 in ISaWManManager_ProcessUpdates (thiz=0x8060560,
flags=DSFLIP_WAITFORSYNC) at
/home/trees/neo/proto/srcroot/opensource/sawman/SaWMan-1.4.0/src/isawmanmanager.c:129
#7 0x08049789 in MosaicRelayout (tm=0xbf9ef6e4, layout_data=0x0) at
/home/trees/neo/proto/srcroot/opensource/sawman/SaWMan-1.4.0/samples/testman.c:387
#8 0x08049921 in MosaicAddWindow (tm=0xbf9ef6e4, layout_data=0x0,
window=538107136) at
/home/trees/neo/proto/srcroot/opensource/sawman/SaWMan-1.4.0/samples/testman.c:457
#9 0x08048d7b in LayoutWindowAdd (tm=0x40040401, window=536965256) at
/home/trees/neo/proto/srcroot/opensource/sawman/SaWMan-1.4.0/samples/testman.c:520
#10 0x08048f6c in window_reconfig (context=0xbf9ef6e4,
reconfig=0x2012b2d8) at
/home/trees/neo/proto/srcroot/opensource/sawman/SaWMan-1.4.0/samples/testman.c:892
#11 0xb7e21bc5 in manager_call_handler (caller=3, call_arg=8,
call_ptr=0x40040401, ctx=0x2012b000, serial=9, ret_val=0xb7bd2ea4) at
/home/trees/neo/proto/srcroot/opensource/sawman/SaWMan-1.4.0/src/sawman.c:340
#12 0xb7e5e981 in _fusion_call_process () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libfusion-1.2.so.0
#13 0xb7e60996 in fusion_dispatch_loop () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libfusion-1.2.so.0
#14 0xb7e5449c in direct_thread_main () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libdirect-1.2.so.0
#15 0xb7e33151 in start_thread (arg=0xb7bd3b90) at pthread_create.c:297
#16 0xb7dae3fe in clone () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libc.so.6
(process #2) slightly modified df_neo to run in window in layer C (the
primary layer)
----------------------------------------------------------------
#0 0xffffe410 in ?? ()
#1 0xbfe98618 in ?? ()
#2 0x2012b004 in ?? ()
#3 0x40040401 in ?? ()
#4 0xb7db1329 in ioctl () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libc.so.6
#5 0xb7e84123 in fusion_skirmish_prevail () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libfusion-1.2.so.0
#6 0xb724a32d in wm_update_window (window=0x20017400,
wm_data=0x805fdc0, window_data=0x2012df00, region=0xbfe9870c,
flags=DSFLIP_ONSYNC) at
/home/trees/neo/proto/srcroot/opensource/sawman/SaWMan-1.4.0/src/sawman_internal.h:331
#7 0xb7f36528 in dfb_wm_update_window () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libdirectfb-1.2.so.0
#8 0xb7f32455 in dfb_window_repaint () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libdirectfb-1.2.so.0
#9 0xb7ea312c in IDirectFBSurface_Window_Flip () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libdirectfb-1.2.so.0
#10 0x080496a9 in main ()
(process #3) slightly modified df_neo to run in a window in layer B
----------------------------------------------------------------
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb7d82329 in ioctl () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libc.so.6
#2 0xb7e51d28 in fusion_call_execute () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libfusion-1.2.so.0
#3 0xb72115a3 in sawman_call (sawman=0xbf84edf4, call=1075053057,
ptr=0x2012b2d8) at
/home/trees/neo/proto/srcroot/opensource/sawman/SaWMan-1.4.0/src/sawman.c:740
#4 0xb721cc40 in wm_set_window_config (window=0x20019e00,
wm_data=0x805fdc0, window_data=0x2012dd00, updated=0xbf84f004,
flags=CWCF_OPACITY) at
/home/trees/neo/proto/srcroot/opensource/sawman/SaWMan-1.4.0/wm/sawman/sawman_wm.c:2524
#5 0xb7f07308 in dfb_wm_set_window_config () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libdirectfb-1.2.so.0
#6 0xb7f0391e in dfb_window_set_opacity () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libdirectfb-1.2.so.0
#7 0xb7e7a9da in IDirectFBWindow_SetOpacity () from
/home/trees/neo/proto/dev-ia32/tivo_root/lib/libdirectfb-1.2.so.0
#8 0x08048b3c in main ()
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev