From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Pinchart Subject: Re: [PATCH v2] drm: Add fb_helper->restore_fbdev_mode hook Date: Wed, 08 May 2013 15:52:23 +0200 Message-ID: <1838766.MyNQAFo94M@avalon> References: <1776838.kA4PF15PTK@avalon> <1368020398-5036-1-git-send-email-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1368020398-5036-1-git-send-email-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: ville.syrjala@linux.intel.com Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Wednesday 08 May 2013 16:39:58 ville.syrjala@linux.intel.com wrote: > From: Ville Syrj=E4l=E4 > = > Drivers may need to turn off overlay planes, cursors, etc. when > restoring the fbdev mode. So allow drivers to provide their own > version of drm_fb_helper_restore_fbdev_mode() that can take care > of such details. > = > Initially just plug in drm_fb_helper_restore_fbdev_mode for all > drivers. > = > v2: Add kernel-doc for the new hook > = > Signed-off-by: Ville Syrj=E4l=E4 Reviewed-by: Laurent Pinchart > --- > drivers/gpu/drm/ast/ast_fb.c | 1 + > drivers/gpu/drm/cirrus/cirrus_fbdev.c | 1 + > drivers/gpu/drm/drm_fb_cma_helper.c | 1 + > drivers/gpu/drm/drm_fb_helper.c | 2 +- > drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 1 + > drivers/gpu/drm/gma500/framebuffer.c | 1 + > drivers/gpu/drm/i915/intel_fb.c | 1 + > drivers/gpu/drm/mgag200/mgag200_fb.c | 1 + > drivers/gpu/drm/nouveau/nouveau_fbcon.c | 1 + > drivers/gpu/drm/omapdrm/omap_fbdev.c | 1 + > drivers/gpu/drm/qxl/qxl_fb.c | 1 + > drivers/gpu/drm/radeon/radeon_fb.c | 1 + > drivers/gpu/drm/udl/udl_fb.c | 1 + > include/drm/drm_fb_helper.h | 2 ++ > 14 files changed, 15 insertions(+), 1 deletion(-) > = > diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c > index 34931fe..2c1f469 100644 > --- a/drivers/gpu/drm/ast/ast_fb.c > +++ b/drivers/gpu/drm/ast/ast_fb.c > @@ -254,6 +254,7 @@ static struct drm_fb_helper_funcs ast_fb_helper_funcs= =3D > { .gamma_set =3D ast_fb_gamma_set, > .gamma_get =3D ast_fb_gamma_get, > .fb_probe =3D astfb_create, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > static void ast_fbdev_destroy(struct drm_device *dev, > diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c > b/drivers/gpu/drm/cirrus/cirrus_fbdev.c index e25afcc..ee48a21 100644 > --- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c > +++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c > @@ -253,6 +253,7 @@ static struct drm_fb_helper_funcs cirrus_fb_helper_fu= ncs > =3D { .gamma_set =3D cirrus_crtc_fb_gamma_set, > .gamma_get =3D cirrus_crtc_fb_gamma_get, > .fb_probe =3D cirrusfb_create, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > int cirrus_fbdev_init(struct cirrus_device *cdev) > diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c > b/drivers/gpu/drm/drm_fb_cma_helper.c index 0b5af7d..f011628 100644 > --- a/drivers/gpu/drm/drm_fb_cma_helper.c > +++ b/drivers/gpu/drm/drm_fb_cma_helper.c > @@ -330,6 +330,7 @@ err_drm_gem_cma_free_object: > = > static struct drm_fb_helper_funcs drm_fb_cma_helper_funcs =3D { > .fb_probe =3D drm_fbdev_cma_create, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > /** > diff --git a/drivers/gpu/drm/drm_fb_helper.c > b/drivers/gpu/drm/drm_fb_helper.c index b78cbe7..02c70b2 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -315,7 +315,7 @@ static bool drm_fb_helper_force_kernel_mode(void) > if (helper->dev->switch_power_state =3D=3D DRM_SWITCH_POWER_OFF) > continue; > = > - ret =3D drm_fb_helper_restore_fbdev_mode(helper); > + ret =3D helper->funcs->restore_fbdev_mode(helper); > if (ret) > error =3D true; > } > diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c > b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 68f0045..6ed4065 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c > @@ -228,6 +228,7 @@ out: > = > static struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs =3D { > .fb_probe =3D exynos_drm_fbdev_create, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > int exynos_drm_fbdev_init(struct drm_device *dev) > diff --git a/drivers/gpu/drm/gma500/framebuffer.c > b/drivers/gpu/drm/gma500/framebuffer.c index 1534e22..8d7f9c0 100644 > --- a/drivers/gpu/drm/gma500/framebuffer.c > +++ b/drivers/gpu/drm/gma500/framebuffer.c > @@ -567,6 +567,7 @@ static struct drm_fb_helper_funcs psb_fb_helper_funcs= =3D > { .gamma_set =3D psbfb_gamma_set, > .gamma_get =3D psbfb_gamma_get, > .fb_probe =3D psbfb_probe, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev > *fbdev) diff --git a/drivers/gpu/drm/i915/intel_fb.c > b/drivers/gpu/drm/i915/intel_fb.c index 0e19e57..a04481f 100644 > --- a/drivers/gpu/drm/i915/intel_fb.c > +++ b/drivers/gpu/drm/i915/intel_fb.c > @@ -187,6 +187,7 @@ static struct drm_fb_helper_funcs intel_fb_helper_fun= cs > =3D { .gamma_set =3D intel_crtc_fb_gamma_set, > .gamma_get =3D intel_crtc_fb_gamma_get, > .fb_probe =3D intelfb_create, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > static void intel_fbdev_destroy(struct drm_device *dev, > diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c > b/drivers/gpu/drm/mgag200/mgag200_fb.c index 421beab..23b8de2 100644 > --- a/drivers/gpu/drm/mgag200/mgag200_fb.c > +++ b/drivers/gpu/drm/mgag200/mgag200_fb.c > @@ -239,6 +239,7 @@ static struct drm_fb_helper_funcs mga_fb_helper_funcs= =3D > { .gamma_set =3D mga_crtc_fb_gamma_set, > .gamma_get =3D mga_crtc_fb_gamma_get, > .fb_probe =3D mgag200fb_create, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > int mgag200_fbdev_init(struct mga_device *mdev) > diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c > b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index b035317..2a280d8 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c > +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c > @@ -435,6 +435,7 @@ static struct drm_fb_helper_funcs > nouveau_fbcon_helper_funcs =3D { .gamma_set =3D nouveau_fbcon_gamma_set, > .gamma_get =3D nouveau_fbcon_gamma_get, > .fb_probe =3D nouveau_fbcon_create, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > = > diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c > b/drivers/gpu/drm/omapdrm/omap_fbdev.c index b11ce60..ff3bc81 100644 > --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c > +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c > @@ -297,6 +297,7 @@ static struct drm_fb_helper_funcs omap_fb_helper_func= s =3D > { .gamma_set =3D omap_crtc_fb_gamma_set, > .gamma_get =3D omap_crtc_fb_gamma_get, > .fb_probe =3D omap_fbdev_create, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > static struct drm_fb_helper *get_fb(struct fb_info *fbi) > diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c > index b3c5127..b10db0c 100644 > --- a/drivers/gpu/drm/qxl/qxl_fb.c > +++ b/drivers/gpu/drm/qxl/qxl_fb.c > @@ -525,6 +525,7 @@ static struct drm_fb_helper_funcs qxl_fb_helper_funcs= =3D > { .gamma_get =3D qxl_crtc_fb_gamma_get, > */ > .fb_probe =3D qxl_fb_find_or_create_single, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > int qxl_fbdev_init(struct qxl_device *qdev) > diff --git a/drivers/gpu/drm/radeon/radeon_fb.c > b/drivers/gpu/drm/radeon/radeon_fb.c index b174674..2b1b211 100644 > --- a/drivers/gpu/drm/radeon/radeon_fb.c > +++ b/drivers/gpu/drm/radeon/radeon_fb.c > @@ -335,6 +335,7 @@ static struct drm_fb_helper_funcs radeon_fb_helper_fu= ncs > =3D { .gamma_set =3D radeon_crtc_fb_gamma_set, > .gamma_get =3D radeon_crtc_fb_gamma_get, > .fb_probe =3D radeonfb_create, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > int radeon_fbdev_init(struct radeon_device *rdev) > diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c > index dc0c065..75a44fd 100644 > --- a/drivers/gpu/drm/udl/udl_fb.c > +++ b/drivers/gpu/drm/udl/udl_fb.c > @@ -561,6 +561,7 @@ static struct drm_fb_helper_funcs udl_fb_helper_funcs= =3D > { .gamma_set =3D udl_crtc_fb_gamma_set, > .gamma_get =3D udl_crtc_fb_gamma_get, > .fb_probe =3D udlfb_create, > + .restore_fbdev_mode =3D drm_fb_helper_restore_fbdev_mode, > }; > = > static void udl_fbdev_destroy(struct drm_device *dev, > diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h > index 471f276..146abb6 100644 > --- a/include/drm/drm_fb_helper.h > +++ b/include/drm/drm_fb_helper.h > @@ -58,6 +58,7 @@ struct drm_fb_helper_surface_size { > * structure. Futhermore it also needs to allocate the drm > * framebuffer used to back the fbdev. > * @initial_config: Setup an initial fbdev display configuration > + * @restore_fbdev_mode: Restore the fbdev display configuration (eg. to > show an oops) * > * Driver callbacks used by the fbdev emulation helper library. > */ > @@ -73,6 +74,7 @@ struct drm_fb_helper_funcs { > struct drm_fb_helper_crtc **crtcs, > struct drm_display_mode **modes, > bool *enabled, int width, int height); > + bool (*restore_fbdev_mode)(struct drm_fb_helper *fb_helper); > }; > = > struct drm_fb_helper_connector { -- = Regards, Laurent Pinchart