Skip to content

Commit 48d0fdd

Browse files
hoshinolinamarcan
authored andcommitted
media: apple: isp: VMap only what is necessary, remove redundant logging state bit
Signed-off-by: Asahi Lina <[email protected]>
1 parent cfc5662 commit 48d0fdd

1 file changed

Lines changed: 15 additions & 24 deletions

File tree

drivers/media/platform/apple/isp/isp-ipc.c

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ int ipc_tm_handle(struct apple_isp *isp, struct isp_channel *chan)
204204
dma_addr_t iova = req->arg0 & ~ISP_IPC_FLAG_TERMINAL_ACK;
205205
u32 size = req->arg1;
206206
if (iova && size && size < sizeof(buf) &&
207-
test_bit(ISP_STATE_LOGGING, &isp->state)) {
207+
isp->log_surf) {
208208
void *p = apple_isp_translate(isp, isp->log_surf, iova, size);
209209
if (p) {
210210
size = min_t(u32, size, 512);
@@ -243,30 +243,25 @@ int ipc_sm_handle(struct apple_isp *isp, struct isp_channel *chan)
243243
rsp->arg1 = 0x0;
244244
rsp->arg2 = 0x0; /* macOS uses this to index surfaces */
245245

246+
switch (surf->type) {
247+
case 0x4c4f47: /* "LOG" */
248+
isp->log_surf = surf;
249+
break;
250+
case 0x4d495343: /* "MISC" */
251+
/* Hacky... maybe there's a better way to identify this surface? */
252+
if (surf->size == 0xc000)
253+
isp->bt_surf = surf;
254+
break;
255+
default:
256+
goto skip_vmap;
257+
}
258+
246259
err = isp_surf_vmap(isp, surf);
247260
if (err < 0) {
248261
isp_err(isp, "failed to vmap iova=0x%llx size=0x%llx\n",
249262
surf->iova, surf->size);
250-
} else {
251-
switch (surf->type) {
252-
case 0x4c4f47: /* "LOG" */
253-
isp->log_surf = surf;
254-
break;
255-
case 0x4d495343: /* "MISC" */
256-
/* Hacky... maybe there's a better way to identify this surface? */
257-
if (surf->size == 0xc000)
258-
isp->bt_surf = surf;
259-
break;
260-
}
261263
}
262-
263-
#ifdef APPLE_ISP_DEBUG
264-
/* Only enabled in debug builds so it shouldn't matter, but
265-
* the LOG surface is always the first surface requested.
266-
*/
267-
if (!test_bit(ISP_STATE_LOGGING, &isp->state))
268-
set_bit(ISP_STATE_LOGGING, &isp->state);
269-
#endif
264+
skip_vmap:
270265
/* To the gc it goes... */
271266

272267
} else {
@@ -275,10 +270,6 @@ int ipc_sm_handle(struct apple_isp *isp, struct isp_channel *chan)
275270
* 2) The fw continues to access the surface after
276271
* So we link it to the gc, which runs after fw shutdown
277272
*/
278-
#ifdef APPLE_ISP_DEBUG
279-
if (test_bit(ISP_STATE_LOGGING, &isp->state))
280-
clear_bit(ISP_STATE_LOGGING, &isp->state);
281-
#endif
282273
rsp->arg0 = req->arg0 | ISP_IPC_FLAG_ACK;
283274
rsp->arg1 = 0x0;
284275
rsp->arg2 = 0x0;

0 commit comments

Comments
 (0)