From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucas Stach Subject: Re: [PATCH v2 3/5] drm/tegra: Implement .mode_set_base() Date: Mon, 14 Jan 2013 18:14:39 +0100 Message-ID: <1358183679.1524.11.camel@tellur> References: <1358179560-26799-1-git-send-email-thierry.reding@avionic-design.de> <1358179560-26799-4-git-send-email-thierry.reding@avionic-design.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1358179560-26799-4-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org> Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Thierry Reding Cc: David Airlie , linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: linux-tegra@vger.kernel.org Am Montag, den 14.01.2013, 17:05 +0100 schrieb Thierry Reding: > The sequence for replacing the scanout buffer is much shorter than a > full mode change operation so implementing this callback considerably > speeds up cases where only a new framebuffer is to be scanned out. > > Signed-off-by: Thierry Reding Aside from the small comment: Reviewed-by: Lucas Stach > --- > drivers/gpu/drm/tegra/dc.c | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c > index 157e962..8dd7d8a 100644 > --- a/drivers/gpu/drm/tegra/dc.c > +++ b/drivers/gpu/drm/tegra/dc.c > @@ -116,6 +116,25 @@ static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc) > return 0; > } > > +static int tegra_dc_set_base(struct tegra_dc *dc, int x, int y, > + struct tegra_framebuffer *fb) > +{ > + unsigned long value; > + > + tegra_dc_writel(dc, WINDOW_A_SELECT, DC_CMD_DISPLAY_WINDOW_HEADER); > + > + value = fb->base.offsets[0] + y * fb->base.pitches[0] + > + x * fb->base.bits_per_pixel / 8; > + > + tegra_dc_writel(dc, fb->obj->paddr + value, DC_WINBUF_START_ADDR); > + > + value = GENERAL_ACT_REQ | WIN_A_ACT_REQ; > + value |= GENERAL_UPDATE | WIN_A_UPDATE; > + tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); Make this two separate writes. > + > + return 0; > +} > + > static const struct drm_crtc_funcs tegra_crtc_funcs = { > .set_config = drm_crtc_helper_set_config, > .destroy = drm_crtc_cleanup, > @@ -404,6 +423,15 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, > return 0; > } > > +static int tegra_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, > + struct drm_framebuffer *old_fb) > +{ > + struct tegra_framebuffer *fb = to_tegra_fb(crtc->fb); > + struct tegra_dc *dc = to_tegra_dc(crtc); > + > + return tegra_dc_set_base(dc, x, y, fb); > +} > + > static void tegra_crtc_prepare(struct drm_crtc *crtc) > { > struct tegra_dc *dc = to_tegra_dc(crtc); > @@ -483,6 +511,7 @@ static const struct drm_crtc_helper_funcs tegra_crtc_helper_funcs = { > .dpms = tegra_crtc_dpms, > .mode_fixup = tegra_crtc_mode_fixup, > .mode_set = tegra_crtc_mode_set, > + .mode_set_base = tegra_crtc_mode_set_base, > .prepare = tegra_crtc_prepare, > .commit = tegra_crtc_commit, > .load_lut = tegra_crtc_load_lut,