exynos4: build libEGL_mali from sources

* used a handcrafted assembly to replicate original functions
* fix invalid window format passed to libMali (RGBA vs BGRA fix)

Change-Id: Idc88c255e3280e11a35e552c40098ae967947108
This commit is contained in:
Shilin Victor 2019-03-02 16:08:32 +03:00
parent 8b1d6eb487
commit c1b4b30ccc
4 changed files with 368 additions and 1 deletions

View File

@ -18,7 +18,7 @@ ifeq ($(TARGET_SLSI_VARIANT),)
ifeq ($(TARGET_BOARD_PLATFORM),exynos4)
common_exynos4_dirs := libgralloc_ump libhwconverter libsecion libUMP libhwc
common_exynos4_dirs := libgralloc_ump libhwconverter libsecion libUMP libEGL_mali libhwc
ifneq ($(BOARD_USES_PROPRIETARY_LIBCAMERA),true)
common_exynos4_dirs += libcamera

View File

@ -0,0 +1,47 @@
#
# Copyright (C) 2019 The Android Open Source Project
# Copyright (C) 2019 The LineageOS 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.
#
ifeq ($(TARGET_BOARD_PLATFORM),exynos4)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_C_INCLUDES := \
frameworks/native/libs/nativewindow/include \
frameworks/native/libs/nativebase/include \
frameworks/native/libs/arect/include \
system/core/include
LOCAL_SHARED_LIBRARIES := liblog libcutils
LOCAL_CFLAGS := -DLOG_TAG=\"EGL_mali\"
ifeq ($(TARGET_NEEDS_NATIVE_WINDOW_FORMAT_FIX),true)
LOCAL_CFLAGS += -DNEEDS_NATIVE_WINDOW_FORMAT_FIX
endif
LOCAL_SRC_FILES := shim.S eglApi.cpp
LOCAL_SHARED_LIBRARIES := libMali
LOCAL_MODULE := libEGL_mali
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_RELATIVE_PATH := egl
include $(BUILD_SHARED_LIBRARY)
endif

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2019 The Android Open Source Project
* Copyright (C) 2019 The LineageOS 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 <system/graphics.h>
#include <system/window.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
extern "C" EGLBoolean shim_eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
EGLint attribute, EGLint *value);
extern "C" EGLSurface shim_eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
NativeWindowType window,
const EGLint *attrib_list);
EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
EGLint attribute, EGLint *value) {
return shim_eglGetConfigAttrib(dpy, config, attribute, value);
}
EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
NativeWindowType window,
const EGLint *attrib_list) {
#ifdef NEEDS_NATIVE_WINDOW_FORMAT_FIX
int format, err;
window->query(window, NATIVE_WINDOW_FORMAT, &format);
if (format == (int)HAL_PIXEL_FORMAT_RGBA_8888) {
format = (int)HAL_PIXEL_FORMAT_BGRA_8888;
err = window->perform(window, NATIVE_WINDOW_SET_BUFFERS_FORMAT, format);
}
#endif
return shim_eglCreateWindowSurface(dpy, config, window, attrib_list);
}

View File

