Commit b4df3ba0 authored by Russell King's avatar Russell King

drm/armada: pass plane state into armada_drm_plane_calc_addrs()

armada_drm_plane_calc_addrs() gets all its information from the plane
state, so it makes sense to pass the plane state pointer down into this
function, rather than extracting the information in identical ways,
sometimes a couple of layers up.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent 3382a6b9
...@@ -130,11 +130,10 @@ static void armada_drm_overlay_plane_atomic_update(struct drm_plane *plane, ...@@ -130,11 +130,10 @@ static void armada_drm_overlay_plane_atomic_update(struct drm_plane *plane,
old_state->src.y1 != state->src.y1 || old_state->src.y1 != state->src.y1 ||
old_state->fb != state->fb) { old_state->fb != state->fb) {
const struct drm_format_info *format; const struct drm_format_info *format;
u16 src_x = state->src.x1 >> 16; u16 src_x;
u16 src_y = state->src.y1 >> 16;
u32 addrs[3]; u32 addrs[3];
armada_drm_plane_calc_addrs(addrs, state->fb, src_x, src_y); armada_drm_plane_calc_addrs(state, addrs);
armada_reg_queue_set(regs, idx, addrs[0], armada_reg_queue_set(regs, idx, addrs[0],
LCD_SPU_DMA_START_ADDR_Y0); LCD_SPU_DMA_START_ADDR_Y0);
...@@ -166,6 +165,7 @@ static void armada_drm_overlay_plane_atomic_update(struct drm_plane *plane, ...@@ -166,6 +165,7 @@ static void armada_drm_overlay_plane_atomic_update(struct drm_plane *plane,
* the UV swap. * the UV swap.
*/ */
format = state->fb->format; format = state->fb->format;
src_x = state->src.x1 >> 16;
if (format->num_planes == 1 && src_x & (format->hsub - 1)) if (format->num_planes == 1 && src_x & (format->hsub - 1))
cfg ^= CFG_DMA_MOD(CFG_SWAPUV); cfg ^= CFG_DMA_MOD(CFG_SWAPUV);
cfg_mask = CFG_CBSH_ENA | CFG_DMAFORMAT | cfg_mask = CFG_CBSH_ENA | CFG_DMAFORMAT |
......
...@@ -35,14 +35,19 @@ static const uint32_t armada_primary_formats[] = { ...@@ -35,14 +35,19 @@ static const uint32_t armada_primary_formats[] = {
DRM_FORMAT_BGR565, DRM_FORMAT_BGR565,
}; };
void armada_drm_plane_calc_addrs(u32 *addrs, struct drm_framebuffer *fb, void armada_drm_plane_calc_addrs(struct drm_plane_state *state, u32 addrs[3])
int x, int y)
{ {
struct drm_framebuffer *fb = state->fb;
const struct drm_format_info *format = fb->format; const struct drm_format_info *format = fb->format;
unsigned int num_planes = format->num_planes; unsigned int num_planes = format->num_planes;
unsigned int x = state->src.x1 >> 16;
unsigned int y = state->src.y1 >> 16;
u32 addr = drm_fb_obj(fb)->dev_addr; u32 addr = drm_fb_obj(fb)->dev_addr;
int i; int i;
DRM_DEBUG_KMS("pitch %u x %d y %d bpp %d\n",
fb->pitches[0], x, y, format->cpp[0] * 8);
if (num_planes > 3) if (num_planes > 3)
num_planes = 3; num_planes = 3;
...@@ -59,17 +64,14 @@ void armada_drm_plane_calc_addrs(u32 *addrs, struct drm_framebuffer *fb, ...@@ -59,17 +64,14 @@ void armada_drm_plane_calc_addrs(u32 *addrs, struct drm_framebuffer *fb,
addrs[i] = 0; addrs[i] = 0;
} }
static unsigned armada_drm_crtc_calc_fb(struct drm_framebuffer *fb, static unsigned armada_drm_crtc_calc_fb(struct drm_plane_state *state,
int x, int y, struct armada_regs *regs, bool interlaced) struct armada_regs *regs, bool interlaced)
{ {
unsigned pitch = fb->pitches[0]; unsigned pitch = state->fb->pitches[0];
u32 addrs[3], addr_odd, addr_even; u32 addrs[3], addr_odd, addr_even;
unsigned i = 0; unsigned i = 0;
DRM_DEBUG_DRIVER("pitch %u x %d y %d bpp %d\n", armada_drm_plane_calc_addrs(state, addrs);
pitch, x, y, fb->format->cpp[0] * 8);
armada_drm_plane_calc_addrs(addrs, fb, x, y);
addr_odd = addr_even = addrs[0]; addr_odd = addr_even = addrs[0];
...@@ -175,10 +177,7 @@ static void armada_drm_primary_plane_atomic_update(struct drm_plane *plane, ...@@ -175,10 +177,7 @@ static void armada_drm_primary_plane_atomic_update(struct drm_plane *plane,
if (old_state->src.x1 != state->src.x1 || if (old_state->src.x1 != state->src.x1 ||
old_state->src.y1 != state->src.y1 || old_state->src.y1 != state->src.y1 ||
old_state->fb != state->fb) { old_state->fb != state->fb) {
idx += armada_drm_crtc_calc_fb(state->fb, idx += armada_drm_crtc_calc_fb(state, regs + idx,
state->src.x1 >> 16,
state->src.y1 >> 16,
regs + idx,
dcrtc->interlaced); dcrtc->interlaced);
} }
if (old_state->fb != state->fb) { if (old_state->fb != state->fb) {
......
#ifndef ARMADA_PLANE_H #ifndef ARMADA_PLANE_H
#define ARMADA_PLANE_H #define ARMADA_PLANE_H
void armada_drm_plane_calc_addrs(u32 *addrs, struct drm_framebuffer *fb, void armada_drm_plane_calc_addrs(struct drm_plane_state *state, u32 addrs[3]);
int x, int y);
int armada_drm_plane_prepare_fb(struct drm_plane *plane, int armada_drm_plane_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *state); struct drm_plane_state *state);
void armada_drm_plane_cleanup_fb(struct drm_plane *plane, void armada_drm_plane_cleanup_fb(struct drm_plane *plane,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment