video: driver: Add support for non-secure pix context bank

- Add support for a new non-secure pix context bank.
- Remove usage of deprecated 'buffer-types' in context banks.

Change-Id: I3a21eb8ce1d9aff277568d54aadb54193ad0ce75
Signed-off-by: Mihir Ganu <mganu@codeaurora.org>
Dieser Commit ist enthalten in:
Mihir Ganu
2021-03-05 17:51:10 -08:00
Ursprung 03bda80d9e
Commit ccb6da7567
6 geänderte Dateien mit 75 neuen und 55 gelöschten Zeilen

Datei anzeigen

@@ -180,11 +180,17 @@ static inline bool is_active_session(u64 prev, u64 curr)
MSM_VIDC_SESSION_INACTIVE_THRESHOLD_MS);
}
static inline bool is_session_error(struct msm_vidc_inst* inst)
static inline bool is_session_error(struct msm_vidc_inst *inst)
{
return inst->state == MSM_VIDC_ERROR;
}
static inline bool is_secure_region(enum msm_vidc_buffer_region region)
{
return !(region == MSM_VIDC_NON_SECURE ||
region == MSM_VIDC_NON_SECURE_PIXEL);
}
const char *cap_name(enum msm_vidc_inst_capability_type cap);
void print_vidc_buffer(u32 tag, const char *tag_str, const char *str, struct msm_vidc_inst *inst,
struct msm_vidc_buffer *vbuf);

Datei anzeigen

