aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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,
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 */
3144void 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}
3179EXPORT_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)
811} 811}
812EXPORT_SYMBOL(drm_helper_connector_dpms); 812EXPORT_SYMBOL(drm_helper_connector_dpms);
813 813
814/*
815 * Just need to support RGB formats here for compat with code that doesn't
816 * use pixel formats directly yet.
817 */
818void drm_helper_get_fb_bpp_depth(uint32_t format, unsigned int *depth,
819 int *bpp)
820{
821 switch (format) {
822 case DRM_FOURCC_RGB332:
823 *depth = 8;
824 *bpp = 8;
825 break;
826 case DRM_FOURCC_RGB555:
827 *depth = 15;
828 *bpp = 16;
829 break;
830 case DRM_FOURCC_RGB565:
831 *depth = 16;
832 *bpp = 16;
833 break;
834 case DRM_FOURCC_RGB24:
835 *depth = 24;
836 *bpp = 32;
837 break;
838 case DRM_INTEL_RGB30:
839 *depth = 30;
840 *bpp = 32;
841 break;
842 case DRM_FOURCC_RGB32:
843 *depth = 32;
844 *bpp = 32;
845 break;
846 default:
847 DRM_DEBUG_KMS("unsupported pixel format\n");
848 *depth = 0;
849 *bpp = 0;
850 break;
851 }
852}
853EXPORT_SYMBOL(drm_helper_get_fb_bpp_depth);
854
855int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, 814int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
856 struct drm_mode_fb_cmd2 *mode_cmd) 815 struct drm_mode_fb_cmd2 *mode_cmd)
857{ 816{
858 fb->width = mode_cmd->width; 817 fb->width = mode_cmd->width;
859 fb->height = mode_cmd->height; 818 fb->height = mode_cmd->height;
860 fb->pitch = mode_cmd->pitches[0]; 819 fb->pitch = mode_cmd->pitches[0];
861 drm_helper_get_fb_bpp_depth(mode_cmd->pixel_format, &fb->depth, 820 drm_fb_get_bpp_depth(mode_cmd->pixel_format, &fb->depth,
862 &fb->bits_per_pixel); 821 &fb->bits_per_pixel);
863 fb->pixel_format = mode_cmd->pixel_format; 822 fb->pixel_format = mode_cmd->pixel_format;
864 823
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,
247 u32 bpp, depth; 247 u32 bpp, depth;
248 int ret; 248 int ret;
249 249
250 drm_helper_get_fb_bpp_depth(mode_cmd->pixel_format, &depth, &bpp); 250 drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
251 251
252 if (mode_cmd->pitches[0] & 63) 252 if (mode_cmd->pitches[0] & 63)
253 return -EINVAL; 253 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,
116 int height = mode_cmd->height; 116 int height = mode_cmd->height;
117 u32 bpp, depth; 117 u32 bpp, depth;
118 118
119 drm_helper_get_fb_bpp_depth(mode_cmd->pixel_format, &depth, &bpp); 119 drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
120 120
121 /* need to align pitch with crtc limits */ 121 /* need to align pitch with crtc limits */
122 mode_cmd->pitches[0] = radeon_align_pitch(rdev, mode_cmd->width, bpp, 122 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,
1006 mode_cmd.height = mode_cmd2->height; 1006 mode_cmd.height = mode_cmd2->height;
1007 mode_cmd.pitch = mode_cmd2->pitches[0]; 1007 mode_cmd.pitch = mode_cmd2->pitches[0];
1008 mode_cmd.handle = mode_cmd2->handles[0]; 1008 mode_cmd.handle = mode_cmd2->handles[0];
1009 drm_helper_get_fb_bpp_depth(mode_cmd2->pixel_format, &mode_cmd.depth, 1009 drm_fb_get_bpp_depth(mode_cmd2->pixel_format, &mode_cmd.depth,
1010 &mode_cmd.bpp); 1010 &mode_cmd.bpp);
1011 1011
1012 /** 1012 /**
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,
280 u32 bpp, depth; 280 u32 bpp, depth;
281 int ret; 281 int ret;
282 282
283 drm_helper_get_fb_bpp_depth(mode_cmd->pixel_format, &depth, &bpp); 283 drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
284 284
285 if (mode_cmd->pitches[0] & 63) 285 if (mode_cmd->pitches[0] & 63)
286 return -EINVAL; 286 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,
902 void *data, struct drm_file *file_priv); 902 void *data, struct drm_file *file_priv);
903extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, 903extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
904 void *data, struct drm_file *file_priv); 904 void *data, struct drm_file *file_priv);
905
906extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
907 int *bpp);
905#endif /* __DRM_CRTC_H__ */ 908#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);
116 116
117extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode); 117extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode);
118 118
119extern void drm_helper_get_fb_bpp_depth(uint32_t format, unsigned int *depth,
120 int *bpp);
121extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, 119extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
122 struct drm_mode_fb_cmd2 *mode_cmd); 120 struct drm_mode_fb_cmd2 *mode_cmd);
123 121