linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/msm: update generated headers
@ 2015-02-20 14:42 Beeresh Gopal
  2015-02-20 14:42 ` [PATCH 2/2] drm/msm: Support NV12MT format in mdp4 Beeresh Gopal
  0 siblings, 1 reply; 12+ messages in thread
From: Beeresh Gopal @ 2015-02-20 14:42 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-kernel, robdclark, airlied, sviau, hali, Beeresh Gopal

To avoid ambiguity rename FRAME_SIZE to
SSTILE_FRAME_SIZE

Change-Id: I2c1c763cec31acb6c860220c41a8b33bfad430a3
Signed-off-by: Beeresh Gopal <gbeeresh@codeaurora.org>
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h | 36 +++++++++++++--------------------
 1 file changed, 14 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h b/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h
index 1d39174..2d0029d 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h
@@ -8,19 +8,11 @@ http://github.com/freedreno/envytools/
 git clone https://github.com/freedreno/envytools.git
 
 The rules-ng-ng source files this header was generated from are:
-- /home/robclark/src/freedreno/envytools/rnndb/msm.xml                 (    676 bytes, from 2014-12-05 15:34:49)
-- /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2013-03-31 16:51:27)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml            (  20908 bytes, from 2014-12-08 16:13:00)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2357 bytes, from 2014-12-08 16:13:00)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  27208 bytes, from 2015-01-13 23:56:11)
-- /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml             (  11712 bytes, from 2013-08-17 17:13:43)
-- /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml            (    344 bytes, from 2013-08-11 19:26:32)
-- /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml         (   1686 bytes, from 2014-10-31 16:48:57)
-- /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml         (    600 bytes, from 2013-07-05 19:21:12)
-- /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml           (  26848 bytes, from 2015-01-13 23:55:57)
-- /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml             (   8253 bytes, from 2014-12-08 16:13:00)
-
-Copyright (C) 2013-2014 by the following authors:
+- /local/mnt/workspace/sandbox/envytools/rnndb/mdp/mdp4.xml            (  20915 bytes, from 2015-02-06 15:25:51)
+- /local/mnt/workspace/sandbox/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2015-02-06 15:25:09)
+- /local/mnt/workspace/sandbox/envytools/rnndb/mdp/mdp_common.xml      (   2357 bytes, from 2015-02-06 15:25:09)
+
+Copyright (C) 2013-2015 by the following authors:
 - Rob Clark <robdclark@gmail.com> (robclark)
 
 Permission is hereby granted, free of charge, to any person obtaining
@@ -680,18 +672,18 @@ static inline uint32_t MDP4_PIPE_SRC_STRIDE_B_P3(uint32_t val)
 	return ((val) << MDP4_PIPE_SRC_STRIDE_B_P3__SHIFT) & MDP4_PIPE_SRC_STRIDE_B_P3__MASK;
 }
 
-static inline uint32_t REG_MDP4_PIPE_FRAME_SIZE(enum mdp4_pipe i0) { return 0x00020048 + 0x10000*i0; }
-#define MDP4_PIPE_FRAME_SIZE_HEIGHT__MASK			0xffff0000
-#define MDP4_PIPE_FRAME_SIZE_HEIGHT__SHIFT			16
-static inline uint32_t MDP4_PIPE_FRAME_SIZE_HEIGHT(uint32_t val)
+static inline uint32_t REG_MDP4_PIPE_SSTILE_FRAME_SIZE(enum mdp4_pipe i0) { return 0x00020048 + 0x10000*i0; }
+#define MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__MASK		0xffff0000
+#define MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__SHIFT		16
+static inline uint32_t MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT(uint32_t val)
 {
-	return ((val) << MDP4_PIPE_FRAME_SIZE_HEIGHT__SHIFT) & MDP4_PIPE_FRAME_SIZE_HEIGHT__MASK;
+	return ((val) << MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__SHIFT) & MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__MASK;
 }
-#define MDP4_PIPE_FRAME_SIZE_WIDTH__MASK			0x0000ffff
-#define MDP4_PIPE_FRAME_SIZE_WIDTH__SHIFT			0
-static inline uint32_t MDP4_PIPE_FRAME_SIZE_WIDTH(uint32_t val)
+#define MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__MASK			0x0000ffff
+#define MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__SHIFT		0
+static inline uint32_t MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH(uint32_t val)
 {
-	return ((val) << MDP4_PIPE_FRAME_SIZE_WIDTH__SHIFT) & MDP4_PIPE_FRAME_SIZE_WIDTH__MASK;
+	return ((val) << MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__SHIFT) & MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__MASK;
 }
 
 static inline uint32_t REG_MDP4_PIPE_SRC_FORMAT(enum mdp4_pipe i0) { return 0x00020050 + 0x10000*i0; }
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] drm/msm: Support NV12MT format in mdp4
  2015-02-20 14:42 [PATCH 1/2] drm/msm: update generated headers Beeresh Gopal
@ 2015-02-20 14:42 ` Beeresh Gopal
  2015-02-20 15:26   ` Rob Clark
  2015-02-22 10:34   ` [PATCH 2/2] drm/msm: " Daniel Vetter
  0 siblings, 2 replies; 12+ messages in thread
From: Beeresh Gopal @ 2015-02-20 14:42 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-kernel, robdclark, airlied, sviau, hali, Beeresh Gopal

Using fb modifier flag, support NV12MT format
in MDP4

Change-Id: I3de92b0c3b6d0cb56647aed6e4e35e56eff7adab
Signed-off-by: Beeresh Gopal <gbeeresh@codeaurora.org>
Signed-off-by: Stephane Viau <sviau@codeaurora.org>
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c   |  9 +++++++++
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 22 ++++++++++++++++++++++
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c   |  5 +++++
 drivers/gpu/drm/msm/msm_drv.c             |  2 ++
 drivers/gpu/drm/msm/msm_kms.h             |  1 +
 include/uapi/drm/drm_fourcc.h             | 14 ++++++++++++++
 6 files changed, 53 insertions(+)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
index d81e19d..24c38d4 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
@@ -157,6 +157,14 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
 	mdp4_disable(mdp4_kms);
 }
 
