Skip to content

backend-drm: Take screenshot with DMA buffer using writeback connector

The existing screenshot with writeback source implementation is only supporting dump content to sharemem buffer from clients. Weston allocates new framebuffer to get screen data and using pixman framework to copy content. This method seems to be less performant.

There is one way to improve performance, which is to attach the framebuffer taken from the DMA buffer sent by the client. Clients should allocate DMA buffer and sent it to compositor. The compositor then get framebuffer object from that DMA buffer, attach it to writeback connector to take screenshot.

I have provided a sample implementation and new clients to verify content of the screenshot.

Besides that, there are 2 issues when we take screenshot using writeback connector in Weston now:

  • issue1: The black screen occurs in short time when taking the first screenshot.
    • Root cause: When the writeback connector is attached to the CRTC, that CRTC will temporarily disable itself before committing a new atomic state.
  • issue2: Cannot commit a new state when DPMS switches to off after taking a screenshot.
    • Root cause:  When DPMS switches to off, the CRTC currently in use will be disabled. If that CRTC is still connected to connectors, an error will be thrown.

In this MR, issue2 is resolved if the writeback connector is detached when DPMS switches to off, and the compositor will re-attach it when DPMS switches to on to prevent issue1 from occurring again.

Merge request reports

Loading