libcopybit: Merge copybit HAL from jb
Single commit having all the following commits
commit f39e512ad6f51cf35ab00995e52a39f31e76e77f
Author: Naomi Luis <nluis@codeaurora.org>
Date: Fri Oct 19 14:41:32 2012 -0700
copybit_c2d: Use a single draw call for surfaces with different rotations
- When opening the copybit module, query the c2d driver capabilities.
- If supported, use a single draw call for blitting surfaces with different
orientations using the target target rotate override flag.
- If not supported, invoke finish_copybit to draw the layers with the
previous orientation before applying the current orientation.
Change-Id: I0446f2817786321c9caa2eabf7b6679e5ecbcabe
commit a4008ff75150c1591c0dca46354e6bb8b30a675b
Author: Naomi Luis <nluis@codeaurora.org>
Date: Thu Oct 18 15:26:15 2012 -0700
Display: Add copybit_c2d performance optimizations
Following performance optimizations have been made to copybit_c2d
- Club all the layers into a single draw call. When finish_copybit
is invoked, the draw and finish are executed.
- Send the layer blend mode to copybit.
- If the blend is set to none, set the pre-multiplied alpha flag.
SurfaceFlinger assumes all surfaces have pre-multiplied alpha unless
explicitly specified. Copybit_c2d does the same.
The following cases are currently exempt from this optimization:
- Change in C2D target
- The template surfaces limit has been reached
- Max. blit object limit has been reached.
- Change in target transform.
- Use of any temporary source/destination surfaces.
Change-Id: I5ad1dc48bbe6d38d319116ccaa800fefb4fbf9f6
commit b188d739f69272c4820e1a33c5e10aa2f2825a5f
Author: Naomi Luis <nluis@codeaurora.org>
Date: Mon Oct 15 11:17:11 2012 -0700
copybit: Add finish API
Add the finish API to copybit. This API is used to indicate the
end of the drawing required by the copybit client.
Change-Id: Ica4d13dbe6e7aeb7f88aabb734bf03e86c043acc
commit ecd56ace395fce78c14e2e753d3221218d062899
Author: Naomi Luis <nluis@codeaurora.org>
Date: Mon Oct 15 11:21:08 2012 -0700
copybit: Clean up copybit_c2d
- Remove unused functions
- Do nothing for the COPYBIT_BLIT_TO_FRAMEBUFFER case when using c2d
composition.
Change-Id: Idc416ce3742bb41f060e52ac70add44e584032b9
commit 35d45d0cff5f6fe866fcb5df71444824a45e046e
Author: Naomi Luis <nluis@codeaurora.org>
Date: Wed Oct 17 10:37:33 2012 -0700
copybit: Use correct alignment in get_size()
get_size() is used to get the size required by c2d. It's alignment
should be 32 and not 16.
Change-Id: I9fedca0186d0ea19883b967e127417b059621a99
commit 31311da328cbe2229fcf8d8d8e276ec64005bcb3
Author: Ramakant Singh <ramaka@codeaurora.org>
Date: Thu Sep 20 15:58:29 2012 +0530
HWC: use uncached buffer for tmp yv12 and tmp stretch buffer.
Change-Id: Iecc2a9c3c9a365d00d3491ce1007a36484209346
CRs-fixed: 396574
commit 5503c90b5001aa4d863139eebcd9c0c43f265702
Author: Pawan Kumar <pavaku@codeaurora.org>
Date: Mon Sep 3 09:14:13 2012 +0530
copybit: Fix crash when copy_image is called with Tile format
Add check for copy_image failure case.
CRs-Fixed: 393122
Change-Id: I5765120e87a135795d771c5d331275a66ade7e23
commit 48975bc53702ecba66ecaa5e5769036bb91f5cf2
Merge: feb1cd6 ab25cb4
Author: Linux Build Service Account <lnxbuild@localhost>
Date: Sat Sep 1 13:36:47 2012 -0700
Merge "Display ::Use proper ion heap id" into jb
commit ab25cb4818d9b87886678972f2861bacc93c580a
Author: Ramakant Singh <ramaka@codeaurora.org>
Date: Thu Aug 9 14:23:39 2012 +0530
Display ::Use proper ion heap id
Change the MM heap to CAMERA heap for 7627a in use case
1.Intermediate stretch of low resolution clips
2.Software conversion of Y12 format
Change-Id: Ib705d3245f601256179e2dedccbc707df85eb431
CRs-Fixed: 383115
commit 90bcaadf41451d89fe80f96961ffc0a07a333145
Author: Prabhanjan Kandula <pkandula@codeaurora.org>
Date: Mon Aug 6 12:50:12 2012 +0530
libcopybit: fix YUV buffer alignments as per gralloc
buffer alignment in copybit should be in sync with
gralloc allignments while allocating buffer.
CRs-fixed: 377051
Change-Id: Ib2ae64e368ea3c92d3494c71da605197ccb4a9a5
Conflicts:
libcopybit/copybit_c2d.cpp
commit 95cf0038ea6eb02314024d673418464f0739ddb4
Author: Sravan Kumar D.V.N <sravank1@codeaurora.org>
Date: Thu Aug 2 14:37:37 2012 +0530
copybit : Add support for NV12_ENCODABLE format
Change-Id: I7087dcad2238a3c35cc15c28d75b76a9e3ca6718
Change-Id: I748bffb4215d27f609beec209af0a5047858a314
diff --git a/libcopybit/copybit.cpp b/libcopybit/copybit.cpp
index 773e9b8..ed302f1 100644
--- a/libcopybit/copybit.cpp
+++ b/libcopybit/copybit.cpp
@@ -1,6 +1,9 @@
/*
* Copyright (C) 2008 The Android Open Source Project
- * Copyright (c) 2010 - 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2010 - 2013, The Linux Foundation. All rights reserved.
+ *
+ * Not a Contribution, Apache license notifications and license are retained
+ * for attribution purposes only.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -129,6 +132,7 @@
case HAL_PIXEL_FORMAT_YCbCr_422_SP: return MDP_Y_CRCB_H2V1;
case HAL_PIXEL_FORMAT_YCbCr_420_SP: return MDP_Y_CRCB_H2V2;
case HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO: return MDP_Y_CBCR_H2V2_ADRENO;
+ case HAL_PIXEL_FORMAT_NV12_ENCODEABLE: return MDP_Y_CBCR_H2V2;
}
return -1;
}
@@ -313,10 +317,10 @@
ctx->mFlags &= ~MDP_BLUR;
}
break;
- case COPYBIT_PREMULTIPLIED_ALPHA:
- if(value == COPYBIT_ENABLE) {
+ case COPYBIT_BLEND_MODE:
+ if(value == COPYBIT_BLENDING_PREMULT) {
ctx->mFlags |= MDP_BLEND_FG_PREMULT;
- } else if (value == COPYBIT_DISABLE) {
+ } else {
ctx->mFlags &= ~MDP_BLEND_FG_PREMULT;
}
break;
@@ -403,8 +407,8 @@
}
}
- if (src_rect->l < 0 || src_rect->r > (int)src->w ||
- src_rect->t < 0 || src_rect->b > (int)src->h) {
+ if (src_rect->l < 0 || (uint32_t)src_rect->r > src->w ||
+ src_rect->t < 0 || (uint32_t)src_rect->b > src->h) {
// this is always invalid
ALOGE ("%s : Invalid source rectangle : src_rect l %d t %d r %d b %d",\
__FUNCTION__, src_rect->l, src_rect->t, src_rect->r, src_rect->b);
@@ -423,7 +427,8 @@
}
if(src->format == HAL_PIXEL_FORMAT_YV12) {
- int usage = GRALLOC_USAGE_PRIVATE_MM_HEAP;
+ int usage =
+ GRALLOC_USAGE_PRIVATE_CAMERA_HEAP|GRALLOC_USAGE_PRIVATE_UNCACHED;
if (0 == alloc_buffer(&yv12_handle,src->w,src->h,
src->format, usage)){
if(0 == convertYV12toYCrCb420SP(src,yv12_handle)){
@@ -501,6 +506,11 @@
return stretch_copybit(dev, dst, src, &dr, &sr, region);
}
+static int finish_copybit(struct copybit_device_t *dev)
+{
+ // NOP for MDP copybit
+}
+
/*****************************************************************************/
/** Close the copybit device */
@@ -531,6 +541,7 @@
ctx->device.get = get;
ctx->device.blit = blit_copybit;
ctx->device.stretch = stretch_copybit;
+ ctx->device.finish = finish_copybit;
ctx->mAlpha = MDP_ALPHA_NOP;
ctx->mFlags = 0;
ctx->mFD = open("/dev/graphics/fb0", O_RDWR, 0);