From bb0f8f29713ff2db083c562b4f5e84ecb7bab73a Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Tue, 6 May 2008 15:43:07 +0800 Subject: [PATCH] modeset: add a default console fb to crtc Add a con_fb field to drm_crtc as the default fb attached to this crtc if there is no fb assigned to this crtc. --- linux-core/drm_crtc.c | 10 +++++++--- linux-core/drm_crtc.h | 3 +++ linux-core/intel_fb.c | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c index fa28b4b..de12de4 100644 --- a/linux-core/drm_crtc.c +++ b/linux-core/drm_crtc.c @@ -210,7 +210,7 @@ EXPORT_SYMBOL(drm_framebuffer_create); * Caller must hold mode config lock. * * Scans all the CRTCs in @dev's mode_config. If they're using @fb, removes - * it, setting it to NULL. + * it, setting it to con_fb if con_fb is not the one to be removed. */ void drm_framebuffer_destroy(struct drm_framebuffer *fb) { @@ -219,8 +219,12 @@ void drm_framebuffer_destroy(struct drm_framebuffer *fb) /* remove from any CRTC */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { - if (crtc->fb == fb) - crtc->fb = NULL; + if (crtc->fb == fb) { + if (crtc->con_fb == fb) + crtc->con_fb = crtc->fb = NULL; + else + crtc->fb = crtc->con_fb; + } } drm_idr_put(dev, fb->id); diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h index 20b1ea0..aea9ca1 100644 --- a/linux-core/drm_crtc.h +++ b/linux-core/drm_crtc.h @@ -361,6 +361,9 @@ struct drm_crtc { /* framebuffer the output is currently bound to */ struct drm_framebuffer *fb; + /* console framebuffer allocated by kernel, the default one + * if there is no user allocated fbs*/ + struct drm_framebuffer *con_fb; bool enabled; diff --git a/linux-core/intel_fb.c b/linux-core/intel_fb.c index 6bac3fb..736ffd2 100644 --- a/linux-core/intel_fb.c +++ b/linux-core/intel_fb.c @@ -580,7 +580,7 @@ int intelfb_probe(struct drm_device *dev, struct drm_crtc *crtc) DRM_ERROR("failed to allocate fb.\n"); return -EINVAL; } - crtc->fb = fb; + crtc->con_fb = crtc->fb = fb; /* To allow resizeing without swapping buffers */ fb->width = 2048;/* crtc->desired_mode->hdisplay; */ -- 1.5.2