+static void mdp4_set_mode_config(struct msm_kms *kms)
+{
+	struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
+	struct drm_device *dev = mdp4_kms->dev;
+
+	dev->mode_config.allow_fb_modifiers = true;
+}
+
 static long mdp4_round_pixclk(struct msm_kms *kms, unsigned long rate,
 		struct drm_encoder *encoder)
 {
@@ -197,6 +205,7 @@ static const struct mdp_kms_funcs kms_funcs = {
 		.complete_commit = mdp4_complete_commit,
 		.get_format      = mdp_get_format,
 		.round_pixclk    = mdp4_round_pixclk,
+		.set_mode_config = mdp4_set_mode_config,
 		.preclose        = mdp4_preclose,
 		.destroy         = mdp4_destroy,
 	},
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
index cde2500..2c2d6a5 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
@@ -33,6 +33,21 @@ struct mdp4_plane {
 };
 #define to_mdp4_plane(x) container_of(x, struct mdp4_plane, base)
 
+/* MDP format helper functions */
+static inline
+enum mdp4_frame_format mdp4_get_frame_format(struct drm_framebuffer *fb)
+{
+	bool is_tile = false;
+
+	if (fb->modifier[1] == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE)
+		is_tile = true;
+
+	if (fb->pixel_format == DRM_FORMAT_NV12 && is_tile)
+		return FRAME_TILE_YCBCR_420;
+
+	return FRAME_LINEAR;
+}
+
 static void mdp4_plane_set_scanout(struct drm_plane *plane,
 		struct drm_framebuffer *fb);
 static int mdp4_plane_mode_set(struct drm_plane *plane,
@@ -203,6 +218,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
 	uint32_t op_mode = 0;
 	uint32_t phasex_step = MDP4_VG_PHASE_STEP_DEFAULT;
 	uint32_t phasey_step = MDP4_VG_PHASE_STEP_DEFAULT;
+	enum mdp4_frame_format frame_type = mdp4_get_frame_format(fb);
 
 	if (!(crtc && fb)) {
 		DBG("%s: disabled!", mdp4_plane->name);
@@ -302,6 +318,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
 			MDP4_PIPE_SRC_FORMAT_UNPACK_COUNT(format->unpack_count - 1) |
 			MDP4_PIPE_SRC_FORMAT_FETCH_PLANES(format->fetch_type) |
 			MDP4_PIPE_SRC_FORMAT_CHROMA_SAMP(format->chroma_sample) |
+			MDP4_PIPE_SRC_FORMAT_FRAME_FORMAT(frame_type) |
 			COND(format->unpack_tight, MDP4_PIPE_SRC_FORMAT_UNPACK_TIGHT));
 
 	mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_UNPACK(pipe),
@@ -322,6 +339,11 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
 	mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEX_STEP(pipe), phasex_step);
 	mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEY_STEP(pipe), phasey_step);
 
+	if (frame_type != FRAME_LINEAR)
+		mdp4_write(mdp4_kms, REG_MDP4_PIPE_SSTILE_FRAME_SIZE(pipe),
+				MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH(src_w) |
+				MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT(src_h));
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index 92b61db..9cb5a5d 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -80,6 +80,10 @@ static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
 	mdp5_disable(mdp5_kms);
 }
 
+static void mdp5_set_mode_config(struct msm_kms *kms)
+{
+}
+
 static long mdp5_round_pixclk(struct msm_kms *kms, unsigned long rate,
 		struct drm_encoder *encoder)
 {
@@ -131,6 +135,7 @@ static const struct mdp_kms_funcs kms_funcs = {
 		.complete_commit = mdp5_complete_commit,
 		.get_format      = mdp_get_format,
 		.round_pixclk    = mdp5_round_pixclk,
+		.set_mode_config = mdp5_set_mode_config,
 		.preclose        = mdp5_preclose,
 		.destroy         = mdp5_destroy,
 	},
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index dfd583f..a72ed0a 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -281,6 +281,8 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
 			dev_err(dev->dev, "kms hw init failed: %d\n", ret);
 			goto fail;
 		}
+
+		kms->funcs->set_mode_config(kms);
 	}
 
 	dev->mode_config.min_width = 0;
diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h
index 3a78cb4..d6e3bb4 100644
--- a/drivers/gpu/drm/msm/msm_kms.h
+++ b/drivers/gpu/drm/msm/msm_kms.h
@@ -47,6 +47,7 @@ struct msm_kms_funcs {
 	const struct msm_format *(*get_format)(struct msm_kms *kms, uint32_t format);
 	long (*round_pixclk)(struct msm_kms *kms, unsigned long rate,
 			struct drm_encoder *encoder);
+	void (*set_mode_config)(struct msm_kms *kms);
 	/* cleanup: */
 	void (*preclose)(struct msm_kms *kms, struct drm_file *file);
 	void (*destroy)(struct msm_kms *kms);
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 188e61f..1546302 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -161,4 +161,18 @@
  * authoritative source for all of these.
  */
 
+/* Samsung framebuffer modifiers */
+
+/*
+ * NV12 64x32 Tiled
+ *
+ * 2 planes Y and CbCr, grouped into 64x32 macro tiles,
+ * with a non-standard order in memory (Z-shape).
+ *
+ * Pixel layout identical to DRM_FORMAT_NV21 format:
+ * index 0 = Y plane, [7:0] Y
+ * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
+ */
+#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
+
 #endif /* DRM_FOURCC_H */
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] drm/msm: Support NV12MT format in mdp4
  2015-02-20 14:42 ` [PATCH 2/2] drm/msm: Support NV12MT format in mdp4 Beeresh Gopal
@ 2015-02-20 15:26   ` Rob Clark
  2015-03-13 19:12     ` [PATCH v2 0/2] drm/msm: Add support for " Stephane Viau
  2015-02-22 10:34   ` [PATCH 2/2] drm/msm: " Daniel Vetter
  1 sibling, 1 reply; 12+ messages in thread
From: Rob Clark @ 2015-02-20 15:26 UTC (permalink / raw)
  To: Beeresh Gopal
  Cc: dri-devel, Linux Kernel Mailing List, David Airlie,
	Stephane Viau, Hai Li

On Fri, Feb 20, 2015 at 9:42 AM, Beeresh Gopal <gbeeresh@codeaurora.org> wrote:
> Using fb modifier flag, support NV12MT format
> in MDP4
>
> Change-Id: I3de92b0c3b6d0cb56647aed6e4e35e56eff7adab
> Signed-off-by: Beeresh Gopal <gbeeresh@codeaurora.org>
> Signed-off-by: Stephane Viau <sviau@codeaurora.org>

on small comment below, and one open question at the end, but other
than that it looks good.

oh, and you should drop the Change-Id


> ---
>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c   |  9 +++++++++
>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 22 ++++++++++++++++++++++
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c   |  5 +++++
>  drivers/gpu/drm/msm/msm_drv.c             |  2 ++
>  drivers/gpu/drm/msm/msm_kms.h             |  1 +
>  include/uapi/drm/drm_fourcc.h             | 14 ++++++++++++++
>  6 files changed, 53 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> index d81e19d..24c38d4 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> @@ -157,6 +157,14 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
>         mdp4_disable(mdp4_kms);
>  }
>
> +static void mdp4_set_mode_config(struct msm_kms *kms)
> +{
> +       struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
> +       struct drm_device *dev = mdp4_kms->dev;
> +
> +       dev->mode_config.allow_fb_modifiers = true;

why not just add this in mdp4_kms_init() or hw_init()?  That would
avoid having to add a new vfunc and keep things a bit simpler

> +}
> +
>  static long mdp4_round_pixclk(struct msm_kms *kms, unsigned long rate,
>                 struct drm_encoder *encoder)
>  {
> @@ -197,6 +205,7 @@ static const struct mdp_kms_funcs kms_funcs = {
>                 .complete_commit = mdp4_complete_commit,
>                 .get_format      = mdp_get_format,
>                 .round_pixclk    = mdp4_round_pixclk,
> +               .set_mode_config = mdp4_set_mode_config,
>                 .preclose        = mdp4_preclose,
>                 .destroy         = mdp4_destroy,
>         },
> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
> index cde2500..2c2d6a5 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
> @@ -33,6 +33,21 @@ struct mdp4_plane {
>  };
>  #define to_mdp4_plane(x) container_of(x, struct mdp4_plane, base)
>
> +/* MDP format helper functions */
> +static inline
> +enum mdp4_frame_format mdp4_get_frame_format(struct drm_framebuffer *fb)
> +{
> +       bool is_tile = false;
> +
> +       if (fb->modifier[1] == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE)
> +               is_tile = true;
> +
> +       if (fb->pixel_format == DRM_FORMAT_NV12 && is_tile)
> +               return FRAME_TILE_YCBCR_420;
> +
> +       return FRAME_LINEAR;
> +}
> +
>  static void mdp4_plane_set_scanout(struct drm_plane *plane,
>                 struct drm_framebuffer *fb);
>  static int mdp4_plane_mode_set(struct drm_plane *plane,
> @@ -203,6 +218,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
>         uint32_t op_mode = 0;
>         uint32_t phasex_step = MDP4_VG_PHASE_STEP_DEFAULT;
>         uint32_t phasey_step = MDP4_VG_PHASE_STEP_DEFAULT;
> +       enum mdp4_frame_format frame_type = mdp4_get_frame_format(fb);
>
>         if (!(crtc && fb)) {
>                 DBG("%s: disabled!", mdp4_plane->name);
> @@ -302,6 +318,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
>                         MDP4_PIPE_SRC_FORMAT_UNPACK_COUNT(format->unpack_count - 1) |
>                         MDP4_PIPE_SRC_FORMAT_FETCH_PLANES(format->fetch_type) |
>                         MDP4_PIPE_SRC_FORMAT_CHROMA_SAMP(format->chroma_sample) |
> +                       MDP4_PIPE_SRC_FORMAT_FRAME_FORMAT(frame_type) |
>                         COND(format->unpack_tight, MDP4_PIPE_SRC_FORMAT_UNPACK_TIGHT));
>
>         mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_UNPACK(pipe),
> @@ -322,6 +339,11 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
>         mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEX_STEP(pipe), phasex_step);
>         mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEY_STEP(pipe), phasey_step);
>
> +       if (frame_type != FRAME_LINEAR)
> +               mdp4_write(mdp4_kms, REG_MDP4_PIPE_SSTILE_FRAME_SIZE(pipe),
> +                               MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH(src_w) |
> +                               MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT(src_h));
> +
>         return 0;
>  }
>
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
> index 92b61db..9cb5a5d 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
> @@ -80,6 +80,10 @@ static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
>         mdp5_disable(mdp5_kms);
>  }
>
> +static void mdp5_set_mode_config(struct msm_kms *kms)
> +{
> +}
> +
>  static long mdp5_round_pixclk(struct msm_kms *kms, unsigned long rate,
>                 struct drm_encoder *encoder)
>  {
> @@ -131,6 +135,7 @@ static const struct mdp_kms_funcs kms_funcs = {
>                 .complete_commit = mdp5_complete_commit,
>                 .get_format      = mdp_get_format,
>                 .round_pixclk    = mdp5_round_pixclk,
> +               .set_mode_config = mdp5_set_mode_config,
>                 .preclose        = mdp5_preclose,
>                 .destroy         = mdp5_destroy,
>         },
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index dfd583f..a72ed0a 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -281,6 +281,8 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
>                         dev_err(dev->dev, "kms hw init failed: %d\n", ret);
>                         goto fail;
>                 }
> +
> +               kms->funcs->set_mode_config(kms);
>         }
>
>         dev->mode_config.min_width = 0;
> diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h
> index 3a78cb4..d6e3bb4 100644
> --- a/drivers/gpu/drm/msm/msm_kms.h
> +++ b/drivers/gpu/drm/msm/msm_kms.h
> @@ -47,6 +47,7 @@ struct msm_kms_funcs {
>         const struct msm_format *(*get_format)(struct msm_kms *kms, uint32_t format);
>         long (*round_pixclk)(struct msm_kms *kms, unsigned long rate,
>                         struct drm_encoder *encoder);
> +       void (*set_mode_config)(struct msm_kms *kms);
>         /* cleanup: */
>         void (*preclose)(struct msm_kms *kms, struct drm_file *file);
>         void (*destroy)(struct msm_kms *kms);
> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> index 188e61f..1546302 100644
> --- a/include/uapi/drm/drm_fourcc.h
> +++ b/include/uapi/drm/drm_fourcc.h
> @@ -161,4 +161,18 @@
>   * authoritative source for all of these.
>   */
>
> +/* Samsung framebuffer modifiers */
> +
> +/*
> + * NV12 64x32 Tiled
> + *
> + * 2 planes Y and CbCr, grouped into 64x32 macro tiles,
> + * with a non-standard order in memory (Z-shape).
> + *
> + * Pixel layout identical to DRM_FORMAT_NV21 format:
> + * index 0 = Y plane, [7:0] Y
> + * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
> + */
> +#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
> +

so, the one thing I couldn't quite figure out...  I'm assuming the
untiling is before un-sub-sampling the UV, meaning that the pattern in
the UV plane is 32x16 pairs of pixels (so 64x16).  I found some
gstreamer code that untile a buffer in this layout, but there were too
many levels of indirection ;-)

