Move render/shm_format functions to render/pixel_format

This commit is contained in:
Simon Zeni 2021-03-15 12:35:47 -04:00 committed by Simon Ser
parent 5fd82c6f54
commit 50d2985607
8 changed files with 28 additions and 37 deletions

View File

@ -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

View File

@ -1,9 +0,0 @@
#ifndef RENDER_SHM_FORMAT_H
#define RENDER_SHM_FORMAT_H
#include <wayland-server-protocol.h>
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

View File

@ -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',

View File

@ -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;
}
}

View File

@ -1,24 +0,0 @@
#include <drm_fourcc.h>
#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;
}
}

View File

@ -9,7 +9,7 @@
#include <wlr/types/wlr_matrix.h>
#include <wlr/util/log.h>
#include "util/signal.h"
#include "render/shm_format.h"
#include "render/pixel_format.h"
#include "render/wlr_renderer.h"
#include "backend/backend.h"

View File

@ -4,7 +4,7 @@
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/util/log.h>
#include "render/shm_format.h"
#include "render/pixel_format.h"
#include "util/signal.h"
void wlr_buffer_init(struct wlr_buffer *buffer,

View File

@ -9,8 +9,8 @@
#include <wlr/backend.h>
#include <wlr/util/log.h>
#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