summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/gma500/oaktrail_hdmi.c
diff options
context:
space:
mode:
authorAlan Cox2012-01-12 15:40:12 +0100
committerDave Airlie2012-01-13 10:02:06 +0100
commit9f821c675a389cf4aab7f1dc8ee0860fba4f3204 (patch)
tree5c4dde154e229e235da1d91624aba163d9c88cb6 /drivers/gpu/drm/gma500/oaktrail_hdmi.c
parentdrm: bump DRM_CONNECTOR_MAX_ENCODER from 2 to 3 (diff)
downloadkernel-qcow2-linux-9f821c675a389cf4aab7f1dc8ee0860fba4f3204.tar.gz
kernel-qcow2-linux-9f821c675a389cf4aab7f1dc8ee0860fba4f3204.tar.xz
kernel-qcow2-linux-9f821c675a389cf4aab7f1dc8ee0860fba4f3204.zip
gma500: Discard modes that don't fit in stolen memory
[This fixes a crash on boot if the system is plugged into an HDTV so it's probably appropriate to push even though it didn't make the window. We could be cleverer about this but the simple version seems to be the safe one] From: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> At the moment we cannot allocate more than stolen memory size for framebuffers. To get around that issues we discard modes that doesn't fit. This is a temporary solution until we can freely allocate framebuffer memory. [Currently the framebuffer needs to be linear in kernel space due to limits in the kernel fb layer - AC] Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/gma500/oaktrail_hdmi.c')
-rw-r--r--drivers/gpu/drm/gma500/oaktrail_hdmi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index 36878a60080d..025d30970cc0 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -506,6 +506,7 @@ int oaktrail_crtc_hdmi_mode_set(struct drm_crtc *crtc,
static int oaktrail_hdmi_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
+ struct drm_psb_private *dev_priv = connector->dev->dev_private;
if (mode->clock > 165000)
return MODE_CLOCK_HIGH;
if (mode->clock < 20000)
@@ -514,6 +515,11 @@ static int oaktrail_hdmi_mode_valid(struct drm_connector *connector,
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
return MODE_NO_DBLESCAN;
+ /* We assume worst case scenario of 32 bpp here, since we don't know */
+ if ((ALIGN(mode->hdisplay * 4, 64) * mode->vdisplay) >
+ dev_priv->vram_stolen_size)
+ return MODE_MEM;
+
return MODE_OK;
}