I'm not sure if we should then define separate modifiers for Y and UV.
Or maybe it is simpler the define that the layout depends on the
plane?



>  #endif /* DRM_FOURCC_H */
> --
> 1.8.2.1
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] drm/msm: Support NV12MT format in mdp4
  2015-02-20 14:42 ` [PATCH 2/2] drm/msm: Support NV12MT format in mdp4 Beeresh Gopal
  2015-02-20 15:26   ` Rob Clark
@ 2015-02-22 10:34   ` Daniel Vetter
  2015-03-13 14:51     ` "Stéphane Viau"
  1 sibling, 1 reply; 12+ messages in thread
From: Daniel Vetter @ 2015-02-22 10:34 UTC (permalink / raw)
  To: Beeresh Gopal; +Cc: dri-devel, Linux Kernel Mailing List

On Fri, Feb 20, 2015 at 3:42 PM, Beeresh Gopal <gbeeresh@codeaurora.org> wrote:
> +/* Samsung framebuffer modifiers */
> +
> +/*
> + * NV12 64x32 Tiled
> + *
> + * 2 planes Y and CbCr, grouped into 64x32 macro tiles,
> + * with a non-standard order in memory (Z-shape).
> + *
> + * Pixel layout identical to DRM_FORMAT_NV21 format:
> + * index 0 = Y plane, [7:0] Y
> + * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
> + */
> +#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)

This description mixes layout information with pixel format. Strictly
speaking you could use this for other formats, but since the
description doesn't mention whether this is in bytes or pixels that's
a bit awkward. Or just mandatae that this can only be used with NV12
fourcc (and maybe add a check for that into the core drm code.

Also, is this really samsung and not mpeg?
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] drm/msm: Support NV12MT format in mdp4
  2015-02-22 10:34   ` [PATCH 2/2] drm/msm: " Daniel Vetter
@ 2015-03-13 14:51     ` "Stéphane Viau"
  0 siblings, 0 replies; 12+ messages in thread
From: "Stéphane Viau" @ 2015-03-13 14:51 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Beeresh Gopal, Linux Kernel Mailing List, dri-devel

Hi Daniel,

> On Fri, Feb 20, 2015 at 3:42 PM, Beeresh Gopal <gbeeresh@codeaurora.org>
> wrote:
>> +/* Samsung framebuffer modifiers */
>> +
>> +/*
>> + * NV12 64x32 Tiled
>> + *
>> + * 2 planes Y and CbCr, grouped into 64x32 macro tiles,
>> + * with a non-standard order in memory (Z-shape).
>> + *
>> + * Pixel layout identical to DRM_FORMAT_NV21 format:
>> + * index 0 = Y plane, [7:0] Y
>> + * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
>> + */
>> +#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
>
> This description mixes layout information with pixel format. Strictly
> speaking you could use this for other formats, but since the
> description doesn't mention whether this is in bytes or pixels that's
> a bit awkward. Or just mandatae that this can only be used with NV12
> fourcc (and maybe add a check for that into the core drm code.

Agreed: I think /* Tiled: 64x32 pixel macroblocks */ - or something along
those lines - as a description should do the trick.

>
> Also, is this really samsung and not mpeg?

>From my understanding the VENDOR is actually SAMSUNG for the following
reasons:
 a) V4L2_PIX_FMT_NV12MT has  been introduced[1] for the Samsung’s s5p-fimc
driver (which got renamed into exynos4-is[2])
 b) A search on “V4L2_PIX_FMT_NV12MT” in the drivers folder only returns
Samsung drivers so far..

[1]
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4a3c9b4f0df43207eb0b4d0da9cb51e185506bd5
[2]
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=56fa1a6a6a7da91e7ece8b01b0ae8adb2926e434


> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

Stéphane
-- 
Qualcomm Innovation Center, Inc.

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 0/2] drm/msm: Add support for NV12MT format in mdp4
  2015-02-20 15:26   ` Rob Clark
@ 2015-03-13 19:12     ` Stephane Viau
  2015-03-13 19:12       ` [PATCH v2 1/2] drm/msm: update generated headers Stephane Viau
  2015-03-13 19:12       ` [PATCH v2 2/2] drm/msm/mdp4: Support NV12MT format in mdp4 Stephane Viau
  0 siblings, 2 replies; 12+ messages in thread
From: Stephane Viau @ 2015-03-13 19:12 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-arm-msm, linux-kernel, robdclark, daniel, Stephane Viau

Resending a v2 on behalf of Beeresh with comments from Daniel and Rob
addressed.

Beeresh Gopal (2):
  drm/msm: update generated headers
  drm/msm/mdp4: Support NV12MT format in mdp4

 drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h   | 36 ++++++++++++-------------------
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c   |  2 ++
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 22 +++++++++++++++++++
 include/uapi/drm/drm_fourcc.h             |  5 +++++
 4 files changed, 43 insertions(+), 22 deletions(-)

-- 
Qualcomm Innovation Center, Inc.

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/2] drm/msm: update generated headers
  2015-03-13 19:12     ` [PATCH v2 0/2] drm/msm: Add support for " Stephane Viau
@ 2015-03-13 19:12       ` Stephane Viau
  2015-03-13 19:14         ` [PATCH] rnndb: " Stephane Viau
  2015-03-13 19:12       ` [PATCH v2 2/2] drm/msm/mdp4: Support NV12MT format in mdp4 Stephane Viau
  1 sibling, 1 reply; 12+ messages in thread
From: Stephane Viau @ 2015-03-13 19:12 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-arm-msm, linux-kernel, robdclark, daniel, Beeresh Gopal

From: Beeresh Gopal <gbeeresh@codeaurora.org>

To avoid ambiguity rename FRAME_SIZE to
SSTILE_FRAME_SIZE

Signed-off-by: Beeresh Gopal <gbeeresh@codeaurora.org>
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h | 36 +++++++++++++--------------------
 1 file changed, 14 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h b/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h
index 1d39174..2d0029d 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h
@@ -8,19 +8,11 @@ http://github.com/freedreno/envytools/
 git clone https://github.com/freedreno/envytools.git
 
 The rules-ng-ng source files this header was generated from are:
