Procházet zdrojové kódy

video: driver: refine refcount handling for release buffer

If current qbuf entry is already present in release buffer list,
then as part of release done, refcount will get decremented and
for current qbuf, there is 2 possibilities of outputs from fw.
FBD with RO and wo RO. So if firmware gives FBD with RO, we are
currently decrementing refcount from 1 -> 0. So mapping gets
destroyed. But firmware is still holding RO referrence and
leading to smmu fault issues. So added hadling to increment
recount by 1, if current buffer(qbuf) is already present in
release buf list.

Change-Id: Icbe8ce0b1c9b47c4450d17650b63a575e1037ce3
Signed-off-by: Govindaraj Rajagopal <[email protected]>
Govindaraj Rajagopal před 4 roky
rodič
revize
bdd7a33bfb

+ 11 - 0
driver/vidc/src/msm_vidc_driver.c

@@ -2159,6 +2159,7 @@ int msm_vidc_map_driver_buf(struct msm_vidc_inst *inst,
 	int rc = 0;
 	struct msm_vidc_mappings *mappings;
 	struct msm_vidc_map *map;
+	struct msm_vidc_buffer *rel_buf;
 	bool found = false;
 
 	if (!inst || !buf) {
@@ -2204,6 +2205,16 @@ int msm_vidc_map_driver_buf(struct msm_vidc_inst *inst,
 			}
 		}
 		list_add_tail(&map->list, &mappings->list);
+	} else {
+		/* increment map ref_count, if buf already present in release list */
+		list_for_each_entry(rel_buf, &inst->buffers.release.list, list) {
+			if (rel_buf->device_addr == buf->device_addr) {
+				rc = msm_vidc_memory_map(inst->core, map);
+				if (rc)
+					return rc;
+				break;
+			}
+		}
 	}
 	rc = msm_vidc_memory_map(inst->core, map);
 	if (rc)

+ 1 - 1
driver/vidc/src/venus_hfi_response.c

@@ -1356,7 +1356,7 @@ static int handle_session_property(struct msm_vidc_inst *inst,
 		} else {
 			i_vpr_e(inst,
 				"%s: invalid property %#x for %s port %d dpb cap value %d\n",
-				__func__, is_decode_session(inst) ? "decode" : "encode",
+				__func__, pkt->type, is_decode_session(inst) ? "decode" : "encode",
 				port, inst->capabilities->cap[DPB_LIST].value);
 		}
 		break;