Merge "Make sure RGB_565 config is available to emulator"
This commit is contained in:
@@ -105,6 +105,44 @@ EglConfig::EglConfig(EGLint red_size,
|
|||||||
m_nativeFormat(conf.m_nativeFormat) {};
|
m_nativeFormat(conf.m_nativeFormat) {};
|
||||||
|
|
||||||
|
|
||||||
|
EglConfig::EglConfig(const EglConfig& conf,
|
||||||
|
EGLint config_id,
|
||||||
|
EGLint red_size,
|
||||||
|
EGLint green_size,
|
||||||
|
EGLint blue_size,
|
||||||
|
EGLint alpha_size):
|
||||||
|
|
||||||
|
m_buffer_size(red_size + green_size + blue_size + alpha_size),
|
||||||
|
m_red_size(red_size),
|
||||||
|
m_green_size(green_size),
|
||||||
|
m_blue_size(blue_size),
|
||||||
|
m_alpha_size(alpha_size),
|
||||||
|
m_bind_to_tex_rgb(conf.m_bind_to_tex_rgb),
|
||||||
|
m_bind_to_tex_rgba(conf.m_bind_to_tex_rgba),
|
||||||
|
m_caveat(conf.m_caveat),
|
||||||
|
m_config_id(config_id),
|
||||||
|
m_frame_buffer_level(conf.m_frame_buffer_level),
|
||||||
|
m_depth_size(conf.m_depth_size),
|
||||||
|
m_max_pbuffer_width(conf.m_max_pbuffer_width),
|
||||||
|
m_max_pbuffer_height(conf.m_max_pbuffer_height),
|
||||||
|
m_max_pbuffer_size(conf.m_max_pbuffer_size),
|
||||||
|
m_max_swap_interval(conf.m_max_swap_interval),
|
||||||
|
m_min_swap_interval(conf.m_min_swap_interval),
|
||||||
|
m_native_renderable(conf.m_native_renderable),
|
||||||
|
m_renderable_type(conf.m_renderable_type),
|
||||||
|
m_native_visual_id(conf.m_native_visual_id),
|
||||||
|
m_native_visual_type(conf.m_native_visual_type),
|
||||||
|
m_sample_buffers_num(conf.m_sample_buffers_num),
|
||||||
|
m_samples_per_pixel(conf.m_samples_per_pixel),
|
||||||
|
m_stencil_size(conf.m_stencil_size),
|
||||||
|
m_surface_type(conf.m_surface_type),
|
||||||
|
m_transparent_type(conf.m_transparent_type),
|
||||||
|
m_trans_red_val(conf.m_trans_red_val),
|
||||||
|
m_trans_green_val(conf.m_trans_green_val),
|
||||||
|
m_trans_blue_val(conf.m_trans_blue_val),
|
||||||
|
m_conformant(conf.m_conformant),
|
||||||
|
m_nativeFormat(conf.m_nativeFormat) {};
|
||||||
|
|
||||||
|
|
||||||
bool EglConfig::getConfAttrib(EGLint attrib,EGLint* val) const {
|
bool EglConfig::getConfAttrib(EGLint attrib,EGLint* val) const {
|
||||||
switch(attrib) {
|
switch(attrib) {
|
||||||
|
|||||||
@@ -60,6 +60,12 @@ public:
|
|||||||
|
|
||||||
EglConfig(const EglConfig& conf);
|
EglConfig(const EglConfig& conf);
|
||||||
|
|
||||||
|
EglConfig(const EglConfig& conf,
|
||||||
|
EGLint config_id,
|
||||||
|
EGLint red_size,
|
||||||
|
EGLint green_size,
|
||||||
|
EGLint blue_size,
|
||||||
|
EGLint alpha_size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -67,9 +67,52 @@ static bool compareEglConfigsPtrs(EglConfig* first,EglConfig* second) {
|
|||||||
return *first < *second ;
|
return *first < *second ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EglDisplay::addMissingConfigs(void)
|
||||||
|
{
|
||||||
|
m_configs.sort(compareEglConfigsPtrs);
|
||||||
|
|
||||||
|
EGLConfig match;
|
||||||
|
EGLNativePixelFormatType tmpfrmt = PIXEL_FORMAT_INITIALIZER;
|
||||||
|
EglConfig dummy(5, 6, 5, 0, // RGB_565
|
||||||
|
EGL_DONT_CARE,EGL_DONT_CARE,
|
||||||
|
16, // Depth
|
||||||
|
EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,
|
||||||
|
EGL_DONT_CARE, EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,tmpfrmt);
|
||||||
|
|
||||||
|
if(!doChooseConfigs(dummy, &match, 1))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const EglConfig* config = (EglConfig*)match;
|
||||||
|
|
||||||
|
int bSize;
|
||||||
|
config->getConfAttrib(EGL_BUFFER_SIZE,&bSize);
|
||||||
|
|
||||||
|
if(bSize == 16)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int max_config_id = 0;
|
||||||
|
|
||||||
|
for(ConfigsList::iterator it = m_configs.begin(); it != m_configs.end() ;it++) {
|
||||||
|
EGLint id;
|
||||||
|
(*it)->getConfAttrib(EGL_CONFIG_ID, &id);
|
||||||
|
if(id > max_config_id)
|
||||||
|
max_config_id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
EglConfig* newConfig = new EglConfig(*config,max_config_id+1,5,6,5,0);
|
||||||
|
|
||||||
|
m_configs.push_back(newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
void EglDisplay::initConfigurations(int renderableType) {
|
void EglDisplay::initConfigurations(int renderableType) {
|
||||||
if(m_configInitialized) return;
|
if(m_configInitialized) return;
|
||||||
EglOS::queryConfigs(m_dpy,renderableType,m_configs);
|
EglOS::queryConfigs(m_dpy,renderableType,m_configs);
|
||||||
|
|
||||||
|
addMissingConfigs();
|
||||||
m_configs.sort(compareEglConfigsPtrs);
|
m_configs.sort(compareEglConfigsPtrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,6 +224,10 @@ int EglDisplay::getConfigs(EGLConfig* configs,int config_size) {
|
|||||||
|
|
||||||
int EglDisplay::chooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size) {
|
int EglDisplay::chooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size) {
|
||||||
android::Mutex::Autolock mutex(m_lock);
|
android::Mutex::Autolock mutex(m_lock);
|
||||||
|
return doChooseConfigs(dummy, configs, config_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
int EglDisplay::doChooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size) {
|
||||||
int added = 0;
|
int added = 0;
|
||||||
for(ConfigsList::iterator it = m_configs.begin(); it != m_configs.end() && (added < config_size || !configs);it++) {
|
for(ConfigsList::iterator it = m_configs.begin(); it != m_configs.end() && (added < config_size || !configs);it++) {
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ public:
|
|||||||
bool destroyImageKHR(EGLImageKHR img);
|
bool destroyImageKHR(EGLImageKHR img);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int doChooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size);
|
||||||
|
void addMissingConfigs(void);
|
||||||
void initConfigurations(int renderableType);
|
void initConfigurations(int renderableType);
|
||||||
|
|
||||||
EGLNativeDisplayType m_dpy;
|
EGLNativeDisplayType m_dpy;
|
||||||
|
|||||||
Reference in New Issue
Block a user