From patchwork Thu Mar 19 04:33:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 6045731 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D72949FB96 for ; Thu, 19 Mar 2015 04:33:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC204204B0 for ; Thu, 19 Mar 2015 04:33:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5680A20465 for ; Thu, 19 Mar 2015 04:33:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9059C6E951; Wed, 18 Mar 2015 21:33:46 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [93.93.135.160]) by gabe.freedesktop.org (Postfix) with ESMTP id 0AB686E952 for ; Wed, 18 Mar 2015 21:33:45 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id B70D9600621 From: Daniel Stone To: dri-devel@lists.freedesktop.org Subject: [RFC PATCH 07/37] drm: sti: Use crtc->hwmode for adjusted mode Date: Thu, 19 Mar 2015 04:33:06 +0000 Message-Id: <1426739616-10635-7-git-send-email-daniels@collabora.com> X-Mailer: git-send-email 2.3.2 In-Reply-To: <1426739616-10635-1-git-send-email-daniels@collabora.com> References: <1426739556-10429-1-git-send-email-daniels@collabora.com> <1426739616-10635-1-git-send-email-daniels@collabora.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP crtc->hwmode contains the adjusted_mode from mode_set; no reason to overwrite crtc->mode (the user-specified mode) with this anymore. This mode can also be const, since we don't modify it anywhere. Signed-off-by: Daniel Stone --- drivers/gpu/drm/sti/sti_cursor.c | 4 ++-- drivers/gpu/drm/sti/sti_drm_crtc.c | 11 +++-------- drivers/gpu/drm/sti/sti_drm_plane.c | 2 +- drivers/gpu/drm/sti/sti_gdp.c | 2 +- drivers/gpu/drm/sti/sti_layer.c | 2 +- drivers/gpu/drm/sti/sti_layer.h | 4 ++-- drivers/gpu/drm/sti/sti_mixer.c | 4 ++-- drivers/gpu/drm/sti/sti_mixer.h | 2 +- drivers/gpu/drm/sti/sti_vid.c | 2 +- 9 files changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c index 010eaee..998b13c 100644 --- a/drivers/gpu/drm/sti/sti_cursor.c +++ b/drivers/gpu/drm/sti/sti_cursor.c @@ -99,7 +99,7 @@ static void sti_cursor_argb8888_to_clut8(struct sti_layer *layer) static int sti_cursor_prepare_layer(struct sti_layer *layer, bool first_prepare) { struct sti_cursor *cursor = to_sti_cursor(layer); - struct drm_display_mode *mode = layer->mode; + const struct drm_display_mode *mode = layer->mode; u32 y, x; u32 val; @@ -166,7 +166,7 @@ static int sti_cursor_prepare_layer(struct sti_layer *layer, bool first_prepare) static int sti_cursor_commit_layer(struct sti_layer *layer) { struct sti_cursor *cursor = to_sti_cursor(layer); - struct drm_display_mode *mode = layer->mode; + const struct drm_display_mode *mode = layer->mode; u32 ydo, xdo; dev_dbg(layer->dev, "%s %s\n", __func__, sti_layer_to_str(layer)); diff --git a/drivers/gpu/drm/sti/sti_drm_crtc.c b/drivers/gpu/drm/sti/sti_drm_crtc.c index e6f6ef7..4721e91 100644 --- a/drivers/gpu/drm/sti/sti_drm_crtc.c +++ b/drivers/gpu/drm/sti/sti_drm_crtc.c @@ -129,17 +129,12 @@ sti_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, return -EINVAL; } - /* copy the mode data adjusted by mode_fixup() into crtc->mode - * so that hardware can be set to proper mode - */ - memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode)); - res = sti_mixer_set_layer_depth(mixer, layer); if (res) { DRM_ERROR("Can not set layer depth\n"); return -EINVAL; } - res = sti_mixer_active_video_area(mixer, &crtc->mode); + res = sti_mixer_active_video_area(mixer, adjusted_mode); if (res) { DRM_ERROR("Can not set active video area\n"); return -EINVAL; @@ -149,7 +144,7 @@ sti_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, h = crtc->primary->fb->height - y; return sti_layer_prepare(layer, crtc, - crtc->primary->fb, &crtc->mode, + crtc->primary->fb, adjusted_mode, mixer->id, 0, 0, w, h, x, y, w, h); } @@ -177,7 +172,7 @@ static int sti_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, h = crtc->primary->fb->height - crtc->y; ret = sti_layer_prepare(layer, crtc, - crtc->primary->fb, &crtc->mode, + crtc->primary->fb, &crtc->hwmode, mixer->id, 0, 0, w, h, crtc->x, crtc->y, w, h); if (ret) { diff --git a/drivers/gpu/drm/sti/sti_drm_plane.c b/drivers/gpu/drm/sti/sti_drm_plane.c index bb6a293..42edba3 100644 --- a/drivers/gpu/drm/sti/sti_drm_plane.c +++ b/drivers/gpu/drm/sti/sti_drm_plane.c @@ -46,7 +46,7 @@ sti_drm_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, /* src_x are in 16.16 format. */ res = sti_layer_prepare(layer, crtc, fb, - &crtc->mode, mixer->id, + &crtc->hwmode, mixer->id, crtc_x, crtc_y, crtc_w, crtc_h, src_x >> 16, src_y >> 16, src_w >> 16, src_h >> 16); diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index 087906f..af81e8a 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -251,7 +251,7 @@ static int sti_gdp_prepare_layer(struct sti_layer *layer, bool first_prepare) { struct sti_gdp_node_list *list; struct sti_gdp_node *top_field, *btm_field; - struct drm_display_mode *mode = layer->mode; + const struct drm_display_mode *mode = layer->mode; struct device *dev = layer->dev; struct sti_gdp *gdp = to_sti_gdp(layer); struct sti_compositor *compo = dev_get_drvdata(dev); diff --git a/drivers/gpu/drm/sti/sti_layer.c b/drivers/gpu/drm/sti/sti_layer.c index 899104f..f514989 100644 --- a/drivers/gpu/drm/sti/sti_layer.c +++ b/drivers/gpu/drm/sti/sti_layer.c @@ -83,7 +83,7 @@ EXPORT_SYMBOL(sti_layer_create); int sti_layer_prepare(struct sti_layer *layer, struct drm_crtc *crtc, struct drm_framebuffer *fb, - struct drm_display_mode *mode, int mixer_id, + const struct drm_display_mode *mode, int mixer_id, int dest_x, int dest_y, int dest_w, int dest_h, int src_x, int src_y, int src_w, int src_h) { diff --git a/drivers/gpu/drm/sti/sti_layer.h b/drivers/gpu/drm/sti/sti_layer.h index ceff497..50dd638 100644 --- a/drivers/gpu/drm/sti/sti_layer.h +++ b/drivers/gpu/drm/sti/sti_layer.h @@ -92,7 +92,7 @@ struct sti_layer { struct drm_plane plane; struct drm_framebuffer *fb; struct drm_crtc *crtc; - struct drm_display_mode *mode; + const struct drm_display_mode *mode; enum sti_layer_desc desc; struct device *dev; void __iomem *regs; @@ -116,7 +116,7 @@ struct sti_layer *sti_layer_create(struct device *dev, int desc, int sti_layer_prepare(struct sti_layer *layer, struct drm_crtc *crtc, struct drm_framebuffer *fb, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, int mixer_id, int dest_x, int dest_y, int dest_w, int dest_h, diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c index 13a4b84..45aa842 100644 --- a/drivers/gpu/drm/sti/sti_mixer.c +++ b/drivers/gpu/drm/sti/sti_mixer.c @@ -88,7 +88,7 @@ static void sti_mixer_set_background_color(struct sti_mixer *mixer, } static void sti_mixer_set_background_area(struct sti_mixer *mixer, - struct drm_display_mode *mode) + const struct drm_display_mode *mode) { u32 ydo, xdo, yds, xds; @@ -155,7 +155,7 @@ int sti_mixer_set_layer_depth(struct sti_mixer *mixer, struct sti_layer *layer) } int sti_mixer_active_video_area(struct sti_mixer *mixer, - struct drm_display_mode *mode) + const struct drm_display_mode *mode) { u32 ydo, xdo, yds, xds; diff --git a/drivers/gpu/drm/sti/sti_mixer.h b/drivers/gpu/drm/sti/sti_mixer.h index b972821..239f2a4 100644 --- a/drivers/gpu/drm/sti/sti_mixer.h +++ b/drivers/gpu/drm/sti/sti_mixer.h @@ -44,7 +44,7 @@ int sti_mixer_set_layer_status(struct sti_mixer *mixer, void sti_mixer_clear_all_layers(struct sti_mixer *mixer); int sti_mixer_set_layer_depth(struct sti_mixer *mixer, struct sti_layer *layer); int sti_mixer_active_video_area(struct sti_mixer *mixer, - struct drm_display_mode *mode); + const struct drm_display_mode *mode); void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable); diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c index 10ced6a..5add4a7 100644 --- a/drivers/gpu/drm/sti/sti_vid.c +++ b/drivers/gpu/drm/sti/sti_vid.c @@ -57,7 +57,7 @@ static int sti_vid_prepare_layer(struct sti_layer *vid, bool first_prepare) static int sti_vid_commit_layer(struct sti_layer *vid) { - struct drm_display_mode *mode = vid->mode; + const struct drm_display_mode *mode = vid->mode; u32 ydo, xdo, yds, xds; ydo = sti_vtg_get_line_number(*mode, vid->dst_y);