]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm: move the fb bpp/depth helper into the core.
authorDave Airlie <airlied@redhat.com>
Tue, 29 Nov 2011 20:02:54 +0000 (20:02 +0000)
committerDave Airlie <airlied@redhat.com>
Tue, 29 Nov 2011 20:02:54 +0000 (20:02 +0000)
This is used by nearly everyone including vmwgfx which doesn't generally
use the fb helper.

Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_crtc_helper.c
drivers/gpu/drm/gma500/framebuffer.c
drivers/gpu/drm/radeon/radeon_fb.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/staging/gma500/framebuffer.c
include/drm/drm_crtc.h
include/drm/drm_crtc_helper.h

index e54c0a6a30726bc0bea6f290008b579c7fa84a34..07c80fd7a98d506705efd11879640e3703417d9e 100644 (file)
@@ -3136,3 +3136,44 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
 
        return dev->driver->dumb_destroy(file_priv, dev, args->handle);
 }
+
+/*
+ * Just need to support RGB formats here for compat with code that doesn't
+ * use pixel formats directly yet.
+ */
+void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
+                         int *bpp)
+{
+       switch (format) {
+       case DRM_FOURCC_RGB332:
+               *depth = 8;
+               *bpp = 8;
+               break;
+       case DRM_FOURCC_RGB555:
+               *depth = 15;
+               *bpp = 16;
+               break;
+       case DRM_FOURCC_RGB565:
+               *depth = 16;
+               *bpp = 16;
+               break;
+       case DRM_FOURCC_RGB24:
+               *depth = 24;
+               *bpp = 32;
+               break;
+       case DRM_INTEL_RGB30:
+               *depth = 30;
+               *bpp = 32;
+               break;
+       case DRM_FOURCC_RGB32:
+               *depth = 32;
+               *bpp = 32;
+               break;
+       default:
+               DRM_DEBUG_KMS("unsupported pixel format\n");
+               *depth = 0;
+               *bpp = 0;
+               break;
+       }
+}
+EXPORT_SYMBOL(drm_fb_get_bpp_depth);
index 432d5391b93c965cb1f3bfe15ef6489d2bf60bc2..2ce61d72d416f8539b49227ed3da1a1c606232fa 100644 (file)
@@ -811,54 +811,13 @@ void drm_helper_connector_dpms(struct drm_connector *connector, int mode)
 }
 EXPORT_SYMBOL(drm_helper_connector_dpms);
 
-/*
- * Just need to support RGB formats here for compat with code that doesn't
- * use pixel formats directly yet.
- */
-void drm_helper_get_fb_bpp_depth(uint32_t format, unsigned int *depth,
-                                int *bpp)
-{
-       switch (format) {
-       case DRM_FOURCC_RGB332:
-               *depth = 8;
-               *bpp = 8;
-               break;
-       case DRM_FOURCC_RGB555:
-               *depth = 15;
-               *bpp = 16;
-               break;
-       case DRM_FOURCC_RGB565:
-               *depth = 16;
-               *bpp = 16;
-               break;
-       case DRM_FOURCC_RGB24:
-               *depth = 24;
-               *bpp = 32;
-               break;
-       case DRM_INTEL_RGB30:
-               *depth = 30;
-               *bpp = 32;
-               break;
-       case DRM_FOURCC_RGB32:
-               *depth = 32;
-               *bpp = 32;
-               break;
-       default:
-               DRM_DEBUG_KMS("unsupported pixel format\n");
-               *depth = 0;
-               *bpp = 0;
-               break;
-       }
-}
-EXPORT_SYMBOL(drm_helper_get_fb_bpp_depth);
-
 int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
                                   struct drm_mode_fb_cmd2 *mode_cmd)
 {
        fb->width = mode_cmd->width;
        fb->height = mode_cmd->height;
        fb->pitch = mode_cmd->pitches[0];
-       drm_helper_get_fb_bpp_depth(mode_cmd->pixel_format, &fb->depth,
+       drm_fb_get_bpp_depth(mode_cmd->pixel_format, &fb->depth,
                                    &fb->bits_per_pixel);
        fb->pixel_format = mode_cmd->pixel_format;
 
index 21c2c56fa37c9960854a75ffa03a527885992b97..171c4419b7f682016a0bc9b8eff221a5647d4e40 100644 (file)
@@ -247,7 +247,7 @@ static int psb_framebuffer_init(struct drm_device *dev,
        u32 bpp, depth;
        int ret;
 
-       drm_helper_get_fb_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
+       drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
 
        if (mode_cmd->pitches[0] & 63)
                return -EINVAL;
index 9c42c6a333d9dd95ef193f5ea8787322fdf8864c..0dc749eb4222b69dce878be0a16794fa6e75e0d9 100644 (file)
@@ -116,7 +116,7 @@ static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev,
        int height = mode_cmd->height;
        u32 bpp, depth;
 
-       drm_helper_get_fb_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
+       drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
 
        /* need to align pitch with crtc limits */
        mode_cmd->pitches[0] = radeon_align_pitch(rdev, mode_cmd->width, bpp,
index 1beaa3f8dac2f20f0fe0cb93eb162d422094c8b3..760d04aee3807ff5cdde2221e536f3a02accd916 100644 (file)
@@ -1006,7 +1006,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
        mode_cmd.height = mode_cmd2->height;
        mode_cmd.pitch = mode_cmd2->pitches[0];
        mode_cmd.handle = mode_cmd2->handles[0];
-       drm_helper_get_fb_bpp_depth(mode_cmd2->pixel_format, &mode_cmd.depth,
+       drm_fb_get_bpp_depth(mode_cmd2->pixel_format, &mode_cmd.depth,
                                    &mode_cmd.bpp);
 
        /**
index 29f25b5908a5e356a18e0768b415511d850531e5..7aee4d2cd1d481fe73d7fa759fceed6802035caf 100644 (file)
@@ -280,7 +280,7 @@ static int psb_framebuffer_init(struct drm_device *dev,
        u32 bpp, depth;
        int ret;
 
-       drm_helper_get_fb_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
+       drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
 
        if (mode_cmd->pitches[0] & 63)
                return -EINVAL;
index a2fbf339968239f438818bcf6d3079a04786718c..6718b1873dfc34a00e64681b926f3246c0e6c7ec 100644 (file)
@@ -902,4 +902,7 @@ extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
                                    void *data, struct drm_file *file_priv);
 extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
                                      void *data, struct drm_file *file_priv);
+
+extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
+                                int *bpp);
 #endif /* __DRM_CRTC_H__ */
index b4abb33dbcd82efc4cdfa001ace7a19fd03ab126..e88b7d70594e085c6845c5479335257e6a014944 100644 (file)
@@ -116,8 +116,6 @@ extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
 
 extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode);
 
-extern void drm_helper_get_fb_bpp_depth(uint32_t format, unsigned int *depth,
-                                       int *bpp);
 extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
                                          struct drm_mode_fb_cmd2 *mode_cmd);