mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
msm: vidc: Add support for ION memory on 8x55 target
This commit will add support for ION memory on 8x55 target for video encoder and decoder. Change-Id: I23be61d698cf3c6ee81846bad61be15b9e3f824f Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
This commit is contained in:
parent
4da81b3375
commit
f5a3312d0e
10 changed files with 251 additions and 96 deletions
|
@ -26,7 +26,7 @@
|
|||
#include <mach/dma.h>
|
||||
#include <mach/board.h>
|
||||
#include <asm/clkdev.h>
|
||||
|
||||
#include <linux/ion.h>
|
||||
#include "devices.h"
|
||||
#include "footswitch.h"
|
||||
|
||||
|
@ -963,8 +963,8 @@ static struct resource msm_vidc_720p_resources[] = {
|
|||
};
|
||||
|
||||
struct msm_vidc_platform_data vidc_platform_data = {
|
||||
.memtype = MEMTYPE_EBI0,
|
||||
.enable_ion = 0,
|
||||
.memtype = ION_CAMERA_HEAP_ID,
|
||||
.enable_ion = 1,
|
||||
.disable_dmx = 0,
|
||||
.cont_mode_dpb_count = 8
|
||||
};
|
||||
|
|
|
@ -42,8 +42,17 @@ u32 ddl_device_init(struct ddl_init_config *ddl_init_config,
|
|||
}
|
||||
|
||||
DDL_MEMSET(ddl_context, 0, sizeof(struct ddl_context));
|
||||
|
||||
DDL_BUSY(ddl_context);
|
||||
|
||||
if (res_trk_get_enable_ion()) {
|
||||
VIDC_LOGERR_STRING("ddl_dev_init: ION framework enabled");
|
||||
ddl_context->video_ion_client =
|
||||
res_trk_get_ion_client();
|
||||
if (!ddl_context->video_ion_client) {
|
||||
VIDC_LOGERR_STRING("ION client create failed");
|
||||
return VCD_ERR_ILLEGAL_OP;
|
||||
}
|
||||
}
|
||||
ddl_context->memtype = res_trk_get_mem_type();
|
||||
if (ddl_context->memtype == -1) {
|
||||
VIDC_LOGERR_STRING("ddl_dev_init:Invalid Memtype");
|
||||
|
@ -161,7 +170,7 @@ u32 ddl_device_release(void *client_data)
|
|||
|
||||
VIDC_LOG_STRING("FW_ENDDONE");
|
||||
ddl_release_context_buffers(ddl_context);
|
||||
|
||||
ddl_context->video_ion_client = NULL;
|
||||
DDL_IDLE(ddl_context);
|
||||
|
||||
return VCD_S_SUCCESS;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2010-2012 Code Aurora Forum. 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
|
||||
|
@ -77,6 +77,7 @@ struct ddl_buf_addr {
|
|||
u32 *align_physical_addr;
|
||||
u32 *align_virtual_addr;
|
||||
struct msm_mapped_buffer *mapped_buffer;
|
||||
struct ion_handle *alloc_handle;
|
||||
u32 buffer_size;
|
||||
enum ddl_mem_area mem_type;
|
||||
};
|
||||
|
@ -225,6 +226,7 @@ struct ddl_context {
|
|||
struct ddl_buf_addr dbg_core_dump;
|
||||
u32 enable_dbg_core_dump;
|
||||
struct ddl_client_context *ddl_clients[VCD_MAX_NO_CLIENT];
|
||||
struct ion_client *video_ion_client;
|
||||
u32 device_state;
|
||||
u32 ddl_busy;
|
||||
u32 intr_status;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <linux/memory_alloc.h>
|
||||
#include <media/msm/vidc_type.h>
|
||||
#include "vcd_ddl_utils.h"
|
||||
#include "vcd_res_tracker_api.h"
|
||||
|
||||
#if DEBUG
|
||||
#define DBG(x...) printk(KERN_DEBUG x)
|
||||
|
@ -91,103 +92,178 @@ void ddl_pmem_alloc(struct ddl_buf_addr *buff_addr, size_t sz, u32 align)
|
|||
u32 alloc_size, flags = 0;
|
||||
struct ddl_context *ddl_context;
|
||||
struct msm_mapped_buffer *mapped_buffer = NULL;
|
||||
unsigned long *kernel_vaddr = NULL;
|
||||
ion_phys_addr_t phyaddr = 0;
|
||||
size_t len = 0;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (!buff_addr) {
|
||||
ERR("\n%s() Invalid Parameters", __func__);
|
||||
ERR("\n%s() Invalid Parameters\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
DBG_PMEM("\n%s() IN: Requested alloc size(%u)", __func__, (u32)sz);
|
||||
|
||||
if (align == DDL_LINEAR_BUFFER_ALIGN_BYTES) {
|
||||
|
||||
guard_bytes = 31;
|
||||
align_mask = 0xFFFFFFE0U;
|
||||
|
||||
} else {
|
||||
|
||||
guard_bytes = DDL_TILE_BUF_ALIGN_GUARD_BYTES;
|
||||
align_mask = DDL_TILE_BUF_ALIGN_MASK;
|
||||
}
|
||||
ddl_context = ddl_get_context();
|
||||
alloc_size = sz + guard_bytes;
|
||||
if (res_trk_get_enable_ion()) {
|
||||
if (!ddl_context->video_ion_client)
|
||||
ddl_context->video_ion_client =
|
||||
res_trk_get_ion_client();
|
||||
if (!ddl_context->video_ion_client) {
|
||||
ERR("\n%s(): DDL ION Client Invalid handle\n",
|
||||
__func__);
|
||||
goto bailout;
|
||||
}
|
||||
buff_addr->mem_type = res_trk_get_mem_type();
|
||||
buff_addr->alloc_handle = ion_alloc(
|
||||
ddl_context->video_ion_client,
|
||||
alloc_size,
|
||||
SZ_4K,
|
||||
buff_addr->mem_type);
|
||||
if (!buff_addr->alloc_handle) {
|
||||
ERR("\n%s(): DDL ION alloc failed\n",
|
||||
__func__);
|
||||
goto bailout;
|
||||
}
|
||||
ret = ion_phys(ddl_context->video_ion_client,
|
||||
buff_addr->alloc_handle,
|
||||
&phyaddr,
|
||||
&len);
|
||||
if (ret || !phyaddr) {
|
||||
ERR("\n%s(): DDL ION client physical failed\n",
|
||||
__func__);
|
||||
goto free_ion_buffer;
|
||||
}
|
||||
buff_addr->physical_base_addr = (u32 *)phyaddr;
|
||||
kernel_vaddr = (unsigned long *) ion_map_kernel(
|
||||
ddl_context->video_ion_client,
|
||||
buff_addr->alloc_handle,
|
||||
UNCACHED);
|
||||
if (IS_ERR_OR_NULL(kernel_vaddr)) {
|
||||
ERR("\n%s(): DDL ION map failed\n", __func__);
|
||||
goto unmap_ion_buffer;
|
||||
}
|
||||
buff_addr->virtual_base_addr = (u32 *)kernel_vaddr;
|
||||
DBG("ddl_ion_alloc: handle(0x%x), mem_type(0x%x), "\
|
||||
"phys(0x%x), virt(0x%x), size(%u), align(%u), "\
|
||||
"alloced_len(%u)", (u32)buff_addr->alloc_handle,
|
||||
(u32)buff_addr->mem_type,
|
||||
(u32)buff_addr->physical_base_addr,
|
||||
(u32)buff_addr->virtual_base_addr,
|
||||
alloc_size, align, len);
|
||||
} else {
|
||||
physical_addr = (u32)
|
||||
allocate_contiguous_memory_nomap(alloc_size,
|
||||
ddl_context->memtype, SZ_4K);
|
||||
if (!physical_addr) {
|
||||
ERR("\n%s(): DDL pmem allocate failed\n",
|
||||
__func__);
|
||||
goto bailout;
|
||||
}
|
||||
buff_addr->physical_base_addr = (u32 *) physical_addr;
|
||||
flags = MSM_SUBSYSTEM_MAP_KADDR;
|
||||
buff_addr->mapped_buffer =
|
||||
msm_subsystem_map_buffer((unsigned long)physical_addr,
|
||||
alloc_size, flags, NULL, 0);
|
||||
if (IS_ERR(buff_addr->mapped_buffer)) {
|
||||
ERR("\n%s() buffer map failed\n", __func__);
|
||||
goto free_pmem_buffer;
|
||||
}
|
||||
mapped_buffer = buff_addr->mapped_buffer;
|
||||
if (!mapped_buffer->vaddr) {
|
||||
ERR("\n%s() mapped virtual address is NULL\n",
|
||||
__func__);
|
||||
goto unmap_pmem_buffer;
|
||||
}
|
||||
buff_addr->virtual_base_addr = mapped_buffer->vaddr;
|
||||
DBG("ddl_pmem_alloc: mem_type(0x%x), phys(0x%x),"\
|
||||
" virt(0x%x), sz(%u), align(%u)",
|
||||
(u32)buff_addr->mem_type,
|
||||
(u32)buff_addr->physical_base_addr,
|
||||
(u32)buff_addr->virtual_base_addr,
|
||||
alloc_size, SZ_4K);
|
||||
}
|
||||
|
||||
physical_addr = (u32)
|
||||
allocate_contiguous_memory_nomap(alloc_size,
|
||||
ddl_context->memtype, SZ_4K);
|
||||
|
||||
if (!physical_addr) {
|
||||
pr_err("%s(): could not allocate kernel pmem buffers\n",
|
||||
__func__);
|
||||
goto bailout;
|
||||
}
|
||||
buff_addr->physical_base_addr = (u32 *) physical_addr;
|
||||
flags = MSM_SUBSYSTEM_MAP_KADDR;
|
||||
buff_addr->mapped_buffer =
|
||||
msm_subsystem_map_buffer((unsigned long)physical_addr,
|
||||
alloc_size, flags, NULL, 0);
|
||||
if (IS_ERR(buff_addr->mapped_buffer)) {
|
||||
pr_err(" %s() buffer map failed", __func__);
|
||||
goto free_acm_alloc;
|
||||
}
|
||||
mapped_buffer = buff_addr->mapped_buffer;
|
||||
if (!mapped_buffer->vaddr) {
|
||||
pr_err("%s() mapped virtual address is NULL", __func__);
|
||||
goto free_map_buffers;
|
||||
}
|
||||
buff_addr->virtual_base_addr = mapped_buffer->vaddr;
|
||||
memset(buff_addr->virtual_base_addr, 0 , sz + guard_bytes);
|
||||
buff_addr->buffer_size = sz;
|
||||
|
||||
buff_addr->align_physical_addr =
|
||||
(u32 *) ((physical_addr + guard_bytes) & align_mask);
|
||||
|
||||
align_offset =
|
||||
(u32) (buff_addr->align_physical_addr) - physical_addr;
|
||||
|
||||
buff_addr->align_physical_addr = (u32 *)
|
||||
(((u32)buff_addr->physical_base_addr + guard_bytes) &
|
||||
align_mask);
|
||||
align_offset = (u32) (buff_addr->align_physical_addr) -
|
||||
(u32)buff_addr->physical_base_addr;
|
||||
buff_addr->align_virtual_addr =
|
||||
(u32 *) ((u32) (buff_addr->virtual_base_addr)
|
||||
+ align_offset);
|
||||
|
||||
DBG_PMEM("\n%s() OUT: phy_addr(%p) ker_addr(%p) size(%u)", __func__,
|
||||
buff_addr->physical_base_addr, buff_addr->virtual_base_addr,
|
||||
buff_addr->buffer_size);
|
||||
|
||||
DBG("%s(): phys(0x%x) align_phys(0x%x), virt(0x%x),"\
|
||||
" align_virt(0x%x)", __func__,
|
||||
(u32)buff_addr->physical_base_addr,
|
||||
(u32)buff_addr->align_physical_addr,
|
||||
(u32)buff_addr->virtual_base_addr,
|
||||
(u32)buff_addr->align_virtual_addr);
|
||||
return;
|
||||
free_map_buffers:
|
||||
msm_subsystem_unmap_buffer(buff_addr->mapped_buffer);
|
||||
free_acm_alloc:
|
||||
free_contiguous_memory_by_paddr(
|
||||
(unsigned long) physical_addr);
|
||||
|
||||
unmap_pmem_buffer:
|
||||
if (buff_addr->mapped_buffer)
|
||||
msm_subsystem_unmap_buffer(buff_addr->mapped_buffer);
|
||||
free_pmem_buffer:
|
||||
if (buff_addr->physical_base_addr)
|
||||
free_contiguous_memory_by_paddr((unsigned long)
|
||||
buff_addr->physical_base_addr);
|
||||
memset(buff_addr, 0, sizeof(struct ddl_buf_addr));
|
||||
return;
|
||||
|
||||
unmap_ion_buffer:
|
||||
if (ddl_context->video_ion_client) {
|
||||
if (buff_addr->alloc_handle)
|
||||
ion_unmap_kernel(ddl_context->video_ion_client,
|
||||
buff_addr->alloc_handle);
|
||||
}
|
||||
free_ion_buffer:
|
||||
if (ddl_context->video_ion_client) {
|
||||
if (buff_addr->alloc_handle)
|
||||
ion_free(ddl_context->video_ion_client,
|
||||
buff_addr->alloc_handle);
|
||||
}
|
||||
bailout:
|
||||
buff_addr->physical_base_addr = NULL;
|
||||
buff_addr->virtual_base_addr = NULL;
|
||||
buff_addr->buffer_size = 0;
|
||||
buff_addr->mapped_buffer = NULL;
|
||||
memset(buff_addr, 0, sizeof(struct ddl_buf_addr));
|
||||
}
|
||||
|
||||
void ddl_pmem_free(struct ddl_buf_addr *buff_addr)
|
||||
{
|
||||
struct ddl_context *ddl_context;
|
||||
ddl_context = ddl_get_context();
|
||||
if (!buff_addr) {
|
||||
ERR("\n %s() invalid arguments %p", __func__, buff_addr);
|
||||
return;
|
||||
}
|
||||
DBG_PMEM("\n%s() IN: phy_addr(%p) ker_addr(%p) size(%u)", __func__,
|
||||
buff_addr->physical_base_addr, buff_addr->virtual_base_addr,
|
||||
DBG("ddl_pmem_free: phys(0x%x) align_phys(0x%x), "\
|
||||
"virt(0x%x), align_virt(0x%x), size(%u)",
|
||||
(u32)buff_addr->physical_base_addr,
|
||||
(u32)buff_addr->align_physical_addr,
|
||||
(u32)buff_addr->virtual_base_addr,
|
||||
(u32)buff_addr->align_virtual_addr,
|
||||
buff_addr->buffer_size);
|
||||
|
||||
if (buff_addr->mapped_buffer)
|
||||
msm_subsystem_unmap_buffer(buff_addr->mapped_buffer);
|
||||
if (buff_addr->physical_base_addr)
|
||||
free_contiguous_memory_by_paddr(
|
||||
(unsigned long) buff_addr->physical_base_addr);
|
||||
DBG_PMEM("\n%s() OUT: phy_addr(%p) ker_addr(%p) size(%u)", __func__,
|
||||
buff_addr->physical_base_addr, buff_addr->virtual_base_addr,
|
||||
buff_addr->buffer_size);
|
||||
buff_addr->buffer_size = 0;
|
||||
buff_addr->physical_base_addr = NULL;
|
||||
buff_addr->virtual_base_addr = NULL;
|
||||
buff_addr->mapped_buffer = NULL;
|
||||
if (ddl_context->video_ion_client) {
|
||||
if (buff_addr->alloc_handle) {
|
||||
ion_unmap_kernel(ddl_context->video_ion_client,
|
||||
buff_addr->alloc_handle);
|
||||
ion_free(ddl_context->video_ion_client,
|
||||
buff_addr->alloc_handle);
|
||||
}
|
||||
} else {
|
||||
if (buff_addr->mapped_buffer)
|
||||
msm_subsystem_unmap_buffer(
|
||||
buff_addr->mapped_buffer);
|
||||
if (buff_addr->physical_base_addr)
|
||||
free_contiguous_memory_by_paddr((unsigned long)
|
||||
buff_addr->physical_base_addr);
|
||||
}
|
||||
memset(buff_addr, 0, sizeof(struct ddl_buf_addr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -677,8 +677,16 @@ boot_fw_free:
|
|||
return false;
|
||||
}
|
||||
|
||||
static struct ion_client *res_trk_create_ion_client(void){
|
||||
struct ion_client *video_client;
|
||||
VCDRES_MSG_LOW("%s", __func__);
|
||||
video_client = msm_ion_client_create(-1, "video_client");
|
||||
return video_client;
|
||||
}
|
||||
|
||||
void res_trk_init(struct device *device, u32 irq)
|
||||
{
|
||||
VCDRES_MSG_LOW("%s", __func__);
|
||||
if (resource_context.device || resource_context.irq_num ||
|
||||
!device) {
|
||||
VCDRES_MSG_ERROR("%s() Resource Tracker Init error\n",
|
||||
|
@ -695,9 +703,27 @@ void res_trk_init(struct device *device, u32 irq)
|
|||
(struct msm_vidc_platform_data *) device->platform_data;
|
||||
if (resource_context.vidc_platform_data) {
|
||||
resource_context.memtype =
|
||||
resource_context.vidc_platform_data->memtype;
|
||||
resource_context.vidc_platform_data->memtype;
|
||||
VCDRES_MSG_LOW("%s(): resource_context.memtype = 0x%x",
|
||||
__func__, (u32)resource_context.memtype);
|
||||
if (resource_context.vidc_platform_data->enable_ion) {
|
||||
resource_context.res_ion_client =
|
||||
res_trk_create_ion_client();
|
||||
if (!(resource_context.res_ion_client)) {
|
||||
VCDRES_MSG_ERROR("%s()ION createfail\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
VCDRES_MSG_LOW("%s(): ion_client = 0x%x", __func__,
|
||||
(u32)resource_context.res_ion_client);
|
||||
} else {
|
||||
VCDRES_MSG_ERROR("%s(): ION not disabled\n",
|
||||
__func__);
|
||||
}
|
||||
} else {
|
||||
resource_context.memtype = -1;
|
||||
VCDRES_MSG_ERROR("%s(): vidc_platform_data is NULL",
|
||||
__func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -705,18 +731,23 @@ u32 res_trk_get_core_type(void){
|
|||
return resource_context.core_type;
|
||||
}
|
||||
|
||||
u32 res_trk_get_mem_type(void){
|
||||
return resource_context.memtype;
|
||||
}
|
||||
|
||||
u32 res_trk_get_enable_ion(void)
|
||||
{
|
||||
return 0;
|
||||
if (resource_context.vidc_platform_data->enable_ion)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ion_client *res_trk_get_ion_client(void)
|
||||
{
|
||||
return NULL;
|
||||
return resource_context.res_ion_client;
|
||||
}
|
||||
|
||||
u32 res_trk_get_mem_type(void)
|
||||
{
|
||||
u32 mem_type = ION_HEAP(resource_context.memtype);
|
||||
return mem_type;
|
||||
}
|
||||
|
||||
void res_trk_set_mem_type(enum ddl_mem_area mem_type)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#ifndef _VIDEO_720P_RESOURCE_TRACKER_H_
|
||||
#define _VIDEO_720P_RESOURCE_TRACKER_H_
|
||||
#include <mach/board.h>
|
||||
#include <linux/ion.h>
|
||||
#include "vcd_res_tracker_api.h"
|
||||
|
||||
#define VCD_RESTRK_MIN_PERF_LEVEL 37900
|
||||
|
@ -36,6 +37,8 @@ struct res_trk_context {
|
|||
u32 core_type;
|
||||
int memtype;
|
||||
u32 secure_session;
|
||||
struct ion_client *res_ion_client;
|
||||
enum ddl_mem_area res_mem_type;
|
||||
};
|
||||
|
||||
#if DEBUG
|
||||
|
|
|
@ -915,7 +915,8 @@ static u32 vid_dec_set_h264_mv_buffers(struct video_client_ctx *client_ctx,
|
|||
__func__);
|
||||
goto import_ion_error;
|
||||
}
|
||||
if (res_trk_check_for_sec_session()) {
|
||||
if (res_trk_check_for_sec_session() ||
|
||||
(res_trk_get_core_type() == (u32)VCD_CORE_720P)) {
|
||||
rc = ion_phys(client_ctx->user_ion_client,
|
||||
client_ctx->h264_mv_ion_handle,
|
||||
(unsigned long *) (&(vcd_h264_mv_buffer->
|
||||
|
@ -1038,7 +1039,8 @@ static u32 vid_dec_free_h264_mv_buffers(struct video_client_ctx *client_ctx)
|
|||
if (!IS_ERR_OR_NULL(client_ctx->h264_mv_ion_handle)) {
|
||||
ion_unmap_kernel(client_ctx->user_ion_client,
|
||||
client_ctx->h264_mv_ion_handle);
|
||||
if (!res_trk_check_for_sec_session()) {
|
||||
if (!res_trk_check_for_sec_session() &&
|
||||
(res_trk_get_core_type() != (u32)VCD_CORE_720P)) {
|
||||
ion_unmap_iommu(client_ctx->user_ion_client,
|
||||
client_ctx->h264_mv_ion_handle,
|
||||
VIDEO_DOMAIN,
|
||||
|
|
|
@ -1844,7 +1844,8 @@ u32 vid_enc_set_recon_buffers(struct video_client_ctx *client_ctx,
|
|||
__func__);
|
||||
goto import_ion_error;
|
||||
}
|
||||
if (res_trk_check_for_sec_session()) {
|
||||
if (res_trk_check_for_sec_session() ||
|
||||
(res_trk_get_core_type() == (u32)VCD_CORE_720P)) {
|
||||
rc = ion_phys(client_ctx->user_ion_client,
|
||||
client_ctx->recon_buffer_ion_handle[i],
|
||||
&phy_addr, &ion_len);
|
||||
|
@ -1945,7 +1946,8 @@ u32 vid_enc_free_recon_buffers(struct video_client_ctx *client_ctx,
|
|||
if (client_ctx->recon_buffer_ion_handle[i]) {
|
||||
ion_unmap_kernel(client_ctx->user_ion_client,
|
||||
client_ctx->recon_buffer_ion_handle[i]);
|
||||
if (!res_trk_check_for_sec_session()) {
|
||||
if (!res_trk_check_for_sec_session() &&
|
||||
(res_trk_get_core_type() != (u32)VCD_CORE_720P)) {
|
||||
ion_unmap_iommu(client_ctx->user_ion_client,
|
||||
client_ctx->recon_buffer_ion_handle[i],
|
||||
VIDEO_DOMAIN,
|
||||
|
|
|
@ -432,7 +432,9 @@ void vidc_cleanup_addr_table(struct video_client_ctx *client_ctx,
|
|||
ion_unmap_kernel(client_ctx->user_ion_client,
|
||||
buf_addr_table[i].
|
||||
buff_ion_handle);
|
||||
if (!res_trk_check_for_sec_session()) {
|
||||
if (!res_trk_check_for_sec_session() &&
|
||||
(res_trk_get_core_type() !=
|
||||
(u32)VCD_CORE_720P)) {
|
||||
ion_unmap_iommu(
|
||||
client_ctx->user_ion_client,
|
||||
buf_addr_table[i].
|
||||
|
@ -456,7 +458,8 @@ void vidc_cleanup_addr_table(struct video_client_ctx *client_ctx,
|
|||
if (!IS_ERR_OR_NULL(client_ctx->user_ion_client)) {
|
||||
ion_unmap_kernel(client_ctx->user_ion_client,
|
||||
client_ctx->h264_mv_ion_handle);
|
||||
if (!res_trk_check_for_sec_session()) {
|
||||
if (!res_trk_check_for_sec_session() &&
|
||||
(res_trk_get_core_type() != (u32)VCD_CORE_720P)) {
|
||||
ion_unmap_iommu(client_ctx->user_ion_client,
|
||||
client_ctx->h264_mv_ion_handle,
|
||||
VIDEO_DOMAIN,
|
||||
|
@ -652,7 +655,8 @@ u32 vidc_insert_addr_table(struct video_client_ctx *client_ctx,
|
|||
*kernel_vaddr = (unsigned long)NULL;
|
||||
goto ion_free_error;
|
||||
}
|
||||
if (res_trk_check_for_sec_session()) {
|
||||
if (res_trk_check_for_sec_session() ||
|
||||
(res_trk_get_core_type() == (u32)VCD_CORE_720P)) {
|
||||
if (ion_phys(client_ctx->user_ion_client,
|
||||
buff_ion_handle,
|
||||
&phys_addr, &ion_len)) {
|
||||
|
@ -780,7 +784,7 @@ u32 vidc_insert_addr_table_kernel(struct video_client_ctx *client_ctx,
|
|||
*num_of_buffers = *num_of_buffers + 1;
|
||||
DBG("%s() : client_ctx = %p, user_virt_addr = 0x%08lx, "
|
||||
"kernel_vaddr = 0x%08lx inserted!", __func__,
|
||||
client_ctx, user_vaddr, *kernel_vaddr);
|
||||
client_ctx, user_vaddr, kernel_vaddr);
|
||||
}
|
||||
mutex_unlock(&client_ctx->enrty_queue_lock);
|
||||
return true;
|
||||
|
@ -833,7 +837,8 @@ u32 vidc_delete_addr_table(struct video_client_ctx *client_ctx,
|
|||
if (buf_addr_table[i].buff_ion_handle) {
|
||||
ion_unmap_kernel(client_ctx->user_ion_client,
|
||||
buf_addr_table[i].buff_ion_handle);
|
||||
if (!res_trk_check_for_sec_session()) {
|
||||
if (!res_trk_check_for_sec_session() &&
|
||||
(res_trk_get_core_type() != (u32)VCD_CORE_720P)) {
|
||||
ion_unmap_iommu(client_ctx->user_ion_client,
|
||||
buf_addr_table[i].buff_ion_handle,
|
||||
VIDEO_DOMAIN,
|
||||
|
|
|
@ -41,6 +41,8 @@ static int vcd_pmem_alloc(size_t sz, u8 **kernel_vaddr, u8 **phy_addr,
|
|||
unsigned long buffer_size = 0;
|
||||
int ret = 0;
|
||||
unsigned long ionflag = 0;
|
||||
ion_phys_addr_t phyaddr = 0;
|
||||
size_t len = 0;
|
||||
|
||||
if (!kernel_vaddr || !phy_addr || !cctxt) {
|
||||
pr_err("\n%s: Invalid parameters", __func__);
|
||||
|
@ -84,6 +86,9 @@ static int vcd_pmem_alloc(size_t sz, u8 **kernel_vaddr, u8 **phy_addr,
|
|||
}
|
||||
*phy_addr = (u8 *) mapped_buffer->iova[0];
|
||||
*kernel_vaddr = (u8 *) mapped_buffer->vaddr;
|
||||
VCD_MSG_LOW("vcd_pmem_alloc: phys(0x%x), virt(0x%x), "\
|
||||
"sz(%u), flags(0x%x)", (u32)*phy_addr,
|
||||
(u32)*kernel_vaddr, sz, (u32)flags);
|
||||
} else {
|
||||
map_buffer->alloc_handle = ion_alloc(
|
||||
cctxt->vcd_ion_client, sz, SZ_4K,
|
||||
|
@ -106,7 +111,8 @@ static int vcd_pmem_alloc(size_t sz, u8 **kernel_vaddr, u8 **phy_addr,
|
|||
pr_err("%s() ION map failed", __func__);
|
||||
goto ion_free_bailout;
|
||||
}
|
||||
ret = ion_map_iommu(cctxt->vcd_ion_client,
|
||||
if (res_trk_get_core_type() != (u32)VCD_CORE_720P) {
|
||||
ret = ion_map_iommu(cctxt->vcd_ion_client,
|
||||
map_buffer->alloc_handle,
|
||||
VIDEO_DOMAIN,
|
||||
VIDEO_MAIN_POOL,
|
||||
|
@ -115,18 +121,32 @@ static int vcd_pmem_alloc(size_t sz, u8 **kernel_vaddr, u8 **phy_addr,
|
|||
(unsigned long *)&iova,
|
||||
(unsigned long *)&buffer_size,
|
||||
UNCACHED, 0);
|
||||
if (ret) {
|
||||
pr_err("%s() ION iommu map failed", __func__);
|
||||
goto ion_map_bailout;
|
||||
if (ret) {
|
||||
pr_err("%s() ION iommu map failed", __func__);
|
||||
goto ion_map_bailout;
|
||||
}
|
||||
map_buffer->phy_addr = iova;
|
||||
} else {
|
||||
ret = ion_phys(cctxt->vcd_ion_client,
|
||||
map_buffer->alloc_handle,
|
||||
&phyaddr,
|
||||
&len);
|
||||
if (ret) {
|
||||
pr_err("%s() ion_phys failed", __func__);
|
||||
goto ion_map_bailout;
|
||||
}
|
||||
map_buffer->phy_addr = phyaddr;
|
||||
}
|
||||
map_buffer->phy_addr = iova;
|
||||
if (!map_buffer->phy_addr) {
|
||||
pr_err("%s() acm alloc failed", __func__);
|
||||
goto free_map_table;
|
||||
}
|
||||
*phy_addr = (u8 *)iova;
|
||||
*phy_addr = (u8 *)map_buffer->phy_addr;
|
||||
mapped_buffer = NULL;
|
||||
map_buffer->mapped_buffer = NULL;
|
||||
VCD_MSG_LOW("vcd_ion_alloc: phys(0x%x), virt(0x%x), "\
|
||||
"sz(%u), ionflags(0x%x)", (u32)*phy_addr,
|
||||
(u32)*kernel_vaddr, sz, (u32)ionflag);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -176,10 +196,13 @@ static int vcd_pmem_free(u8 *kernel_vaddr, u8 *phy_addr,
|
|||
if (map_buffer->mapped_buffer)
|
||||
msm_subsystem_unmap_buffer(map_buffer->mapped_buffer);
|
||||
if (cctxt->vcd_enable_ion) {
|
||||
VCD_MSG_LOW("vcd_ion_free: phys(0x%x), virt(0x%x)",
|
||||
(u32)phy_addr, (u32)kernel_vaddr);
|
||||
if (map_buffer->alloc_handle) {
|
||||
ion_unmap_kernel(cctxt->vcd_ion_client,
|
||||
map_buffer->alloc_handle);
|
||||
ion_unmap_iommu(cctxt->vcd_ion_client,
|
||||
if (res_trk_get_core_type() != (u32)VCD_CORE_720P)
|
||||
ion_unmap_iommu(cctxt->vcd_ion_client,
|
||||
map_buffer->alloc_handle,
|
||||
VIDEO_DOMAIN,
|
||||
VIDEO_MAIN_POOL);
|
||||
|
@ -187,6 +210,8 @@ static int vcd_pmem_free(u8 *kernel_vaddr, u8 *phy_addr,
|
|||
map_buffer->alloc_handle);
|
||||
}
|
||||
} else {
|
||||
VCD_MSG_LOW("vcd_pmem_free: phys(0x%x), virt(0x%x)",
|
||||
(u32)phy_addr, (u32)kernel_vaddr);
|
||||
free_contiguous_memory_by_paddr(
|
||||
(unsigned long)map_buffer->phy_addr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue