Commit bae781b2 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter
Browse files

drm: Nuke modifier[1-3]



It has been suggested that having per-plane modifiers is making life
more difficult for userspace, so let's just retire modifier[1-3] and
use modifier[0] to apply to the entire framebuffer.

Obviosuly this means that if individual planes need different tiling
layouts and whatnot we will need a new modifier for each combination
of planes with different tiling layouts.

For a bit of extra backwards compatilbilty the kernel will allow
non-zero modifier[1+] but it require that they will match modifier[0].
This in case there's existing userspace out there that sets
modifier[1+] to something non-zero with planar formats.

Mostly a cocci job, with a bit of manual stuff mixed in.

@@
struct drm_framebuffer *fb;
expression E;
@@
- fb->modifier[E]
+ fb->modifier

@@
struct drm_framebuffer fb;
expression E;
@@
- fb.modifier[E]
+ fb.modifier

Cc: Kristian Høgsberg <hoegsberg@gmail.com>
Cc: Ben Widawsky <benjamin.widawsky@intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net>
Cc: dczaplejewicz@collabora.co.uk
Suggested-by: default avatarKristian Høgsberg <hoegsberg@gmail.com>
Acked-by: default avatarBen Widawsky <ben@bwidawsk.net>
Acked-by: default avatarDaniel Stone <daniels@collabora.com>
Acked-by: default avatarRob Clark <robdclark@gmail.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479295996-26246-1-git-send-email-ville.syrjala@linux.intel.com
parent 0b46fcdb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -965,12 +965,12 @@ static void drm_atomic_plane_print_state(struct drm_printer *p,

		drm_printf(p, "\t\tformat=%s\n",
		              drm_get_format_name(fb->pixel_format, &format_name));
		drm_printf(p, "\t\t\tmodifier=0x%llx\n", fb->modifier);
		drm_printf(p, "\t\tsize=%dx%d\n", fb->width, fb->height);
		drm_printf(p, "\t\tlayers:\n");
		for (i = 0; i < n; i++) {
			drm_printf(p, "\t\t\tpitch[%d]=%u\n", i, fb->pitches[i]);
			drm_printf(p, "\t\t\toffset[%d]=%u\n", i, fb->offsets[i]);
			drm_printf(p, "\t\t\tmodifier[%d]=0x%llx\n", i, fb->modifier[i]);
		}
	}
	drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&dest));
+7 −0
Original line number Diff line number Diff line
@@ -177,6 +177,13 @@ static int framebuffer_check(const struct drm_mode_fb_cmd2 *r)
			return -EINVAL;
		}

		if (r->flags & DRM_MODE_FB_MODIFIERS &&
		    r->modifier[i] != r->modifier[0]) {
			DRM_DEBUG_KMS("bad fb modifier %llu for plane %d\n",
				      r->modifier[i], i);
			return -EINVAL;
		}

		/* modifier specific checks: */
		switch (r->modifier[i]) {
		case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE:
+1 −1
Original line number Diff line number Diff line
@@ -93,8 +93,8 @@ void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
	for (i = 0; i < 4; i++) {
		fb->pitches[i] = mode_cmd->pitches[i];
		fb->offsets[i] = mode_cmd->offsets[i];
		fb->modifier[i] = mode_cmd->modifier[i];
	}
	fb->modifier = mode_cmd->modifier[0];
	fb->pixel_format = mode_cmd->pixel_format;
	fb->flags = mode_cmd->flags;
}
+2 −2
Original line number Diff line number Diff line
@@ -1896,7 +1896,7 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
			   fbdev_fb->base.height,
			   fbdev_fb->base.depth,
			   fbdev_fb->base.bits_per_pixel,
			   fbdev_fb->base.modifier[0],
			   fbdev_fb->base.modifier,
			   drm_framebuffer_read_refcount(&fbdev_fb->base));
		describe_obj(m, fbdev_fb->obj);
		seq_putc(m, '\n');
@@ -1914,7 +1914,7 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
			   fb->base.height,
			   fb->base.depth,
			   fb->base.bits_per_pixel,
			   fb->base.modifier[0],
			   fb->base.modifier,
			   drm_framebuffer_read_refcount(&fb->base));
		describe_obj(m, fb->obj);
		seq_putc(m, '\n');
+2 −2
Original line number Diff line number Diff line
@@ -143,8 +143,8 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
	if (state->fb && drm_rotation_90_or_270(state->rotation)) {
		struct drm_format_name_buf format_name;

		if (!(state->fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
			state->fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED)) {
		if (state->fb->modifier != I915_FORMAT_MOD_Y_TILED &&
		    state->fb->modifier != I915_FORMAT_MOD_Yf_TILED) {
			DRM_DEBUG_KMS("Y/Yf tiling required for 90/270!\n");
			return -EINVAL;
		}
Loading