Home  >  Article  >  Web Front-end  >  Regarding the synchronization of Layer components and the issue of reducing GPU bandwidth

Regarding the synchronization of Layer components and the issue of reducing GPU bandwidth

零到壹度
零到壹度Original
2018-03-28 13:24:142404browse

This article mainly shares an article about the synchronization of Layer components and the issue of reducing GPU bandwidth. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor to have a look.

Question:

1) Can layers be updated independently, such as how to optimize the status bar scene that pops up on the video layer;

Initial idea of ​​each Only update the video layer at this time or bypass the video layer for processing by BQ.

2) Common processing of video layer by FW and GPU;

3) Understanding of several variables;

(1) mCurrentTexture, nextTextureImage;

(2) BufferItem, BufferQueue, mslots; slot, mqueuedframe, mqueuedItem;

(3) syncForReleaseLocked, updateAndReleaseLocked, releaseBufferLocked, releaseBuffer

(4)

/ acquireBuffer attempts to acquire ownership of the next pending buffer in the BufferQueue.
      // If no buffer is pending then it returns NO_BUFFER_AVAILABLE. If a buffer is successfully
      // acquired, the information about the buffer is returned in BufferItem.
      //
      // If the buffer returned had previously been acquired then the BufferItem::mGraphicBuffer field
      // of buffer is set to NULL and it is assumed that the consumer still holds a reference to the
      // buffer.
      //
      // If presentWhen is non-zero, it indicates the time when the buffer will be displayed on
      // screen. If the buffer's timestamp is farther in the future, the buffer won't be acquired, and
      // PRESENT_LATER will be returned. The presentation time is in nanoseconds, and the time base
      // is CLOCK_MONOTONIC.
      //
      // If maxFrameNumber is non-zero, it indicates that acquireBuffer should only return a buffer
      // with a frame number less than or equal to maxFrameNumber. If no such frame is available
      // (such as when a buffer has been replaced but the consumer has not received the
      // onFrameReplaced callback), then PRESENT_LATER will be returned.
      //
      // Return of NO_ERROR means the operation completed as normal.
      //
      // Return of a positive value means the operation could not be completed at this time, but the
      // user should try again later:
      // * NO_BUFFER_AVAILABLE - no buffer is pending (nothing queued by producer)
      // * PRESENT_LATER - the buffer's timestamp is farther in the future
      //
      // Return of a negative value means an error has occurred:
      // * INVALID_OPERATION - too many buffers have been acquired
  // Returned by releaseBuffer, after which the consumer must free any references to the
            // just-released buffer that it might have.
            STALE_BUFFER_SLOT = 1,
          // Returned by dequeueBuffer if there are no pending buffers available.
          NO_BUFFER_AVAILABLE,
          // Returned by dequeueBuffer if it's too early for the buffer to be acquired.
          PRESENT_LATER,

(5) ) The difference between mslots, mframe and mframenumber

(6) The logic of onframavailable and latchbuffer, reject, updateteximage.

Updateteximage;

(7)The difference between bufferitem and mslots

(8)The difference between bufferqueueconsumer and bufferitemconsumer;

(9) acquirebuffer The fence logic, where does fencefd come from;

For fence related interface definitions, please refer to ui/Fence.h

 status_t Fence::waitForever(const char* logname) {64      ATRACE_CALL();
      if (mFenceFd == -1) {
          return NO_ERROR;
      }
      int warningTimeout = 3000;
      int err = sync_wait(mFenceFd, warningTimeout);
      if (err < 0 && errno == ETIME) {
          ALOGE("%s: fence %d didn&#39;t signal in %u ms", logname, mFenceFd,
                  warningTimeout);
          err = sync_wait(mFenceFd, TIMEOUT_NEVER);
      }
      return err < 0 ? -errno : status_t(NO_ERROR);
  }
  struct EglSlot {
           EglSlot() : mEglFence(EGL_NO_SYNC_KHR) {}
            // mEglImage is the EGLImage created from mGraphicBuffer.
            sp<EglImage> mEglImage;
           // mFence is the EGL sync object that must signal before the buffer
            // associated with this buffer slot may be dequeued. It is initialized
            // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based
           // on a compile-time option) set to a new sync object in updateTexImage.
            EGLSyncKHR mEglFence;
      };

(10)

updateAndReleaseLocked(item, &mPendingRelease),
updateAndReleaseLocked(item),
bindTextureImageLocked()

The above is the detailed content of Regarding the synchronization of Layer components and the issue of reducing GPU bandwidth. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn