Commit a9a63040 authored by Marius Vlad's avatar Marius Vlad
Browse files

pixel-formats: Added pixel_format_get_info_shm() helper for printing SHM buffers

In current form SHM buffers pixel format can only be printed as 0 and 1.
With the help of this helper we align with DRM_FORMAT_ pixel format.
Signed-off-by: Marius Vlad's avatarMarius Vlad <>
parent 62a94364
......@@ -32,6 +32,7 @@
#include <unistd.h>
#include <string.h>
#include <drm_fourcc.h>
#include <wayland-client-protocol.h>
#include "helpers.h"
#include "wayland-util.h"
......@@ -375,6 +376,17 @@ static const struct pixel_format_info pixel_format_table[] = {
WL_EXPORT const struct pixel_format_info *
pixel_format_get_info_shm(uint32_t format)
if (format == WL_SHM_FORMAT_XRGB8888)
return pixel_format_get_info(DRM_FORMAT_XRGB8888);
else if (format == WL_SHM_FORMAT_ARGB8888)
return pixel_format_get_info(DRM_FORMAT_ARGB8888);
return pixel_format_get_info(format);
WL_EXPORT const struct pixel_format_info *
pixel_format_get_info(uint32_t format)
......@@ -115,6 +115,19 @@ struct pixel_format_info {
const struct pixel_format_info *
pixel_format_get_info(uint32_t format);
* Get pixel format information for a SHM format code
* Given a SHM format code, return a DRM pixel format info structure describing
* the properties of that format.
* @param format SHM format code to get info for.
* @returns A pixel format structure (must not be freed), or NULL if the
* format could not be found.
const struct pixel_format_info *
pixel_format_get_info_shm(uint32_t format);
* Get pixel format information for a named DRM format
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment