From: Andrzej Hajda <a.hajda@samsung.com>
To: Inki Dae <inki.dae@samsung.com>
Cc: Andrzej Hajda <a.hajda@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Joonyoung Shim <jy0922.shim@samsung.com>,
Seung-Woo Kim <sw0312.kim@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org (open list),
linux-samsung-soc@vger.kernel.org (moderated list:ARM/S5P EXYNOS
AR...)
Subject: [PATCH v2 14/15] drm/exynos/fimc: simplify buffer queuing
Date: Wed, 27 Aug 2014 13:07:03 +0200 [thread overview]
Message-ID: <1409137623-20936-1-git-send-email-a.hajda@samsung.com> (raw)
In-Reply-To: <1408693946-15456-15-git-send-email-a.hajda@samsung.com>
The patch removes redundant checks, redundant HW reads
and simplifies code.
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
v2:
- fixed bit cleaning operation
---
drivers/gpu/drm/exynos/exynos_drm_fimc.c | 64 ++++++++------------------------
1 file changed, 15 insertions(+), 49 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index 62ba033..59ba8bb 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -1126,67 +1126,34 @@ static int fimc_dst_set_size(struct device *dev, int swap,
return 0;
}
-static int fimc_dst_get_buf_count(struct fimc_context *ctx)
-{
- u32 cfg, buf_num;
-
- cfg = fimc_read(ctx, EXYNOS_CIFCNTSEQ);
-
- buf_num = hweight32(cfg);
-
- DRM_DEBUG_KMS("buf_num[%d]\n", buf_num);
-
- return buf_num;
-}
-
-static int fimc_dst_set_buf_seq(struct fimc_context *ctx, u32 buf_id,
+static void fimc_dst_set_buf_seq(struct fimc_context *ctx, u32 buf_id,
enum drm_exynos_ipp_buf_type buf_type)
{
- struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
- bool enable;
- u32 cfg;
- u32 mask = 0x00000001 << buf_id;
- int ret = 0;
unsigned long flags;
+ u32 buf_num;
+ u32 cfg;
DRM_DEBUG_KMS("buf_id[%d]buf_type[%d]\n", buf_id, buf_type);
spin_lock_irqsave(&ctx->lock, flags);
- /* mask register set */
cfg = fimc_read(ctx, EXYNOS_CIFCNTSEQ);
- switch (buf_type) {
- case IPP_BUF_ENQUEUE:
- enable = true;
- break;
- case IPP_BUF_DEQUEUE:
- enable = false;
- break;
- default:
- dev_err(ippdrv->dev, "invalid buf ctrl parameter.\n");
- ret = -EINVAL;
- goto err_unlock;
- }
+ if (buf_type == IPP_BUF_ENQUEUE)
+ cfg |= (1 << buf_id);
+ else
+ cfg &= ~(1 << buf_id);
- /* sequence id */
- cfg &= ~mask;
- cfg |= (enable << buf_id);
fimc_write(ctx, cfg, EXYNOS_CIFCNTSEQ);
- /* interrupt enable */
- if (buf_type == IPP_BUF_ENQUEUE &&
- fimc_dst_get_buf_count(ctx) >= FIMC_BUF_START)
- fimc_mask_irq(ctx, true);
+ buf_num = hweight32(cfg);
- /* interrupt disable */
- if (buf_type == IPP_BUF_DEQUEUE &&
- fimc_dst_get_buf_count(ctx) <= FIMC_BUF_STOP)
+ if (buf_type == IPP_BUF_ENQUEUE && buf_num >= FIMC_BUF_START)
+ fimc_mask_irq(ctx, true);
+ else if (buf_type == IPP_BUF_DEQUEUE && buf_num <= FIMC_BUF_STOP)
fimc_mask_irq(ctx, false);
-err_unlock:
spin_unlock_irqrestore(&ctx->lock, flags);
- return ret;
}
static int fimc_dst_set_addr(struct device *dev,
@@ -1244,7 +1211,9 @@ static int fimc_dst_set_addr(struct device *dev,
break;
}
- return fimc_dst_set_buf_seq(ctx, buf_id, buf_type);
+ fimc_dst_set_buf_seq(ctx, buf_id, buf_type);
+
+ return 0;
}
static struct exynos_drm_ipp_ops fimc_dst_ops = {
@@ -1299,10 +1268,7 @@ static irqreturn_t fimc_irq_handler(int irq, void *dev_id)
DRM_DEBUG_KMS("buf_id[%d]\n", buf_id);
- if (fimc_dst_set_buf_seq(ctx, buf_id, IPP_BUF_DEQUEUE) < 0) {
- DRM_ERROR("failed to dequeue.\n");
- return IRQ_HANDLED;
- }
+ fimc_dst_set_buf_seq(ctx, buf_id, IPP_BUF_DEQUEUE);
event_work->ippdrv = ippdrv;
event_work->buf_id[EXYNOS_DRM_OPS_DST] = buf_id;
--
1.9.1
next prev parent reply other threads:[~2014-08-27 11:07 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-22 7:52 [PATCH 00/15] drm/exynos/ipp: image post processing fixes and improvements, part four Andrzej Hajda
2014-08-22 7:52 ` [PATCH 01/15] drm/exynos/ipp: remove fake pm callbacks Andrzej Hajda
2014-08-22 7:52 ` [PATCH 02/15] drm/exynos/ipp: cancel works before command node clean Andrzej Hajda
2014-08-22 7:52 ` [PATCH 03/15] drm/exynos/ipp: move file reference from memory to command node Andrzej Hajda
2014-08-26 2:55 ` Joonyoung Shim
2014-08-26 2:59 ` Joonyoung Shim
2014-08-26 6:16 ` Andrzej Hajda
2014-08-22 7:52 ` [PATCH 04/15] drm/exynos/ipp: remove only related commands on file close Andrzej Hajda
2014-08-22 7:52 ` [PATCH 05/15] drm/exynos/ipp: remove unused field in command node Andrzej Hajda
2014-08-22 7:52 ` [PATCH 06/15] drm/exynos/ipp: free partially allocated resources on error Andrzej Hajda
2014-08-26 5:00 ` Joonyoung Shim
2014-08-27 10:27 ` Andrzej Hajda
2014-08-27 23:59 ` Joonyoung Shim
2014-08-22 7:52 ` [PATCH 07/15] drm/exynos/ipp: move nodes cleaning to separate function Andrzej Hajda
2014-08-22 7:52 ` [PATCH 08/15] drm/exynos/ipp: clean memory nodes on command node cleaning Andrzej Hajda
2014-08-22 7:52 ` [PATCH 09/15] drm/exynos/ipp: replace work_struct casting with better constructs Andrzej Hajda
2014-08-22 7:52 ` [PATCH 10/15] drm/exynos/ipp: stop hardware before freeing memory Andrzej Hajda
2014-08-22 7:52 ` [PATCH 11/15] drm/exynos/ipp: remove events during command cleaning Andrzej Hajda
2014-08-22 7:52 ` [PATCH 12/15] drm/exynos/fimc: avoid clearing overflow bits Andrzej Hajda
2014-08-22 7:52 ` [PATCH 13/15] drm/exynos/fimc: do not enable fimc twice Andrzej Hajda
2014-08-22 7:52 ` [PATCH 14/15] drm/exynos/fimc: simplify buffer queuing Andrzej Hajda
2014-08-26 5:53 ` Joonyoung Shim
2014-08-26 6:20 ` Andrzej Hajda
2014-08-27 11:07 ` Andrzej Hajda [this message]
2014-08-22 7:52 ` [PATCH 15/15] drm/exynos/fimc: fix source buffer registers Andrzej Hajda
2014-08-26 5:57 ` Joonyoung Shim
2014-08-26 6:35 ` Andrzej Hajda
2014-08-26 6:47 ` Joonyoung Shim
2014-08-26 6:52 ` [PATCH 00/15] drm/exynos/ipp: image post processing fixes and improvements, part four Joonyoung Shim
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=1409137623-20936-1-git-send-email-a.hajda@samsung.com \
--to=a.hajda@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=jy0922.shim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=sw0312.kim@samsung.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
all inboxes | Powered by JetHome®