-- /home/robclark/src/freedreno/envytools/rnndb/msm.xml                 (    676 bytes, from 2014-12-05 15:34:49)
-- /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2013-03-31 16:51:27)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml            (  20908 bytes, from 2014-12-08 16:13:00)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2357 bytes, from 2014-12-08 16:13:00)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  27208 bytes, from 2015-01-13 23:56:11)
-- /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml             (  11712 bytes, from 2013-08-17 17:13:43)
-- /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml            (    344 bytes, from 2013-08-11 19:26:32)
-- /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml         (   1686 bytes, from 2014-10-31 16:48:57)
-- /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml         (    600 bytes, from 2013-07-05 19:21:12)
-- /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml           (  26848 bytes, from 2015-01-13 23:55:57)
-- /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml             (   8253 bytes, from 2014-12-08 16:13:00)
-
-Copyright (C) 2013-2014 by the following authors:
+- /local/mnt/workspace/sandbox/envytools/rnndb/mdp/mdp4.xml            (  20915 bytes, from 2015-02-06 15:25:51)
+- /local/mnt/workspace/sandbox/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2015-02-06 15:25:09)
+- /local/mnt/workspace/sandbox/envytools/rnndb/mdp/mdp_common.xml      (   2357 bytes, from 2015-02-06 15:25:09)
+
+Copyright (C) 2013-2015 by the following authors:
 - Rob Clark <robdclark@gmail.com> (robclark)
 
 Permission is hereby granted, free of charge, to any person obtaining
@@ -680,18 +672,18 @@ static inline uint32_t MDP4_PIPE_SRC_STRIDE_B_P3(uint32_t val)
 	return ((val) << MDP4_PIPE_SRC_STRIDE_B_P3__SHIFT) & MDP4_PIPE_SRC_STRIDE_B_P3__MASK;
 }
 
-static inline uint32_t REG_MDP4_PIPE_FRAME_SIZE(enum mdp4_pipe i0) { return 0x00020048 + 0x10000*i0; }
-#define MDP4_PIPE_FRAME_SIZE_HEIGHT__MASK			0xffff0000
-#define MDP4_PIPE_FRAME_SIZE_HEIGHT__SHIFT			16
-static inline uint32_t MDP4_PIPE_FRAME_SIZE_HEIGHT(uint32_t val)
+static inline uint32_t REG_MDP4_PIPE_SSTILE_FRAME_SIZE(enum mdp4_pipe i0) { return 0x00020048 + 0x10000*i0; }
+#define MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__MASK		0xffff0000
+#define MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__SHIFT		16
+static inline uint32_t MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT(uint32_t val)
 {
-	return ((val) << MDP4_PIPE_FRAME_SIZE_HEIGHT__SHIFT) & MDP4_PIPE_FRAME_SIZE_HEIGHT__MASK;
+	return ((val) << MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__SHIFT) & MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__MASK;
 }
-#define MDP4_PIPE_FRAME_SIZE_WIDTH__MASK			0x0000ffff
-#define MDP4_PIPE_FRAME_SIZE_WIDTH__SHIFT			0
-static inline uint32_t MDP4_PIPE_FRAME_SIZE_WIDTH(uint32_t val)
+#define MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__MASK			0x0000ffff
+#define MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__SHIFT		0
+static inline uint32_t MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH(uint32_t val)
 {
-	return ((val) << MDP4_PIPE_FRAME_SIZE_WIDTH__SHIFT) & MDP4_PIPE_FRAME_SIZE_WIDTH__MASK;
+	return ((val) << MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__SHIFT) & MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__MASK;
 }
 
 static inline uint32_t REG_MDP4_PIPE_SRC_FORMAT(enum mdp4_pipe i0) { return 0x00020050 + 0x10000*i0; }
-- 
Qualcomm Innovation Center, Inc.

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/2] drm/msm/mdp4: Support NV12MT format in mdp4
  2015-03-13 19:12     ` [PATCH v2 0/2] drm/msm: Add support for " Stephane Viau
  2015-03-13 19:12       ` [PATCH v2 1/2] drm/msm: update generated headers Stephane Viau
@ 2015-03-13 19:12       ` Stephane Viau
  2015-03-16  8:05         ` Daniel Vetter
  1 sibling, 1 reply; 12+ messages in thread
From: Stephane Viau @ 2015-03-13 19:12 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-arm-msm, linux-kernel, robdclark, daniel, Beeresh Gopal,
	Stephane Viau

From: Beeresh Gopal <gbeeresh@codeaurora.org>

Using fb modifier flag, support NV12MT format in MDP4.

v2:
- rework the modifier's description [Daniel Vetter's comment]
- drop .set_mode_config() callback [Rob Clark's comment]

Signed-off-by: Beeresh Gopal <gbeeresh@codeaurora.org>
Signed-off-by: Stephane Viau <sviau@codeaurora.org>
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c   |  2 ++
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 22 ++++++++++++++++++++++
 include/uapi/drm/drm_fourcc.h             |  5 +++++
 3 files changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
index d81e19d..6387881 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
@@ -119,6 +119,8 @@ static int mdp4_hw_init(struct msm_kms *kms)
 	if (mdp4_kms->rev > 1)
 		mdp4_write(mdp4_kms, REG_MDP4_RESET_STATUS, 1);
 
+	dev->mode_config.allow_fb_modifiers = true;
+
 out:
 	pm_runtime_put_sync(dev->dev);
 
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
index cde2500..2c2d6a5 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
@@ -33,6 +33,21 @@ struct mdp4_plane {
 };
 #define to_mdp4_plane(x) container_of(x, struct mdp4_plane, base)
 
+/* MDP format helper functions */
+static inline
+enum mdp4_frame_format mdp4_get_frame_format(struct drm_framebuffer *fb)
+{
+	bool is_tile = false;
+
+	if (fb->modifier[1] == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE)
+		is_tile = true;
+
+	if (fb->pixel_format == DRM_FORMAT_NV12 && is_tile)
+		return FRAME_TILE_YCBCR_420;
+
+	return FRAME_LINEAR;
+}
+
 static void mdp4_plane_set_scanout(struct drm_plane *plane,
 		struct drm_framebuffer *fb);
 static int mdp4_plane_mode_set(struct drm_plane *plane,
@@ -203,6 +218,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
 	uint32_t op_mode = 0;
 	uint32_t phasex_step = MDP4_VG_PHASE_STEP_DEFAULT;
 	uint32_t phasey_step = MDP4_VG_PHASE_STEP_DEFAULT;
+	enum mdp4_frame_format frame_type = mdp4_get_frame_format(fb);
 
 	if (!(crtc && fb)) {
 		DBG("%s: disabled!", mdp4_plane->name);
@@ -302,6 +318,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
 			MDP4_PIPE_SRC_FORMAT_UNPACK_COUNT(format->unpack_count - 1) |
 			MDP4_PIPE_SRC_FORMAT_FETCH_PLANES(format->fetch_type) |
 			MDP4_PIPE_SRC_FORMAT_CHROMA_SAMP(format->chroma_sample) |
+			MDP4_PIPE_SRC_FORMAT_FRAME_FORMAT(frame_type) |
 			COND(format->unpack_tight, MDP4_PIPE_SRC_FORMAT_UNPACK_TIGHT));
 
 	mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_UNPACK(pipe),
@@ -322,6 +339,11 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
 	mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEX_STEP(pipe), phasex_step);
 	mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEY_STEP(pipe), phasey_step);
 
+	if (frame_type != FRAME_LINEAR)
+		mdp4_write(mdp4_kms, REG_MDP4_PIPE_SSTILE_FRAME_SIZE(pipe),
+				MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH(src_w) |
+				MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT(src_h));
+
 	return 0;
 }
 
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 188e61f..2ff79cb 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -161,4 +161,9 @@
  * authoritative source for all of these.
  */
 
+/* Samsung framebuffer modifiers */
+
+/* Tiled: 64x32 pixel macroblocks */
+#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
+
 #endif /* DRM_FOURCC_H */
-- 
Qualcomm Innovation Center, Inc.

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] rnndb: update generated headers
  2015-03-13 19:12       ` [PATCH v2 1/2] drm/msm: update generated headers Stephane Viau
@ 2015-03-13 19:14         ` Stephane Viau
  0 siblings, 0 replies; 12+ messages in thread
From: Stephane Viau @ 2015-03-13 19:14 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-arm-msm, linux-kernel, freedreno, robdclark, Beeresh Gopal

From: Beeresh Gopal <gbeeresh@codeaurora.org>

To avoid ambiguity rename register
FRAME_SIZE to SSTILE_FRAME_SIZE.

Signed-off-by: Beeresh Gopal <gbeeresh@codeaurora.org>
---
 rnndb/mdp/mdp4.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rnndb/mdp/mdp4.xml b/rnndb/mdp/mdp4.xml
index 26d1deb..a84f530 100644
--- a/rnndb/mdp/mdp4.xml
+++ b/rnndb/mdp/mdp4.xml
@@ -290,7 +290,7 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
 			<bitfield name="P2" low="0" high="15" type="uint"/>
 			<bitfield name="P3" low="16" high="31" type="uint"/>
 		</reg32>
-		<reg32 offset="0x0048" name="FRAME_SIZE" type="reg_wh"/>
+		<reg32 offset="0x0048" name="SSTILE_FRAME_SIZE" type="reg_wh"/>
 		<reg32 offset="0x0050" name="SRC_FORMAT">
 			<bitfield name="G_BPC" low="0" high="1" type="mdp_bpc"/>
 			<bitfield name="B_BPC" low="2" high="3" type="mdp_bpc"/>
-- 
Qualcomm Innovation Center, Inc.

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/2] drm/msm/mdp4: Support NV12MT format in mdp4
  2015-03-13 19:12       ` [PATCH v2 2/2] drm/msm/mdp4: Support NV12MT format in mdp4 Stephane Viau
@ 2015-03-16  8:05         ` Daniel Vetter
  2015-03-24 18:32           ` Rob Clark
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Vetter @ 2015-03-16  8:05 UTC (permalink / raw)
  To: Stephane Viau
  Cc: dri-devel, linux-arm-msm, linux-kernel, robdclark, daniel, Beeresh Gopal

On Fri, Mar 13, 2015 at 03:12:10PM -0400, Stephane Viau wrote:
> From: Beeresh Gopal <gbeeresh@codeaurora.org>
> 
> Using fb modifier flag, support NV12MT format in MDP4.
> 
> v2:
> - rework the modifier's description [Daniel Vetter's comment]
> - drop .set_mode_config() callback [Rob Clark's comment]
> 
> Signed-off-by: Beeresh Gopal <gbeeresh@codeaurora.org>
> Signed-off-by: Stephane Viau <sviau@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c   |  2 ++
>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 22 ++++++++++++++++++++++
>  include/uapi/drm/drm_fourcc.h             |  5 +++++
>  3 files changed, 29 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> index d81e19d..6387881 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> @@ -119,6 +119,8 @@ static int mdp4_hw_init(struct msm_kms *kms)
>  	if (mdp4_kms->rev > 1)
>  		mdp4_write(mdp4_kms, REG_MDP4_RESET_STATUS, 1);
>  
> +	dev->mode_config.allow_fb_modifiers = true;
> +
>  out:
>  	pm_runtime_put_sync(dev->dev);
>  
> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
> index cde2500..2c2d6a5 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
> @@ -33,6 +33,21 @@ struct mdp4_plane {
>  };
>  #define to_mdp4_plane(x) container_of(x, struct mdp4_plane, base)
>  
> +/* MDP format helper functions */
> +static inline
> +enum mdp4_frame_format mdp4_get_frame_format(struct drm_framebuffer *fb)
> +{
> +	bool is_tile = false;
> +
> +	if (fb->modifier[1] == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE)
> +		is_tile = true;
> +
> +	if (fb->pixel_format == DRM_FORMAT_NV12 && is_tile)
> +		return FRAME_TILE_YCBCR_420;
> +
> +	return FRAME_LINEAR;
> +}
> +
>  static void mdp4_plane_set_scanout(struct drm_plane *plane,
>  		struct drm_framebuffer *fb);
>  static int mdp4_plane_mode_set(struct drm_plane *plane,
> @@ -203,6 +218,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
>  	uint32_t op_mode = 0;
>  	uint32_t phasex_step = MDP4_VG_PHASE_STEP_DEFAULT;
>  	uint32_t phasey_step = MDP4_VG_PHASE_STEP_DEFAULT;
> +	enum mdp4_frame_format frame_type = mdp4_get_frame_format(fb);
>  
>  	if (!(crtc && fb)) {
>  		DBG("%s: disabled!", mdp4_plane->name);
> @@ -302,6 +318,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
>  			MDP4_PIPE_SRC_FORMAT_UNPACK_COUNT(format->unpack_count - 1) |
>  			MDP4_PIPE_SRC_FORMAT_FETCH_PLANES(format->fetch_type) |
>  			MDP4_PIPE_SRC_FORMAT_CHROMA_SAMP(format->chroma_sample) |
> +			MDP4_PIPE_SRC_FORMAT_FRAME_FORMAT(frame_type) |
>  			COND(format->unpack_tight, MDP4_PIPE_SRC_FORMAT_UNPACK_TIGHT));
>  
>  	mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_UNPACK(pipe),
> @@ -322,6 +339,11 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
>  	mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEX_STEP(pipe), phasex_step);
>  	mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEY_STEP(pipe), phasey_step);
>  
> +	if (frame_type != FRAME_LINEAR)
> +		mdp4_write(mdp4_kms, REG_MDP4_PIPE_SSTILE_FRAME_SIZE(pipe),
> +				MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH(src_w) |
> +				MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT(src_h));
> +
>  	return 0;
>  }
>  
> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> index 188e61f..2ff79cb 100644
> --- a/include/uapi/drm/drm_fourcc.h
> +++ b/include/uapi/drm/drm_fourcc.h
> @@ -161,4 +161,9 @@
>   * authoritative source for all of these.
>   */
>  
> +/* Samsung framebuffer modifiers */
> +
> +/* Tiled: 64x32 pixel macroblocks */

Since this seems shared by a lot of vendors (I still don't believe Samsung
invented this really ...) can you please describe this thing a bit in more
detail? Somewhat important how macroblocks are laid out and pixels within.
Also with a planar format like NV12 "pixel" is a bit unclear, e.g. what
happens if you throw 10bit plane formats at this? So maybe also add a note
that for now this is only used together with NV12T.

Then there's the question of validating the input - stride should probably
be a full multiple of the macroblock size. Since this is a shared format
imo this kind of checking should be done in drm core.
-Daniel


> +#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
> +
>  #endif /* DRM_FOURCC_H */
> -- 
> Qualcomm Innovation Center, Inc.
> 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/2] drm/msm/mdp4: Support NV12MT format in mdp4
  2015-03-16  8:05         ` Daniel Vetter
