Implement support for host side multi-window management

This commit is contained in:
Simon Fels 2016-10-13 19:13:59 +02:00
commit fbc8b984f2
23 changed files with 428 additions and 983 deletions

View file

@ -6,6 +6,8 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := AnboxAppManager
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
# We kick out several core packages here which would
# otherwise put up the base UI we don't want.
LOCAL_OVERRIDES_PACKAGES := \
Home \
Launcher2 \

View file

@ -18,6 +18,11 @@
#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
#include <map>
#include <vector>
#include <algorithm>
#include <string>
#define LOG_NDEBUG 0
#include <cutils/log.h>
@ -67,8 +72,8 @@ struct HwcContext {
};
static void dump_layer(hwc_layer_1_t const* l) {
ALOGI("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, {%d,%d,%d,%d}, {%d,%d,%d,%d}",
l->compositionType, l->flags, l->handle, l->transform, l->blending,
ALOGI("\tname='%s', type=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, {%d,%d,%d,%d}, {%d,%d,%d,%d}",
l->name, l->compositionType, l->flags, l->handle, l->transform, l->blending,
l->sourceCrop.left,
l->sourceCrop.top,
l->sourceCrop.right,
@ -185,11 +190,22 @@ static int hwc_set(hwc_composer_device_1_t* dev, size_t numDisplays,
return -EINVAL;
}
ALOGI("Posting buffer %p\n", cb->hostHandle);
rcEnc->rcFBPost(rcEnc, cb->hostHandle);
rcEnc->rcPostLayer(rcEnc,
layer->name,
cb->hostHandle,
layer->sourceCrop.left,
layer->sourceCrop.top,
layer->sourceCrop.right,
layer->sourceCrop.bottom,
layer->displayFrame.left,
layer->displayFrame.top,
layer->displayFrame.right,
layer->displayFrame.bottom);
hostCon->flush();
}
rcEnc->rcPostAllLayersDone(rcEnc);
check_sync_fds(numDisplays, displays);
return 0;
@ -226,8 +242,64 @@ static int hwc_device_close(hw_device_t* dev) {
return 0;
}
static int hwc_get_display_configs(hwc_composer_device_1* dev, int disp,
uint32_t* configs, size_t* numConfigs) {
ALOGI("%s", __PRETTY_FUNCTION__);
if (disp != 0) {
return -EINVAL;
}
if (*numConfigs > 0) {
// Config[0] will be passed in to getDisplayAttributes as the disp
// parameter. The ARC display supports only 1 configuration.
configs[0] = 0;
*numConfigs = 1;
}
return 0;
}
static int hwc_get_display_attributes(hwc_composer_device_1* dev,
int disp, uint32_t config,
const uint32_t* attributes,
int32_t* values) {
ALOGI("%s", __PRETTY_FUNCTION__);
if (disp != 0 || config != 0) {
return -EINVAL;
}
DEFINE_AND_VALIDATE_HOST_CONNECTION();
while (*attributes != HWC_DISPLAY_NO_ATTRIBUTE) {
switch (*attributes) {
case HWC_DISPLAY_VSYNC_PERIOD:
*values = rcEnc->rcGetDisplayVsyncPeriod(rcEnc, disp);
break;
case HWC_DISPLAY_WIDTH:
*values = rcEnc->rcGetDisplayWidth(rcEnc, disp);
break;
case HWC_DISPLAY_HEIGHT:
*values = rcEnc->rcGetDisplayHeight(rcEnc, disp);
break;
case HWC_DISPLAY_DPI_X:
*values = 1000 * rcEnc->rcGetDisplayDpiX(rcEnc, disp);
break;
case HWC_DISPLAY_DPI_Y:
*values = 1000 * rcEnc->rcGetDisplayDpiY(rcEnc, disp);
break;
default:
ALOGE("Unknown attribute value 0x%02x", *attributes);
}
++attributes;
++values;
}
return 0;
}
static int hwc_device_open(const hw_module_t* module, const char* name, hw_device_t** device) {
ALOGI("%s", __PRETTY_FUNCTION__);
if (strcmp(name, HWC_HARDWARE_COMPOSER) != 0)
return -EINVAL;
@ -241,9 +313,9 @@ static int hwc_device_open(const hw_module_t* module, const char* name, hw_devic
dev->device.eventControl = hwc_event_control;
dev->device.blank = hwc_blank;
dev->device.query = hwc_query;
dev->device.getDisplayConfigs = hwc_get_display_configs;
dev->device.getDisplayAttributes = hwc_get_display_attributes;
dev->device.registerProcs = hwc_register_procs;
// FIXME: eventually implement to dump specific information
dev->device.dump = nullptr;
*device = &dev->device.common;