diff options
author | Dave Airlie <airlied@redhat.com> | 2018-09-27 19:31:03 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2018-09-27 19:36:48 -0400 |
commit | 156e60bc71aa31a3b42b1d66a822c2999bd0994c (patch) | |
tree | dbc2fa3c30c78b1465aa29ca37fefbb8a16bde8e /drivers/gpu/drm/drm_fourcc.c | |
parent | bf78296ab1cb215d0609ac6cff4e43e941e51265 (diff) | |
parent | c2b70ffcd34eca60013d90bd6cd56e60b07adef8 (diff) |
Merge tag 'drm-misc-next-2018-09-27' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for 4.20:
UAPI Changes:
- None
Cross-subsystem Changes:
- MAINTAINERS: Move udl, mxsfb, and fsl-dcu into drm-misc (Stefan, Sean)
Core Changes:
- syncobj: Check condition before returning timeout in schedule() (Chris)
Driver Changes:
- various: First wave of drm_fbdev_generic_setup() conversions (Noralf)
- bochs/virtio: More format byte-order improvements (Gerd)
- mxsfb: A couple fixes + add runtime pm support (Leonard)
- virtio: Add vmap support for prime objects (Ezequiel)
Cc: Stefan Agner <stefan@agner.ch>
Cc: Sean Paul <sean@poorly.run>
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: Gerd Hoffman <kraxel@redhat.com>
Cc: Leonard Crestez <leonard.crestez@nxp.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Sean Paul <sean@poorly.run>
Link: https://patchwork.freedesktop.org/patch/msgid/20180927093950.GA180365@art_vandelay
Diffstat (limited to 'drivers/gpu/drm/drm_fourcc.c')
-rw-r--r-- | drivers/gpu/drm/drm_fourcc.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index be1d6aaef651..90a1c846fc25 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c | |||
@@ -96,6 +96,41 @@ uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth) | |||
96 | EXPORT_SYMBOL(drm_mode_legacy_fb_format); | 96 | EXPORT_SYMBOL(drm_mode_legacy_fb_format); |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * drm_driver_legacy_fb_format - compute drm fourcc code from legacy description | ||
100 | * @bpp: bits per pixels | ||
101 | * @depth: bit depth per pixel | ||
102 | * @native: use host native byte order | ||
103 | * | ||
104 | * Computes a drm fourcc pixel format code for the given @bpp/@depth values. | ||
105 | * Unlike drm_mode_legacy_fb_format() this looks at the drivers mode_config, | ||
106 | * and depending on the quirk_addfb_prefer_host_byte_order flag it returns | ||
107 | * little endian byte order or host byte order framebuffer formats. | ||
108 | */ | ||
109 | uint32_t drm_driver_legacy_fb_format(struct drm_device *dev, | ||
110 | uint32_t bpp, uint32_t depth) | ||
111 | { | ||
112 | uint32_t fmt = drm_mode_legacy_fb_format(bpp, depth); | ||
113 | |||
114 | if (dev->mode_config.quirk_addfb_prefer_host_byte_order) { | ||
115 | if (fmt == DRM_FORMAT_XRGB8888) | ||
116 | fmt = DRM_FORMAT_HOST_XRGB8888; | ||
117 | if (fmt == DRM_FORMAT_ARGB8888) | ||
118 | fmt = DRM_FORMAT_HOST_ARGB8888; | ||
119 | if (fmt == DRM_FORMAT_RGB565) | ||
120 | fmt = DRM_FORMAT_HOST_RGB565; | ||
121 | if (fmt == DRM_FORMAT_XRGB1555) | ||
122 | fmt = DRM_FORMAT_HOST_XRGB1555; | ||
123 | } | ||
124 | |||
125 | if (dev->mode_config.quirk_addfb_prefer_xbgr_30bpp && | ||
126 | fmt == DRM_FORMAT_XRGB2101010) | ||
127 | fmt = DRM_FORMAT_XBGR2101010; | ||
128 | |||
129 | return fmt; | ||
130 | } | ||
131 | EXPORT_SYMBOL(drm_driver_legacy_fb_format); | ||
132 | |||
133 | /** | ||
99 | * drm_get_format_name - fill a string with a drm fourcc format's name | 134 | * drm_get_format_name - fill a string with a drm fourcc format's name |
100 | * @format: format to compute name of | 135 | * @format: format to compute name of |
101 | * @buf: caller-supplied buffer | 136 | * @buf: caller-supplied buffer |