Skip to content

Commit

Permalink
drm/armada: improve efficiency of armada_drm_plane_calc_addrs()
Browse files Browse the repository at this point in the history
Lookup the drm_format_info structure once when computing all the
framebuffer plane addresses by using drm_format_info(), rather than
repetitive lookups via drm_format_plane_cpp().

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  • Loading branch information
Russell King committed Dec 8, 2017
1 parent 9c898c4 commit d6a4896
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/gpu/drm/armada/armada_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,17 @@ static void armada_drm_crtc_update(struct armada_crtc *dcrtc)
void armada_drm_plane_calc_addrs(u32 *addrs, struct drm_framebuffer *fb,
int x, int y)
{
const struct drm_format_info *format = fb->format;
unsigned int num_planes = format->num_planes;
u32 addr = drm_fb_obj(fb)->dev_addr;
int num_planes = fb->format->num_planes;
int i;

if (num_planes > 3)
num_planes = 3;

for (i = 0; i < num_planes; i++)
addrs[i] = addr + fb->offsets[i] + y * fb->pitches[i] +
x * fb->format->cpp[i];
x * format->cpp[i];
for (; i < 3; i++)
addrs[i] = 0;
}
Expand Down

0 comments on commit d6a4896

Please sign in to comment.