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 <marius.vlad0@gmail.com>
This commit is contained in:
parent
62a9436417
commit
a9a630401f
@ -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);
|
||||
else
|
||||
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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user