drm: move drm_mode_legacy_fb_format to drm_fourcc.c
It's part of the drm fourcc handling code, mapping the old depth/bpp values to new fourcc codes. Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20160829082757.17913-6-daniel.vetter@ffwll.ch
This commit is contained in:
parent
a2511a557e
commit
ec5e304747
|
@ -1671,49 +1671,6 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
|
|||
return drm_mode_cursor_common(dev, req, file_priv);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_mode_legacy_fb_format - compute drm fourcc code from legacy description
|
||||
* @bpp: bits per pixels
|
||||
* @depth: bit depth per pixel
|
||||
*
|
||||
* Computes a drm fourcc pixel format code for the given @bpp/@depth values.
|
||||
* Useful in fbdev emulation code, since that deals in those values.
|
||||
*/
|
||||
uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth)
|
||||
{
|
||||
uint32_t fmt;
|
||||
|
||||
switch (bpp) {
|
||||
case 8:
|
||||
fmt = DRM_FORMAT_C8;
|
||||
break;
|
||||
case 16:
|
||||
if (depth == 15)
|
||||
fmt = DRM_FORMAT_XRGB1555;
|
||||
else
|
||||
fmt = DRM_FORMAT_RGB565;
|
||||
break;
|
||||
case 24:
|
||||
fmt = DRM_FORMAT_RGB888;
|
||||
break;
|
||||
case 32:
|
||||
if (depth == 24)
|
||||
fmt = DRM_FORMAT_XRGB8888;
|
||||
else if (depth == 30)
|
||||
fmt = DRM_FORMAT_XRGB2101010;
|
||||
else
|
||||
fmt = DRM_FORMAT_ARGB8888;
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("bad bpp, assuming x8r8g8b8 pixel format\n");
|
||||
fmt = DRM_FORMAT_XRGB8888;
|
||||
break;
|
||||
}
|
||||
|
||||
return fmt;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_mode_legacy_fb_format);
|
||||
|
||||
static bool drm_property_type_valid(struct drm_property *property)
|
||||
{
|
||||
if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE)
|
||||
|
|
|
@ -35,6 +35,49 @@ static char printable_char(int c)
|
|||
return isascii(c) && isprint(c) ? c : '?';
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_mode_legacy_fb_format - compute drm fourcc code from legacy description
|
||||
* @bpp: bits per pixels
|
||||
* @depth: bit depth per pixel
|
||||
*
|
||||
* Computes a drm fourcc pixel format code for the given @bpp/@depth values.
|
||||
* Useful in fbdev emulation code, since that deals in those values.
|
||||
*/
|
||||
uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth)
|
||||
{
|
||||
uint32_t fmt;
|
||||
|
||||
switch (bpp) {
|
||||
case 8:
|
||||
fmt = DRM_FORMAT_C8;
|
||||
break;
|
||||
case 16:
|
||||
if (depth == 15)
|
||||
fmt = DRM_FORMAT_XRGB1555;
|
||||
else
|
||||
fmt = DRM_FORMAT_RGB565;
|
||||
break;
|
||||
case 24:
|
||||
fmt = DRM_FORMAT_RGB888;
|
||||
break;
|
||||
case 32:
|
||||
if (depth == 24)
|
||||
fmt = DRM_FORMAT_XRGB8888;
|
||||
else if (depth == 30)
|
||||
fmt = DRM_FORMAT_XRGB2101010;
|
||||
else
|
||||
fmt = DRM_FORMAT_ARGB8888;
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("bad bpp, assuming x8r8g8b8 pixel format\n");
|
||||
fmt = DRM_FORMAT_XRGB8888;
|
||||
break;
|
||||
}
|
||||
|
||||
return fmt;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_mode_legacy_fb_format);
|
||||
|
||||
/**
|
||||
* drm_get_format_name - return a string for drm fourcc format
|
||||
* @format: format to compute name of
|
||||
|
|
|
@ -2158,8 +2158,6 @@ extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
|
|||
|
||||
extern int drm_mode_set_config_internal(struct drm_mode_set *set);
|
||||
|
||||
extern uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
|
||||
|
||||
extern struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
|
||||
char topology[8]);
|
||||
extern struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <uapi/drm/drm_fourcc.h>
|
||||
|
||||
uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
|
||||
void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, int *bpp);
|
||||
int drm_format_num_planes(uint32_t format);
|
||||
int drm_format_plane_cpp(uint32_t format, int plane);
|
||||
|
|
Loading…
Reference in New Issue
Block a user