@ 2015-03-24 18:32           ` Rob Clark
  2015-03-25  2:26             ` Seung-Woo Kim
  0 siblings, 1 reply; 12+ messages in thread
From: Rob Clark @ 2015-03-24 18:32 UTC (permalink / raw)
  To: Stephane Viau, dri-devel, linux-arm-msm,
	Linux Kernel Mailing List, Rob Clark, Beeresh Gopal,
	Seung-Woo Kim, Inki Dae
  Cc: Daniel Vetter

On Mon, Mar 16, 2015 at 4:05 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Fri, Mar 13, 2015 at 03:12:10PM -0400, Stephane Viau wrote:
>> From: Beeresh Gopal <gbeeresh@codeaurora.org>
>>
>> Using fb modifier flag, support NV12MT format in MDP4.
>>
>> v2:
>> - rework the modifier's description [Daniel Vetter's comment]
>> - drop .set_mode_config() callback [Rob Clark's comment]
>>
>> Signed-off-by: Beeresh Gopal <gbeeresh@codeaurora.org>
>> Signed-off-by: Stephane Viau <sviau@codeaurora.org>
>> ---
>>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c   |  2 ++
>>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 22 ++++++++++++++++++++++
>>  include/uapi/drm/drm_fourcc.h             |  5 +++++
>>  3 files changed, 29 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>> index d81e19d..6387881 100644
>> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>> @@ -119,6 +119,8 @@ static int mdp4_hw_init(struct msm_kms *kms)
>>       if (mdp4_kms->rev > 1)
>>               mdp4_write(mdp4_kms, REG_MDP4_RESET_STATUS, 1);
>>
>> +     dev->mode_config.allow_fb_modifiers = true;
>> +
>>  out:
>>       pm_runtime_put_sync(dev->dev);
>>
>> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
>> index cde2500..2c2d6a5 100644
>> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
>> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
>> @@ -33,6 +33,21 @@ struct mdp4_plane {
>>  };
>>  #define to_mdp4_plane(x) container_of(x, struct mdp4_plane, base)
>>
>> +/* MDP format helper functions */
>> +static inline
>> +enum mdp4_frame_format mdp4_get_frame_format(struct drm_framebuffer *fb)
>> +{
>> +     bool is_tile = false;
>> +
>> +     if (fb->modifier[1] == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE)
>> +             is_tile = true;
>> +
>> +     if (fb->pixel_format == DRM_FORMAT_NV12 && is_tile)
>> +             return FRAME_TILE_YCBCR_420;
>> +
>> +     return FRAME_LINEAR;
>> +}
>> +
>>  static void mdp4_plane_set_scanout(struct drm_plane *plane,
>>               struct drm_framebuffer *fb);
>>  static int mdp4_plane_mode_set(struct drm_plane *plane,
>> @@ -203,6 +218,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
>>       uint32_t op_mode = 0;
>>       uint32_t phasex_step = MDP4_VG_PHASE_STEP_DEFAULT;
>>       uint32_t phasey_step = MDP4_VG_PHASE_STEP_DEFAULT;
>> +     enum mdp4_frame_format frame_type = mdp4_get_frame_format(fb);
>>
>>       if (!(crtc && fb)) {
>>               DBG("%s: disabled!", mdp4_plane->name);
>> @@ -302,6 +318,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
>>                       MDP4_PIPE_SRC_FORMAT_UNPACK_COUNT(format->unpack_count - 1) |
>>                       MDP4_PIPE_SRC_FORMAT_FETCH_PLANES(format->fetch_type) |
>>                       MDP4_PIPE_SRC_FORMAT_CHROMA_SAMP(format->chroma_sample) |
>> +                     MDP4_PIPE_SRC_FORMAT_FRAME_FORMAT(frame_type) |
>>                       COND(format->unpack_tight, MDP4_PIPE_SRC_FORMAT_UNPACK_TIGHT));
>>
>>       mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_UNPACK(pipe),
>> @@ -322,6 +339,11 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
>>       mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEX_STEP(pipe), phasex_step);
>>       mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEY_STEP(pipe), phasey_step);
>>
>> +     if (frame_type != FRAME_LINEAR)
>> +             mdp4_write(mdp4_kms, REG_MDP4_PIPE_SSTILE_FRAME_SIZE(pipe),
>> +                             MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH(src_w) |
>> +                             MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT(src_h));
>> +
>>       return 0;
>>  }
>>
>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>> index 188e61f..2ff79cb 100644
>> --- a/include/uapi/drm/drm_fourcc.h
>> +++ b/include/uapi/drm/drm_fourcc.h
>> @@ -161,4 +161,9 @@
>>   * authoritative source for all of these.
>>   */
>>
>> +/* Samsung framebuffer modifiers */
>> +
>> +/* Tiled: 64x32 pixel macroblocks */
>
> Since this seems shared by a lot of vendors (I still don't believe Samsung
> invented this really ...) can you please describe this thing a bit in more
> detail? Somewhat important how macroblocks are laid out and pixels within.
> Also with a planar format like NV12 "pixel" is a bit unclear, e.g. what
> happens if you throw 10bit plane formats at this? So maybe also add a note
> that for now this is only used together with NV12T.