@ -0,0 +1,271 @@
/*
* Copyright (C) 2019 The Android Open Source Project
* Copyright (C) 2019 The LineageOS 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.
*/
.globl eglGetConfigs
eglGetConfigs:
b shim_eglGetConfigs
.globl eglChooseConfig
eglChooseConfig:
b shim_eglChooseConfig
/*
.globl eglGetConfigAttrib
eglGetConfigAttrib:
b shim_eglGetConfigAttrib
*/
.globl eglGetError
eglGetError:
b shim_eglGetError
.globl eglQueryString
eglQueryString:
b shim_eglQueryString
.globl eglWaitClient
eglWaitClient:
b shim_eglWaitClient
.globl eglWaitGL
eglWaitGL:
b shim_eglWaitGL
.globl eglWaitNative
eglWaitNative:
b shim_eglWaitNative
.globl eglSwapBuffers
eglSwapBuffers:
b shim_eglSwapBuffers
.globl eglCopyBuffers
eglCopyBuffers:
b shim_eglCopyBuffers
.globl eglSwapInterval
eglSwapInterval:
b shim_eglSwapInterval
.globl eglBindTexImage
eglBindTexImage:
b shim_eglBindTexImage
.globl eglReleaseTexImage
eglReleaseTexImage:
b shim_eglReleaseTexImage
.globl eglBindAPI
eglBindAPI:
b shim_eglBindAPI
.globl eglQueryAPI
eglQueryAPI:
b shim_eglQueryAPI
.globl eglCreateContext
eglCreateContext:
b shim_eglCreateContext
.globl eglDestroyContext
eglDestroyContext:
b shim_eglDestroyContext
.globl eglQueryContext
eglQueryContext:
b shim_eglQueryContext
.globl eglMakeCurrent
eglMakeCurrent:
b shim_eglMakeCurrent
.globl eglGetCurrentContext
eglGetCurrentContext:
b shim_eglGetCurrentContext
.globl eglGetDisplay
eglGetDisplay:
b shim_eglGetDisplay
.globl eglGetCurrentDisplay
eglGetCurrentDisplay:
b shim_eglGetCurrentDisplay
.globl eglInitialize
eglInitialize:
b shim_eglInitialize
.globl eglTerminate
eglTerminate:
b shim_eglTerminate
/*.globl eglCreateWindowSurface
eglCreateWindowSurface:
b shim_eglCreateWindowSurface
*/
.globl eglCreatePbufferSurface
eglCreatePbufferSurface:
b shim_eglCreatePbufferSurface
.globl eglCreatePbufferFromClientBuffer
eglCreatePbufferFromClientBuffer:
b shim_eglCreatePbufferFromClientBuffer
.globl eglCreatePixmapSurface
eglCreatePixmapSurface:
b shim_eglCreatePixmapSurface
.globl eglDestroySurface
eglDestroySurface:
b shim_eglDestroySurface
.globl eglQuerySurface
eglQuerySurface:
b shim_eglQuerySurface
.globl eglSurfaceAttrib
eglSurfaceAttrib:
b shim_eglSurfaceAttrib
.globl eglGetCurrentSurface
eglGetCurrentSurface:
b shim_eglGetCurrentSurface
.globl eglReleaseThread
eglReleaseThread:
b shim_eglReleaseThread
.globl eglGetProcAddress
eglGetProcAddress:
b shim_eglGetProcAddress
.globl eglCreateSyncKHR
eglCreateSyncKHR:
b shim_eglCreateSyncKHR
.globl eglDestroySyncKHR
eglDestroySyncKHR:
b shim_eglDestroySyncKHR
.globl eglClientWaitSyncKHR
eglClientWaitSyncKHR:
b shim_eglClientWaitSyncKHR
.globl eglSignalSyncKHR
eglSignalSyncKHR:
b shim_eglSignalSyncKHR
.globl eglGetSyncAttribKHR
eglGetSyncAttribKHR:
b shim_eglGetSyncAttribKHR
.globl eglCreateImageKHR
eglCreateImageKHR:
b shim_eglCreateImageKHR
.globl eglDestroyImageKHR
eglDestroyImageKHR:
b shim_eglDestroyImageKHR
.globl eglSetBlobCacheFuncsANDROID
eglSetBlobCacheFuncsANDROID:
b shim_eglSetBlobCacheFuncsANDROID
.globl mali_egl_image_init
mali_egl_image_init:
b shim_mali_egl_image_init
.globl mali_egl_image_get_error
mali_egl_image_get_error:
b shim_mali_egl_image_get_error
.globl mali_egl_image_lock_ptr
mali_egl_image_lock_ptr:
b shim_mali_egl_image_lock_ptr
.globl mali_egl_image_unlock_ptr
mali_egl_image_unlock_ptr:
b shim_mali_egl_image_unlock_ptr
.globl mali_egl_image_set_data
mali_egl_image_set_data:
b shim_mali_egl_image_set_data
.globl mali_egl_image_get_width
mali_egl_image_get_width:
b shim_mali_egl_image_get_width
.globl mali_egl_image_get_height
mali_egl_image_get_height:
b shim_mali_egl_image_get_height
.globl mali_egl_image_get_format
mali_egl_image_get_format:
b shim_mali_egl_image_get_format
.globl mali_egl_image_get_miplevels
mali_egl_image_get_miplevels:
b shim_mali_egl_image_get_miplevels
.globl mali_egl_image_map_buffer
mali_egl_image_map_buffer:
b shim_mali_egl_image_map_buffer
.globl mali_egl_image_unmap_buffer
mali_egl_image_unmap_buffer:
b shim_mali_egl_image_unmap_buffer
.globl mali_egl_image_get_buffer_width
mali_egl_image_get_buffer_width:
b shim_mali_egl_image_get_buffer_width
.globl mali_egl_image_get_buffer_height
mali_egl_image_get_buffer_height:
b shim_mali_egl_image_get_buffer_height
.globl mali_egl_image_get_buffer_secure_id
mali_egl_image_get_buffer_secure_id:
b shim_mali_egl_image_get_buffer_secure_id
.globl mali_egl_image_get_buffer_layout
mali_egl_image_get_buffer_layout:
b shim_mali_egl_image_get_buffer_layout
.globl mali_egl_image_create_sync
mali_egl_image_create_sync:
b shim_mali_egl_image_create_sync
.globl mali_egl_image_set_sync
mali_egl_image_set_sync:
b shim_mali_egl_image_set_sync
.globl mali_egl_image_unset_sync
mali_egl_image_unset_sync:
b shim_mali_egl_image_unset_sync
.globl mali_egl_image_wait_sync
mali_egl_image_wait_sync:
b shim_mali_egl_image_wait_sync
.globl mali_egl_image_create
mali_egl_image_create:
b shim_mali_egl_image_create
.globl mali_egl_image_destroy
mali_egl_image_destroy:
b shim_mali_egl_image_destroy