mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-22 23:10:04 +00:00
adpt OH
Signed-off-by: zleoyu <zhangleiyu1@huawei.com>
This commit is contained in:
parent
50b0bb6735
commit
5a3d6e0173
22
meson.build
22
meson.build
@ -346,10 +346,11 @@ with_platform_x11 = _platforms.contains('x11')
|
||||
with_platform_wayland = _platforms.contains('wayland')
|
||||
with_platform_haiku = _platforms.contains('haiku')
|
||||
with_platform_windows = _platforms.contains('windows')
|
||||
with_platform_ohos = _platforms.contains('ohos')
|
||||
|
||||
with_glx = get_option('glx')
|
||||
if with_glx == 'auto'
|
||||
if with_platform_android
|
||||
if with_platform_android or with_platform_ohos
|
||||
with_glx = 'disabled'
|
||||
elif with_dri
|
||||
with_glx = 'dri'
|
||||
@ -482,7 +483,7 @@ endif
|
||||
|
||||
if with_egl
|
||||
_platforms += 'surfaceless'
|
||||
if with_gbm and not with_platform_android
|
||||
if with_gbm and not with_platform_android and not with_platform_ohos
|
||||
_platforms += 'drm'
|
||||
endif
|
||||
|
||||
@ -1006,7 +1007,18 @@ if with_platform_android
|
||||
]
|
||||
endif
|
||||
|
||||
prog_python = import('python').find_installation('python3')
|
||||
if with_platform_ohos
|
||||
pre_args += '-DHAVE_OHOS_PLATFORM'
|
||||
dep_ohos = [
|
||||
dependency('libsurface'),
|
||||
dependency('libhilog'),
|
||||
]
|
||||
c_args += '-I../ohos'
|
||||
endif
|
||||
|
||||
#prog_python = import('python').find_installation('python3')
|
||||
prog_python = '/usr/bin/python3'
|
||||
|
||||
has_mako = run_command(
|
||||
prog_python, '-c',
|
||||
'''
|
||||
@ -1682,6 +1694,10 @@ foreach d : _libdrm_checks
|
||||
endif
|
||||
endforeach
|
||||
|
||||
dep_hilog = dependency(
|
||||
'libhilog'
|
||||
)
|
||||
|
||||
with_gallium_drisw_kms = false
|
||||
dep_libdrm = dependency(
|
||||
'libdrm', version : '>=' + _drm_ver,
|
||||
|
@ -23,7 +23,7 @@ option(
|
||||
type : 'array',
|
||||
value : ['auto'],
|
||||
choices : [
|
||||
'auto', 'x11', 'wayland', 'haiku', 'android', 'windows', 'ohos'
|
||||
'auto', 'x11', 'wayland', 'haiku', 'android', 'windows', 'ohos',
|
||||
],
|
||||
description : 'window systems to support. If this is set to `auto`, all platforms applicable will be enabled.'
|
||||
)
|
||||
@ -33,7 +33,7 @@ option(
|
||||
value : 'auto',
|
||||
choices : [
|
||||
'auto', 'x11', 'wayland', 'haiku', 'android', 'windows',
|
||||
'surfaceless', 'drm', 'ohos'
|
||||
'surfaceless', 'drm', 'ohos',
|
||||
],
|
||||
description : 'the window system EGL assumes for EGL_DEFAULT_DISPLAY',
|
||||
)
|
||||
|
@ -71,6 +71,8 @@
|
||||
#include "util/driconf.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include "ohos_log.h"
|
||||
|
||||
#define NUM_ATTRIBS 12
|
||||
|
||||
static const struct dri2_pbuffer_visual {
|
||||
@ -1928,6 +1930,7 @@ dri2_surface_get_dri_drawable(_EGLSurface *surf)
|
||||
static _EGLProc
|
||||
dri2_get_proc_address(const char *procname)
|
||||
{
|
||||
DISPLAY_LOGI("procname = %{public}s", procname);
|
||||
return _glapi_get_proc_address(procname);
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,10 @@ struct zwp_linux_dmabuf_feedback_v1;
|
||||
#include <system/window.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OHOS_PLATFORM
|
||||
#include "window.h"
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_ANDROID_PLATFORM */
|
||||
|
||||
#include "eglconfig.h"
|
||||
@ -364,9 +368,9 @@ struct dri2_egl_surface
|
||||
} color_buffers[4], *back, *current;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ANDROID_PLATFORM
|
||||
struct ANativeWindow *window;
|
||||
struct ANativeWindowBuffer *buffer;
|
||||
#if defined(HAVE_ANDROID_PLATFORM) || defined (HAVE_OHOS_PLATFORM)
|
||||
struct NativeWindow *window;
|
||||
struct NativeWindowBuffer *buffer;
|
||||
|
||||
/* in-fence associated with buffer, -1 once passed down to dri layer: */
|
||||
int in_fence_fd;
|
||||
@ -380,7 +384,7 @@ struct dri2_egl_surface
|
||||
*/
|
||||
int color_buffers_count;
|
||||
struct {
|
||||
struct ANativeWindowBuffer *buffer;
|
||||
struct NativeWindowBuffer *buffer;
|
||||
int age;
|
||||
} *color_buffers, *back;
|
||||
uint32_t gralloc_usage;
|
||||
@ -559,6 +563,17 @@ dri2_initialize_android(_EGLDisplay *disp)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OHOS_PLATFORM
|
||||
EGLBoolean
|
||||
dri2_initialize_ohos(_EGLDisplay *disp);
|
||||
#else
|
||||
static inline EGLBoolean
|
||||
dri2_initialize_ohos(_EGLDisplay *disp)
|
||||
{
|
||||
return _eglError(EGL_NOT_INITIALIZED, "ohos platform not built");
|
||||
}
|
||||
#endif
|
||||
|
||||
EGLBoolean
|
||||
dri2_initialize_surfaceless(_EGLDisplay *disp);
|
||||
|
||||
|
@ -104,7 +104,7 @@ static int get_fourcc(int native)
|
||||
case PIXEL_FMT_RGBX_8888:
|
||||
return DRM_FORMAT_XBGR8888;
|
||||
default:
|
||||
_eglLog(_EGL_WARNING, "unsupported native buffer format 0x%x", native);
|
||||
_eglLog(_EGL_WARNING, "unsupported native buffer format 0x%{public}x", native);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -372,7 +372,7 @@ ohos_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
|
||||
dri2_surf->color_buffers_count = buffer_count;
|
||||
|
||||
if (format != dri2_conf->base.NativeVisualID) {
|
||||
_eglLog(_EGL_WARNING, "Native format mismatch: 0x%x != 0x%x",
|
||||
_eglLog(_EGL_WARNING, "Native format mismatch: 0x%{public}x != 0x%{public}x",
|
||||
format, dri2_conf->base.NativeVisualID);
|
||||
}
|
||||
|
||||
@ -439,13 +439,13 @@ ohos_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
||||
}
|
||||
|
||||
if (dri2_surf->dri_image_back) {
|
||||
_eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_back", __func__, __LINE__);
|
||||
_eglLog(_EGL_DEBUG, "%{public}s : %{public}d : destroy dri_image_back", __func__, __LINE__);
|
||||
dri2_dpy->image->destroyImage(dri2_surf->dri_image_back);
|
||||
dri2_surf->dri_image_back = NULL;
|
||||
}
|
||||
|
||||
if (dri2_surf->dri_image_front) {
|
||||
_eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_front", __func__, __LINE__);
|
||||
_eglLog(_EGL_DEBUG, "%{public}s : %{public}d : destroy dri_image_front", __func__, __LINE__);
|
||||
dri2_dpy->image->destroyImage(dri2_surf->dri_image_front);
|
||||
dri2_surf->dri_image_front = NULL;
|
||||
}
|
||||
@ -656,7 +656,7 @@ ohos_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw)
|
||||
if (has_mutable_rb &&
|
||||
draw->RequestedRenderBuffer == EGL_SINGLE_BUFFER &&
|
||||
draw->ActiveRenderBuffer == EGL_SINGLE_BUFFER) {
|
||||
_eglLog(_EGL_DEBUG, "%s: remain in shared buffer mode", __func__);
|
||||
_eglLog(_EGL_DEBUG, "%{public}s: remain in shared buffer mode", __func__);
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
@ -908,7 +908,7 @@ ohos_add_configs_for_visuals(_EGLDisplay *disp)
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(format_count); i++) {
|
||||
if (!format_count[i]) {
|
||||
_eglLog(_EGL_DEBUG, "No DRI config supports native format 0x%x",
|
||||
_eglLog(_EGL_DEBUG, "No DRI config supports native format 0x%{public}x",
|
||||
visuals[i].format);
|
||||
}
|
||||
}
|
||||
@ -947,7 +947,7 @@ ohos_display_shared_buffer(__DRIdrawable *driDrawable, int fence_fd,
|
||||
struct ANativeWindowBuffer *old_buffer UNUSED = dri2_surf->buffer;
|
||||
|
||||
if (!_eglSurfaceInSharedBufferMode(&dri2_surf->base)) {
|
||||
_eglLog(_EGL_WARNING, "%s: internal error: buffer is not shared",
|
||||
_eglLog(_EGL_WARNING, "%{public}s: internal error: buffer is not shared",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
@ -967,7 +967,7 @@ ohos_display_shared_buffer(__DRIdrawable *driDrawable, int fence_fd,
|
||||
|
||||
if (ANativeWindow_queueBuffer(dri2_surf->window, dri2_surf->buffer,
|
||||
fence_fd)) {
|
||||
_eglLog(_EGL_WARNING, "%s: ANativeWindow_queueBuffer failed", __func__);
|
||||
_eglLog(_EGL_WARNING, "%{public}s: ANativeWindow_queueBuffer failed", __func__);
|
||||
close(fence_fd);
|
||||
return;
|
||||
}
|
||||
@ -980,7 +980,7 @@ ohos_display_shared_buffer(__DRIdrawable *driDrawable, int fence_fd,
|
||||
struct dri2_egl_display *dri2_dpy =
|
||||
dri2_egl_display(dri2_surf->base.Resource.Display);
|
||||
|
||||
_eglLog(_EGL_WARNING, "%s: ANativeWindow_dequeueBuffer failed", __func__);
|
||||
_eglLog(_EGL_WARNING, "%{public}s: ANativeWindow_dequeueBuffer failed", __func__);
|
||||
|
||||
dri2_surf->base.Lost = true;
|
||||
dri2_surf->buffer = NULL;
|
||||
@ -1168,7 +1168,7 @@ ohos_open_device(_EGLDisplay *disp, bool swrast)
|
||||
#endif
|
||||
|
||||
num_devices = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
|
||||
_eglLog(_EGL_WARNING, "ohos_open_device %d", num_devices);
|
||||
_eglLog(_EGL_WARNING, "ohos_open_device %{public}d", num_devices);
|
||||
if (num_devices < 0) {
|
||||
return EGL_FALSE;
|
||||
}
|
||||
@ -1183,7 +1183,7 @@ ohos_open_device(_EGLDisplay *disp, bool swrast)
|
||||
dri2_dpy->fd = loader_open_device(device->nodes[node_type]);
|
||||
if (dri2_dpy->fd < 0) {
|
||||
DISPLAY_LOGI();
|
||||
_eglLog(_EGL_WARNING, "%s() Failed to open DRM device %s",
|
||||
_eglLog(_EGL_WARNING, "%{public}s() Failed to open DRM device %{public}s",
|
||||
__func__, device->nodes[node_type]);
|
||||
continue;
|
||||
}
|
||||
@ -1191,7 +1191,7 @@ ohos_open_device(_EGLDisplay *disp, bool swrast)
|
||||
/* If a vendor is explicitly provided, we use only that.
|
||||
* Otherwise we fall-back the first device that is supported.
|
||||
*/
|
||||
DISPLAY_LOGI("vendor_name %s", vendor_name);
|
||||
DISPLAY_LOGI("vendor_name %{public}s", vendor_name);
|
||||
if (vendor_name) {
|
||||
if (ohos_filter_device(disp, dri2_dpy->fd, vendor_name)) {
|
||||
/* Device does not match - try next device */
|
||||
@ -1222,7 +1222,7 @@ ohos_open_device(_EGLDisplay *disp, bool swrast)
|
||||
DISPLAY_LOGI();
|
||||
if (dri2_dpy->fd < 0) {
|
||||
DISPLAY_LOGI();
|
||||
_eglLog(_EGL_WARNING, "Failed to open %s DRM device",
|
||||
_eglLog(_EGL_WARNING, "Failed to open %{public}s DRM device",
|
||||
vendor_name ? "desired" : "any");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
@ -408,9 +408,9 @@ _eglGetPlatformDisplayCommon(EGLenum platform, void *native_display,
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_OHOS_PLATFORM
|
||||
case EGL_PLATFORM_OHOS_KHR:
|
||||
disp = _eglGetOHOSDisplay(native_display, attrib_list);
|
||||
break;
|
||||
case EGL_PLATFORM_OHOS_KHR:
|
||||
disp = _eglGetOHOSDisplay(native_display, attrib_list);
|
||||
break;
|
||||
#endif
|
||||
case EGL_PLATFORM_DEVICE_EXT:
|
||||
disp = _eglGetDeviceDisplay(native_display, attrib_list);
|
||||
|
@ -68,6 +68,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Map build-system platform names to platform types.
|
||||
*/
|
||||
|
@ -136,12 +136,10 @@ if with_dri2
|
||||
override_for_egl += 'cpp_std=c++17'
|
||||
endif
|
||||
endif
|
||||
|
||||
if with_platform_ohos
|
||||
deps_for_egl += dep_ohos
|
||||
files_egl += files('drivers/dri2/platform_ohos.c')
|
||||
endif
|
||||
|
||||
elif with_platform_haiku
|
||||
incs_for_egl += inc_haikugl
|
||||
c_args_for_egl += [
|
||||
|
@ -124,6 +124,7 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
||||
case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
|
||||
case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
|
||||
case PIPE_CAP_SHADER_PACK_HALF_FLOAT:
|
||||
case PIPE_CAP_NATIVE_FENCE_FD:
|
||||
return 1;
|
||||
|
||||
case PIPE_CAP_MAX_RENDER_TARGETS:
|
||||
@ -789,6 +790,16 @@ panfrost_fence_reference(struct pipe_screen *pscreen,
|
||||
*ptr = fence;
|
||||
}
|
||||
|
||||
static int
|
||||
panfrost_fence_get_fd(struct pipe_screen *_screen,
|
||||
struct pipe_fence_handle *fence)
|
||||
{
|
||||
struct panfrost_device *dev = pan_device(_screen);
|
||||
int fd = -1;
|
||||
drmSyncobjExportSyncFile(dev->fd, fence->syncobj, &fd);
|
||||
return fd;
|
||||
}
|
||||
|
||||
static bool
|
||||
panfrost_fence_finish(struct pipe_screen *pscreen,
|
||||
struct pipe_context *ctx,
|
||||
|
@ -68,26 +68,59 @@
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#include "ohos_log.h"
|
||||
|
||||
static void default_logger(int level, const char *fmt, ...)
|
||||
{
|
||||
const int MAX_BUFFER_LEN = 1024;
|
||||
char log_string[MAX_BUFFER_LEN];
|
||||
if (level <= _LOADER_WARNING) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
DISPLAY_LOGI();
|
||||
}
|
||||
|
||||
static loader_logger *log_ = default_logger;
|
||||
static void ohos_logger(int level, const char *fmt, ...)
|
||||
{
|
||||
const int MAX_BUFFER_LEN = 1024;
|
||||
char log_string[MAX_BUFFER_LEN];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
(void)snprintf(log_string, MAX_BUFFER_LEN, fmt, args);
|
||||
va_end(args);
|
||||
switch (level) {
|
||||
case _LOADER_WARNING:
|
||||
DISPLAY_LOGW("%{public}s", log_string);
|
||||
break;
|
||||
case _LOADER_DEBUG:
|
||||
DISPLAY_LOGD("%{public}s", log_string);
|
||||
break;
|
||||
case _LOADER_FATAL:
|
||||
DISPLAY_LOGE("%{public}s", log_string);
|
||||
break;
|
||||
case _LOADER_INFO:
|
||||
DISPLAY_LOGI("%{public}s", log_string);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DISPLAY_LOGI();
|
||||
}
|
||||
|
||||
static loader_logger *log_ = ohos_logger;
|
||||
|
||||
int
|
||||
loader_open_device(const char *device_name)
|
||||
{
|
||||
log_(_LOADER_WARNING, "loader_open_device %s", device_name);
|
||||
int fd;
|
||||
#ifdef O_CLOEXEC
|
||||
fd = open(device_name, O_RDWR | O_CLOEXEC);
|
||||
if (fd == -1 && errno == EINVAL)
|
||||
#endif
|
||||
if (fd == -1 && errno == EINVAL)
|
||||
{
|
||||
fd = open(device_name, O_RDWR);
|
||||
if (fd != -1)
|
||||
@ -326,11 +359,14 @@ int loader_get_user_preferred_fd(int default_fd, bool *different_device)
|
||||
drmDevicePtr devices[MAX_DRM_DEVICES];
|
||||
int i, num_devices, fd = -1;
|
||||
|
||||
#ifdef USE_DRICONF
|
||||
if (dri_prime)
|
||||
prime = strdup(dri_prime);
|
||||
#ifdef USE_DRICONF
|
||||
else
|
||||
prime = loader_get_dri_config_device_id();
|
||||
#else
|
||||
if (dri_prime)
|
||||
prime = strdup(dri_prime);
|
||||
#endif
|
||||
|
||||
if (prime == NULL) {
|
||||
|
@ -92,7 +92,6 @@ build_id_find_nhdr_callback(struct dl_phdr_info *info, size_t size, void *data_)
|
||||
ALIGN_POT(note->nhdr.n_namesz, 4) +
|
||||
ALIGN_POT(note->nhdr.n_descsz, 4);
|
||||
note = (struct build_id_note *)((char *)note + offset);
|
||||
|
||||
// 05 00 00 00 04 00 00 00 4f 48 4f 53 00 01 00 00 00 00 00 00
|
||||
if (note->nhdr.n_type == 0x534f484f && note > 20) {
|
||||
// .note.ohos.ident is not a valid PT_NOTE section, use offset in section header later
|
||||
|
Loading…
Reference in New Issue
Block a user