qcom/display: Update HALs
- Update the display HAL from Code Aurora Forum - Add updated overlay library - Enable HWC with basic video going through overlay - Cleanup some files Change-Id: I65c687c51be458cee71213c79e03eeda962d9086
This commit is contained in:
committed by
Iliyan Malchev
parent
06ff498a7c
commit
29a26818d7
56
libgralloc/gpu.cpp
Executable file → Normal file
56
libgralloc/gpu.cpp
Executable file → Normal file
@@ -32,34 +32,12 @@ using namespace gralloc;
|
||||
using android::sp;
|
||||
|
||||
gpu_context_t::gpu_context_t(const private_module_t* module,
|
||||
sp<IAllocController> alloc_ctrl ) :
|
||||
sp<IAllocController> alloc_ctrl ) :
|
||||
mAllocCtrl(alloc_ctrl)
|
||||
{
|
||||
// Zero out the alloc_device_t
|
||||
memset(static_cast<alloc_device_t*>(this), 0, sizeof(alloc_device_t));
|
||||
|
||||
char property[PROPERTY_VALUE_MAX];
|
||||
if (property_get("debug.sf.hw", property, NULL) > 0) {
|
||||
if(atoi(property) == 0) {
|
||||
//debug.sf.hw = 0
|
||||
compositionType = CPU_COMPOSITION;
|
||||
} else { //debug.sf.hw = 1
|
||||
// Get the composition type
|
||||
property_get("debug.composition.type", property, NULL);
|
||||
if (property == NULL) {
|
||||
compositionType = GPU_COMPOSITION;
|
||||
} else if ((strncmp(property, "mdp", 3)) == 0) {
|
||||
compositionType = MDP_COMPOSITION;
|
||||
} else if ((strncmp(property, "c2d", 3)) == 0) {
|
||||
compositionType = C2D_COMPOSITION;
|
||||
} else {
|
||||
compositionType = GPU_COMPOSITION;
|
||||
}
|
||||
}
|
||||
} else { //debug.sf.hw is not set. Use cpu composition
|
||||
compositionType = CPU_COMPOSITION;
|
||||
}
|
||||
|
||||
// Initialize the procs
|
||||
common.tag = HARDWARE_DEVICE_TAG;
|
||||
common.version = 0;
|
||||
@@ -74,7 +52,7 @@ gpu_context_t::gpu_context_t(const private_module_t* module,
|
||||
}
|
||||
|
||||
int gpu_context_t::gralloc_alloc_framebuffer_locked(size_t size, int usage,
|
||||
buffer_handle_t* pHandle)
|
||||
buffer_handle_t* pHandle)
|
||||
{
|
||||
private_module_t* m = reinterpret_cast<private_module_t*>(common.module);
|
||||
|
||||
@@ -136,7 +114,7 @@ int gpu_context_t::gralloc_alloc_framebuffer_locked(size_t size, int usage,
|
||||
|
||||
|
||||
int gpu_context_t::gralloc_alloc_framebuffer(size_t size, int usage,
|
||||
buffer_handle_t* pHandle)
|
||||
buffer_handle_t* pHandle)
|
||||
{
|
||||
private_module_t* m = reinterpret_cast<private_module_t*>(common.module);
|
||||
pthread_mutex_lock(&m->lock);
|
||||
@@ -162,7 +140,7 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage,
|
||||
else
|
||||
data.align = getpagesize();
|
||||
data.pHandle = (unsigned int) pHandle;
|
||||
err = mAllocCtrl->allocate(data, usage, compositionType);
|
||||
err = mAllocCtrl->allocate(data, usage, 0);
|
||||
|
||||
if (usage & GRALLOC_USAGE_PRIVATE_UNSYNCHRONIZED) {
|
||||
flags |= private_handle_t::PRIV_FLAGS_UNSYNCHRONIZED;
|
||||
@@ -179,7 +157,8 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage,
|
||||
if (err == 0) {
|
||||
flags |= data.allocType;
|
||||
private_handle_t* hnd = new private_handle_t(data.fd, size, flags,
|
||||
bufferType, format, width, height);
|
||||
bufferType, format, width,
|
||||
height);
|
||||
|
||||
hnd->offset = data.offset;
|
||||
hnd->base = int(data.base) + data.offset;
|
||||
@@ -217,7 +196,8 @@ void gpu_context_t::getGrallocInformationFromFormat(int inputFormat,
|
||||
}
|
||||
|
||||
int gpu_context_t::alloc_impl(int w, int h, int format, int usage,
|
||||
buffer_handle_t* pHandle, int* pStride, size_t bufferSize) {
|
||||
buffer_handle_t* pHandle, int* pStride,
|
||||
size_t bufferSize) {
|
||||
if (!pHandle || !pStride)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -234,8 +214,9 @@ int gpu_context_t::alloc_impl(int w, int h, int format, int usage,
|
||||
// All buffers marked as protected or for external
|
||||
// display need to go to overlay
|
||||
if ((usage & GRALLOC_USAGE_EXTERNAL_DISP) ||
|
||||
(usage & GRALLOC_USAGE_PROTECTED)) {
|
||||
bufferType = BUFFER_TYPE_VIDEO;
|
||||
(usage & GRALLOC_USAGE_PROTECTED) ||
|
||||
(usage & GRALLOC_USAGE_PRIVATE_CP_BUFFER)) {
|
||||
bufferType = BUFFER_TYPE_VIDEO;
|
||||
}
|
||||
int err;
|
||||
if (usage & GRALLOC_USAGE_HW_FB) {
|
||||
@@ -268,12 +249,12 @@ int gpu_context_t::free_impl(private_handle_t const* hnd) {
|
||||
int index = (hnd->base - m->framebuffer->base) / bufferSize;
|
||||
m->bufferMask &= ~(1<<index);
|
||||
} else {
|
||||
terminateBuffer(&m->base, const_cast<private_handle_t*>(hnd));
|
||||
sp<IMemAlloc> memalloc = mAllocCtrl->getAllocator(hnd->flags);
|
||||
int err = memalloc->free_buffer((void*)hnd->base, (size_t) hnd->size,
|
||||
hnd->offset, hnd->fd);
|
||||
hnd->offset, hnd->fd);
|
||||
if(err)
|
||||
return err;
|
||||
terminateBuffer(&m->base, const_cast<private_handle_t*>(hnd));
|
||||
}
|
||||
|
||||
// Release the genlock
|
||||
@@ -287,7 +268,8 @@ int gpu_context_t::free_impl(private_handle_t const* hnd) {
|
||||
}
|
||||
|
||||
int gpu_context_t::gralloc_alloc(alloc_device_t* dev, int w, int h, int format,
|
||||
int usage, buffer_handle_t* pHandle, int* pStride)
|
||||
int usage, buffer_handle_t* pHandle,
|
||||
int* pStride)
|
||||
{
|
||||
if (!dev) {
|
||||
return -EINVAL;
|
||||
@@ -295,8 +277,10 @@ int gpu_context_t::gralloc_alloc(alloc_device_t* dev, int w, int h, int format,
|
||||
gpu_context_t* gpu = reinterpret_cast<gpu_context_t*>(dev);
|
||||
return gpu->alloc_impl(w, h, format, usage, pHandle, pStride, 0);
|
||||
}
|
||||
int gpu_context_t::gralloc_alloc_size(alloc_device_t* dev, int w, int h, int format,
|
||||
int usage, buffer_handle_t* pHandle, int* pStride, int bufferSize)
|
||||
int gpu_context_t::gralloc_alloc_size(alloc_device_t* dev, int w, int h,
|
||||
int format, int usage,
|
||||
buffer_handle_t* pHandle, int* pStride,
|
||||
int bufferSize)
|
||||
{
|
||||
if (!dev) {
|
||||
return -EINVAL;
|
||||
@@ -307,7 +291,7 @@ int gpu_context_t::gralloc_alloc_size(alloc_device_t* dev, int w, int h, int for
|
||||
|
||||
|
||||
int gpu_context_t::gralloc_free(alloc_device_t* dev,
|
||||
buffer_handle_t handle)
|
||||
buffer_handle_t handle)
|
||||
{
|
||||
if (private_handle_t::validate(handle) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user