From 50d2985607ced55e6e860ffd682a65b9a664192b Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Mon, 15 Mar 2021 12:35:47 -0400 Subject: [PATCH] Move render/shm_format functions to render/pixel_format --- include/render/pixel_format.h | 3 +++ include/render/shm_format.h | 9 --------- render/meson.build | 1 - render/pixel_format.c | 22 ++++++++++++++++++++++ render/shm_format.c | 24 ------------------------ render/wlr_renderer.c | 2 +- types/wlr_buffer.c | 2 +- types/wlr_screencopy_v1.c | 2 +- 8 files changed, 28 insertions(+), 37 deletions(-) delete mode 100644 include/render/shm_format.h delete mode 100644 render/shm_format.c diff --git a/include/render/pixel_format.h b/include/render/pixel_format.h index 8814bd82..471fa106 100644 --- a/include/render/pixel_format.h +++ b/include/render/pixel_format.h @@ -20,4 +20,7 @@ struct wlr_pixel_format_info { const struct wlr_pixel_format_info *drm_get_pixel_format_info(uint32_t fmt); +uint32_t convert_wl_shm_format_to_drm(enum wl_shm_format fmt); +enum wl_shm_format convert_drm_format_to_wl_shm(uint32_t fmt); + #endif diff --git a/include/render/shm_format.h b/include/render/shm_format.h deleted file mode 100644 index bf6c8679..00000000 --- a/include/render/shm_format.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef RENDER_SHM_FORMAT_H -#define RENDER_SHM_FORMAT_H - -#include - -uint32_t convert_wl_shm_format_to_drm(enum wl_shm_format fmt); -enum wl_shm_format convert_drm_format_to_wl_shm(uint32_t fmt); - -#endif diff --git a/render/meson.build b/render/meson.build index 0b75c5e1..3779e9e0 100644 --- a/render/meson.build +++ b/render/meson.build @@ -4,7 +4,6 @@ wlr_files += files( 'egl.c', 'drm_format_set.c', 'gbm_allocator.c', - 'shm_format.c', 'pixel_format.c', 'swapchain.c', 'wlr_renderer.c', diff --git a/render/pixel_format.c b/render/pixel_format.c index 4c4df3bc..05df2ba4 100644 --- a/render/pixel_format.c +++ b/render/pixel_format.c @@ -28,3 +28,25 @@ const struct wlr_pixel_format_info *drm_get_pixel_format_info(uint32_t fmt) { return NULL; } + +uint32_t convert_wl_shm_format_to_drm(enum wl_shm_format fmt) { + switch (fmt) { + case WL_SHM_FORMAT_XRGB8888: + return DRM_FORMAT_XRGB8888; + case WL_SHM_FORMAT_ARGB8888: + return DRM_FORMAT_ARGB8888; + default: + return (uint32_t)fmt; + } +} + +enum wl_shm_format convert_drm_format_to_wl_shm(uint32_t fmt) { + switch (fmt) { + case DRM_FORMAT_XRGB8888: + return WL_SHM_FORMAT_XRGB8888; + case DRM_FORMAT_ARGB8888: + return WL_SHM_FORMAT_ARGB8888; + default: + return (enum wl_shm_format)fmt; + } +} diff --git a/render/shm_format.c b/render/shm_format.c deleted file mode 100644 index cb3f7c01..00000000 --- a/render/shm_format.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include "render/shm_format.h" - -uint32_t convert_wl_shm_format_to_drm(enum wl_shm_format fmt) { - switch (fmt) { - case WL_SHM_FORMAT_XRGB8888: - return DRM_FORMAT_XRGB8888; - case WL_SHM_FORMAT_ARGB8888: - return DRM_FORMAT_ARGB8888; - default: - return (uint32_t)fmt; - } -} - -enum wl_shm_format convert_drm_format_to_wl_shm(uint32_t fmt) { - switch (fmt) { - case DRM_FORMAT_XRGB8888: - return WL_SHM_FORMAT_XRGB8888; - case DRM_FORMAT_ARGB8888: - return WL_SHM_FORMAT_ARGB8888; - default: - return (enum wl_shm_format)fmt; - } -} diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index 7e62cad1..027c5cf9 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -9,7 +9,7 @@ #include #include #include "util/signal.h" -#include "render/shm_format.h" +#include "render/pixel_format.h" #include "render/wlr_renderer.h" #include "backend/backend.h" diff --git a/types/wlr_buffer.c b/types/wlr_buffer.c index b631fa99..0bc290ca 100644 --- a/types/wlr_buffer.c +++ b/types/wlr_buffer.c @@ -4,7 +4,7 @@ #include #include #include -#include "render/shm_format.h" +#include "render/pixel_format.h" #include "util/signal.h" void wlr_buffer_init(struct wlr_buffer *buffer, diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c index 87f3127f..632b708f 100644 --- a/types/wlr_screencopy_v1.c +++ b/types/wlr_screencopy_v1.c @@ -9,8 +9,8 @@ #include #include #include "wlr-screencopy-unstable-v1-protocol.h" -#include "render/shm_format.h" #include "render/wlr_renderer.h" +#include "render/pixel_format.h" #include "util/signal.h" #define SCREENCOPY_MANAGER_VERSION 3