summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-11-29 20:02:54 +0000
committerDave Airlie <airlied@redhat.com>2011-11-29 20:02:54 +0000
commit248dbc2350501e2c7b9f5ceb60c75515d82f4134 (patch)
treefb12f25d61f71eeba77931b96e58950fc9afd46f
parent435ddd926e880f14ea2ae37062b9b45231d7fdf9 (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>
-rw-r--r--drivers/gpu/drm/drm_crtc.c41
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c43
-rw-r--r--drivers/gpu/drm/gma500/framebuffer.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_fb.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c2
-rw-r--r--drivers/staging/gma500/framebuffer.c2
-rw-r--r--include/drm/drm_crtc.h3
-rw-r--r--include/drm/drm_crtc_helper.h2
8 files changed, 49 insertions, 48 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,
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);
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 432d5391b93c..2ce61d72d416 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -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;
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index 21c2c56fa37c..171c4419b7f6 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -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;
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index 9c42c6a333d9..0dc749eb4222 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -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,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 1beaa3f8dac2..760d04aee380 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -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);
/**
diff --git a/drivers/staging/gma500/framebuffer.c b/drivers/staging/gma500/framebuffer.c
index 29f25b5908a5..7aee4d2cd1d4 100644
--- a/drivers/staging/gma500/framebuffer.c
+++ b/drivers/staging/gma500/framebuffer.c
@@ -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;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index a2fbf3399682..6718b1873dfc 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -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__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index b4abb33dbcd8..e88b7d70594e 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -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);