Skip to content

Commit 4c1b44b

Browse files
hoshinolinajannau
authored andcommitted
media: apple: isp: VMap only what is necessary, remove redundant logging state bit
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent d798858 commit 4c1b44b

1 file changed

Lines changed: 15 additions & 26 deletions

File tree

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

Lines changed: 15 additions & 26 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,42 +243,31 @@ 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+
// skip vmap
257+
return 0;
258+
}
259+
246260
err = isp_surf_vmap(isp, surf);
247261
if (err < 0) {
248262
isp_err(isp, "failed to vmap iova=0x%llx size=0x%llx\n",
249263
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-
}
261264
}
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
270-
/* To the gc it goes... */
271-
272265
} else {
273266
/* This should be the shared surface free request, but
274267
* 1) The fw doesn't request to free all of what it requested
275268
* 2) The fw continues to access the surface after
276269
* So we link it to the gc, which runs after fw shutdown
277270
*/
278-
#ifdef APPLE_ISP_DEBUG
279-
if (test_bit(ISP_STATE_LOGGING, &isp->state))
280-
clear_bit(ISP_STATE_LOGGING, &isp->state);
281-
#endif
282271
rsp->arg0 = req->arg0 | ISP_IPC_FLAG_ACK;
283272
rsp->arg1 = 0x0;
284273
rsp->arg2 = 0x0;

0 commit comments

Comments
 (0)