linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Archit Taneja <archit@ti.com>
To: tomi.valkeinen@ti.com
Cc: rohitkc@ti.com, linux-omap@vger.kernel.org,
	linux-fbdev@vger.kernel.org, Archit Taneja <archit@ti.com>
Subject: [RFC PATCH 04/29] OMAPDSS: APPLY/Writeback: Add writeback_info
Date: Tue, 27 Dec 2011 12:48:47 +0000	[thread overview]
Message-ID: <1324989432-3625-5-git-send-email-archit@ti.com> (raw)
In-Reply-To: <1324989432-3625-1-git-send-email-archit@ti.com>

Create a struct called omap_dss_writeback_info. This contains 'overlay like'
parameters of the writeback pipeline. These parameters are expected to be
configured via get/set_info ops by the DSS2 user similar to how overlay and
manager parameters are configured. These will also be configurable via sysfs
attributes of the dummy writeback panel.

Add get_wb_info/set_wb_info ops in omap_dss_writeback struct. Create a minimal
wb_priv_data structure and a writeback simple_check function used for
dss_wb_get_info and dss_wb_set_info functions in apply.c

Signed-off-by: Archit Taneja <archit@ti.com>
---
 drivers/video/omap2/dss/apply.c        |   45 ++++++++++++++++++++++++++++++++
 drivers/video/omap2/dss/dss.h          |    7 +++++
 drivers/video/omap2/dss/dss_features.h |    1 +
 drivers/video/omap2/dss/writeback.c    |   27 +++++++++++++++++++
 include/video/omapdss.h                |   18 ++++++++++++
 5 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index d529664..19120c1 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -101,9 +101,16 @@ struct mgr_priv_data {
 	bool enabled;
 };
 
+struct wb_priv_data {
+
+	bool user_info_dirty;
+	struct omap_dss_writeback_info user_info;
+};
+
 static struct {
 	struct ovl_priv_data ovl_priv_data_array[MAX_DSS_OVERLAYS];
 	struct mgr_priv_data mgr_priv_data_array[MAX_DSS_MANAGERS];
+	struct wb_priv_data wb_priv_data_array[MAX_DSS_WB];
 
 	bool irq_enabled;
 } dss_data;
@@ -126,6 +133,11 @@ static struct mgr_priv_data *get_mgr_priv(struct omap_overlay_manager *mgr)
 	return &dss_data.mgr_priv_data_array[mgr->id];
 }
 
+static struct wb_priv_data *get_wb_priv(struct omap_dss_writeback *wb)
+{
+	return &dss_data.wb_priv_data_array[wb->id];
+}
+
 void dss_apply_init(void)
 {
 	const int num_ovls = dss_feat_get_num_ovls();
@@ -1351,3 +1363,36 @@ err:
 	return r;
 }
 
+int dss_wb_set_info(struct omap_dss_writeback *wb,
+		struct omap_dss_writeback_info *info)
+{
+	struct wb_priv_data *wp = get_wb_priv(wb);
+	unsigned long flags;
+	int r;
+
+	r = dss_wb_simple_check(wb, info);
+	if (r)
+		return r;
+
+	spin_lock_irqsave(&data_lock, flags);
+
+	wp->user_info = *info;
+	wp->user_info_dirty = true;
+
+	spin_unlock_irqrestore(&data_lock, flags);
+
+	return 0;
+}
+
+void dss_wb_get_info(struct omap_dss_writeback *wb,
+		struct omap_dss_writeback_info *info)
+{
+	struct wb_priv_data *wp = get_wb_priv(wb);
+	unsigned long flags;
+
+	spin_lock_irqsave(&data_lock, flags);
+
+	*info = wp->user_info;
+
+	spin_unlock_irqrestore(&data_lock, flags);
+}
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 607e730..9b3b93c 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -191,6 +191,11 @@ int dss_ovl_set_manager(struct omap_overlay *ovl,
 		struct omap_overlay_manager *mgr);
 int dss_ovl_unset_manager(struct omap_overlay *ovl);
 
+int dss_wb_set_info(struct omap_dss_writeback *wb,
+		struct omap_dss_writeback_info *info);
+void dss_wb_get_info(struct omap_dss_writeback *wb,
+		struct omap_dss_writeback_info *info);
+
 /* display */
 int dss_suspend_all_devices(void);
 int dss_resume_all_devices(void);
@@ -230,6 +235,8 @@ int dss_ovl_check(struct omap_overlay *ovl,
 void dss_init_writeback(void);
 void dss_uninit_writeback(void);
 int writeback_init_display(struct omap_dss_device *dssdev);
+int dss_wb_simple_check(struct omap_dss_writeback *wb,
+		const struct omap_dss_writeback_info *info);
 
 /* DSS */
 int dss_init_platform_driver(void);
diff --git a/drivers/video/omap2/dss/dss_features.h b/drivers/video/omap2/dss/dss_features.h
index 75ee1f1..b3486da 100644
--- a/drivers/video/omap2/dss/dss_features.h
+++ b/drivers/video/omap2/dss/dss_features.h
@@ -28,6 +28,7 @@
 #define MAX_DSS_OVERLAYS	4
 #define MAX_DSS_LCD_MANAGERS	2
 #define MAX_NUM_DSI		2
+#define MAX_DSS_WB		1
 
 /* DSS has feature id */
 enum dss_feat_id {
diff --git a/drivers/video/omap2/dss/writeback.c b/drivers/video/omap2/dss/writeback.c
index ac5d3ba..5e54221 100644
--- a/drivers/video/omap2/dss/writeback.c
+++ b/drivers/video/omap2/dss/writeback.c
@@ -78,6 +78,9 @@ void dss_init_writeback(void)
 		struct omap_dss_writeback *wb = &writeback[i];
 
 		wb->id = i;
+
+		wb->set_wb_info = &dss_wb_set_info;
+		wb->get_wb_info = &dss_wb_get_info;
 	}
 
 	omap_dss_register_driver(&writeback_panel_driver);
@@ -109,6 +112,30 @@ int writeback_init_display(struct omap_dss_device *dssdev)
 	return 0;
 }
 
