/drivers/gpu/pvr/bridged_support.c

https://bitbucket.org/wisechild/galaxy-nexus · C · 89 lines · 53 code · 11 blank · 25 comment · 4 complexity · 83e9445e519cec956b7473df3f2e658d MD5 · raw file

  1. /**********************************************************************
  2. *
  3. * Copyright (C) Imagination Technologies Ltd. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful but, except
  10. * as otherwise stated in writing, without any warranty; without even the
  11. * implied warranty of merchantability or fitness for a particular purpose.
  12. * See the GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  17. *
  18. * The full GNU General Public License is included in this distribution in
  19. * the file called "COPYING".
  20. *
  21. * Contact Information:
  22. * Imagination Technologies Ltd. <gpl-support@imgtec.com>
  23. * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
  24. *
  25. ******************************************************************************/
  26. #include "img_defs.h"
  27. #include "servicesint.h"
  28. #include "bridged_support.h"
  29. PVRSRV_ERROR
  30. #if defined (SUPPORT_SID_INTERFACE)
  31. PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psHandleBase, IMG_HANDLE *phOSMemHandle, IMG_SID hMHandle)
  32. #else
  33. PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psHandleBase, IMG_HANDLE *phOSMemHandle, IMG_HANDLE hMHandle)
  34. #endif
  35. {
  36. IMG_HANDLE hMHandleInt;
  37. PVRSRV_HANDLE_TYPE eHandleType;
  38. PVRSRV_ERROR eError;
  39. eError = PVRSRVLookupHandleAnyType(psHandleBase, &hMHandleInt,
  40. &eHandleType,
  41. hMHandle);
  42. if(eError != PVRSRV_OK)
  43. {
  44. return eError;
  45. }
  46. switch(eHandleType)
  47. {
  48. #if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
  49. case PVRSRV_HANDLE_TYPE_MEM_INFO:
  50. case PVRSRV_HANDLE_TYPE_MEM_INFO_REF:
  51. case PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO:
  52. {
  53. PVRSRV_KERNEL_MEM_INFO *psMemInfo = (PVRSRV_KERNEL_MEM_INFO *)hMHandleInt;
  54. *phOSMemHandle = psMemInfo->sMemBlk.hOSMemHandle;
  55. break;
  56. }
  57. case PVRSRV_HANDLE_TYPE_SYNC_INFO:
  58. {
  59. PVRSRV_KERNEL_SYNC_INFO *psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)hMHandleInt;
  60. PVRSRV_KERNEL_MEM_INFO *psMemInfo = psSyncInfo->psSyncDataMemInfoKM;
  61. *phOSMemHandle = psMemInfo->sMemBlk.hOSMemHandle;
  62. break;
  63. }
  64. case PVRSRV_HANDLE_TYPE_SOC_TIMER:
  65. {
  66. *phOSMemHandle = (IMG_VOID *)hMHandleInt;
  67. break;
  68. }
  69. #else
  70. case PVRSRV_HANDLE_TYPE_NONE:
  71. *phOSMemHandle = (IMG_VOID *)hMHandleInt;
  72. break;
  73. #endif
  74. default:
  75. return PVRSRV_ERROR_BAD_MAPPING;
  76. }
  77. return PVRSRV_OK;
  78. }