diff --git a/meson.build b/meson.build index cec24c2873b1d44a47cca7c7cfd54a020aa4f683..a8c54811a97df3cd822f6aa51429851470779f60 100644 --- a/meson.build +++ b/meson.build @@ -278,7 +278,7 @@ endif _platforms = get_option('platforms') if _platforms.contains('auto') if system_has_kms_drm - _platforms = ['x11', 'wayland', 'drm', 'surfaceless'] + _platforms = ['x11', 'wayland', 'drm', 'surfaceless', 'ohos'] elif ['darwin', 'cygwin'].contains(host_machine.system()) _platforms = ['x11', 'surfaceless'] elif ['haiku'].contains(host_machine.system()) @@ -291,8 +291,6 @@ if _platforms.contains('auto') endif endif -# _platforms = ['ohos'] - with_platform_android = _platforms.contains('android') with_platform_x11 = _platforms.contains('x11') with_platform_wayland = _platforms.contains('wayland') diff --git a/oewm/build_mesa3d.py b/oewm/build_mesa3d.py index 05040e052386014087393fab325f932ce53841b6..4cedf49ab872c62a7c6b23d7bb3469156dba054b 100644 --- a/oewm/build_mesa3d.py +++ b/oewm/build_mesa3d.py @@ -67,7 +67,7 @@ meson_cmd = [ 'setup', mesa3d_dir, 'build-oewm', - '-Dplatforms=ohos', + '-Dplatforms=auto', # '-Degl-native-platform=ohos', # '-Ddri-drivers=', '-Dgallium-drivers=panfrost,swrast,zink,svga,r600', diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 1bec6ad6ac06f3907e3292e1e4dff1456a856fa2..fcfc61d988b8a1c0e5186c74b1595ca1714c4490 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -351,7 +351,7 @@ struct dri2_egl_surface struct { struct NativeWindowBuffer *buffer; int age; - } *color_buffers, *back; + } *color_buffers_ohos, *back_ohos; #endif /* surfaceless and device */ diff --git a/src/egl/drivers/dri2/platform_ohos.c b/src/egl/drivers/dri2/platform_ohos.c index 93c5b8715b515d009b2930e4759161830b5bf33a..449d0fe4b036013fab05885254c6ef11ac805da0 100644 --- a/src/egl/drivers/dri2/platform_ohos.c +++ b/src/egl/drivers/dri2/platform_ohos.c @@ -141,11 +141,11 @@ ohos_window_dequeue_buffer(struct dri2_egl_surface *dri2_surf) */ EGLBoolean updated = EGL_FALSE; for (int i = 0; i < dri2_surf->color_buffers_count; i++) { - if (!dri2_surf->color_buffers[i].buffer) { - dri2_surf->color_buffers[i].buffer = dri2_surf->buffer; + if (!dri2_surf->color_buffers_ohos[i].buffer) { + dri2_surf->color_buffers_ohos[i].buffer = dri2_surf->buffer; } - if (dri2_surf->color_buffers[i].buffer == dri2_surf->buffer) { - dri2_surf->back = &dri2_surf->color_buffers[i]; + if (dri2_surf->color_buffers_ohos[i].buffer == dri2_surf->buffer) { + dri2_surf->back_ohos = &dri2_surf->color_buffers_ohos[i]; updated = EGL_TRUE; break; } @@ -153,14 +153,14 @@ ohos_window_dequeue_buffer(struct dri2_egl_surface *dri2_surf) if (!updated) { /* In case of all the buffers were recreated by ANativeWindow, reset - * the color_buffers + * the color_buffers_ohos */ for (int i = 0; i < dri2_surf->color_buffers_count; i++) { - dri2_surf->color_buffers[i].buffer = NULL; - dri2_surf->color_buffers[i].age = 0; + dri2_surf->color_buffers_ohos[i].buffer = NULL; + dri2_surf->color_buffers_ohos[i].age = 0; } - dri2_surf->color_buffers[0].buffer = dri2_surf->buffer; - dri2_surf->back = &dri2_surf->color_buffers[0]; + dri2_surf->color_buffers_ohos[0].buffer = dri2_surf->buffer; + dri2_surf->back_ohos = &dri2_surf->color_buffers_ohos[0]; } return EGL_TRUE; @@ -196,7 +196,7 @@ ohos_window_enqueue_buffer(_EGLDisplay *disp, struct dri2_egl_surface *dri2_surf NativeWindowFlushBuffer(dri2_surf->window, dri2_surf->buffer, fence_fd, dirty); dri2_surf->buffer = NULL; - dri2_surf->back = NULL; + dri2_surf->back_ohos = NULL; mtx_lock(&disp->Mutex); @@ -265,9 +265,9 @@ ohos_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, /* Required buffer caching slots. */ int buffer_count = 3; // default use 3 buffer; - dri2_surf->color_buffers = calloc(buffer_count, - sizeof(*dri2_surf->color_buffers)); - if (!dri2_surf->color_buffers) { + dri2_surf->color_buffers_ohos = calloc(buffer_count, + sizeof(*dri2_surf->color_buffers_ohos)); + if (!dri2_surf->color_buffers_ohos) { _eglError(EGL_BAD_ALLOC, "ohos_create_surface"); goto cleanup_surface; } @@ -305,7 +305,7 @@ ohos_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, cleanup_surface: if (dri2_surf->color_buffers_count) - free(dri2_surf->color_buffers); + free(dri2_surf->color_buffers_ohos); free(dri2_surf); return NULL; @@ -358,7 +358,7 @@ ohos_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable); dri2_fini_surface(surf); - free(dri2_surf->color_buffers); + free(dri2_surf->color_buffers_ohos); free(dri2_surf); return EGL_TRUE; @@ -566,7 +566,7 @@ ohos_query_buffer_age(_EGLDriver *drv, return -1; } - return dri2_surf->back ? dri2_surf->back->age : 0; + return dri2_surf->back_ohos ? dri2_surf->back_ohos->age : 0; } static EGLBoolean @@ -590,15 +590,15 @@ ohos_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) } for (int i = 0; i < dri2_surf->color_buffers_count; i++) { - if (dri2_surf->color_buffers[i].age > 0) - dri2_surf->color_buffers[i].age++; + if (dri2_surf->color_buffers_ohos[i].age > 0) + dri2_surf->color_buffers_ohos[i].age++; } /* "XXX: we don't use get_back_bo() since it causes regressions in * several dEQP tests. */ - if (dri2_surf->back) - dri2_surf->back->age = 1; + if (dri2_surf->back_ohos) + dri2_surf->back_ohos->age = 1; dri2_flush_drawable_for_swapbuffers(disp, draw); @@ -1042,7 +1042,7 @@ ohos_display_shared_buffer(__DRIdrawable *driDrawable, int fence_fd, dri2_surf->base.Lost = true; dri2_surf->buffer = NULL; - dri2_surf->back = NULL; + dri2_surf->back_ohos = NULL; if (dri2_surf->dri_image_back) { dri2_dpy->image->destroyImage(dri2_surf->dri_image_back);