Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bcb0b461 authored by Ville Syrjälä's avatar Ville Syrjälä
Browse files

drm: Replace drm_format_num_planes() with fb->format->num_planes



Replace drm_format_num_planes(fb->pixel_format) with just
fb->format->num_planes. Avoids the expensive format info lookup.

@@
struct drm_framebuffer *a;
struct drm_framebuffer b;
@@
(
- drm_format_num_planes(a->pixel_format)
+ a->format->num_planes
|
- drm_format_num_planes(b.pixel_format)
+ b.format->num_planes
)

@@
struct drm_plane_state *a;
struct drm_plane_state b;
@@
(
- drm_format_num_planes(a->fb->pixel_format)
+ a->fb->format->num_planes
|
- drm_format_num_planes(b.fb->pixel_format)
+ b.fb->format->num_planes
)

@@
struct drm_framebuffer *a;
identifier T;
@@
  T = a->pixel_format
<+...
- drm_format_num_planes(T)
+ a->format->num_planes
...+>

@@
struct drm_framebuffer b;
identifier T;
@@
  T = b.pixel_format
<+...
- drm_format_num_planes(T)
+ b.format->num_planes
...+>

v2: Rerun spatch due to code changes

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Suggested-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1481751022-18015-1-git-send-email-ville.syrjala@linux.intel.com
parent 570cec32
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
	if (ms->format == MALIDP_INVALID_FORMAT_ID)
		return -EINVAL;

	ms->n_planes = drm_format_num_planes(fb->pixel_format);
	ms->n_planes = fb->format->num_planes;
	for (i = 0; i < ms->n_planes; i++) {
		if (!malidp_hw_pitch_valid(mp->hwdev, fb->pitches[i])) {
			DRM_DEBUG_KMS("Invalid pitch %u for plane %d\n",
+1 −1
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ void armada_drm_plane_calc_addrs(u32 *addrs, struct drm_framebuffer *fb,
{
	u32 addr = drm_fb_obj(fb)->dev_addr;
	u32 pixel_format = fb->pixel_format;
	int num_planes = drm_format_num_planes(pixel_format);
	int num_planes = fb->format->num_planes;
	int i;

	if (num_planes > 3)
+1 −1
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,

		pixel_format = fb->pixel_format;
		hsub = drm_format_horz_chroma_subsampling(pixel_format);
		num_planes = drm_format_num_planes(pixel_format);
		num_planes = fb->format->num_planes;

		/*
		 * Annoyingly, shifting a YUYV-format image by one pixel
+1 −1
Original line number Diff line number Diff line
@@ -446,7 +446,7 @@ void atmel_hlcdc_layer_update_set_fb(struct atmel_hlcdc_layer *layer,
		return;

	if (fb)
		nplanes = drm_format_num_planes(fb->pixel_format);
		nplanes = fb->format->num_planes;

	if (nplanes > layer->max_planes)
		return;
+1 −1
Original line number Diff line number Diff line
@@ -621,7 +621,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
	state->src_w >>= 16;
	state->src_h >>= 16;

	state->nplanes = drm_format_num_planes(fb->pixel_format);
	state->nplanes = fb->format->num_planes;
	if (state->nplanes > ATMEL_HLCDC_MAX_PLANES)
		return -EINVAL;

Loading