03-18 17:42:18.884 3757 3757 D mflinger: n: 4
03-18 17:42:18.884 3757 3757 D mflinger: buf: 64
03-18 17:42:18.884 3757 3757 D mflinger: Update buffer request!
03-18 17:42:18.884 3757 3757 D mflinger: [updateBuffer] n: 12
03-18 17:42:18.884 3757 3757 D mflinger: [updateBuffer] requested id = 2
03-18 17:42:18.884 3757 3757 D mflinger: [updateBuffer] requested pos = (953, 533)
03-18 17:42:18.885 3757 3757 D mflinger: n: 4
03-18 17:42:18.885 3757 3757 D mflinger: buf: 128
03-18 17:42:18.885 3757 3757 D mflinger: Lock buffer request!
03-18 17:42:18.885 3757 3757 D mflinger: [L] n: 4
03-18 17:42:18.885 3757 3757 D mflinger: [L] requested id = 1
03-18 17:42:18.885 3757 3757 D Surface : Surface::lock called
03-18 17:42:18.907 3657 3657 I joycond : type=1400 audit(0.0:1313): avc: denied { read } for scontext=u:r:init:s0 tcontext=u:r:init:s0 tclass=netlink_kobject_uevent_socket permissive=1
03-18 17:42:19.410 3744 7310 D AudioTrack: stop(15): called with 52920 frames delivered
03-18 17:42:19.454 3757 3757 D mflinger: n: 4
03-18 17:42:19.454 3757 3757 D mflinger: buf: 128
03-18 17:42:19.454 3757 3757 D mflinger: Lock buffer request!
03-18 17:42:19.455 3757 3757 D mflinger: [L] n: 4
03-18 17:42:19.455 3757 3757 D mflinger: [L] requested id = 2
03-18 17:42:19.455 3757 3757 D Surface : Surface::lock called
03-18 17:42:19.455 3757 3757 E Surface : Surface::lock failed, already locked
03-18 17:42:19.455 3757 3757 E mflinger: failed to lock buffer
From the log, we know the mclient requests to lock the buffer with id 2, and update it, and then requests to lock the buffer with id 1.
Before the mclient requests unlockAndPost to unlock and post the buffer with id 2 to SurfaceFlinger, it requests lock for the buffer
with id 2, and it causes lock failure. The lock failure for the buffer with id 1 is the same as the buffer with id 2.
The following log is expected on my development phone:
03-13 11:28:19.919 835 835 D mflinger: Create buffer request!
03-13 11:28:19.919 835 835 D mflinger: [C] n: 8
03-13 11:28:19.919 835 835 D mflinger: [C] requested dims = (1280x720)
03-13 11:28:19.919 835 835 D mflinger: [C] 1 -- num_surfaces = 0
03-13 11:28:19.928 835 835 D mflinger: [C] 2 -- num_surfaces = 1
03-13 11:28:19.929 835 835 D mflinger: n: 4
03-13 11:28:19.929 835 835 D mflinger: buf: 32
03-13 11:28:19.929 835 835 D mflinger: Create buffer request!
03-13 11:28:19.929 835 835 D mflinger: [C] n: 8
03-13 11:28:19.929 835 835 D mflinger: [C] requested dims = (24x24)
03-13 11:28:19.929 835 835 D mflinger: [C] 1 -- num_surfaces = 1
03-13 11:28:19.930 835 835 D mflinger: [C] 2 -- num_surfaces = 2
03-13 11:28:19.931 835 835 D mflinger: n: 4
03-13 11:28:19.931 835 835 D mflinger: buf: 128
03-13 11:28:19.931 835 835 D mflinger: Lock buffer request!
03-13 11:28:19.931 835 835 D mflinger: [L] n: 4
03-13 11:28:19.931 835 835 D mflinger: [L] requested id = 2
03-13 11:28:19.945 835 835 D mflinger: n: 4
03-13 11:28:19.945 835 835 D mflinger: buf: 256
03-13 11:28:19.945 835 835 D mflinger: Unlock and post buffer request!
03-13 11:28:19.945 835 835 D mflinger: [U] n: 4
03-13 11:28:19.945 835 835 D mflinger: [U] requested id = 2
03-13 11:28:19.946 835 835 D mflinger: n: 4
03-13 11:28:19.946 835 835 D mflinger: buf: 64
03-13 11:28:19.946 835 835 D mflinger: Update buffer request!
03-13 11:28:19.946 835 835 D mflinger: [updateBuffer] n: 12
03-13 11:28:19.946 835 835 D mflinger: [updateBuffer] requested id = 2
03-13 11:28:19.946 835 835 D mflinger: [updateBuffer] requested pos = (953, 533)
03-13 11:28:19.946 835 835 D mflinger: n: 4
03-13 11:28:19.947 835 835 D mflinger: buf: 128
03-13 11:28:19.947 835 835 D mflinger: Lock buffer request!
03-13 11:28:19.947 835 835 D mflinger: [L] n: 4
03-13 11:28:19.947 835 835 D mflinger: [L] requested id = 1
03-13 11:28:19.966 835 835 D mflinger: n: 4
03-13 11:28:19.966 835 835 D mflinger: buf: 256
03-13 11:28:19.966 835 835 D mflinger: Unlock and post buffer request!
From the current log, it looks like the mclient doesn't send the unlock command to the mflinger. But the MUnlockBuffer and
MLockBuffer are called in the same method. The possible reason is the mclient encounters the exception when copying Linux surface
to shared buffer, aka the method copy_ximg_to_buffer_mlocked, in mclient.c. Could you use lxc-attach to attach
Linux to check whether the mcilent works correctly? And the mclient uses fprintf to print error information to stderr, could
you also check it?