diff mbox

[hwc,v2,13/18] drm_hwcomposer: Pass buffer sizes to Prepareframebuffer

Message ID 1523460149-1740-14-git-send-email-alexandru-cosmin.gheorghe@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alexandru-Cosmin Gheorghe April 11, 2018, 3:22 p.m. UTC
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@arm.com>
---
 drmdisplaycompositor.cpp | 7 ++++---
 drmdisplaycompositor.h   | 3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)

Comments

Sean Paul April 17, 2018, 4:51 p.m. UTC | #1
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@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
>
diff mbox

Patch

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();
   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);