[PATCH 1/2] drm/fb_helper: make sure crtc_count is consistent
Ilija Hadzic
ihadzic at research.bell-labs.com
Tue Oct 25 18:57:18 PDT 2011
stop adding crtcs from dev->mode_config.crtc_list
to crtc_info array if gpu driver specifies (by mistake
or with a reason) fewer crtcs in crtc_count parameter
also, correct crtc_count value if gpu driver
specifies too many crtcs
Signed-off-by: Ilija Hadzic <ihadzic at research.bell-labs.com>
---
drivers/gpu/drm/drm_fb_helper.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index f7c6854..feac888 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -466,10 +466,18 @@ int drm_fb_helper_init(struct drm_device *dev,
i = 0;
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+ if (i >= crtc_count) {
+ DRM_DEBUG("crtc count set by the gpu reached\n");
+ break;
+ }
fb_helper->crtc_info[i].crtc_id = crtc->base.id;
fb_helper->crtc_info[i].mode_set.crtc = crtc;
i++;
}
+ if (i < fb_helper->crtc_count) {
+ DRM_DEBUG("crtc count known by the drm reached\n");
+ fb_helper->crtc_count = i;
+ }
fb_helper->conn_limit = max_conn_count;
return 0;
out_free:
--
1.7.7
More information about the dri-devel
mailing list