+ a couple folks from Samsung, since I expect they want this for
exynos as well (and might be able to help with the description)

vl4 also has this format, but last I looked was rather light on the details.

http://linuxtv.org/downloads/v4l-dvb-apis/re31.html

I know up in userspace, GStreamer seems to have some support for this format:

http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=f8d3b9b4fcc5e08b771314fa95e9ed8f750b54e6

> Then there's the question of validating the input - stride should probably
> be a full multiple of the macroblock size. Since this is a shared format
> imo this kind of checking should be done in drm core.

afaiu, stride (and maybe even width?) should be a multiple of the
block size (but height does not)

BR,
-R


> -Daniel
>
>
>> +#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
>> +
>>  #endif /* DRM_FOURCC_H */
>> --
>> Qualcomm Innovation Center, Inc.
>>
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
>>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/2] drm/msm/mdp4: Support NV12MT format in mdp4
  2015-03-24 18:32           ` Rob Clark
@ 2015-03-25  2:26             ` Seung-Woo Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Seung-Woo Kim @ 2015-03-25  2:26 UTC (permalink / raw)
  To: Rob Clark
  Cc: Stephane Viau, dri-devel, linux-arm-msm,
	Linux Kernel Mailing List, Beeresh Gopal, Inki Dae,
	Daniel Vetter, Seung-Woo Kim, m.szyprowski, s.nawrocki, k.debski

Hello,

On 2015년 03월 25일 03:32, Rob Clark wrote:
> On Mon, Mar 16, 2015 at 4:05 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
>> On Fri, Mar 13, 2015 at 03:12:10PM -0400, Stephane Viau wrote:
>>> From: Beeresh Gopal <gbeeresh@codeaurora.org>
>>>
>>> Using fb modifier flag, support NV12MT format in MDP4.
>>>
>>> v2:
>>> - rework the modifier's description [Daniel Vetter's comment]
>>> - drop .set_mode_config() callback [Rob Clark's comment]
>>>
>>> Signed-off-by: Beeresh Gopal <gbeeresh@codeaurora.org>
>>> Signed-off-by: Stephane Viau <sviau@codeaurora.org>
>>> ---
>>>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c   |  2 ++
>>>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 22 ++++++++++++++++++++++
>>>  include/uapi/drm/drm_fourcc.h             |  5 +++++
>>>  3 files changed, 29 insertions(+)
>>>

<snip.>

>>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>>> index 188e61f..2ff79cb 100644
>>> --- a/include/uapi/drm/drm_fourcc.h
>>> +++ b/include/uapi/drm/drm_fourcc.h
>>> @@ -161,4 +161,9 @@
>>>   * authoritative source for all of these.
>>>   */
>>>
>>> +/* Samsung framebuffer modifiers */
>>> +
>>> +/* Tiled: 64x32 pixel macroblocks */
>>
>> Since this seems shared by a lot of vendors (I still don't believe Samsung
>> invented this really ...) can you please describe this thing a bit in more
>> detail? Somewhat important how macroblocks are laid out and pixels within.
>> Also with a planar format like NV12 "pixel" is a bit unclear, e.g. what
>> happens if you throw 10bit plane formats at this? So maybe also add a note
>> that for now this is only used together with NV12T.
> 
> + a couple folks from Samsung, since I expect they want this for
> exynos as well (and might be able to help with the description)

Yes, I have a plan to apply fb_modifier for exynos with kms interface of
hdmi.

> 
> vl4 also has this format, but last I looked was rather light on the details.

I am not sure msm mdp uses exactly same format with exynos, but anyway
v4l2 NV12MT format was introduced for exynos hw video codec.

macro blocks for the format is laid z-order and each pixel data in each
macro block is just normal NV12 style.

I think Marek and Sylwester can help understanding the format.

> 
> http://linuxtv.org/downloads/v4l-dvb-apis/re31.html
> 
> I know up in userspace, GStreamer seems to have some support for this format:
> 
> http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=f8d3b9b4fcc5e08b771314fa95e9ed8f750b54e6
> 
>> Then there's the question of validating the input - stride should probably
>> be a full multiple of the macroblock size. Since this is a shared format
>> imo this kind of checking should be done in drm core.
> 
> afaiu, stride (and maybe even width?) should be a multiple of the
> block size (but height does not)
> 
> BR,
> -R
> 
> 
>> -Daniel
>>
>>
>>> +#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
>>> +
>>>  #endif /* DRM_FOURCC_H */
>>> --
>>> Qualcomm Innovation Center, Inc.
>>>
>>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
>>>
>>
>> --
>> Daniel Vetter
>> Software Engineer, Intel Corporation
>> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> 

-- 
Seung-Woo Kim
Samsung Software R&D Center
--


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-03-25  2:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20 14:42 [PATCH 1/2] drm/msm: update generated headers Beeresh Gopal
2015-02-20 14:42 ` [PATCH 2/2] drm/msm: Support NV12MT format in mdp4 Beeresh Gopal
2015-02-20 15:26   ` Rob Clark
2015-03-13 19:12     ` [PATCH v2 0/2] drm/msm: Add support for " Stephane Viau
2015-03-13 19:12       ` [PATCH v2 1/2] drm/msm: update generated headers Stephane Viau
2015-03-13 19:14         ` [PATCH] rnndb: " Stephane Viau
2015-03-13 19:12       ` [PATCH v2 2/2] drm/msm/mdp4: Support NV12MT format in mdp4 Stephane Viau
2015-03-16  8:05         ` Daniel Vetter
2015-03-24 18:32           ` Rob Clark
2015-03-25  2:26             ` Seung-Woo Kim
2015-02-22 10:34   ` [PATCH 2/2] drm/msm: " Daniel Vetter
2015-03-13 14:51     ` "Stéphane Viau"

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).