get rid of dependency on copybit HAL module
Change-Id: Ia608099a2426c11a91d33063ba53c93e1eccb428
This commit is contained in:
parent
e960d3a874
commit
9cdb01da71
|
@ -26,7 +26,6 @@
|
|||
#endif
|
||||
|
||||
#include <private/pixelflinger/ggl_context.h>
|
||||
#include <hardware/copybit.h>
|
||||
#include <hardware/gralloc.h>
|
||||
|
||||
#include <GLES/gl.h>
|
||||
|
@ -606,7 +605,6 @@ struct prims_t {
|
|||
|
||||
struct copybits_context_t {
|
||||
// A handle to the blit engine, if it exists, else NULL.
|
||||
copybit_device_t* blitEngine;
|
||||
int32_t minScale;
|
||||
int32_t maxScale;
|
||||
android_native_buffer_t* drawSurfaceBuffer;
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
#include <ui/Rect.h>
|
||||
|
||||
#include <hardware/copybit.h>
|
||||
|
||||
namespace android {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -183,27 +181,6 @@ Region& Region::operator -= (const Region& rhs) {
|
|||
Region& Region::operator += (const Point& pt) {
|
||||
return translateSelf(pt.x, pt.y);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
struct region_iterator : public copybit_region_t {
|
||||
region_iterator(const Region& region)
|
||||
: b(region.begin()), e(region.end()) {
|
||||
this->next = iterate;
|
||||
}
|
||||
private:
|
||||
static int iterate(copybit_region_t const * self, copybit_rect_t* rect) {
|
||||
region_iterator const* me = static_cast<region_iterator const*>(self);
|
||||
if (me->b != me->e) {
|
||||
*reinterpret_cast<Rect*>(rect) = *me->b++;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
mutable Region::const_iterator b;
|
||||
Region::const_iterator const e;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
}; // namespace android
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
|
||||
#include <private/ui/android_natives_priv.h>
|
||||
|
||||
#include <hardware/copybit.h>
|
||||
|
||||
#include "context.h"
|
||||
#include "state.h"
|
||||
#include "texture.h"
|
||||
|
@ -238,7 +236,6 @@ private:
|
|||
android_native_buffer_t* buffer;
|
||||
android_native_buffer_t* previousBuffer;
|
||||
gralloc_module_t const* module;
|
||||
copybit_device_t* blitengine;
|
||||
int width;
|
||||
int height;
|
||||
void* bits;
|
||||
|
@ -324,24 +321,6 @@ private:
|
|||
ssize_t count;
|
||||
};
|
||||
|
||||
struct region_iterator : public copybit_region_t {
|
||||
region_iterator(const Region& region)
|
||||
: b(region.begin()), e(region.end()) {
|
||||
this->next = iterate;
|
||||
}
|
||||
private:
|
||||
static int iterate(copybit_region_t const * self, copybit_rect_t* rect) {
|
||||
region_iterator const* me = static_cast<region_iterator const*>(self);
|
||||
if (me->b != me->e) {
|
||||
*reinterpret_cast<Rect*>(rect) = *me->b++;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
mutable Region::const_iterator b;
|
||||
Region::const_iterator const e;
|
||||
};
|
||||
|
||||
void copyBlt(
|
||||
android_native_buffer_t* dst, void* dst_vaddr,
|
||||
android_native_buffer_t* src, void const* src_vaddr,
|
||||
|
@ -357,16 +336,8 @@ egl_window_surface_v2_t::egl_window_surface_v2_t(EGLDisplay dpy,
|
|||
ANativeWindow* window)
|
||||
: egl_surface_t(dpy, config, depthFormat),
|
||||
nativeWindow(window), buffer(0), previousBuffer(0), module(0),
|
||||
blitengine(0), bits(NULL)
|
||||
bits(NULL)
|
||||
{
|
||||
hw_module_t const* pModule;
|
||||
hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule);
|
||||
module = reinterpret_cast<gralloc_module_t const*>(pModule);
|
||||
|
||||
if (hw_get_module(COPYBIT_HARDWARE_MODULE_ID, &pModule) == 0) {
|
||||
copybit_open(pModule, &blitengine);
|
||||
}
|
||||
|
||||
pixelFormatTable = gglGetPixelFormatTable();
|
||||
|
||||
// keep a reference on the window
|
||||
|
@ -383,9 +354,6 @@ egl_window_surface_v2_t::~egl_window_surface_v2_t() {
|
|||
previousBuffer->common.decRef(&previousBuffer->common);
|
||||
}
|
||||
nativeWindow->common.decRef(&nativeWindow->common);
|
||||
if (blitengine) {
|
||||
copybit_close(blitengine);
|
||||
}
|
||||
}
|
||||
|
||||
EGLBoolean egl_window_surface_v2_t::connect()
|
||||
|
@ -475,32 +443,6 @@ void egl_window_surface_v2_t::copyBlt(
|
|||
// FIXME: use copybit if possible
|
||||
// NOTE: dst and src must be the same format
|
||||
|
||||
status_t err = NO_ERROR;
|
||||
copybit_device_t* const copybit = blitengine;
|
||||
if (copybit) {
|
||||
copybit_image_t simg;
|
||||
simg.w = src->stride;
|
||||
simg.h = src->height;
|
||||
simg.format = src->format;
|
||||
simg.handle = const_cast<native_handle_t*>(src->handle);
|
||||
|
||||
copybit_image_t dimg;
|
||||
dimg.w = dst->stride;
|
||||
dimg.h = dst->height;
|
||||
dimg.format = dst->format;
|
||||
dimg.handle = const_cast<native_handle_t*>(dst->handle);
|
||||
|
||||
copybit->set_parameter(copybit, COPYBIT_TRANSFORM, 0);
|
||||
copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 255);
|
||||
copybit->set_parameter(copybit, COPYBIT_DITHER, COPYBIT_DISABLE);
|
||||
region_iterator it(clip);
|
||||
err = copybit->blit(copybit, &dimg, &simg, &it);
|
||||
if (err != NO_ERROR) {
|
||||
LOGE("copybit failed (%s)", strerror(err));
|
||||
}
|
||||
}
|
||||
|
||||
if (!copybit || err) {
|
||||
Region::const_iterator cur = clip.begin();
|
||||
Region::const_iterator end = clip.end();
|
||||
|
||||
|
@ -529,7 +471,6 @@ void egl_window_surface_v2_t::copyBlt(
|
|||
s += sbpr;
|
||||
} while (--h > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EGLBoolean egl_window_surface_v2_t::swapBuffers()
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
**
|
||||
** Copyright 2007 The Android Open Source Project
|
||||
**
|
||||
** 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
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** 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
|
||||
** limitations under the License.
|
||||
*/
|
||||
**
|
||||
** Copyright 2007 The Android Open Source Project
|
||||
**
|
||||
** 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
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** 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
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include <private/ui/android_natives_priv.h>
|
||||
|
||||
#include <hardware/copybit.h>
|
||||
|
||||
#include "gles2context.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -139,7 +137,7 @@ protected:
|
|||
egl_surface_t::egl_surface_t(EGLDisplay dpy,
|
||||
EGLConfig config,
|
||||
int32_t depthFormat)
|
||||
: magic(MAGIC), dpy(dpy), config(config), ctx(0)
|
||||
: magic(MAGIC), dpy(dpy), config(config), ctx(0)
|
||||
{
|
||||
depth.version = sizeof(GGLSurface);
|
||||
depth.data = 0;
|
||||
|
@ -219,7 +217,6 @@ private:
|
|||
android_native_buffer_t* buffer;
|
||||
android_native_buffer_t* previousBuffer;
|
||||
gralloc_module_t const* module;
|
||||
copybit_device_t* blitengine;
|
||||
int width;
|
||||
int height;
|
||||
void* bits;
|
||||
|
@ -304,29 +301,11 @@ private:
|
|||
bool isEmpty() const {
|
||||
return count<=0;
|
||||
}
|
||||
private:
|
||||
private:
|
||||
Rect storage[4];
|
||||
ssize_t count;
|
||||
};
|
||||
|
||||
struct region_iterator : public copybit_region_t {
|
||||
region_iterator(const Region& region)
|
||||
: b(region.begin()), e(region.end()) {
|
||||
this->next = iterate;
|
||||
}
|
||||
private:
|
||||
static int iterate(copybit_region_t const * self, copybit_rect_t* rect) {
|
||||
region_iterator const* me = static_cast<region_iterator const*>(self);
|
||||
if (me->b != me->e) {
|
||||
*reinterpret_cast<Rect*>(rect) = *me->b++;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
mutable Region::const_iterator b;
|
||||
Region::const_iterator const e;
|
||||
};
|
||||
|
||||
void copyBlt(
|
||||
android_native_buffer_t* dst, void* dst_vaddr,
|
||||
android_native_buffer_t* src, void const* src_vaddr,
|
||||
|
@ -340,18 +319,10 @@ egl_window_surface_v2_t::egl_window_surface_v2_t(EGLDisplay dpy,
|
|||
EGLConfig config,
|
||||
int32_t depthFormat,
|
||||
ANativeWindow* window)
|
||||
: egl_surface_t(dpy, config, depthFormat),
|
||||
: egl_surface_t(dpy, config, depthFormat),
|
||||
nativeWindow(window), buffer(0), previousBuffer(0), module(0),
|
||||
blitengine(0), bits(NULL)
|
||||
bits(NULL)
|
||||
{
|
||||
hw_module_t const* pModule;
|
||||
hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule);
|
||||
module = reinterpret_cast<gralloc_module_t const*>(pModule);
|
||||
|
||||
if (hw_get_module(COPYBIT_HARDWARE_MODULE_ID, &pModule) == 0) {
|
||||
copybit_open(pModule, &blitengine);
|
||||
}
|
||||
|
||||
pixelFormatTable = gglGetPixelFormatTable();
|
||||
|
||||
// keep a reference on the window
|
||||
|
@ -361,7 +332,7 @@ egl_window_surface_v2_t::egl_window_surface_v2_t(EGLDisplay dpy,
|
|||
int format = 0;
|
||||
nativeWindow->query(nativeWindow, NATIVE_WINDOW_FORMAT, &format);
|
||||
LOGD("agl2: egl_window_surface_v2_t format=0x%.4X", format);
|
||||
// assert(0);
|
||||
// assert(0);
|
||||
}
|
||||
|
||||
egl_window_surface_v2_t::~egl_window_surface_v2_t()
|
||||
|
@ -373,9 +344,6 @@ egl_window_surface_v2_t::~egl_window_surface_v2_t()
|
|||
previousBuffer->common.decRef(&previousBuffer->common);
|
||||
}
|
||||
nativeWindow->common.decRef(&nativeWindow->common);
|
||||
if (blitengine) {
|
||||
copybit_close(blitengine);
|
||||
}
|
||||
}
|
||||
|
||||
EGLBoolean egl_window_surface_v2_t::connect()
|
||||
|
@ -467,32 +435,6 @@ void egl_window_surface_v2_t::copyBlt(
|
|||
// FIXME: use copybit if possible
|
||||
// NOTE: dst and src must be the same format
|
||||
|
||||
status_t err = NO_ERROR;
|
||||
copybit_device_t* const copybit = blitengine;
|
||||
if (copybit) {
|
||||
copybit_image_t simg;
|
||||
simg.w = src->stride;
|
||||
simg.h = src->height;
|
||||
simg.format = src->format;
|
||||
simg.handle = const_cast<native_handle_t*>(src->handle);
|
||||
|
||||
copybit_image_t dimg;
|
||||
dimg.w = dst->stride;
|
||||
dimg.h = dst->height;
|
||||
dimg.format = dst->format;
|
||||
dimg.handle = const_cast<native_handle_t*>(dst->handle);
|
||||
|
||||
copybit->set_parameter(copybit, COPYBIT_TRANSFORM, 0);
|
||||
copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 255);
|
||||
copybit->set_parameter(copybit, COPYBIT_DITHER, COPYBIT_DISABLE);
|
||||
region_iterator it(clip);
|
||||
err = copybit->blit(copybit, &dimg, &simg, &it);
|
||||
if (err != NO_ERROR) {
|
||||
LOGE("copybit failed (%s)", strerror(err));
|
||||
}
|
||||
}
|
||||
|
||||
if (!copybit || err) {
|
||||
Region::const_iterator cur = clip.begin();
|
||||
Region::const_iterator end = clip.end();
|
||||
|
||||
|
@ -521,7 +463,6 @@ void egl_window_surface_v2_t::copyBlt(
|
|||
s += sbpr;
|
||||
} while (--h > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EGLBoolean egl_window_surface_v2_t::swapBuffers()
|
||||
|
@ -703,7 +644,7 @@ egl_pixmap_surface_t::egl_pixmap_surface_t(EGLDisplay dpy,
|
|||
EGLConfig config,
|
||||
int32_t depthFormat,
|
||||
egl_native_pixmap_t const * pixmap)
|
||||
: egl_surface_t(dpy, config, depthFormat), nativePixmap(*pixmap)
|
||||
: egl_surface_t(dpy, config, depthFormat), nativePixmap(*pixmap)
|
||||
{
|
||||
if (depthFormat) {
|
||||
depth.width = pixmap->width;
|
||||
|
@ -771,7 +712,7 @@ private:
|
|||
egl_pbuffer_surface_t::egl_pbuffer_surface_t(EGLDisplay dpy,
|
||||
EGLConfig config, int32_t depthFormat,
|
||||
int32_t w, int32_t h, int32_t f)
|
||||
: egl_surface_t(dpy, config, depthFormat)
|
||||
: egl_surface_t(dpy, config, depthFormat)
|
||||
{
|
||||
size_t size = w*h;
|
||||
switch (f) {
|
||||
|
@ -879,48 +820,48 @@ struct extention_map_t {
|
|||
};
|
||||
|
||||
static const extention_map_t gExtentionMap[] = {
|
||||
// { "glDrawTexsOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexsOES },
|
||||
// { "glDrawTexiOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexiOES },
|
||||
// { "glDrawTexfOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexfOES },
|
||||
// { "glDrawTexxOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexxOES },
|
||||
// { "glDrawTexsvOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexsvOES },
|
||||
// { "glDrawTexivOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexivOES },
|
||||
// { "glDrawTexfvOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexfvOES },
|
||||
// { "glDrawTexxvOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexxvOES },
|
||||
// { "glQueryMatrixxOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glQueryMatrixxOES },
|
||||
// { "glEGLImageTargetTexture2DOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glEGLImageTargetTexture2DOES },
|
||||
// { "glEGLImageTargetRenderbufferStorageOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glEGLImageTargetRenderbufferStorageOES },
|
||||
// { "glClipPlanef",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glClipPlanef },
|
||||
// { "glClipPlanex",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glClipPlanex },
|
||||
// { "glBindBuffer",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glBindBuffer },
|
||||
// { "glBufferData",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glBufferData },
|
||||
// { "glBufferSubData",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glBufferSubData },
|
||||
// { "glDeleteBuffers",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDeleteBuffers },
|
||||
// { "glGenBuffers",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glGenBuffers },
|
||||
// { "eglCreateImageKHR",
|
||||
// (__eglMustCastToProperFunctionPointerType)&eglCreateImageKHR },
|
||||
// { "eglDestroyImageKHR",
|
||||
// (__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR },
|
||||
// { "eglSetSwapRectangleANDROID",
|
||||
// (__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID },
|
||||
// { "glDrawTexsOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexsOES },
|
||||
// { "glDrawTexiOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexiOES },
|
||||
// { "glDrawTexfOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexfOES },
|
||||
// { "glDrawTexxOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexxOES },
|
||||
// { "glDrawTexsvOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexsvOES },
|
||||
// { "glDrawTexivOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexivOES },
|
||||
// { "glDrawTexfvOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexfvOES },
|
||||
// { "glDrawTexxvOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDrawTexxvOES },
|
||||
// { "glQueryMatrixxOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glQueryMatrixxOES },
|
||||
// { "glEGLImageTargetTexture2DOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glEGLImageTargetTexture2DOES },
|
||||
// { "glEGLImageTargetRenderbufferStorageOES",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glEGLImageTargetRenderbufferStorageOES },
|
||||
// { "glClipPlanef",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glClipPlanef },
|
||||
// { "glClipPlanex",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glClipPlanex },
|
||||
// { "glBindBuffer",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glBindBuffer },
|
||||
// { "glBufferData",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glBufferData },
|
||||
// { "glBufferSubData",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glBufferSubData },
|
||||
// { "glDeleteBuffers",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glDeleteBuffers },
|
||||
// { "glGenBuffers",
|
||||
// (__eglMustCastToProperFunctionPointerType)&glGenBuffers },
|
||||
// { "eglCreateImageKHR",
|
||||
// (__eglMustCastToProperFunctionPointerType)&eglCreateImageKHR },
|
||||
// { "eglDestroyImageKHR",
|
||||
// (__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR },
|
||||
// { "eglSetSwapRectangleANDROID",
|
||||
// (__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID },
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1067,8 +1008,8 @@ static configs_t const gConfigs[] = {
|
|||
{ config_3_attribute_list, NELEM(config_3_attribute_list) },
|
||||
{ config_4_attribute_list, NELEM(config_4_attribute_list) },
|
||||
{ config_5_attribute_list, NELEM(config_5_attribute_list) },
|
||||
// { config_6_attribute_list, NELEM(config_6_attribute_list) },
|
||||
// { config_7_attribute_list, NELEM(config_7_attribute_list) },
|
||||
// { config_6_attribute_list, NELEM(config_6_attribute_list) },
|
||||
// { config_7_attribute_list, NELEM(config_7_attribute_list) },
|
||||
};
|
||||
|
||||
static config_management_t const gConfigManagement[] = {
|
||||
|
@ -2001,7 +1942,7 @@ EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
|
|||
float elapsed = (float)(time - c->lastSwapTime) / CLOCKS_PER_SEC;
|
||||
c->accumulateSeconds += elapsed;
|
||||
c->frame++;
|
||||
// LOGD("agl2: eglSwapBuffers elapsed=%.2fms \n*", elapsed * 1000);
|
||||
// LOGD("agl2: eglSwapBuffers elapsed=%.2fms \n*", elapsed * 1000);
|
||||
if (20 == c->frame) {
|
||||
float avg = c->accumulateSeconds / c->frame;
|
||||
LOGD("\n*\n* agl2: eglSwapBuffers %u frame avg fps=%.1f elapsed=%.2fms \n*",
|
||||
|
@ -2129,7 +2070,7 @@ EGLSurface eglCreatePbufferFromClientBuffer(
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
void (*eglGetProcAddress (const char *procname))()
|
||||
{
|
||||
{
|
||||
extention_map_t const * const map = gExtentionMap;
|
||||
for (uint32_t i=0 ; i<NELEM(gExtentionMap) ; i++) {
|
||||
if (!strcmp(procname, map[i].name)) {
|
||||
|
@ -2137,7 +2078,7 @@ void (*eglGetProcAddress (const char *procname))()
|
|||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy, EGLSurface surface,
|
||||
const EGLint *attrib_list)
|
||||
|
|
Loading…
Reference in New Issue