aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Salido-Moreno <adrianm@codeaurora.org>2014-10-08 16:33:47 -0700
committerAdrian Salido-Moreno <adrianm@codeaurora.org>2014-10-08 17:24:56 -0700
commit323bbd9f3458dc19b8df1401a7930495114b7907 (patch)
tree11720c00519a23ff4a585add54b54a44f8ad732c
parent9917404fc1ebc7483f2602ab4d5d0d7cdcfbdadb (diff)
msm: mdss: fix wb memory registration optimizationandroid-l-preview_r2.2
In order to avoid multiple mappings of same buffer handle, we check for any existing handles that are already mapped within writeback. However current checks are based on file descriptors, and these may be reused for a new buffer handle, and in turn we end up having wrong assumptions of the actual queued buffer while performing the writeback commit. Fix this by getting the actual ion handle mapped to the file descriptor and look for this handle instead. Change-Id: Ib800dc4000ce8353ed16c7e779cda21644696ec8 Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
-rw-r--r--drivers/video/msm/mdss/mdss_mdp_wb.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/video/msm/mdss/mdss_mdp_wb.c b/drivers/video/msm/mdss/mdss_mdp_wb.c
index 07cc548f6208..01a0c7ff3615 100644
--- a/drivers/video/msm/mdss/mdss_mdp_wb.c
+++ b/drivers/video/msm/mdss/mdss_mdp_wb.c
@@ -357,18 +357,29 @@ static struct mdss_mdp_wb_data *get_local_node(struct mdss_mdp_wb *wb,
static struct mdss_mdp_wb_data *get_user_node(struct msm_fb_data_type *mfd,
struct msmfb_data *data)
{
-
struct mdss_mdp_wb *wb = mfd_to_wb(mfd);
struct mdss_mdp_wb_data *node;
struct mdss_mdp_img_data *buf;
int ret;
if (!list_empty(&wb->register_queue)) {
+ struct ion_client *iclient = mdss_get_ionclient();
+ struct ion_handle *ihdl;
+
+ ihdl = ion_import_dma_buf(iclient, data->memory_id);
+ if (IS_ERR_OR_NULL(ihdl)) {
+ pr_err("unable to import fd %d\n", data->memory_id);
+ return NULL;
+ }
+ /* only interested in ptr address, so we can free handle */
+ ion_free(iclient, ihdl);
+
list_for_each_entry(node, &wb->register_queue, registered_entry)
- if ((node->buf_info.memory_id == data->memory_id) &&
+ if ((node->buf_data.p[0].srcp_ihdl == ihdl) &&
(node->buf_info.offset == data->offset)) {
- pr_debug("found node fd=%x off=%x addr=%x\n",
- data->memory_id, data->offset,
+ pr_debug("found fd=%d ihdl=%p off=%x addr=%x\n",
+ data->memory_id, ihdl,
+ data->offset,
node->buf_data.p[0].addr);
return node;
}
@@ -414,8 +425,9 @@ static void mdss_mdp_wb_free_node(struct mdss_mdp_wb_data *node)
if (node->user_alloc) {
buf = &node->buf_data.p[0];
- pr_debug("free user node mem_id=%d offset=%u addr=0x%x\n",
+ pr_debug("free user mem_id=%d ihdl=%p, offset=%u addr=0x%x\n",
node->buf_info.memory_id,
+ buf->srcp_ihdl,
node->buf_info.offset,
buf->addr);