2014-11-17 20:03:59 +00:00
|
|
|
/*
|
2009-03-04 03:31:44 +00:00
|
|
|
**
|
|
|
|
** Copyright 2007 The Android Open Source Project
|
|
|
|
**
|
2014-11-17 20:03:59 +00:00
|
|
|
** Licensed under the Apache License Version 2.0(the "License");
|
|
|
|
** you may not use this file except in compliance with the License.
|
|
|
|
** You may obtain a copy of the License at
|
2009-03-04 03:31:44 +00:00
|
|
|
**
|
2014-11-17 20:03:59 +00:00
|
|
|
** http://www.apache.org/licenses/LICENSE-2.0
|
2009-03-04 03:31:44 +00:00
|
|
|
**
|
2014-11-17 20:03:59 +00:00
|
|
|
** Unless required by applicable law or agreed to in writing software
|
|
|
|
** distributed under the License is distributed on an "AS IS" BASIS
|
|
|
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
|
|
|
|
** See the License for the specific language governing permissions and
|
2009-03-04 03:31:44 +00:00
|
|
|
** limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2009-05-04 21:17:04 +00:00
|
|
|
#define LOG_TAG "FramebufferNativeWindow"
|
2009-03-04 03:31:44 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2009-04-10 21:24:30 +00:00
|
|
|
#include <errno.h>
|
2009-03-04 03:31:44 +00:00
|
|
|
|
|
|
|
#include <cutils/log.h>
|
|
|
|
#include <cutils/atomic.h>
|
2009-04-10 21:24:30 +00:00
|
|
|
#include <utils/threads.h>
|
2009-08-07 03:46:44 +00:00
|
|
|
#include <utils/RefBase.h>
|
2009-03-04 03:31:44 +00:00
|
|
|
|
2012-02-25 02:25:41 +00:00
|
|
|
#include <ui/ANativeObjectBase.h>
|
2012-06-13 23:32:25 +00:00
|
|
|
#include <ui/Fence.h>
|
2014-11-11 18:32:31 +00:00
|
|
|
#define INCLUDED_FROM_FRAMEBUFFER_NATIVE_WINDOW_CPP
|
2009-05-04 21:17:04 +00:00
|
|
|
#include <ui/FramebufferNativeWindow.h>
|
2014-11-11 18:32:31 +00:00
|
|
|
#undef INCLUDED_FROM_FRAMEBUFFER_NATIVE_WINDOW_CPP
|
2012-02-25 02:25:41 +00:00
|
|
|
#include <ui/Rect.h>
|
2009-03-04 03:31:44 +00:00
|
|
|
|
|
|
|
#include <EGL/egl.h>
|
|
|
|
|
2009-04-10 21:24:30 +00:00
|
|
|
#include <hardware/hardware.h>
|
|
|
|
#include <hardware/gralloc.h>
|
2009-03-04 03:31:44 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
namespace android {
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
class NativeBuffer final
|
2012-02-25 02:25:41 +00:00
|
|
|
: public ANativeObjectBase<
|
2014-11-17 20:03:59 +00:00
|
|
|
ANativeWindowBuffer,
|
|
|
|
NativeBuffer,
|
|
|
|
LightRefBase<NativeBuffer>>
|
2009-05-06 01:11:11 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NativeBuffer(int w, int h, int f, int u) : BASE() {
|
2011-05-01 18:33:26 +00:00
|
|
|
ANativeWindowBuffer::width = w;
|
|
|
|
ANativeWindowBuffer::height = h;
|
|
|
|
ANativeWindowBuffer::format = f;
|
|
|
|
ANativeWindowBuffer::usage = u;
|
2009-05-06 01:11:11 +00:00
|
|
|
}
|
|
|
|
private:
|
2014-11-17 20:03:59 +00:00
|
|
|
friend class LightRefBase<NativeBuffer>;
|
2009-05-06 01:11:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-04-10 21:24:30 +00:00
|
|
|
/*
|
|
|
|
* This implements the (main) framebuffer management. This class is used
|
|
|
|
* mostly by SurfaceFlinger, but also by command line GL application.
|
2014-11-17 20:03:59 +00:00
|
|
|
*
|
2010-06-30 20:56:17 +00:00
|
|
|
* In fact this is an implementation of ANativeWindow on top of
|
2009-04-10 21:24:30 +00:00
|
|
|
* the framebuffer.
|
2014-11-17 20:03:59 +00:00
|
|
|
*
|
|
|
|
* Currently it is pretty simple, it manages only two buffers (the front and
|
2009-04-10 21:24:30 +00:00
|
|
|
* back buffer).
|
2014-11-17 20:03:59 +00:00
|
|
|
*
|
2009-04-10 21:24:30 +00:00
|
|
|
*/
|
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
FramebufferNativeWindow::FramebufferNativeWindow()
|
2009-05-08 00:40:23 +00:00
|
|
|
: BASE(), fbDev(0), grDev(0), mUpdateOnDemand(false)
|
2009-03-04 03:31:44 +00:00
|
|
|
{
|
2009-04-10 21:24:30 +00:00
|
|
|
hw_module_t const* module;
|
|
|
|
if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module) == 0) {
|
|
|
|
int err;
|
2010-11-03 20:16:18 +00:00
|
|
|
int i;
|
2009-08-07 03:46:44 +00:00
|
|
|
err = framebuffer_open(module, &fbDev);
|
2012-01-06 19:20:56 +00:00
|
|
|
ALOGE_IF(err, "couldn't open framebuffer HAL (%s)", strerror(-err));
|
2014-11-17 20:03:59 +00:00
|
|
|
|
2009-08-07 03:46:44 +00:00
|
|
|
err = gralloc_open(module, &grDev);
|
2012-01-06 19:20:56 +00:00
|
|
|
ALOGE_IF(err, "couldn't open gralloc HAL (%s)", strerror(-err));
|
2009-04-10 21:24:30 +00:00
|
|
|
|
2009-08-07 03:46:44 +00:00
|
|
|
// bail out if we can't initialize the modules
|
|
|
|
if (!fbDev || !grDev)
|
|
|
|
return;
|
2014-11-17 20:03:59 +00:00
|
|
|
|
2009-05-08 00:40:23 +00:00
|
|
|
mUpdateOnDemand = (fbDev->setUpdateRect != 0);
|
2014-11-17 20:03:59 +00:00
|
|
|
|
2009-04-10 21:24:30 +00:00
|
|
|
// initialize the buffer FIFO
|
2012-06-29 19:02:32 +00:00
|
|
|
if(fbDev->numFramebuffers >= MIN_NUM_FRAME_BUFFERS &&
|
|
|
|
fbDev->numFramebuffers <= MAX_NUM_FRAME_BUFFERS){
|
|
|
|
mNumBuffers = fbDev->numFramebuffers;
|
|
|
|
} else {
|
|
|
|
mNumBuffers = MIN_NUM_FRAME_BUFFERS;
|
|
|
|
}
|
|
|
|
mNumFreeBuffers = mNumBuffers;
|
2009-04-10 21:24:30 +00:00
|
|
|
mBufferHead = mNumBuffers-1;
|
|
|
|
|
2012-02-22 22:37:57 +00:00
|
|
|
/*
|
|
|
|
* This does not actually change the framebuffer format. It merely
|
|
|
|
* fakes this format to surfaceflinger so that when it creates
|
|
|
|
* framebuffer surfaces it will use this format. It's really a giant
|
|
|
|
* HACK to allow interworking with buggy gralloc+GPU driver
|
|
|
|
* implementations. You should *NEVER* need to set this for shipping
|
|
|
|
* devices.
|
|
|
|
*/
|
|
|
|
#ifdef FRAMEBUFFER_FORCE_FORMAT
|
|
|
|
*((uint32_t *)&fbDev->format) = FRAMEBUFFER_FORCE_FORMAT;
|
|
|
|
#endif
|
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
for (i = 0; i < mNumBuffers; i++) {
|
|
|
|
buffers[i] = new NativeBuffer(
|
|
|
|
static_cast<int>(fbDev->width),
|
|
|
|
static_cast<int>(fbDev->height),
|
|
|
|
fbDev->format, GRALLOC_USAGE_HW_FB);
|
2010-11-03 20:16:18 +00:00
|
|
|
}
|
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
for (i = 0; i < mNumBuffers; i++) {
|
|
|
|
err = grDev->alloc(grDev,
|
|
|
|
static_cast<int>(fbDev->width),
|
|
|
|
static_cast<int>(fbDev->height),
|
|
|
|
fbDev->format, GRALLOC_USAGE_HW_FB,
|
|
|
|
&buffers[i]->handle, &buffers[i]->stride);
|
|
|
|
|
|
|
|
ALOGE_IF(err, "fb buffer %d allocation failed w=%d, h=%d, err=%s",
|
|
|
|
i, fbDev->width, fbDev->height, strerror(-err));
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
mNumBuffers = i;
|
|
|
|
mNumFreeBuffers = i;
|
|
|
|
mBufferHead = mNumBuffers-1;
|
|
|
|
break;
|
|
|
|
}
|
2010-11-03 20:16:18 +00:00
|
|
|
}
|
2009-04-10 21:24:30 +00:00
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
const_cast<uint32_t&>(ANativeWindow::flags) = fbDev->flags;
|
2010-06-30 20:56:17 +00:00
|
|
|
const_cast<float&>(ANativeWindow::xdpi) = fbDev->xdpi;
|
|
|
|
const_cast<float&>(ANativeWindow::ydpi) = fbDev->ydpi;
|
2014-11-17 20:03:59 +00:00
|
|
|
const_cast<int&>(ANativeWindow::minSwapInterval) =
|
2009-09-23 17:54:36 +00:00
|
|
|
fbDev->minSwapInterval;
|
2014-11-17 20:03:59 +00:00
|
|
|
const_cast<int&>(ANativeWindow::maxSwapInterval) =
|
2009-09-23 17:54:36 +00:00
|
|
|
fbDev->maxSwapInterval;
|
|
|
|
} else {
|
2012-01-06 19:20:56 +00:00
|
|
|
ALOGE("Couldn't get gralloc module");
|
2009-09-23 17:54:36 +00:00
|
|
|
}
|
2009-04-10 21:24:30 +00:00
|
|
|
|
2010-06-30 20:56:17 +00:00
|
|
|
ANativeWindow::setSwapInterval = setSwapInterval;
|
|
|
|
ANativeWindow::dequeueBuffer = dequeueBuffer;
|
|
|
|
ANativeWindow::queueBuffer = queueBuffer;
|
|
|
|
ANativeWindow::query = query;
|
|
|
|
ANativeWindow::perform = perform;
|
2012-06-13 23:32:25 +00:00
|
|
|
|
|
|
|
ANativeWindow::dequeueBuffer_DEPRECATED = dequeueBuffer_DEPRECATED;
|
|
|
|
ANativeWindow::lockBuffer_DEPRECATED = lockBuffer_DEPRECATED;
|
|
|
|
ANativeWindow::queueBuffer_DEPRECATED = queueBuffer_DEPRECATED;
|
2009-03-04 03:31:44 +00:00
|
|
|
}
|
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
FramebufferNativeWindow::~FramebufferNativeWindow()
|
2009-08-07 03:46:44 +00:00
|
|
|
{
|
|
|
|
if (grDev) {
|
2012-06-29 19:02:32 +00:00
|
|
|
for(int i = 0; i < mNumBuffers; i++) {
|
|
|
|
if (buffers[i] != NULL) {
|
|
|
|
grDev->free(grDev, buffers[i]->handle);
|
|
|
|
}
|
|
|
|
}
|
2009-08-07 03:46:44 +00:00
|
|
|
gralloc_close(grDev);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fbDev) {
|
|
|
|
framebuffer_close(fbDev);
|
|
|
|
}
|
2009-03-04 03:31:44 +00:00
|
|
|
}
|
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
status_t FramebufferNativeWindow::setUpdateRectangle(const Rect& r)
|
2009-05-08 00:40:23 +00:00
|
|
|
{
|
|
|
|
if (!mUpdateOnDemand) {
|
|
|
|
return INVALID_OPERATION;
|
|
|
|
}
|
|
|
|
return fbDev->setUpdateRect(fbDev, r.left, r.top, r.width(), r.height());
|
|
|
|
}
|
|
|
|
|
2009-09-17 23:18:16 +00:00
|
|
|
status_t FramebufferNativeWindow::compositionComplete()
|
|
|
|
{
|
|
|
|
if (fbDev->compositionComplete) {
|
|
|
|
return fbDev->compositionComplete(fbDev);
|
|
|
|
}
|
|
|
|
return INVALID_OPERATION;
|
|
|
|
}
|
|
|
|
|
2009-04-10 21:24:30 +00:00
|
|
|
int FramebufferNativeWindow::setSwapInterval(
|
2014-11-17 20:03:59 +00:00
|
|
|
ANativeWindow* window, int interval)
|
2009-03-04 03:31:44 +00:00
|
|
|
{
|
2009-04-10 21:24:30 +00:00
|
|
|
framebuffer_device_t* fb = getSelf(window)->fbDev;
|
|
|
|
return fb->setSwapInterval(fb, interval);
|
2009-03-04 03:31:44 +00:00
|
|
|
}
|
|
|
|
|
2010-12-02 00:38:01 +00:00
|
|
|
void FramebufferNativeWindow::dump(String8& result) {
|
|
|
|
if (fbDev->common.version >= 1 && fbDev->dump) {
|
|
|
|
const size_t SIZE = 4096;
|
|
|
|
char buffer[SIZE];
|
|
|
|
|
|
|
|
fbDev->dump(fbDev, buffer, SIZE);
|
|
|
|
result.append(buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-14 05:57:58 +00:00
|
|
|
// only for debugging / logging
|
|
|
|
int FramebufferNativeWindow::getCurrentBufferIndex() const
|
|
|
|
{
|
|
|
|
Mutex::Autolock _l(mutex);
|
|
|
|
const int index = mCurrentBufferIndex;
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
int FramebufferNativeWindow::dequeueBuffer_DEPRECATED(ANativeWindow* window,
|
2011-05-01 18:33:26 +00:00
|
|
|
ANativeWindowBuffer** buffer)
|
2012-06-13 23:32:25 +00:00
|
|
|
{
|
|
|
|
int fenceFd = -1;
|
|
|
|
int result = dequeueBuffer(window, buffer, &fenceFd);
|
|
|
|
sp<Fence> fence(new Fence(fenceFd));
|
|
|
|
int waitResult = fence->wait(Fence::TIMEOUT_NEVER);
|
|
|
|
if (waitResult != OK) {
|
|
|
|
ALOGE("dequeueBuffer_DEPRECATED: Fence::wait returned an "
|
|
|
|
"error: %d", waitResult);
|
|
|
|
return waitResult;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
int FramebufferNativeWindow::dequeueBuffer(ANativeWindow* window,
|
2012-06-13 23:32:25 +00:00
|
|
|
ANativeWindowBuffer** buffer, int* fenceFd)
|
2009-03-04 03:31:44 +00:00
|
|
|
{
|
2009-04-10 21:24:30 +00:00
|
|
|
FramebufferNativeWindow* self = getSelf(window);
|
|
|
|
Mutex::Autolock _l(self->mutex);
|
2009-03-04 03:31:44 +00:00
|
|
|
|
2010-09-14 05:57:58 +00:00
|
|
|
int index = self->mBufferHead++;
|
|
|
|
if (self->mBufferHead >= self->mNumBuffers)
|
|
|
|
self->mBufferHead = 0;
|
|
|
|
|
2012-06-21 18:35:23 +00:00
|
|
|
// wait for a free non-front buffer
|
|
|
|
while (self->mNumFreeBuffers < 2) {
|
2009-04-10 21:24:30 +00:00
|
|
|
self->mCondition.wait(self->mutex);
|
2009-03-04 03:31:44 +00:00
|
|
|
}
|
2014-11-17 20:03:59 +00:00
|
|
|
ALOG_ASSERT(self->buffers[index] != self->front, "");
|
2012-06-21 18:35:23 +00:00
|
|
|
|
2009-04-10 21:24:30 +00:00
|
|
|
// get this buffer
|
|
|
|
self->mNumFreeBuffers--;
|
2010-09-14 05:57:58 +00:00
|
|
|
self->mCurrentBufferIndex = index;
|
2009-04-10 21:24:30 +00:00
|
|
|
|
|
|
|
*buffer = self->buffers[index].get();
|
2012-06-13 23:32:25 +00:00
|
|
|
*fenceFd = -1;
|
2009-04-10 21:24:30 +00:00
|
|
|
|
2009-03-04 03:31:44 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
int FramebufferNativeWindow::lockBuffer_DEPRECATED(ANativeWindow* /*window*/,
|
2014-03-12 20:12:44 +00:00
|
|
|
ANativeWindowBuffer* /*buffer*/)
|
2009-04-10 21:24:30 +00:00
|
|
|
{
|
2009-05-04 21:17:04 +00:00
|
|
|
return NO_ERROR;
|
2009-03-04 03:31:44 +00:00
|
|
|
}
|
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
int FramebufferNativeWindow::queueBuffer_DEPRECATED(ANativeWindow* window,
|
2011-05-01 18:33:26 +00:00
|
|
|
ANativeWindowBuffer* buffer)
|
2012-06-13 23:32:25 +00:00
|
|
|
{
|
|
|
|
return queueBuffer(window, buffer, -1);
|
|
|
|
}
|
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
int FramebufferNativeWindow::queueBuffer(ANativeWindow* window,
|
2012-06-13 23:32:25 +00:00
|
|
|
ANativeWindowBuffer* buffer, int fenceFd)
|
2009-03-04 03:31:44 +00:00
|
|
|
{
|
2009-04-10 21:24:30 +00:00
|
|
|
FramebufferNativeWindow* self = getSelf(window);
|
|
|
|
Mutex::Autolock _l(self->mutex);
|
|
|
|
framebuffer_device_t* fb = self->fbDev;
|
|
|
|
buffer_handle_t handle = static_cast<NativeBuffer*>(buffer)->handle;
|
2010-09-14 05:57:58 +00:00
|
|
|
|
2012-06-13 23:32:25 +00:00
|
|
|
sp<Fence> fence(new Fence(fenceFd));
|
|
|
|
fence->wait(Fence::TIMEOUT_NEVER);
|
|
|
|
|
2009-04-10 21:24:30 +00:00
|
|
|
int res = fb->post(fb, handle);
|
|
|
|
self->front = static_cast<NativeBuffer*>(buffer);
|
|
|
|
self->mNumFreeBuffers++;
|
|
|
|
self->mCondition.broadcast();
|
|
|
|
return res;
|
2009-03-04 03:31:44 +00:00
|
|
|
}
|
|
|
|
|
2011-04-14 23:54:38 +00:00
|
|
|
int FramebufferNativeWindow::query(const ANativeWindow* window,
|
2014-11-17 20:03:59 +00:00
|
|
|
int what, int* value)
|
2009-07-31 01:14:56 +00:00
|
|
|
{
|
2011-04-14 23:54:38 +00:00
|
|
|
const FramebufferNativeWindow* self = getSelf(window);
|
2009-07-31 01:14:56 +00:00
|
|
|
Mutex::Autolock _l(self->mutex);
|
|
|
|
framebuffer_device_t* fb = self->fbDev;
|
|
|
|
switch (what) {
|
|
|
|
case NATIVE_WINDOW_WIDTH:
|
2014-11-17 20:03:59 +00:00
|
|
|
*value = static_cast<int>(fb->width);
|
2009-07-31 01:14:56 +00:00
|
|
|
return NO_ERROR;
|
|
|
|
case NATIVE_WINDOW_HEIGHT:
|
2014-11-17 20:03:59 +00:00
|
|
|
*value = static_cast<int>(fb->height);
|
2009-07-31 01:14:56 +00:00
|
|
|
return NO_ERROR;
|
2009-08-06 23:04:29 +00:00
|
|
|
case NATIVE_WINDOW_FORMAT:
|
|
|
|
*value = fb->format;
|
|
|
|
return NO_ERROR;
|
2011-03-14 22:00:06 +00:00
|
|
|
case NATIVE_WINDOW_CONCRETE_TYPE:
|
|
|
|
*value = NATIVE_WINDOW_FRAMEBUFFER;
|
|
|
|
return NO_ERROR;
|
2011-07-19 22:24:46 +00:00
|
|
|
case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER:
|
|
|
|
*value = 0;
|
|
|
|
return NO_ERROR;
|
|
|
|
case NATIVE_WINDOW_DEFAULT_WIDTH:
|
2014-11-17 20:03:59 +00:00
|
|
|
*value = static_cast<int>(fb->width);
|
2011-07-19 22:24:46 +00:00
|
|
|
return NO_ERROR;
|
|
|
|
case NATIVE_WINDOW_DEFAULT_HEIGHT:
|
2014-11-17 20:03:59 +00:00
|
|
|
*value = static_cast<int>(fb->height);
|
2011-07-19 22:24:46 +00:00
|
|
|
return NO_ERROR;
|
|
|
|
case NATIVE_WINDOW_TRANSFORM_HINT:
|
|
|
|
*value = 0;
|
|
|
|
return NO_ERROR;
|
2009-07-31 01:14:56 +00:00
|
|
|
}
|
2009-08-07 03:46:44 +00:00
|
|
|
*value = 0;
|
2009-07-31 01:14:56 +00:00
|
|
|
return BAD_VALUE;
|
|
|
|
}
|
|
|
|
|
2014-03-12 20:12:44 +00:00
|
|
|
int FramebufferNativeWindow::perform(ANativeWindow* /*window*/,
|
2009-08-12 05:34:02 +00:00
|
|
|
int operation, ...)
|
|
|
|
{
|
|
|
|
switch (operation) {
|
2010-03-11 23:06:54 +00:00
|
|
|
case NATIVE_WINDOW_CONNECT:
|
|
|
|
case NATIVE_WINDOW_DISCONNECT:
|
2011-07-21 21:50:29 +00:00
|
|
|
case NATIVE_WINDOW_SET_USAGE:
|
|
|
|
case NATIVE_WINDOW_SET_BUFFERS_GEOMETRY:
|
|
|
|
case NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS:
|
|
|
|
case NATIVE_WINDOW_SET_BUFFERS_FORMAT:
|
|
|
|
case NATIVE_WINDOW_SET_BUFFERS_TRANSFORM:
|
2011-07-30 00:55:48 +00:00
|
|
|
case NATIVE_WINDOW_API_CONNECT:
|
|
|
|
case NATIVE_WINDOW_API_DISCONNECT:
|
2011-07-21 21:50:29 +00:00
|
|
|
// TODO: we should implement these
|
2011-07-13 22:24:42 +00:00
|
|
|
return NO_ERROR;
|
2011-07-21 21:50:29 +00:00
|
|
|
|
2011-07-14 00:39:11 +00:00
|
|
|
case NATIVE_WINDOW_LOCK:
|
|
|
|
case NATIVE_WINDOW_UNLOCK_AND_POST:
|
2011-07-13 22:24:42 +00:00
|
|
|
case NATIVE_WINDOW_SET_CROP:
|
|
|
|
case NATIVE_WINDOW_SET_BUFFER_COUNT:
|
|
|
|
case NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP:
|
|
|
|
case NATIVE_WINDOW_SET_SCALING_MODE:
|
|
|
|
return INVALID_OPERATION;
|
2009-08-12 05:34:02 +00:00
|
|
|
}
|
2011-07-13 22:24:42 +00:00
|
|
|
return NAME_NOT_FOUND;
|
2009-08-12 05:34:02 +00:00
|
|
|
}
|
|
|
|
|
2009-03-04 03:31:44 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
}; // namespace android
|
|
|
|
// ----------------------------------------------------------------------------
|
2009-04-10 21:24:30 +00:00
|
|
|
|
2014-11-17 20:03:59 +00:00
|
|
|
using android::sp;
|
|
|
|
using android::FramebufferNativeWindow;
|
2009-04-10 21:24:30 +00:00
|
|
|
|
|
|
|
EGLNativeWindowType android_createDisplaySurface(void)
|
|
|
|
{
|
2009-08-07 03:46:44 +00:00
|
|
|
FramebufferNativeWindow* w;
|
|
|
|
w = new FramebufferNativeWindow();
|
|
|
|
if (w->getDevice() == NULL) {
|
|
|
|
// get a ref so it can be destroyed when we exit this block
|
|
|
|
sp<FramebufferNativeWindow> ref(w);
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-11-17 20:03:59 +00:00
|
|
|
return static_cast<EGLNativeWindowType>(w);
|
2009-04-10 21:24:30 +00:00
|
|
|
}
|