From 4c51a0f6eba0aee7b959a81b7034dbdf764e53ec Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 11 Jul 2021 19:55:32 +0200 Subject: [PATCH] render/egl: rename wlr_egl.exts to better match Khronos Khronos refers to extensions with their namespace as a prefix in uppercase. Change our naming to align with Khronos conventions. This also makes grepping easier. --- include/wlr/render/egl.h | 8 ++++---- render/egl.c | 24 ++++++++++++------------ render/gles2/renderer.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index c92364f5..4a474062 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -37,12 +37,12 @@ struct wlr_egl { struct { // Display extensions - bool image_base_khr; - bool image_dmabuf_import_ext; - bool image_dmabuf_import_modifiers_ext; + bool KHR_image_base; + bool EXT_image_dma_buf_import; + bool EXT_image_dma_buf_import_modifiers; // Device extensions - bool device_drm_ext; + bool EXT_device_drm; } exts; struct { diff --git a/render/egl.c b/render/egl.c index 3eae5a3d..9a3ce29c 100644 --- a/render/egl.c +++ b/render/egl.c @@ -230,16 +230,16 @@ struct wlr_egl *wlr_egl_create_with_drm_fd(int drm_fd) { } if (check_egl_ext(display_exts_str, "EGL_KHR_image_base")) { - egl->exts.image_base_khr = true; + egl->exts.KHR_image_base = true; load_egl_proc(&egl->procs.eglCreateImageKHR, "eglCreateImageKHR"); load_egl_proc(&egl->procs.eglDestroyImageKHR, "eglDestroyImageKHR"); } - egl->exts.image_dmabuf_import_ext = + egl->exts.EXT_image_dma_buf_import = check_egl_ext(display_exts_str, "EGL_EXT_image_dma_buf_import"); if (check_egl_ext(display_exts_str, "EGL_EXT_image_dma_buf_import_modifiers")) { - egl->exts.image_dmabuf_import_modifiers_ext = true; + egl->exts.EXT_image_dma_buf_import_modifiers = true; load_egl_proc(&egl->procs.eglQueryDmaBufFormatsEXT, "eglQueryDmaBufFormatsEXT"); load_egl_proc(&egl->procs.eglQueryDmaBufModifiersEXT, @@ -287,7 +287,7 @@ struct wlr_egl *wlr_egl_create_with_drm_fd(int drm_fd) { } #endif - egl->exts.device_drm_ext = + egl->exts.EXT_device_drm = check_egl_ext(device_exts_str, "EGL_EXT_device_drm"); } @@ -390,7 +390,7 @@ void wlr_egl_destroy(struct wlr_egl *egl) { } bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImage image) { - if (!egl->exts.image_base_khr) { + if (!egl->exts.KHR_image_base) { return false; } if (!image) { @@ -448,7 +448,7 @@ bool wlr_egl_restore_context(struct wlr_egl_context *context) { EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, struct wlr_dmabuf_attributes *attributes, bool *external_only) { - if (!egl->exts.image_base_khr || !egl->exts.image_dmabuf_import_ext) { + if (!egl->exts.KHR_image_base || !egl->exts.EXT_image_dma_buf_import) { wlr_log(WLR_ERROR, "dmabuf import extension not present"); return NULL; } @@ -461,7 +461,7 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, // have here if (attributes->modifier != DRM_FORMAT_MOD_INVALID && attributes->modifier != DRM_FORMAT_MOD_LINEAR) { - if (!egl->exts.image_dmabuf_import_modifiers_ext) { + if (!egl->exts.EXT_image_dma_buf_import_modifiers) { wlr_log(WLR_ERROR, "dmabuf modifiers extension not present"); return NULL; } @@ -541,7 +541,7 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, } static int get_egl_dmabuf_formats(struct wlr_egl *egl, int **formats) { - if (!egl->exts.image_dmabuf_import_ext) { + if (!egl->exts.EXT_image_dma_buf_import) { wlr_log(WLR_DEBUG, "DMA-BUF import extension not present"); return -1; } @@ -551,7 +551,7 @@ static int get_egl_dmabuf_formats(struct wlr_egl *egl, int **formats) { // supported; it's the intended way to just try to create buffers. // Just a guess but better than not supporting dmabufs at all, // given that the modifiers extension isn't supported everywhere. - if (!egl->exts.image_dmabuf_import_modifiers_ext) { + if (!egl->exts.EXT_image_dma_buf_import_modifiers) { static const int fallback_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888, @@ -594,11 +594,11 @@ static int get_egl_dmabuf_modifiers(struct wlr_egl *egl, int format, *modifiers = NULL; *external_only = NULL; - if (!egl->exts.image_dmabuf_import_ext) { + if (!egl->exts.EXT_image_dma_buf_import) { wlr_log(WLR_DEBUG, "DMA-BUF extension not present"); return -1; } - if (!egl->exts.image_dmabuf_import_modifiers_ext) { + if (!egl->exts.EXT_image_dma_buf_import_modifiers) { return 0; } @@ -707,7 +707,7 @@ static char *get_render_name(const char *name) { } int wlr_egl_dup_drm_fd(struct wlr_egl *egl) { - if (egl->device == EGL_NO_DEVICE_EXT || !egl->exts.device_drm_ext) { + if (egl->device == EGL_NO_DEVICE_EXT || !egl->exts.EXT_device_drm) { return -1; } diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 7ca08d9f..7ef076c5 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -744,7 +744,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) { wlr_log(WLR_INFO, "GL renderer: %s", glGetString(GL_RENDERER)); wlr_log(WLR_INFO, "Supported GLES2 extensions: %s", exts_str); - if (!renderer->egl->exts.image_dmabuf_import_ext) { + if (!renderer->egl->exts.EXT_image_dma_buf_import) { wlr_log(WLR_ERROR, "EGL_EXT_image_dma_buf_import not supported"); free(renderer); return NULL;