diff mbox

[v3,04/32] drm/exynos: Use manager_op initialize in fimd

Message ID 1383063198-10526-5-git-send-email-seanpaul@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sean Paul Oct. 29, 2013, 4:12 p.m. UTC
This patch implements the intitialize manager op in fimd.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---

Changes in v2: None
Changes in v3: None

 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

Comments

Tomasz Figa Oct. 31, 2013, 11:49 p.m. UTC | #1
Hi Sean,

On Tuesday 29 of October 2013 12:12:50 Sean Paul wrote:
> This patch implements the intitialize manager op in fimd.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
> 
> Changes in v2: None
> Changes in v3: None
> 
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
[snip]
>  static void fimd_dpms(struct device *subdrv_dev, int mode)
>  {
>  	struct fimd_context *ctx = get_fimd_context(subdrv_dev);
> @@ -660,6 +671,7 @@ static void fimd_wait_for_vblank(struct device *dev)
> }
> 
>  static struct exynos_drm_manager_ops fimd_manager_ops = {
> +	.initialize = fimd_mgr_initialize,
>  	.dpms = fimd_dpms,
>  	.apply = fimd_apply,
>  	.commit = fimd_commit,
> @@ -681,7 +693,6 @@ static irqreturn_t fimd_irq_handler(int irq, void
> *dev_id) {
>  	struct fimd_context *ctx = (struct fimd_context *)dev_id;
>  	struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
> -	struct drm_device *drm_dev = subdrv->drm_dev;

Apparently the driver already can have a reference to drm_device, without 
the .initialize() method being called.

I guess your change makes it somehow better, but patch description fails 
to explain this.

Best regards,
Tomasz
Sean Paul Nov. 1, 2013, 7:51 p.m. UTC | #2
On Thu, Oct 31, 2013 at 7:49 PM, Tomasz Figa <tomasz.figa@gmail.com> wrote:
> Hi Sean,
>
> On Tuesday 29 of October 2013 12:12:50 Sean Paul wrote:
>> This patch implements the intitialize manager op in fimd.
>>
>> Signed-off-by: Sean Paul <seanpaul@chromium.org>
>> ---
>>
>> Changes in v2: None
>> Changes in v3: None
>>
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 19 +++++++++++++++----
>>  1 file changed, 15 insertions(+), 4 deletions(-)
> [snip]
>>  static void fimd_dpms(struct device *subdrv_dev, int mode)
>>  {
>>       struct fimd_context *ctx = get_fimd_context(subdrv_dev);
>> @@ -660,6 +671,7 @@ static void fimd_wait_for_vblank(struct device *dev)
>> }
>>
>>  static struct exynos_drm_manager_ops fimd_manager_ops = {
>> +     .initialize = fimd_mgr_initialize,
>>       .dpms = fimd_dpms,
>>       .apply = fimd_apply,
>>       .commit = fimd_commit,
>> @@ -681,7 +693,6 @@ static irqreturn_t fimd_irq_handler(int irq, void
>> *dev_id) {
>>       struct fimd_context *ctx = (struct fimd_context *)dev_id;
>>       struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
>> -     struct drm_device *drm_dev = subdrv->drm_dev;
>
> Apparently the driver already can have a reference to drm_device, without
> the .initialize() method being called.
>
> I guess your change makes it somehow better, but patch description fails
> to explain this.
>

I've updated the patch description. This change is needed to remove
all subdrv references from fimd so we can just implement manager.

Sean

> Best regards,
> Tomasz
>
Tomasz Figa Nov. 1, 2013, 7:57 p.m. UTC | #3
On Friday 01 of November 2013 15:51:00 Sean Paul wrote:
> On Thu, Oct 31, 2013 at 7:49 PM, Tomasz Figa <tomasz.figa@gmail.com> 
wrote:
> > Hi Sean,
> > 
> > On Tuesday 29 of October 2013 12:12:50 Sean Paul wrote:
> >> This patch implements the intitialize manager op in fimd.
> >> 
> >> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> >> ---
> >> 
> >> Changes in v2: None
> >> Changes in v3: None
> >> 
> >>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 19 +++++++++++++++----
> >>  1 file changed, 15 insertions(+), 4 deletions(-)
> > 
> > [snip]
> > 
> >>  static void fimd_dpms(struct device *subdrv_dev, int mode)
> >>  {
> >>  
> >>       struct fimd_context *ctx = get_fimd_context(subdrv_dev);
> >> 
> >> @@ -660,6 +671,7 @@ static void fimd_wait_for_vblank(struct device
> >> *dev) }
> >> 
> >>  static struct exynos_drm_manager_ops fimd_manager_ops = {
> >> 
> >> +     .initialize = fimd_mgr_initialize,
> >> 
> >>       .dpms = fimd_dpms,
> >>       .apply = fimd_apply,
> >>       .commit = fimd_commit,
> >> 
> >> @@ -681,7 +693,6 @@ static irqreturn_t fimd_irq_handler(int irq, void
> >> *dev_id) {
> >> 
> >>       struct fimd_context *ctx = (struct fimd_context *)dev_id;
> >>       struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
> >> 
> >> -     struct drm_device *drm_dev = subdrv->drm_dev;
> > 
> > Apparently the driver already can have a reference to drm_device,
> > without the .initialize() method being called.
> > 
> > I guess your change makes it somehow better, but patch description
> > fails to explain this.
> 
> I've updated the patch description. This change is needed to remove
> all subdrv references from fimd so we can just implement manager.

Fair enough. Thanks.

Best regards,
Tomasz
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index f271f22..90fcd6f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -106,6 +106,7 @@  struct fimd_win_data {
 
 struct fimd_context {
 	struct exynos_drm_subdrv	subdrv;
+	struct drm_device		*drm_dev;
 	int				irq;
 	struct drm_crtc			*crtc;
 	struct clk			*bus_clk;
@@ -490,6 +491,16 @@  static void fimd_win_disable(struct device *dev, int zpos)
 	win_data->enabled = false;
 }
 
+static int fimd_mgr_initialize(struct device *subdrv_dev,
+		struct drm_device *drm_dev)
+{
+	struct fimd_context *ctx = get_fimd_context(subdrv_dev);
+
+	ctx->drm_dev = drm_dev;
+
+	return 0;
+}
+
 static void fimd_dpms(struct device *subdrv_dev, int mode)
 {
 	struct fimd_context *ctx = get_fimd_context(subdrv_dev);
@@ -660,6 +671,7 @@  static void fimd_wait_for_vblank(struct device *dev)
 }
 
 static struct exynos_drm_manager_ops fimd_manager_ops = {
+	.initialize = fimd_mgr_initialize,
 	.dpms = fimd_dpms,
 	.apply = fimd_apply,
 	.commit = fimd_commit,
@@ -681,7 +693,6 @@  static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
 {
 	struct fimd_context *ctx = (struct fimd_context *)dev_id;
 	struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
-	struct drm_device *drm_dev = subdrv->drm_dev;
 	struct exynos_drm_manager *manager = subdrv->manager;
 	u32 val;
 
@@ -692,11 +703,11 @@  static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
 		writel(VIDINTCON1_INT_FRAME, ctx->regs + VIDINTCON1);
 
 	/* check the crtc is detached already from encoder */
-	if (manager->pipe < 0)
+	if (manager->pipe < 0 || !ctx->drm_dev)
 		goto out;
 
-	drm_handle_vblank(drm_dev, manager->pipe);
-	exynos_drm_crtc_finish_pageflip(drm_dev, manager->pipe);
+	drm_handle_vblank(ctx->drm_dev, manager->pipe);
+	exynos_drm_crtc_finish_pageflip(ctx->drm_dev, manager->pipe);
 
 	/* set wait vsync event to zero and wake up queue. */
 	if (atomic_read(&ctx->wait_vsync_event)) {