Hi

>> I'm wondering why there's such a difference ?

I am not the person to design GonkDisplayJB. Sorry, I do not know about it. One 
possibility is to keep the call stack functions from 
LayerManagerComposite::Render() to GonkDisplayJB::Post() as to gecko's 
functions. The function calls are the following.

LayerManagerComposite::Render()
 ->CompositorOGL::EndFrame()
  ->GLContextEGL::SwapBuffers()
   ->GonkDisplayJB::SwapBuffers()
    ->eglSwapBuffers();
     ->FramebufferSurface::onFrameAvailable() 
      ->//Get next rendreing buffer and next an acquire fence.
    ->GonkDisplayJB::Post()
      ->mHwc->set()
        ->//Render buffer and push the acquire fence.


under eglSwapBuffers(), function call sequence seems like the following. 

eglSwapBuffers();
 ->Surface::queueBuffer()
  ->BufferQueue::queueBuffer()
   ->BufferQueue::ProxyConsumerListener::onFrameAvailable()  
    ->FramebufferSurface::onFrameAvailable() 


If eglSwapBuffers() works as expected, there should be no difference, because 
since JB, eglSwapBuffers() is independent from display rendering. It is 
controlled by HwComposer. It might be better to analyze how 
Surface::queueBuffer(), Surface::dequeueBuffer() are called and how release 
fence and acquire fence are handled when the problem happens.


*FYI
The following is related part's diagram.
  
https://github.com/sotaroikeda/firefox-diagrams/blob/master/widget/widget_HwcComposer2D__FirefoxOS_1_4.pdf?raw=true


sotaro

----- Original Message -----
From: "Dou Zeyun" <[email protected]>
To: "Sotaro Ikeda" <[email protected]>
Cc: [email protected], "Ben Kelly" <[email protected]>
Sent: Monday, May 26, 2014 4:40:02 AM
Subject: Re: [b2g] Question about fb post in B2G and Android

Hi Sotaro:

   Would you pls help me about this problem ?
   Thanks very much !


2014-05-21 21:40 GMT+08:00 Ben Kelly <[email protected]>:

> I think Sotaro (CC'd) probably knows the most about this.  Alternatively
> this sounds appropriate for a bug to me.
>
> Thanks!
>
> Ben
>
>
> On 5/20/2014 11:31 PM, Raven Dou wrote:
>
>> Hi All:
>>
>>
>>
>>      The method onFrameAvailable In FrameBufferSurface.cpp of Android:
>>
>> ------------------------------------------------------------
>> void FramebufferSurface::onFrameAvailable() {
>>      sp<GraphicBuffer> buf;
>>      sp<Fence> acquireFence;
>>      status_t err = nextBuffer(buf, acquireFence);
>>      if (err != NO_ERROR) {
>>          ALOGE("error latching nnext FramebufferSurface buffer: %s (%d)",
>>                  strerror(-err), err);
>>          return;
>>      }
>>      err = mHwc.fbPost(mDisplayType, acquireFence, buf);
>>      if (err != NO_ERROR) {
>>          ALOGE("error posting framebuffer: %d", err);
>>      }
>> }
>> -------------------------------------------------------------
>>
>>      fbPost be executed here, but in B2G, the fbPost is executed in
>> GonkDisplayJB::SwapBuffers, not in gecko/widget/gonk/libdisplay/
>> FramebufferSurface.cpp
>>
>> --------------------------------------------------------------
>> bool
>> GonkDisplayJB::SwapBuffers(EGLDisplay dpy, EGLSurface sur)
>> {
>>      StopBootAnimation();
>>      mBootAnimBuffer = nullptr;
>>
>>      // Should be called when composition rendering is complete for a
>> frame.
>>      // Only HWC v1.0 needs this call.
>>      // HWC > v1.0 case, do not call compositionComplete().
>>      // mFBDevice is present only when HWC is v1.0.
>>      if (mFBDevice && mFBDevice->compositionComplete) {
>>          mFBDevice->compositionComplete(mFBDevice);
>>      }
>>
>> #if ANDROID_VERSION == 17
>>      mList->dpy = dpy;
>>      mList->sur = sur;
>> #else
>>      mList->outbuf = nullptr;
>>      mList->outbufAcquireFenceFd = -1;
>> #endif
>>      eglSwapBuffers(dpy, sur);
>>      return Post(mFBSurface->lastHandle, mFBSurface->lastFenceFD);
>> }
>> --------------------------------------------------------------
>>
>>
>>
>> I'm wondering why there's such a difference ?
>>
>> on my device, the views on screen will be torn, especially when views
>> change quickly.
>>
>> But if I move the method {Post(mFBSurface->lastHandle,
>> mFBSurface->lastFenceFD);} to gecko/widget/gonk/libdisplay/
>> FramebufferSurface.cpp::onFrameAvailable() , this problem is resolved.
>>
>> Any body could explain the reason ?  thanks in advance!
>> _______________________________________________
>> dev-b2g mailing list
>> [email protected]
>> https://lists.mozilla.org/listinfo/dev-b2g
>>
>>


-- 
   Best regards
   Raven Dou
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to