Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282450
b: refs/heads/master
c: 248dbc2
h: refs/heads/master
v: v3
  • Loading branch information
Dave Airlie committed Nov 29, 2011
1 parent 46fc2bf commit a438942
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 49 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 435ddd926e880f14ea2ae37062b9b45231d7fdf9
refs/heads/master: 248dbc2350501e2c7b9f5ceb60c75515d82f4134
41 changes: 41 additions & 0 deletions trunk/drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
43 changes: 1 addition & 42 deletions trunk/drivers/gpu/drm/drm_crtc_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/gpu/drm/gma500/framebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/gpu/drm/radeon/radeon_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/gma500/framebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/drm/drm_crtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
2 changes: 0 additions & 2 deletions trunk/include/drm/drm_crtc_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit a438942

Please sign in to comment.