ExHWComposer.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* Copyright (c) 2015, The Linux Foundation. All rights reserved.
  2. *
  3. * Redistribution and use in source and binary forms, with or without
  4. * modification, are permitted provided that the following conditions are
  5. * met:
  6. * * Redistributions of source code must retain the above copyright
  7. * notice, this list of conditions and the following disclaimer.
  8. * * Redistributions in binary form must reproduce the above
  9. * copyright notice, this list of conditions and the following
  10. * disclaimer in the documentation and/or other materials provided
  11. * with the distribution.
  12. * * Neither the name of The Linux Foundation nor the names of its
  13. * contributors may be used to endorse or promote products derived
  14. * from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  17. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
  19. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  20. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  21. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  22. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  23. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  24. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  25. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  26. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. #include "ExSurfaceFlinger.h"
  29. #include "ExLayer.h"
  30. #include "ExHWComposer.h"
  31. #ifdef QTI_BSP
  32. #include <hardware/display_defs.h>
  33. #include <gralloc_priv.h>
  34. #include <qdMetaData.h>
  35. #endif
  36. namespace android {
  37. ExHWComposer::ExHWComposer(const sp<SurfaceFlinger>& flinger,
  38. EventHandler& handler)
  39. : HWComposer(flinger, handler) {
  40. mVDSEnabled = false;
  41. char property[PROPERTY_VALUE_MAX] = {0};
  42. /* Read system property for VDS solution.
  43. * This property is expected to be setup once during bootup
  44. */
  45. if( (property_get("persist.hwc.enable_vds", property, NULL) > 0) &&
  46. ((!strncmp(property, "1", strlen("1"))) ||
  47. !strncasecmp(property, "true", strlen("true")))) {
  48. /* HAL virtual display is using VDS based implementation */
  49. mVDSEnabled = true;
  50. }
  51. mDebugLogs = false;
  52. if((property_get("persist.debug.qdframework.logs", property, NULL) > 0) &&
  53. (!strncmp(property, "1", PROPERTY_VALUE_MAX ) ||
  54. (!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) {
  55. mDebugLogs = true;
  56. }
  57. ALOGD_IF(isDebug(),"Creating custom HWC %s",__FUNCTION__);
  58. }
  59. ExHWComposer::~ExHWComposer() {
  60. }
  61. bool ExHWComposer::isCompositionTypeBlit(const int32_t compType) const {
  62. #ifdef QTI_BSP
  63. return (compType == HWC_BLIT);
  64. #else
  65. ALOGD_IF(mDebugLogs, "%s: compType = %d", __FUNCTION__, compType);
  66. #endif
  67. return false;
  68. }
  69. #if defined(QTI_BSP) && defined(SDM_TARGET)
  70. uint32_t ExHWComposer::getS3DFlag(int disp) const {
  71. if (disp < 0) {
  72. return 0;
  73. }
  74. if (!mHwc || uint32_t(disp) >= MAX_HWC_DISPLAYS || !mAllocatedDisplayIDs.hasBit(disp))
  75. return 0;
  76. const DisplayData& disp_data(mDisplayData[disp]);
  77. for (size_t i=0 ; i<disp_data.list->numHwLayers-1; i++) {
  78. const hwc_layer_1_t &l = disp_data.list->hwLayers[i];
  79. private_handle_t *pvt_handle = static_cast<private_handle_t *>
  80. (const_cast<native_handle_t*>(l.handle));
  81. if (pvt_handle != NULL) {
  82. struct S3DSFRender_t s3dRender;
  83. getMetaData(pvt_handle, GET_S3D_RENDER, &s3dRender);
  84. if (s3dRender.DisplayId == static_cast<uint32_t>(disp) && s3dRender.GpuRender) {
  85. return s3dRender.GpuS3dFormat;
  86. }
  87. }
  88. }
  89. return 0;
  90. }
  91. #endif
  92. }; // namespace android