hwcTestFillColorHBlend(equivFrame.get(), refFormat->format,
startRefColor, endRefColor);
- hwc_layer_list_1_t *list;
- size_t size = sizeof(hwc_layer_list_1_t) + numFrames * sizeof(hwc_layer_1_t);
- if ((list = (hwc_layer_list_1_t *) calloc(1, size)) == NULL) {
+ hwc_display_contents_1_t *list;
+ size_t size = sizeof(hwc_display_contents_1_t) + numFrames * sizeof(hwc_layer_1_t);
+ if ((list = (hwc_display_contents_1_t *) calloc(1, size)) == NULL) {
testPrintE("Allocate list failed");
exit(11);
}
// Perform prepare operation
if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(list); }
- hwcDevice->prepare(hwcDevice, list);
+ hwcDevice->prepare(hwcDevice, 1, &list);
if (verbose) {
testPrintI("Post Prepare:");
hwcTestDisplayListPrepareModifiable(list);
list->flags &= ~HWC_GEOMETRY_CHANGED;
if (verbose) {hwcTestDisplayListHandles(list); }
- hwcDevice->set(hwcDevice, dpy, surface, list);
+ list->dpy = dpy;
+ list->sur = surface;
+ hwcDevice->set(hwcDevice, 1, &list);
testDelay(endDelay);
// Given a list of rectangles, determine how many HWC will commit to render
uint32_t numOverlays(list<Rectangle>& rectList)
{
- hwc_layer_list_1_t *hwcList;
+ hwc_display_contents_1_t *hwcList;
list<sp<GraphicBuffer> > buffers;
hwcList = hwcTestCreateLayerList(rectList.size());
// Perform prepare operation
if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(hwcList); }
- hwcDevice->prepare(hwcDevice, hwcList);
+ hwcDevice->prepare(hwcDevice, 1, &hwcList);
if (verbose) {
testPrintI("Post Prepare:");
hwcTestDisplayListPrepareModifiable(hwcList);
}
// Create list of frames
- hwc_layer_list_1_t *list;
+ hwc_display_contents_1_t *list;
list = hwcTestCreateLayerList(rectangle.size());
if (list == NULL) {
testPrintE("hwcTestCreateLayerList failed");
// Perform prepare operation
if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(list); }
- hwcDevice->prepare(hwcDevice, list);
+ hwcDevice->prepare(hwcDevice, 1, &list);
if (verbose) {
testPrintI("Post Prepare:");
hwcTestDisplayListPrepareModifiable(list);
// Perform the set operation(s)
if (verbose) {testPrintI("Set:"); }
if (verbose) { hwcTestDisplayListHandles(list); }
- hwcDevice->set(hwcDevice, dpy, surface, list);
+ list->dpy = dpy;
+ list->sur = surface;
+ hwcDevice->set(hwcDevice, 1, &list);
testDelay(endDelay);
// generated for this pass.
srand48(pass);
- hwc_layer_list_1_t *list;
+ hwc_display_contents_1_t *list;
list = hwcTestCreateLayerList(testRandMod(frames.size()) + 1);
if (list == NULL) {
testPrintE("hwcTestCreateLayerList failed");
// Perform prepare operation
if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(list); }
- hwcDevice->prepare(hwcDevice, list);
+ hwcDevice->prepare(hwcDevice, 1, &list);
if (verbose) {
testPrintI("Post Prepare:");
hwcTestDisplayListPrepareModifiable(list);
if (verbose) {testPrintI("Set:"); }
for (unsigned int n1 = 0; n1 < numSet; n1++) {
if (verbose) { hwcTestDisplayListHandles(list); }
- hwcDevice->set(hwcDevice, dpy, surface, list);
+ list->dpy = dpy;
+ list->sur = surface;
+ hwcDevice->set(hwcDevice, 1, &list);
// Prandomly select a new set of handles
for (unsigned int n1 = 0; n1 < list->numHwLayers; n1++) {
* Dynamically creates layer list with numLayers worth
* of hwLayers entries.
*/
-hwc_layer_list_1_t *hwcTestCreateLayerList(size_t numLayers)
+hwc_display_contents_1_t *hwcTestCreateLayerList(size_t numLayers)
{
- hwc_layer_list_1_t *list;
+ hwc_display_contents_1_t *list;
- size_t size = sizeof(hwc_layer_list_1_t) + numLayers * sizeof(hwc_layer_1_t);
- if ((list = (hwc_layer_list_1_t *) calloc(1, size)) == NULL) {
+ size_t size = sizeof(hwc_display_contents_1_t) + numLayers * sizeof(hwc_layer_1_t);
+ if ((list = (hwc_display_contents_1_t *) calloc(1, size)) == NULL) {
return NULL;
}
list->flags = HWC_GEOMETRY_CHANGED;
* hwcTestFreeLayerList
* Frees memory previous allocated via hwcTestCreateLayerList().
*/
-void hwcTestFreeLayerList(hwc_layer_list_1_t *list)
+void hwcTestFreeLayerList(hwc_display_contents_1_t *list)
{
free(list);
}
// Display the settings of the layer list pointed to by list
-void hwcTestDisplayList(hwc_layer_list_1_t *list)
+void hwcTestDisplayList(hwc_display_contents_1_t *list)
{
testPrintI(" flags: %#x%s", list->flags,
(list->flags & HWC_GEOMETRY_CHANGED) ? " GEOMETRY_CHANGED" : "");
* Displays the portions of a list that are meant to be modified by
* a prepare call.
*/
-void hwcTestDisplayListPrepareModifiable(hwc_layer_list_1_t *list)
+void hwcTestDisplayListPrepareModifiable(hwc_display_contents_1_t *list)
{
uint32_t numOverlays = 0;
for (unsigned int layer = 0; layer < list->numHwLayers; layer++) {
*
* Displays the handles of all the graphic buffers in the list.
*/
-void hwcTestDisplayListHandles(hwc_layer_list_1_t *list)
+void hwcTestDisplayListHandles(hwc_display_contents_1_t *list)
{
const unsigned int maxLayersPerLine = 6;
const char *hwcTestGraphicFormat2str(uint32_t format);
std::string hwcTestRect2str(const struct hwc_rect& rect);
-hwc_layer_list_1_t *hwcTestCreateLayerList(size_t numLayers);
-void hwcTestFreeLayerList(hwc_layer_list_1_t *list);
-void hwcTestDisplayList(hwc_layer_list_1_t *list);
-void hwcTestDisplayListPrepareModifiable(hwc_layer_list_1_t *list);
-void hwcTestDisplayListHandles(hwc_layer_list_1_t *list);
+hwc_display_contents_1_t *hwcTestCreateLayerList(size_t numLayers);
+void hwcTestFreeLayerList(hwc_display_contents_1_t *list);
+void hwcTestDisplayList(hwc_display_contents_1_t *list);
+void hwcTestDisplayListPrepareModifiable(hwc_display_contents_1_t *list);
+void hwcTestDisplayListHandles(hwc_display_contents_1_t *list);
uint32_t hwcTestColor2Pixel(uint32_t format, ColorFract color, float alpha);
void hwcTestColorConvert(uint32_t fromFormat, uint32_t toFormat,
// can just use the v1.0 pointer without branches or casts.
#if HWC_REMOVE_DEPRECATED_VERSIONS
-// We need complete types with to satisfy semantic checks, even though the
-// code paths that use these won't get executed at runtime (and will likely be
-// dead-code-eliminated). When we remove the code to support v0.3 we can remove
+// We need complete types to satisfy semantic checks, even though the code
+// paths that use these won't get executed at runtime (and will likely be dead-
+// code-eliminated). When we remove the code to support v0.3 we can remove
// these as well.
typedef hwc_layer_1_t hwc_layer_t;
-typedef hwc_layer_list_1_t hwc_layer_list_t;
+typedef hwc_display_contents_1_t hwc_layer_list_t;
typedef hwc_composer_device_1_t hwc_composer_device_t;
#endif
static size_t sizeofHwcLayerList(const hwc_composer_device_1_t* hwc,
size_t numLayers) {
if (hwcHasVersion(hwc, HWC_DEVICE_API_VERSION_1_0)) {
- return sizeof(hwc_layer_list_1_t) + numLayers*sizeof(hwc_layer_1_t);
+ return sizeof(hwc_display_contents_1_t) + numLayers*sizeof(hwc_layer_1_t);
} else {
return sizeof(hwc_layer_list_t) + numLayers*sizeof(hwc_layer_t);
}
}
if (mHwc) {
- if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_0_3)) {
- // always turn vsync off when we start
- mHwc->methods->eventControl(mHwc, HWC_EVENT_VSYNC, 0);
- needVSyncThread = false;
+ // always turn vsync off when we start
+ needVSyncThread = false;
+ if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_1_0)) {
+ mHwc->methods->eventControl(mHwc, 0, HWC_EVENT_VSYNC, 0);
+ } else if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_0_3)) {
+ hwc_composer_device_t* hwc0 = (hwc_composer_device_t*)mHwc;
+ err = hwc0->methods->eventControl(hwc0, HWC_EVENT_VSYNC, 0);
+ } else {
+ needVSyncThread = true;
}
+
if (mHwc->registerProcs) {
mCBContext->hwc = this;
mCBContext->procs.invalidate = &hook_invalidate;
status_t err = NO_ERROR;
if (mHwc && mHwc->common.version >= HWC_DEVICE_API_VERSION_0_3) {
if (!mDebugForceFakeVSync) {
- err = mHwc->methods->eventControl(mHwc, event, enabled);
+ if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_1_0)) {
+ err = mHwc->methods->eventControl(mHwc, 0, event, enabled);
+ } else {
+ hwc_composer_device_t* hwc0 = (hwc_composer_device_t*)mHwc;
+ err = hwc0->methods->eventControl(hwc0, event, enabled);
+ }
// error here should not happen -- not sure what we should
// do if it does.
ALOGE_IF(err, "eventControl(%d, %d) failed %s",
if (!mList || mCapacity < numLayers) {
free(mList);
size_t size = sizeofHwcLayerList(mHwc, numLayers);
- mList = (hwc_layer_list_1_t*)malloc(size);
+ mList = (hwc_display_contents_1_t*)malloc(size);
mCapacity = numLayers;
+ mList->flipFenceFd = -1;
}
mList->flags = HWC_GEOMETRY_CHANGED;
mList->numHwLayers = numLayers;
}
status_t HWComposer::prepare() const {
- int err = mHwc->prepare(mHwc, mList);
+ int err = mHwc->prepare(mHwc, 1,
+ const_cast<hwc_display_contents_1_t**>(&mList));
if (err == NO_ERROR) {
size_t numOVLayers = 0;
size_t numFBLayers = 0;
status_t HWComposer::commit() const {
int err = NO_ERROR;
if (mHwc) {
- err = mHwc->set(mHwc, mDpy, mSur, mList);
+ if (mList) {
+ mList->dpy = mDpy;
+ mList->sur = mSur;
+ }
+ err = mHwc->set(mHwc, 1, const_cast<hwc_display_contents_1_t**>(&mList));
if (mList) {
mList->flags &= ~HWC_GEOMETRY_CHANGED;
+ if (mList->flipFenceFd != -1) {
+ close(mList->flipFenceFd);
+ mList->flipFenceFd = -1;
+ }
}
} else {
eglSwapBuffers(mDpy, mSur);
status_t HWComposer::release() const {
if (mHwc) {
- if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_0_3)) {
- mHwc->methods->eventControl(mHwc, HWC_EVENT_VSYNC, 0);
+ if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_1_0)) {
+ mHwc->methods->eventControl(mHwc, 0, HWC_EVENT_VSYNC, 0);
+ } else if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_0_3)) {
+ hwc_composer_device_t* hwc0 = (hwc_composer_device_t*)mHwc;
+ hwc0->methods->eventControl(hwc0, HWC_EVENT_VSYNC, 0);
}
- int err = mHwc->set(mHwc, NULL, NULL, NULL);
+ int err = mHwc->set(mHwc, 0, NULL);
if (err < 0) {
return (status_t)err;
}
if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_1_0)) {
if (mHwc->methods && mHwc->methods->blank) {
- err = mHwc->methods->blank(mHwc, 1);
+ err = mHwc->methods->blank(mHwc, 0, 1);
}
}
return (status_t)err;
if (mHwc) {
if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_1_0)) {
if (mHwc->methods && mHwc->methods->blank) {
- int err = mHwc->methods->blank(mHwc, 0);
+ int err = mHwc->methods->blank(mHwc, 0, 0);
return (status_t)err;
}
}
if (mHwc) {
free(mList);
mList = NULL;
- int err = mHwc->prepare(mHwc, NULL);
+ int err = mHwc->prepare(mHwc, 0, NULL);
return (status_t)err;
}
return NO_ERROR;
struct timespec *remain);
struct hwc_composer_device_1;
-struct hwc_layer_list_1;
+struct hwc_display_contents_1;
struct hwc_procs;
namespace android {
sp<SurfaceFlinger> mFlinger;
hw_module_t const* mModule;
struct hwc_composer_device_1* mHwc;
- struct hwc_layer_list_1* mList;
+ struct hwc_display_contents_1* mList;
size_t mCapacity;
mutable size_t mNumOVLayers;
mutable size_t mNumFBLayers;