@@ -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));
@@ -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) {
@@ -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);
@@ -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);
@@ -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)
{
@@ -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,
@@ -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;
@@ -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);
@@ -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);
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 <daniels@collabora.com> --- 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(-)