diff options
author | Dave Airlie <airlied@redhat.com> | 2011-11-29 15:02:54 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-11-29 15:02:54 -0500 |
commit | 248dbc2350501e2c7b9f5ceb60c75515d82f4134 (patch) | |
tree | fb12f25d61f71eeba77931b96e58950fc9afd46f /drivers/gpu/drm/drm_crtc.c | |
parent | 435ddd926e880f14ea2ae37062b9b45231d7fdf9 (diff) |
drm: move the fb bpp/depth helper into the core.
This is used by nearly everyone including vmwgfx which doesn't generally
use the fb helper.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index e54c0a6a3072..07c80fd7a98d 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -3136,3 +3136,44 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, | |||
3136 | 3136 | ||
3137 | return dev->driver->dumb_destroy(file_priv, dev, args->handle); | 3137 | return dev->driver->dumb_destroy(file_priv, dev, args->handle); |
3138 | } | 3138 | } |
3139 | |||
3140 | /* | ||
3141 | * Just need to support RGB formats here for compat with code that doesn't | ||
3142 | * use pixel formats directly yet. | ||
3143 | */ | ||
3144 | void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, | ||
3145 | int *bpp) | ||
3146 | { | ||
3147 | switch (format) { | ||
3148 | case DRM_FOURCC_RGB332: | ||
3149 | *depth = 8; | ||
3150 | *bpp = 8; | ||
3151 | break; | ||
3152 | case DRM_FOURCC_RGB555: | ||
3153 | *depth = 15; | ||
3154 | *bpp = 16; | ||
3155 | break; | ||
3156 | case DRM_FOURCC_RGB565: | ||
3157 | *depth = 16; | ||
3158 | *bpp = 16; | ||
3159 | break; | ||
3160 | case DRM_FOURCC_RGB24: | ||
3161 | *depth = 24; | ||
3162 | *bpp = 32; | ||
3163 | break; | ||
3164 | case DRM_INTEL_RGB30: | ||
3165 | *depth = 30; | ||
3166 | *bpp = 32; | ||
3167 | break; | ||
3168 | case DRM_FOURCC_RGB32: | ||
3169 | *depth = 32; | ||
3170 | *bpp = 32; | ||
3171 | break; | ||
3172 | default: | ||
3173 | DRM_DEBUG_KMS("unsupported pixel format\n"); | ||
3174 | *depth = 0; | ||
3175 | *bpp = 0; | ||
3176 | break; | ||
3177 | } | ||
3178 | } | ||
3179 | EXPORT_SYMBOL(drm_fb_get_bpp_depth); | ||