summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2016-05-19 12:15:23 +0200
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:50:45 +0900
commit15f8386c66d725c5b0700371c38790e220caa9d8 (patch)
tree4097eff74af6dec1ff6cb4647356825d14bf581f
parent6d5dc71b3a9188bb1bfa986cf7bbbc92dcdac566 (diff)
drm/exynos: gsc: force to use zero buf_id for src and dst
Exynos DRM GSC IPP subdriver supports only processing a single src/dst buffer pair, so don't use any other buf_id to avoid accessing uninitialized buffers (IOMMU page fault). Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Change-Id: I488bb9ee60e0fe8e711b9c116b04483ac99a66e9
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gsc.c46
1 files changed, 4 insertions, 42 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index a01e0e75ef00..1e12beef5169 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -836,7 +836,7 @@ static int gsc_src_set_addr(struct device *dev,
DRM_DEBUG_KMS("prop_id[%d]buf_id[%d]buf_type[%d]\n",
property->prop_id, buf_id, buf_type);
- buf_id %= GSC_MAX_SRC;
+ buf_id = 0;
/* address register set */
switch (buf_type) {
@@ -1298,7 +1298,7 @@ static int gsc_dst_set_addr(struct device *dev,
DRM_DEBUG_KMS("prop_id[%d]buf_id[%d]buf_type[%d]\n",
property->prop_id, buf_id, buf_type);
- buf_id %= GSC_MAX_DST;
+ buf_id = 0;
/* address register set */
switch (buf_type) {
@@ -1365,71 +1365,33 @@ static int gsc_clk_ctrl(struct gsc_context *ctx, bool enable)
static int gsc_get_src_buf_index(struct gsc_context *ctx)
{
- u32 cfg, curr_index, i;
- u32 buf_id = GSC_MAX_SRC;
+ u32 buf_id = 0;
int ret;
DRM_DEBUG_KMS("gsc id[%d]\n", ctx->id);
- cfg = gsc_read(GSC_IN_BASE_ADDR_Y_MASK);
- curr_index = GSC_IN_CURR_GET_INDEX(cfg);
-
- for (i = curr_index; i < GSC_MAX_SRC; i++) {
- if (!((cfg >> i) & 0x1)) {
- buf_id = i;
- break;
- }
- }
-
- if (buf_id == GSC_MAX_SRC) {
- DRM_ERROR("failed to get in buffer index.\n");
- return -EINVAL;
- }
-
ret = gsc_src_set_buf_seq(ctx, buf_id, IPP_BUF_DEQUEUE);
if (ret < 0) {
DRM_ERROR("failed to dequeue.\n");
return ret;
}
- DRM_DEBUG_KMS("cfg[0x%x]curr_index[%d]buf_id[%d]\n", cfg,
- curr_index, buf_id);
-
return buf_id;
}
static int gsc_get_dst_buf_index(struct gsc_context *ctx)
{
- u32 cfg, curr_index, i;
- u32 buf_id = GSC_MAX_DST;
+ u32 buf_id = 0;
int ret;
DRM_DEBUG_KMS("gsc id[%d]\n", ctx->id);
- cfg = gsc_read(GSC_OUT_BASE_ADDR_Y_MASK);
- curr_index = GSC_OUT_CURR_GET_INDEX(cfg);
-
- for (i = curr_index; i < GSC_MAX_DST; i++) {
- if (!((cfg >> i) & 0x1)) {
- buf_id = i;
- break;
- }
- }
-
- if (buf_id == GSC_MAX_DST) {
- DRM_ERROR("failed to get out buffer index.\n");
- return -EINVAL;
- }
-
ret = gsc_dst_set_buf_seq(ctx, buf_id, IPP_BUF_DEQUEUE);
if (ret < 0) {
DRM_ERROR("failed to dequeue.\n");
return ret;
}
- DRM_DEBUG_KMS("cfg[0x%x]curr_index[%d]buf_id[%d]\n", cfg,
- curr_index, buf_id);
-
return buf_id;
}