aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaurabh Bipin Chandra2013-07-31 09:50:49 -0500
committerSaurabh Bipin Chandra2013-08-27 16:12:42 -0500
commit17668bcb5a1f7f9db2ba225b1825bc55365c3e66 (patch)
tree20a4d47c840afbb44a6c232e6aac05e0c8ffa77a /libdce.c
parent2bda487ad3ce775777d03cf2b7cfd31d9ec9329a (diff)
downloadrepo-libdce-17668bcb5a1f7f9db2ba225b1825bc55365c3e66.tar.gz
repo-libdce-17668bcb5a1f7f9db2ba225b1825bc55365c3e66.tar.xz
repo-libdce-17668bcb5a1f7f9db2ba225b1825bc55365c3e66.zip
[DCE] Modify approach to pass parameters to IPC
Three approaches were followed for IPC MmRpc calls. 1. All the parameters which need to be sent and received to/from IPU are coupled in a struct allocated from Shared/Tiler Memory. Only the adrress of the struct is passed to MmRpc as a pointer argument. This approach is useful as MmRpc in some cases to avoid multiple translations. This approach is followed for : Engine_open(), Engine_close(), create(), control(), delete() 2. All the parameters which need to be sent are given as separate arguments to MmRpc. This approach is needed when you need to translate an address which is ofsetted from a pointer which in itself needs to be translated. This apporach is followed for : process() For understanding, take the example of inbufs argument in process call(). Inbufs allocated in Shared memory and needs to be translated, has the address of Input buffer (allocated from Tiler). It is not possible to give the Input buffer as an argument to Mmrpc for translation until inbufs is given as a parameter to Mmrpc. Therefore inbuf can't be populated inside another Shared/Tiler memory struct. 3. This approach is a workaround to use approach [1] by solving the issue posed by [2]. This approach is followed for : get_version() Taking the example of inbufs to explain, the Input buffer address will be one of the parameters of the struct (explained in [1]) along with inbufs address. Therefore the Input buffer address will get translated here. At the IPU, this address needs to be copied back to inbufs. This patch aligns all DCE calls except Engine_Open to use Approach [2]. Engine_open still follows Approach [1] because: 1. Engine open takes in pointers to Engine_attrs and Error_code structures. The client may set both, none or either one of them to NULL (as allowed by CE). So that implies either I'll have to pass NULL as param_pointer to IPU or decide not to pass them at all. In the second case, I'll have to pass extra arguments to inform IPU that I have not passed Attrs or ErrorCode or both. I tried passing NULL but mmrpc_write failed. Dependent on ipumm patch: https://gerrit.ext.ti.com/gerrit/omap/#/c/12773 Change-Id: Ic770aaa99a56ea559efe9446e6e98d70726cc7c5 Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
Diffstat (limited to 'libdce.c')
-rw-r--r--libdce.c193
1 files changed, 67 insertions, 126 deletions
diff --git a/libdce.c b/libdce.c
index 550e85a..ed02fcf 100644
--- a/libdce.c
+++ b/libdce.c
@@ -216,10 +216,10 @@ EXIT:
216Engine_Handle Engine_open(String name, Engine_Attrs *attrs, Engine_Error *ec) 216Engine_Handle Engine_open(String name, Engine_Attrs *attrs, Engine_Error *ec)
217{ 217{
218 MmRpc_FxnCtx fxnCtx; 218 MmRpc_FxnCtx fxnCtx;
219 int32_t fxnRet;
220 dce_error_status eError = DCE_EOK; 219 dce_error_status eError = DCE_EOK;
221 dce_engine_open *engine_open_msg = NULL; 220 dce_engine_open *engine_open_msg = NULL;
222 Engine_Handle eng_handle = NULL; 221 Engine_Attrs *engine_attrs = NULL;
222 Engine_Handle engine_handle = NULL;
223 223
224 _ASSERT(name != '\0', DCE_EINVALID_INPUT); 224 _ASSERT(name != '\0', DCE_EINVALID_INPUT);
225 225
@@ -228,34 +228,39 @@ Engine_Handle Engine_open(String name, Engine_Attrs *attrs, Engine_Error *ec)
228 228
229 printf(">> Engine_open Params::name = %s size = %d\n", name, strlen(name)); 229 printf(">> Engine_open Params::name = %s size = %d\n", name, strlen(name));
230 /* Allocate Shared memory for the engine_open rpc msg structure*/ 230 /* Allocate Shared memory for the engine_open rpc msg structure*/
231 /* Tiler Memory preferred for now for First level testing */ 231 /* Tiler Memory preferred in QNX */
232 engine_open_msg = memplugin_alloc(sizeof(dce_engine_open), 0, TILER_1D_BUFFER); 232 engine_open_msg = memplugin_alloc(sizeof(dce_engine_open), 0, TILER_1D_BUFFER);
233 _ASSERT_AND_EXECUTE(engine_open_msg != NULL, DCE_EOUT_OF_MEMORY, engine_handle = NULL);
233 234
234 _ASSERT_AND_EXECUTE(engine_open_msg != NULL, DCE_EOUT_OF_MEMORY, eng_handle = NULL); 235 if( attrs ) {
235 236 engine_attrs = memplugin_alloc(sizeof(Engine_Attrs), 0, TILER_1D_BUFFER);
237 _ASSERT_AND_EXECUTE(engine_attrs != NULL, DCE_EOUT_OF_MEMORY, engine_handle = NULL);
238 *engine_attrs = *attrs;
239 }
236 /* Populating the msg structure with all the params */ 240 /* Populating the msg structure with all the params */
237 /* Populating all params into a struct avoid individual address translations of name, ec */ 241 /* Populating all params into a struct avoid individual address translations of name, ec */
238 strncpy(engine_open_msg->name, name, strlen(name)); 242 strncpy(engine_open_msg->name, name, strlen(name));
239 engine_open_msg->eng_handle = NULL; 243 engine_open_msg->engine_attrs = engine_attrs;
240 244
241 /* Marshall function arguments into the send buffer */ 245 /* Marshall function arguments into the send buffer */
242 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_ENGINE_OPEN, 1, 0, NULL); 246 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_ENGINE_OPEN, 1, 0, NULL);
243 Fill_MmRpc_fxnCtx_Ptr_Params(fxnCtx.params, sizeof(dce_engine_open), engine_open_msg, NULL); 247 Fill_MmRpc_fxnCtx_Ptr_Params(fxnCtx.params, sizeof(dce_engine_open), engine_open_msg, NULL);
244 248
245 /* Invoke the Remote function through MmRpc */ 249 /* Invoke the Remote function through MmRpc */
246 eError = MmRpc_call(MmRpcHandle, &fxnCtx, &fxnRet); 250 eError = MmRpc_call(MmRpcHandle, &fxnCtx, (int32_t *)(&engine_handle));
247 251
248 /* In case of Error, the Application will get a NULL Engine Handle */ 252 /* In case of Error, the Application will get a NULL Engine Handle */
249 _ASSERT_AND_EXECUTE(eError == DCE_EOK, DCE_EIPC_CALL_FAIL, eng_handle = NULL); 253 _ASSERT_AND_EXECUTE(eError == DCE_EOK, DCE_EIPC_CALL_FAIL, engine_handle = NULL);
250
251 /* Populate return arguments */
252 eng_handle = engine_open_msg->eng_handle;
253 ec[0] = engine_open_msg->error_code;
254 254
255 if( ec ) {
256 *ec = engine_open_msg->error_code;
257 }
255EXIT: 258EXIT:
256 memplugin_free(engine_open_msg, TILER_1D_BUFFER); 259 memplugin_free(engine_open_msg, TILER_1D_BUFFER);
257 260 if( engine_attrs ) {
258 return (eng_handle); 261 memplugin_free(engine_attrs, TILER_1D_BUFFER);
262 }
263 return ((Engine_Handle)engine_handle);
259} 264}
260 265
261/*===============================================================*/ 266/*===============================================================*/
@@ -268,21 +273,12 @@ Void Engine_close(Engine_Handle engine)
268 MmRpc_FxnCtx fxnCtx; 273 MmRpc_FxnCtx fxnCtx;
269 int32_t fxnRet; 274 int32_t fxnRet;
270 dce_error_status eError = DCE_EOK; 275 dce_error_status eError = DCE_EOK;
271 dce_engine_close *engine_close_msg = NULL;
272 276
273 _ASSERT(engine != NULL, DCE_EINVALID_INPUT); 277 _ASSERT(engine != NULL, DCE_EINVALID_INPUT);
274 278
275 /* Allocate Shared/Tiler memory for the engine_close rpc msg structure*/
276 engine_close_msg = memplugin_alloc(sizeof(dce_engine_close), 0, TILER_1D_BUFFER);
277
278 _ASSERT(engine_close_msg != NULL, DCE_EOUT_OF_MEMORY);
279
280 /* Populating the msg structure with all the params */
281 engine_close_msg->eng_handle = engine;
282
283 /* Marshall function arguments into the send buffer */ 279 /* Marshall function arguments into the send buffer */
284 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_ENGINE_CLOSE, 1, 0, NULL); 280 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_ENGINE_CLOSE, 1, 0, NULL);
285 Fill_MmRpc_fxnCtx_Ptr_Params(fxnCtx.params, sizeof(dce_engine_close), engine_close_msg, NULL); 281 Fill_MmRpc_fxnCtx_Scalar_Params(fxnCtx.params, sizeof(Engine_Handle), (int32_t)engine);
286 282
287 /* Invoke the Remote function through MmRpc */ 283 /* Invoke the Remote function through MmRpc */
288 eError = MmRpc_call(MmRpcHandle, &fxnCtx, &fxnRet); 284 eError = MmRpc_call(MmRpcHandle, &fxnCtx, &fxnRet);
@@ -290,8 +286,6 @@ Void Engine_close(Engine_Handle engine)
290 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); 286 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
291 287
292EXIT: 288EXIT:
293 memplugin_free(engine_close_msg, TILER_1D_BUFFER);
294
295 dce_deinit(); 289 dce_deinit();
296 return; 290 return;
297} 291}
@@ -313,49 +307,36 @@ EXIT:
313static void *create(Engine_Handle engine, String name, void *params, dce_codec_type codec_id) 307static void *create(Engine_Handle engine, String name, void *params, dce_codec_type codec_id)
314{ 308{
315 MmRpc_FxnCtx fxnCtx; 309 MmRpc_FxnCtx fxnCtx;
316 MmRpc_Xlt xltAry;
317 int32_t fxnRet;
318 dce_error_status eError = DCE_EOK; 310 dce_error_status eError = DCE_EOK;
319 dce_codec_create *codec_create_msg = NULL;
320 void *codec_handle = NULL; 311 void *codec_handle = NULL;
312 char *codec_name = NULL;
321 313
322 _ASSERT(name != '\0', DCE_EINVALID_INPUT); 314 _ASSERT(name != '\0', DCE_EINVALID_INPUT);
323 _ASSERT(engine != NULL, DCE_EINVALID_INPUT); 315 _ASSERT(engine != NULL, DCE_EINVALID_INPUT);
324 _ASSERT(params != NULL, DCE_EINVALID_INPUT); 316 _ASSERT(params != NULL, DCE_EINVALID_INPUT);
325 317
326 /* Allocate Shared/Tiler memory for the codec_create rpc msg structure*/ 318 /* Allocate shared memory for translating codec name to IPU */
327 codec_create_msg = memplugin_alloc(sizeof(dce_codec_create), 0, TILER_1D_BUFFER); 319 codec_name = memplugin_alloc(MAX_NAME_LENGTH * sizeof(char), 0, TILER_1D_BUFFER);
320 _ASSERT_AND_EXECUTE(codec_name != NULL, DCE_EOUT_OF_MEMORY, codec_handle = NULL);
328 321
329 _ASSERT_AND_EXECUTE(codec_create_msg != NULL, DCE_EOUT_OF_MEMORY, codec_handle = NULL); 322 strncpy(codec_name, name, strlen(name));
330
331 /* Populating the msg structure with all the params */
332 codec_create_msg->engine = engine;
333 strncpy(codec_create_msg->codec_name, name, strlen(name));
334 codec_create_msg->codec_id = codec_id;
335 codec_create_msg->codec_handle = NULL;
336 codec_create_msg->static_params = params;
337 323
338 /* Marshall function arguments into the send buffer */ 324 /* Marshall function arguments into the send buffer */
339 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_CODEC_CREATE, 1, 1, &xltAry); 325 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_CODEC_CREATE, 4, 0, NULL);
340 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[0]), sizeof(dce_codec_create), codec_create_msg, NULL); 326 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[0]), sizeof(int32_t), codec_id);
341 327 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[1]), sizeof(Engine_Handle), (int32_t)engine);
342 /* Mention the virtual pointers that need translation */ 328 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[2]), (P2H(codec_name))->size, codec_name, NULL);
343 /* Allocations through dce_alloc need translation */ 329 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[3]), (P2H(params))->size, params, NULL);
344 /* In this case the static params buffer need translation */
345 Fill_MmRpc_fxnCtx_Xlt_Array(fxnCtx.xltAry, 0, (int32_t)codec_create_msg, (int32_t)&(codec_create_msg->static_params), NULL);
346 330
347 /* Invoke the Remote function through MmRpc */ 331 /* Invoke the Remote function through MmRpc */
348 eError = MmRpc_call(MmRpcHandle, &fxnCtx, &fxnRet); 332 eError = MmRpc_call(MmRpcHandle, &fxnCtx, (int32_t *)(&codec_handle));
349 333
350 /* In case of Error, the Application will get a NULL Codec Handle */ 334 /* In case of Error, the Application will get a NULL Codec Handle */
351 _ASSERT_AND_EXECUTE(eError == DCE_EOK, DCE_EIPC_CALL_FAIL, codec_handle = NULL); 335 _ASSERT_AND_EXECUTE(eError == DCE_EOK, DCE_EIPC_CALL_FAIL, codec_handle = NULL);
352 336
353 codec_handle = codec_create_msg->codec_handle;
354
355EXIT: 337EXIT:
356 memplugin_free(codec_create_msg, TILER_1D_BUFFER); 338 memplugin_free(codec_name, TILER_1D_BUFFER);
357 339 return ((void *)codec_handle);
358 return (codec_handle);
359} 340}
360 341
361/*===============================================================*/ 342/*===============================================================*/
@@ -375,47 +356,30 @@ EXIT:
375 */ 356 */
376static XDAS_Int32 control(void *codec, int id, void *dynParams, void *status, dce_codec_type codec_id) 357static XDAS_Int32 control(void *codec, int id, void *dynParams, void *status, dce_codec_type codec_id)
377{ 358{
378 MmRpc_FxnCtx fxnCtx; 359 MmRpc_FxnCtx fxnCtx;
379 MmRpc_Xlt xltAry[2]; 360 int32_t fxnRet;
380 int32_t fxnRet; 361 dce_error_status eError = DCE_EOK;
381 dce_error_status eError = DCE_EOK;
382 dce_codec_control *codec_control_msg = NULL;
383 362
384 _ASSERT(codec != NULL, DCE_EINVALID_INPUT); 363 _ASSERT(codec != NULL, DCE_EINVALID_INPUT);
385 _ASSERT(dynParams != NULL, DCE_EINVALID_INPUT); 364 _ASSERT(dynParams != NULL, DCE_EINVALID_INPUT);
386 _ASSERT(status != NULL, DCE_EINVALID_INPUT); 365 _ASSERT(status != NULL, DCE_EINVALID_INPUT);
387 366
388 /* Allocate Shared/Tiler memory for the codec_control rpc msg structure*/
389 codec_control_msg = memplugin_alloc(sizeof(dce_codec_control), 0, TILER_1D_BUFFER);
390
391 _ASSERT(codec_control_msg != NULL, DCE_EOUT_OF_MEMORY);
392
393 /* Populating the msg structure with all the params */
394 codec_control_msg->codec_handle = codec;
395 codec_control_msg->cmd_id = id;
396 codec_control_msg->codec_id = codec_id;
397 codec_control_msg->dyn_params = dynParams;
398 codec_control_msg->status = status;
399
400 /* Marshall function arguments into the send buffer */ 367 /* Marshall function arguments into the send buffer */
401 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_CODEC_CONTROL, 1, 2, xltAry); 368 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_CODEC_CONTROL, 5, 0, NULL);
402 Fill_MmRpc_fxnCtx_Ptr_Params(fxnCtx.params, sizeof(dce_codec_control), codec_control_msg, NULL); 369 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[0]), sizeof(int32_t), codec_id);
403 370 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[1]), sizeof(int32_t), (int32_t)codec);
404 /* Dynamic and status params buffer need translation */ 371 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[2]), sizeof(int32_t), (int32_t)id);
405 Fill_MmRpc_fxnCtx_Xlt_Array(fxnCtx.xltAry, 0, (int32_t)codec_control_msg, (int32_t)&(codec_control_msg->dyn_params), NULL); 372 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[3]), (P2H(dynParams))->size, dynParams, NULL);
406 Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[1]), 0, (int32_t)codec_control_msg, (int32_t)&(codec_control_msg->status), NULL); 373 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[4]), (P2H(status))->size, status, NULL);
407 374
408 /* Invoke the Remote function through MmRpc */ 375 /* Invoke the Remote function through MmRpc */
409 eError = MmRpc_call(MmRpcHandle, &fxnCtx, &fxnRet); 376 eError = MmRpc_call(MmRpcHandle, &fxnCtx, &fxnRet);
410 377
411 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); 378 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
412 379
413 eError = codec_control_msg->result;
414
415EXIT: 380EXIT:
416 memplugin_free(codec_control_msg, TILER_1D_BUFFER); 381 return (fxnRet);
417 382
418 return (eError);
419} 383}
420 384
421/*===============================================================*/ 385/*===============================================================*/
@@ -437,61 +401,49 @@ EXIT:
437 */ 401 */
438static XDAS_Int32 get_version(void *codec, void *dynParams, void *status, dce_codec_type codec_id) 402static XDAS_Int32 get_version(void *codec, void *dynParams, void *status, dce_codec_type codec_id)
439{ 403{
440 MmRpc_FxnCtx fxnCtx; 404 MmRpc_FxnCtx fxnCtx;
441 MmRpc_Xlt xltAry[3]; 405 MmRpc_Xlt xltAry;
442 int32_t fxnRet; 406 void * *version_buf = NULL;
443 dce_error_status eError = DCE_EOK; 407 int32_t fxnRet;
444 dce_codec_get_version *codec_get_version_msg = NULL; 408 dce_error_status eError = DCE_EOK;
445 409
446 _ASSERT(codec != NULL, DCE_EINVALID_INPUT); 410 _ASSERT(codec != NULL, DCE_EINVALID_INPUT);
447 _ASSERT(dynParams != NULL, DCE_EINVALID_INPUT); 411 _ASSERT(dynParams != NULL, DCE_EINVALID_INPUT);
448 _ASSERT(status != NULL, DCE_EINVALID_INPUT); 412 _ASSERT(status != NULL, DCE_EINVALID_INPUT);
449 413
450 /* Allocate Shared/Tiler memory for the codec_get_version rpc msg structure*/
451 codec_get_version_msg = memplugin_alloc(sizeof(dce_codec_get_version), 0, TILER_1D_BUFFER);
452
453 _ASSERT(codec_get_version_msg != NULL, DCE_EOUT_OF_MEMORY);
454
455 /* Populating the msg structure with all the params */
456 codec_get_version_msg->codec_handle = codec;
457 codec_get_version_msg->codec_id = codec_id;
458 codec_get_version_msg->dyn_params = dynParams;
459 codec_get_version_msg->status = status;
460 if( codec_id == OMAP_DCE_VIDDEC3 ) { 414 if( codec_id == OMAP_DCE_VIDDEC3 ) {
461 codec_get_version_msg->version = ((IVIDDEC3_Status *)status)->data.buf; 415 version_buf = (void * *)(&(((IVIDDEC3_Status *)status)->data.buf));
462 } else if( codec_id == OMAP_DCE_VIDENC2 ) { 416 } else if( codec_id == OMAP_DCE_VIDENC2 ) {
463 codec_get_version_msg->version = ((IVIDDEC3_Status *)status)->data.buf; 417 version_buf = (void * *)(&(((IVIDENC2_Status *)status)->data.buf));
464 } 418 }
419 _ASSERT(*version_buf != NULL, DCE_EINVALID_INPUT);
465 420
466 /* Marshall function arguments into the send buffer */ 421 /* Marshall function arguments into the send buffer */
467 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_CODEC_CONTROL, 1, 3, xltAry); 422 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_CODEC_GET_VERSION, 4, 1, &xltAry);
468 Fill_MmRpc_fxnCtx_Ptr_Params(fxnCtx.params, sizeof(dce_codec_get_version), codec_get_version_msg, NULL); 423 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[0]), sizeof(int32_t), codec_id);
424 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[1]), sizeof(int32_t), (int32_t)codec);
425 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[2]), (P2H(dynParams))->size, dynParams, NULL);
426 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[3]), (P2H(status))->size, status, NULL);
469 427
470 /* Dynamic, status params and version info buffer need translation */ 428 /* Address Translation needed for buffer for version Info */
471 Fill_MmRpc_fxnCtx_Xlt_Array(fxnCtx.xltAry, 0, (int32_t)codec_get_version_msg, (int32_t)&(codec_get_version_msg->dyn_params), NULL); 429 Fill_MmRpc_fxnCtx_Xlt_Array(fxnCtx.xltAry, 3, (int32_t)status, (int32_t)version_buf, NULL);
472 Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[1]), 0, (int32_t)codec_get_version_msg, (int32_t)&(codec_get_version_msg->status), NULL);
473 Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[2]), 0, (int32_t)codec_get_version_msg, (int32_t)&(codec_get_version_msg->version), NULL);
474 430
475 /* Invoke the Remote function through MmRpc */ 431 /* Invoke the Remote function through MmRpc */
476 eError = MmRpc_call(MmRpcHandle, &fxnCtx, &fxnRet); 432 eError = MmRpc_call(MmRpcHandle, &fxnCtx, &fxnRet);
477 433
478 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); 434 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
479 435
480 eError = codec_get_version_msg->result;
481
482EXIT: 436EXIT:
483 memplugin_free(codec_get_version_msg, TILER_1D_BUFFER); 437 return (fxnRet);
484
485 return (eError);
486} 438}
487 439
488typedef enum process_call_params { 440typedef enum process_call_params {
489 CODEC_HANDLE_INDEX = 0, 441 CODEC_ID_INDEX = 0,
442 CODEC_HANDLE_INDEX,
490 INBUFS_INDEX, 443 INBUFS_INDEX,
491 OUTBUFS_INDEX, 444 OUTBUFS_INDEX,
492 INARGS_INDEX, 445 INARGS_INDEX,
493 OUTARGS_INDEX, 446 OUTARGS_INDEX
494 CODEC_ID_INDEX
495} process_call_params; 447} process_call_params;
496 448
497/*===============================================================*/ 449/*===============================================================*/
@@ -514,7 +466,7 @@ static XDAS_Int32 process(void *codec, void *inBufs, void *outBufs,
514{ 466{
515 MmRpc_FxnCtx fxnCtx; 467 MmRpc_FxnCtx fxnCtx;
516 MmRpc_Xlt xltAry[MAX_TOTAl_BUF]; 468 MmRpc_Xlt xltAry[MAX_TOTAl_BUF];
517 int fxnRet, count, total_count, numInBufs = 0, numOutBufs = 0, sz[5] = { 0 }; 469 int fxnRet, count, total_count, numInBufs = 0, numOutBufs = 0, sz[OUTARGS_INDEX + 1] = { 0 };
518 dce_error_status eError = DCE_EOK; 470 dce_error_status eError = DCE_EOK;
519 471
520 _ASSERT(codec != NULL, DCE_EINVALID_INPUT); 472 _ASSERT(codec != NULL, DCE_EINVALID_INPUT);
@@ -542,12 +494,12 @@ static XDAS_Int32 process(void *codec, void *inBufs, void *outBufs,
542 /* marshall function arguments into the send buffer */ 494 /* marshall function arguments into the send buffer */
543 /* Approach [2] as explained in "Notes" used for process */ 495 /* Approach [2] as explained in "Notes" used for process */
544 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_CODEC_PROCESS, 6, numInBufs + numOutBufs, xltAry); 496 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_CODEC_PROCESS, 6, numInBufs + numOutBufs, xltAry);
497 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[CODEC_ID_INDEX]), sizeof(int32_t), codec_id);
545 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[CODEC_HANDLE_INDEX]), sizeof(int32_t), (int32_t)codec); 498 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[CODEC_HANDLE_INDEX]), sizeof(int32_t), (int32_t)codec);
546 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[INBUFS_INDEX]), sz[INBUFS_INDEX], inBufs, NULL); 499 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[INBUFS_INDEX]), sz[INBUFS_INDEX], inBufs, NULL);
547 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[OUTBUFS_INDEX]), sz[OUTBUFS_INDEX], outBufs, NULL); 500 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[OUTBUFS_INDEX]), sz[OUTBUFS_INDEX], outBufs, NULL);
548 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[INARGS_INDEX]), sz[INARGS_INDEX], inArgs, NULL); 501 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[INARGS_INDEX]), sz[INARGS_INDEX], inArgs, NULL);
549 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[OUTARGS_INDEX]), sz[OUTARGS_INDEX], outArgs, NULL); 502 Fill_MmRpc_fxnCtx_Ptr_Params(&(fxnCtx.params[OUTARGS_INDEX]), sz[OUTARGS_INDEX], outArgs, NULL);
550 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[CODEC_ID_INDEX]), sizeof(int32_t), codec_id);
551 503
552 /* InBufs, OutBufs, InArgs, OutArgs buffer need translation but since they have been */ 504 /* InBufs, OutBufs, InArgs, OutArgs buffer need translation but since they have been */
553 /* individually mentioned as fxnCtx Params, they need not be mentioned below again */ 505 /* individually mentioned as fxnCtx Params, they need not be mentioned below again */
@@ -586,22 +538,13 @@ static void delete(void *codec, dce_codec_type codec_id)
586 MmRpc_FxnCtx fxnCtx; 538 MmRpc_FxnCtx fxnCtx;
587 int32_t fxnRet; 539 int32_t fxnRet;
588 dce_error_status eError = DCE_EOK; 540 dce_error_status eError = DCE_EOK;
589 dce_codec_delete *codec_delete_msg = NULL;
590 541
591 _ASSERT(codec != NULL, DCE_EINVALID_INPUT); 542 _ASSERT(codec != NULL, DCE_EINVALID_INPUT);
592 543
593 /* Allocate Shared/Tiler memory for the codec_delete rpc msg structure*/
594 codec_delete_msg = memplugin_alloc(sizeof(dce_codec_delete), 0, TILER_1D_BUFFER);
595
596 _ASSERT(codec_delete_msg != NULL, DCE_EOUT_OF_MEMORY);
597
598 /* Populating the msg structure with all the params */
599 codec_delete_msg->codec_handle = codec;
600 codec_delete_msg->codec_id = codec_id;
601
602 /* Marshall function arguments into the send buffer */ 544 /* Marshall function arguments into the send buffer */
603 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_CODEC_DELETE, 1, 0, NULL); 545 Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_CODEC_DELETE, 2, 0, NULL);
604 Fill_MmRpc_fxnCtx_Ptr_Params(fxnCtx.params, sizeof(dce_codec_delete), codec_delete_msg, NULL); 546 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[0]), sizeof(int32_t), codec_id);
547 Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[1]), sizeof(int32_t), (int32_t)codec);
605 548
606 /* Invoke the Remote function through MmRpc */ 549 /* Invoke the Remote function through MmRpc */
607 eError = MmRpc_call(MmRpcHandle, &fxnCtx, &fxnRet); 550 eError = MmRpc_call(MmRpcHandle, &fxnCtx, &fxnRet);
@@ -609,8 +552,6 @@ static void delete(void *codec, dce_codec_type codec_id)
609 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); 552 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
610 553
611EXIT: 554EXIT:
612 memplugin_free(codec_delete_msg, TILER_1D_BUFFER);
613
614 return; 555 return;
615} 556}
616 557