@@ -104,7 +104,6 @@ struct addr_set {
struct context_bank_info {
struct list_head list;
const char *name;
u32 buffer_type;
bool is_secure;
struct addr_range addr_range;
struct device *dev;

Datei anzeigen

@@ -168,6 +168,7 @@ enum msm_vidc_buffer_attributes {
enum msm_vidc_buffer_region {
MSM_VIDC_REGION_NONE = 0,
MSM_VIDC_NON_SECURE,
MSM_VIDC_NON_SECURE_PIXEL,
MSM_VIDC_SECURE_PIXEL,
MSM_VIDC_SECURE_NONPIXEL,
MSM_VIDC_SECURE_BITSTREAM,

Datei anzeigen

@@ -784,48 +784,69 @@ u32 msm_vidc_get_buffer_region(struct msm_vidc_inst *inst,
{
u32 region = MSM_VIDC_NON_SECURE;
if (!is_secure_session(inst) &&
buffer_type != MSM_VIDC_BUF_ARP) {
return region;
if (!is_secure_session(inst)) {
switch (buffer_type) {
case MSM_VIDC_BUF_ARP:
region = MSM_VIDC_SECURE_NONPIXEL;
break;
case MSM_VIDC_BUF_INPUT:
if (is_encode_session(inst))
region = MSM_VIDC_NON_SECURE_PIXEL;
else
region = MSM_VIDC_NON_SECURE;
break;
case MSM_VIDC_BUF_OUTPUT:
if (is_decode_session(inst))
region = MSM_VIDC_NON_SECURE_PIXEL;
else
region = MSM_VIDC_NON_SECURE;
break;
case MSM_VIDC_BUF_DPB:
region = MSM_VIDC_NON_SECURE_PIXEL;
break;
default:
region = MSM_VIDC_NON_SECURE;
break;
}
} else {
switch (buffer_type) {
case MSM_VIDC_BUF_INPUT:
if (is_encode_session(inst))
region = MSM_VIDC_SECURE_PIXEL;
else
region = MSM_VIDC_SECURE_BITSTREAM;
break;
case MSM_VIDC_BUF_OUTPUT:
if (is_encode_session(inst))
region = MSM_VIDC_SECURE_BITSTREAM;
else
region = MSM_VIDC_SECURE_PIXEL;
break;
case MSM_VIDC_BUF_INPUT_META:
case MSM_VIDC_BUF_OUTPUT_META:
region = MSM_VIDC_NON_SECURE;
break;
case MSM_VIDC_BUF_BIN:
region = MSM_VIDC_SECURE_BITSTREAM;
break;
case MSM_VIDC_BUF_COMV:
case MSM_VIDC_BUF_NON_COMV:
case MSM_VIDC_BUF_LINE:
region = MSM_VIDC_SECURE_NONPIXEL;
break;
case MSM_VIDC_BUF_DPB:
region = MSM_VIDC_SECURE_PIXEL;
break;
case MSM_VIDC_BUF_PERSIST:
case MSM_VIDC_BUF_ARP:
region = MSM_VIDC_SECURE_NONPIXEL;
break;
default:
i_vpr_e(inst, "%s: invalid driver buffer type %d\n",
func, buffer_type);
}
}
switch (buffer_type) {
case MSM_VIDC_BUF_INPUT:
if (is_encode_session(inst))
region = MSM_VIDC_SECURE_PIXEL;
else
region = MSM_VIDC_SECURE_BITSTREAM;
break;
case MSM_VIDC_BUF_OUTPUT:
if (is_encode_session(inst))
region = MSM_VIDC_SECURE_BITSTREAM;
else
region = MSM_VIDC_SECURE_PIXEL;
break;
case MSM_VIDC_BUF_INPUT_META:
case MSM_VIDC_BUF_OUTPUT_META:
region = MSM_VIDC_NON_SECURE;
break;
case MSM_VIDC_BUF_BIN:
region = MSM_VIDC_SECURE_BITSTREAM;
break;
case MSM_VIDC_BUF_COMV:
case MSM_VIDC_BUF_NON_COMV:
case MSM_VIDC_BUF_LINE:
region = MSM_VIDC_SECURE_NONPIXEL;
break;
case MSM_VIDC_BUF_DPB:
region = MSM_VIDC_SECURE_PIXEL;
break;
case MSM_VIDC_BUF_PERSIST:
// TODO: Need to revisit for ARP
case MSM_VIDC_BUF_ARP:
region = MSM_VIDC_SECURE_NONPIXEL;
break;
default:
i_vpr_e(inst, "%s: invalid driver buffer type %d\n",
func, buffer_type);
}
return region;
}
@@ -2283,7 +2304,7 @@ int msm_vidc_create_internal_buffer(struct msm_vidc_inst *inst,
alloc->region = msm_vidc_get_buffer_region(inst,
buffer_type, __func__);
alloc->size = buffer->buffer_size;
alloc->secure = (alloc->region > MSM_VIDC_NON_SECURE) ? 1 : 0;
alloc->secure = is_secure_region(alloc->region);
rc = msm_vidc_memory_alloc(inst->core, alloc);
if (rc)
return -ENOMEM;

Datei anzeigen

@@ -819,10 +819,9 @@ static int msm_vidc_setup_context_bank(struct msm_vidc_core *core,
d_vpr_h("Attached %s and created mapping\n", dev_name(dev));
d_vpr_h(
"Context bank: %s, buffer_type: %#x, is_secure: %d, address range start: %#x, size: %#x, dev: %pK, domain: %pK",
cb->name, cb->buffer_type, cb->is_secure, cb->addr_range.start,
"Context bank: %s, is_secure: %d, address range start: %#x, size: %#x, dev: %pK, domain: %pK",
cb->name, cb->is_secure, cb->addr_range.start,
cb->addr_range.size, cb->dev, cb->domain);
remove_cb:
return rc;
}
@@ -868,16 +867,9 @@ static int msm_vidc_populate_context_bank(struct device *dev,
d_vpr_h("context bank %s: secure = %d\n",
cb->name, cb->is_secure);
/* setup buffer type for each sub device*/
rc = of_property_read_u32(np, "buffer-types", &cb->buffer_type);
if (rc) {
d_vpr_e("failed to load buffer_type info %d\n", rc);
rc = -ENOENT;
goto err_setup_cb;
}
d_vpr_h("context bank %s address start %x size %x buffer_type %x\n",
d_vpr_h("context bank %s address start %x size %x\n",
cb->name, cb->addr_range.start,
cb->addr_range.size, cb->buffer_type);
cb->addr_range.size);
rc = msm_vidc_setup_context_bank(core, cb, dev);
if (rc) {

Datei anzeigen

@@ -27,6 +27,7 @@ struct context_bank_info *get_context_bank(struct msm_vidc_core *core,
static const struct msm_vidc_buf_region_name buf_region_name[] = {
{MSM_VIDC_REGION_NONE, "none" },
{MSM_VIDC_NON_SECURE, "venus_ns" },
{MSM_VIDC_NON_SECURE_PIXEL, "venus_ns_pixel" },
{MSM_VIDC_SECURE_PIXEL, "venus_sec_pixel" },
{MSM_VIDC_SECURE_NONPIXEL, "venus_sec_non_pixel" },
{MSM_VIDC_SECURE_BITSTREAM, "venus_sec_bitstream" },