From 1ae5a28caa0e1801a4d688e2423fffaf016aed62 Mon Sep 17 00:00:00 2001 From: "Arun Kumar K.R" Date: Tue, 8 Mar 2011 19:03:09 -0800 Subject: [PATCH] gralloc: Avoid unnecessary overlay set calls for HDMI Call setPosition and setParameter for HDMI only when there is a change in the rotation or position. Change-Id: Id11b58408607c2f9799bb332c30d52f52957ec4e --- libgralloc-qsd8k/framebuffer.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/libgralloc-qsd8k/framebuffer.cpp b/libgralloc-qsd8k/framebuffer.cpp index 6a4e3f7..8e78164 100644 --- a/libgralloc-qsd8k/framebuffer.cpp +++ b/libgralloc-qsd8k/framebuffer.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2008 The Android Open Source Project - * Copyright (c) 2010, Code Aurora Forum. All rights reserved. + * Copyright (c) 2010-2011 Code Aurora Forum. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -312,13 +312,24 @@ static void *hdmi_ui_loop(void *ptr) break; } } - pTemp->setParameter(OVERLAY_TRANSFORM, - rot); + int currentOrientation = 0; + pTemp->getOrientation(currentOrientation); + if(rot != currentOrientation) { + pTemp->setParameter(OVERLAY_TRANSFORM, + rot); + } EVEN_OUT(asX); EVEN_OUT(asY); EVEN_OUT(aswidth); EVEN_OUT(asheight); - pTemp->setPosition(asX, asY, aswidth, asheight); + int currentX = 0, currentY = 0; + uint32_t currentW = width, currentH = height; + if (pTemp->getPosition(currentX, currentY, currentW, currentH)) { + if ((currentX != asX) || (currentY != asY) || (currentW != aswidth) + || (currentH != asheight)) { + pTemp->setPosition(asX, asY, aswidth, asheight); + } + } pTemp->queueBuffer(m->currentOffset); } }