diff options
author | Jakob Bornecrantz <jakob@vmware.com> | 2011-10-04 14:13:34 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-10-05 05:17:33 -0400 |
commit | c337ada7e76507efc617f562b81216f80c92bec0 (patch) | |
tree | 05c36569068b8cbc8981bda65f5db88a73de13bb /drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |
parent | 5bb39e818169783ee17ddbbefbd7bd16a4383fec (diff) |
vmwgfx: Be more strict with fb depths when using screen objects
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_kms.c')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index b4b9aa9fa9ed..0921cce44205 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -776,6 +776,33 @@ static int vmw_kms_new_framebuffer_dmabuf(struct vmw_private *dev_priv, | |||
776 | return -EINVAL; | 776 | return -EINVAL; |
777 | } | 777 | } |
778 | 778 | ||
779 | /* Limited framebuffer color depth support for screen objects */ | ||
780 | if (dev_priv->sou_priv) { | ||
781 | switch (mode_cmd->depth) { | ||
782 | case 32: | ||
783 | case 24: | ||
784 | /* Only support 32 bpp for 32 and 24 depth fbs */ | ||
785 | if (mode_cmd->bpp == 32) | ||
786 | break; | ||
787 | |||
788 | DRM_ERROR("Invalid color depth/bbp: %d %d\n", | ||
789 | mode_cmd->depth, mode_cmd->bpp); | ||
790 | return -EINVAL; | ||
791 | case 16: | ||
792 | case 15: | ||
793 | /* Only support 16 bpp for 16 and 15 depth fbs */ | ||
794 | if (mode_cmd->bpp == 16) | ||
795 | break; | ||
796 | |||
797 | DRM_ERROR("Invalid color depth/bbp: %d %d\n", | ||
798 | mode_cmd->depth, mode_cmd->bpp); | ||
799 | return -EINVAL; | ||
800 | default: | ||
801 | DRM_ERROR("Invalid color depth: %d\n", mode_cmd->depth); | ||
802 | return -EINVAL; | ||
803 | } | ||
804 | } | ||
805 | |||
779 | vfbd = kzalloc(sizeof(*vfbd), GFP_KERNEL); | 806 | vfbd = kzalloc(sizeof(*vfbd), GFP_KERNEL); |
780 | if (!vfbd) { | 807 | if (!vfbd) { |
781 | ret = -ENOMEM; | 808 | ret = -ENOMEM; |