Loading drivers/media/platform/msm/vidc/msm_smem.c +18 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -462,6 +462,23 @@ struct msm_smem *msm_smem_user_to_kernel(void *clt, int fd, u32 offset, return mem; } bool msm_smem_compare_buffers(void *clt, int fd, void *priv) { struct smem_client *client = clt; struct ion_handle *handle = NULL; bool ret = false; if (!clt || !priv) { dprintk(VIDC_ERR, "Invalid params: %p, %p\n", clt, priv); return false; } handle = ion_import_dma_buf(client->clnt, fd); ret = handle == priv; handle ? ion_free(client->clnt, handle) : 0; return ret; } static int ion_cache_operations(struct smem_client *client, struct msm_smem *mem, enum smem_cache_ops cache_op) { Loading drivers/media/platform/msm/vidc/msm_vidc.c +4 −2 Original line number Diff line number Diff line Loading @@ -212,7 +212,9 @@ struct buffer_info *get_registered_buf(struct msm_vidc_inst *inst, *plane = 0; list_for_each_entry(temp, &inst->registeredbufs.list, list) { for (i = 0; i < min(temp->num_planes, VIDEO_MAX_PLANES); i++) { bool fd_matches = fd == temp->fd[i]; bool ion_hndl_matches = temp->handle[i] ? msm_smem_compare_buffers(inst->mem_client, fd, temp->handle[i]->smem_priv) : false; bool device_addr_matches = device_addr == temp->device_addr[i]; bool contains_within = CONTAINS(temp->buff_off[i], Loading @@ -222,7 +224,7 @@ struct buffer_info *get_registered_buf(struct msm_vidc_inst *inst, temp->buff_off[i], temp->size[i]); if (!temp->inactive && (fd_matches || device_addr_matches) && (ion_hndl_matches || device_addr_matches) && (contains_within || overlaps)) { dprintk(VIDC_DBG, "This memory region is already mapped\n"); Loading drivers/media/platform/msm/vidc/msm_vidc_internal.h +1 −0 Original line number Diff line number Diff line Loading @@ -367,6 +367,7 @@ struct msm_smem *msm_smem_user_to_kernel(void *clt, int fd, u32 offset, struct context_bank_info *msm_smem_get_context_bank(void *clt, bool is_secure, enum hal_buffer buffer_type); void msm_vidc_fw_unload_handler(struct work_struct *work); bool msm_smem_compare_buffers(void *clt, int fd, void *priv); /* XXX: normally should be in msm_vidc.h, but that's meant for public APIs, * whereas this is private */ int msm_vidc_destroy(struct msm_vidc_inst *inst); Loading Loading
drivers/media/platform/msm/vidc/msm_smem.c +18 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -462,6 +462,23 @@ struct msm_smem *msm_smem_user_to_kernel(void *clt, int fd, u32 offset, return mem; } bool msm_smem_compare_buffers(void *clt, int fd, void *priv) { struct smem_client *client = clt; struct ion_handle *handle = NULL; bool ret = false; if (!clt || !priv) { dprintk(VIDC_ERR, "Invalid params: %p, %p\n", clt, priv); return false; } handle = ion_import_dma_buf(client->clnt, fd); ret = handle == priv; handle ? ion_free(client->clnt, handle) : 0; return ret; } static int ion_cache_operations(struct smem_client *client, struct msm_smem *mem, enum smem_cache_ops cache_op) { Loading
drivers/media/platform/msm/vidc/msm_vidc.c +4 −2 Original line number Diff line number Diff line Loading @@ -212,7 +212,9 @@ struct buffer_info *get_registered_buf(struct msm_vidc_inst *inst, *plane = 0; list_for_each_entry(temp, &inst->registeredbufs.list, list) { for (i = 0; i < min(temp->num_planes, VIDEO_MAX_PLANES); i++) { bool fd_matches = fd == temp->fd[i]; bool ion_hndl_matches = temp->handle[i] ? msm_smem_compare_buffers(inst->mem_client, fd, temp->handle[i]->smem_priv) : false; bool device_addr_matches = device_addr == temp->device_addr[i]; bool contains_within = CONTAINS(temp->buff_off[i], Loading @@ -222,7 +224,7 @@ struct buffer_info *get_registered_buf(struct msm_vidc_inst *inst, temp->buff_off[i], temp->size[i]); if (!temp->inactive && (fd_matches || device_addr_matches) && (ion_hndl_matches || device_addr_matches) && (contains_within || overlaps)) { dprintk(VIDC_DBG, "This memory region is already mapped\n"); Loading
drivers/media/platform/msm/vidc/msm_vidc_internal.h +1 −0 Original line number Diff line number Diff line Loading @@ -367,6 +367,7 @@ struct msm_smem *msm_smem_user_to_kernel(void *clt, int fd, u32 offset, struct context_bank_info *msm_smem_get_context_bank(void *clt, bool is_secure, enum hal_buffer buffer_type); void msm_vidc_fw_unload_handler(struct work_struct *work); bool msm_smem_compare_buffers(void *clt, int fd, void *priv); /* XXX: normally should be in msm_vidc.h, but that's meant for public APIs, * whereas this is private */ int msm_vidc_destroy(struct msm_vidc_inst *inst); Loading