diff options
author | Ramakant Singh <ramaka@codeaurora.org> | 2013-10-17 15:25:14 +0530 |
---|---|---|
committer | Radhika Ranjan Soni <rrsoni@codeaurora.org> | 2013-11-18 13:35:08 +0530 |
commit | 613e357e6ae2c088d0f2df47535507dbcbe74039 (patch) | |
tree | f66931c6e393eb67b71ab93c003f7cdc83031980 /libcopybit | |
parent | 8bad3f9144400e94df2eca23db09c51a7d24eca5 (diff) | |
download | display-613e357e6ae2c088d0f2df47535507dbcbe74039.tar.gz |
HWC : Add support for solid fill color
We are using the solid fill feature for
clearing the wormhole region using black
color.
Using the src buffer same as dst buffer to
avoid kernel checks for this use case.
Change-Id: Ia46aded9b067ece83c9df1f2c2cdd6b017fa64ea
Diffstat (limited to 'libcopybit')
-rw-r--r-- | libcopybit/copybit.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/libcopybit/copybit.cpp b/libcopybit/copybit.cpp index b37eee08..5d8da05d 100644 --- a/libcopybit/copybit.cpp +++ b/libcopybit/copybit.cpp @@ -555,6 +555,63 @@ static int finish_copybit(struct copybit_device_t *dev) // NOP for MDP copybit return 0; } +static int clear_copybit(struct copybit_device_t *dev, + struct copybit_image_t const *buf, + struct copybit_rect_t *rect) +{ + struct copybit_context_t* ctx = (struct copybit_context_t*)dev; + uint32_t color = 0; // black color + + if (!ctx) { + ALOGE ("%s: Invalid copybit context", __FUNCTION__); + return -EINVAL; + } + + struct blitReq list1; + memset((char *)&list1 , 0 ,sizeof (struct blitReq) ); + list1.count = 1; + int rel_fen_fd = -1; + int my_tmp_get_fence = -1; + + list1.sync.rel_fen_fd = &my_tmp_get_fence; + mdp_blit_req* req = &list1.req[0]; + + if(!req) { + ALOGE ("%s : Invalid request", __FUNCTION__); + return -EINVAL; + } + + set_image(&req->dst, buf); + set_image(&req->src, buf); + + if (rect->l < 0 || (uint32_t)(rect->r - rect->l) > req->dst.width || + rect->t < 0 || (uint32_t)(rect->b - rect->t) > req->dst.height) { + ALOGE ("%s : Invalid rect : src_rect l %d t %d r %d b %d",\ + __FUNCTION__, rect->l, rect->t, rect->r, rect->b); + return -EINVAL; + } + + req->dst_rect.x = rect->l; + req->dst_rect.y = rect->t; + req->dst_rect.w = rect->r - rect->l; + req->dst_rect.h = rect->b - rect->t; + + req->src_rect = req->dst_rect; + + req->const_color.b = (uint32_t)((color >> 16) & 0xff); + req->const_color.g = (uint32_t)((color >> 8) & 0xff); + req->const_color.r = (uint32_t)((color >> 0) & 0xff); + req->const_color.alpha = MDP_ALPHA_NOP; + + req->transp_mask = MDP_TRANSP_NOP; + req->flags = MDP_SOLID_FILL | MDP_MEMORY_ID_TYPE_FB | MDP_BLEND_FG_PREMULT; + int status = msm_copybit(ctx, &list1); + + if (my_tmp_get_fence != -1) + close(my_tmp_get_fence); + + return status; +} /** Fill the rect on dst with RGBA color **/ static int fill_color(struct copybit_device_t *dev, @@ -653,6 +710,7 @@ static int open_copybit(const struct hw_module_t* module, const char* name, ctx->device.finish = finish_copybit; ctx->device.fill_color = fill_color; ctx->device.flush_get_fence = flush_get_fence; + ctx->device.clear = clear_copybit; ctx->mAlpha = MDP_ALPHA_NOP; ctx->mFlags = 0; ctx->sync.flags = 0; |