[PATCH hwc v2 13/18] drm_hwcomposer: Pass buffer sizes to Prepareframebuffer
Sean Paul
seanpaul at chromium.org
Tue Apr 17 16:51:25 UTC 2018
On Wed, Apr 11, 2018 at 04:22:24PM +0100, Alexandru Gheorghe wrote:
> Currently Prepareframebuffer uses the mode of the connected connector
> to decide how big the buffer should be, however when using the
> drmdisplaycompositor just for flattening, the mode had not been set
> yet, so we need a way to pass the desired buffer sizes.
>
> Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe at arm.com>
> ---
> drmdisplaycompositor.cpp | 7 ++++---
> drmdisplaycompositor.h | 3 ++-
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp
> index 6e5be24..afd3b05 100644
> --- a/drmdisplaycompositor.cpp
> +++ b/drmdisplaycompositor.cpp
> @@ -268,14 +268,15 @@ DrmDisplayCompositor::GetActiveModeResolution() {
> }
>
> int DrmDisplayCompositor::PrepareFramebuffer(
> - DrmFramebuffer &fb, DrmDisplayComposition *display_comp) {
> + DrmFramebuffer &fb, DrmDisplayComposition *display_comp, uint32_t width,
> + uint32_t height) {
> int ret = fb.WaitReleased(-1);
> if (ret) {
> ALOGE("Failed to wait for framebuffer release %d", ret);
> return ret;
> }
> - uint32_t width, height;
> - std::tie(width, height, ret) = GetActiveModeResolution();
> + if (width == 0 || height == 0)
> + std::tie(width, height, ret) = GetActiveModeResolution();
Just plumb it through at the other callsites.
> if (ret) {
> ALOGE(
> "Failed to allocate framebuffer because the display resolution could "
> diff --git a/drmdisplaycompositor.h b/drmdisplaycompositor.h
> index ccaffb4..0f8daad 100644
> --- a/drmdisplaycompositor.h
> +++ b/drmdisplaycompositor.h
> @@ -115,7 +115,8 @@ class DrmDisplayCompositor {
> static const int kAcquireWaitTimeoutMs = 100;
>
> int PrepareFramebuffer(DrmFramebuffer &fb,
> - DrmDisplayComposition *display_comp);
> + DrmDisplayComposition *display_comp,
> + uint32_t width = 0, uint32_t height = 0);
> int ApplySquash(DrmDisplayComposition *display_comp);
> int ApplyPreComposite(DrmDisplayComposition *display_comp);
> int PrepareFrame(DrmDisplayComposition *display_comp);
> --
> 2.7.4
>
--
Sean Paul, Software Engineer, Google / Chromium OS
More information about the dri-devel
mailing list