+int dss_wb_simple_check(struct omap_dss_writeback *wb,
+		const struct omap_dss_writeback_info *info)
+{
+	if (info->paddr = 0) {
+		DSSERR("wb_simple_check: paddr cannot be 0\n");
+		return -EINVAL;
+	}
+
+	if (info->color_mode = OMAP_DSS_COLOR_NV12 &&
+			info->p_uv_addr = 0) {
+		DSSERR("wb_simple_check: p_uv_addr cannot be 0 for NV12"
+			" format\n");
+		return -EINVAL;
+	}
+
+	if (info->capture_rate < 0 || info->capture_rate > 7) {
+		DSSERR("wb_simple_check: capture rate cannot be %d\n",
+			info->capture_rate);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 /* Dummy Writeback Panel driver */
 
 static int writeback_panel_probe(struct omap_dss_device *dssdev)
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 77e2ca4..01092e4 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -472,11 +472,29 @@ struct omap_overlay_manager {
 	struct omap_dss_device *(*get_writeback)(struct omap_overlay_manager *mgr);
 };
 
+struct omap_dss_writeback_info {
+	u32 paddr;
+	u32 p_uv_addr;
+	u16 buf_width;
+	u16 buf_height;
+	enum omap_color_mode color_mode;
+	u8 rotation;
+	enum omap_dss_rotation_type rotation_type;
+	bool mirror;
+	u8 pre_mult_alpha;
+	int capture_rate;
+};
+
 struct omap_dss_writeback {
 	int id;
 
 	/* dummy panel we are connected to */
 	struct omap_dss_device *dssdev;
+
+	int (*set_wb_info)(struct omap_dss_writeback *wb,
+		struct omap_dss_writeback_info *info);
+	void (*get_wb_info)(struct omap_dss_writeback *wb,
+		struct omap_dss_writeback_info *info);
 };
 
 struct omap_dss_device {
-- 
1.7.4.1


  parent reply	other threads:[~2011-12-27 12:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-27 12:48 [RFC PATCH 00/29] OMAPDSS: Initial Writeback Capture mode support Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 01/29] omapdss/omapfb/omap_vout: Introduce manager output struct Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 02/29] OMAPDSS: Add writeback to omap_dss_mgr_output Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 03/29] OMAPDSS: Writeback: Add writeback interface and panel driver Archit Taneja
2011-12-27 12:48 ` Archit Taneja [this message]
2011-12-27 12:48 ` [RFC PATCH 05/29] OMAPDSS: APPLY/Writeback: Apply writeback configurations Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 06/29] OMAPDSS: APPLY: Add writeback enable/disable functions Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 07/29] OMAPDSS: APPLY: Add extra_info for writeback Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 08/29] OMAPDSS: APPLY: Modify manager unset device op Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 09/29] OMAPDSS: APPLY: Allow manager set/unset_device ops to set/unset writeback Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 10/29] OMAPDSS: APPLY: Calculate channel_in for writeback Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 11/29] OMAPDSS: DISPC: Add writeback as a new plane Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 12/29] OMAPDSS: Writeback: Add check for color_mode in dss_wb_simple_check() Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 13/29] OMAPDSS: APPLY: Configure writeback FIFOs Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 14/29] OMAPDSS: DISPC: Allow both upscaling and downscaling of chroma Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 15/29] OMAPDSS: DISPC: Pass overlay caps as a parameter to DISPC overlay related function Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 16/29] OMAPDSS: OVERLAY: Add position and replication as overlay caps Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 17/29] OMAPDSS: DISPC: Make dispc_ovl_setup call dispc_plane_setup Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 18/29] OMAPDSS: DISPC: Make chroma_upscale an argument to dispc_plane_setup Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 19/29] OMAPDSS: DISPC: Don't set chroma resampling bit for writeback Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 20/29] OMAPDSS: Writeback: Add writeback capabilities Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 21/29] OMAPDSS: DISPC: Configure overlay-like parameters in dispc_wb_setup Archit Taneja
2012-08-02 10:22   ` Chandrabhanu Mahapatra
2011-12-27 12:49 ` [RFC PATCH 22/29] OMAPDSS: DISPC: Setup writeback go, enable and channel_in functions Archit Taneja
2012-08-02 10:07   ` Mahapatra, Chandrabhanu
2011-12-27 12:49 ` [RFC PATCH 23/29] OMAPDSS: Writeback: Configure writeback specific parameters Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 24/29] OMAPDSS: Writeback: Use panel driver ops to configure mirroring rotation and buffe Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 25/29] OMAPDSS: Writeback: Add sysfs attributes to writeback panel Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 26/29] OMAPDSS: DISPLAY: Add a manager apply to sysfs store attributes for writeback Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 27/29] OMAPDSS: MANAGER: Split manager_display_store into smaller functions Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 28/29] OMAPDSS: MANAGER: Add writeback as a sysfs attribute Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 29/29] OMAPDSS: FEATURES: Allow WB panels to attach to managers Archit Taneja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1324989432-3625-5-git-send-email-archit@ti.com \
    --to=archit@ti.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rohitkc@ti.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).