ExLayer.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. #ifndef ANDROID_EX_LAYER_H
  29. #define ANDROID_EX_LAYER_H
  30. #include <stdint.h>
  31. #include <sys/types.h>
  32. #include <cutils/properties.h>
  33. #include <Layer.h>
  34. #include "ExSurfaceFlinger.h"
  35. namespace android {
  36. class ExSurfaceFlinger;
  37. class ExLayer : public Layer
  38. {
  39. public:
  40. #ifdef QTI_BSP
  41. enum {
  42. /*
  43. * HWC S3D_MODE is set by HWC driver to indicate that HWC driver can not support
  44. * S3D standalone, need surfaceflinger help to draw layers twice to construct
  45. * S3D framebuffer target.
  46. */
  47. HWC_S3DMODE_NONE = 0x00000000,
  48. HWC_S3DMODE_LR = 0x00000001,
  49. HWC_S3DMODE_RL = 0x00000002,
  50. HWC_S3DMODE_TB = 0x00000003,
  51. HWC_S3DMODE_FP = 0x00000004,
  52. HWC_S3DMODE_MAX = 0x00000005,
  53. };
  54. #endif
  55. ExLayer(SurfaceFlinger* flinger, const sp<Client>& client,
  56. const String8& name, uint32_t w, uint32_t h, uint32_t flags);
  57. virtual ~ExLayer();
  58. virtual bool isExtOnly() const;
  59. virtual bool isIntOnly() const;
  60. virtual bool isSecureDisplay() const;
  61. virtual bool isYuvLayer() const;
  62. virtual void setPosition(const sp<const DisplayDevice>& hw,
  63. HWComposer::HWCLayerInterface& layer, const State& state);
  64. virtual void setAcquiredFenceIfBlit(int &fenceFd,
  65. HWComposer::HWCLayerInterface& layer);
  66. virtual bool canAllowGPUForProtected() const;
  67. #ifdef QTI_BSP
  68. virtual void computeGeometryS3D(const sp<const DisplayDevice>& hw, Mesh& mesh,
  69. Mesh& meshLeftTop, Mesh &meshRightBottom, uint32_t s3d_fmt) const;
  70. #endif
  71. protected:
  72. bool mDebugLogs;
  73. bool isDebug() { return mDebugLogs; }
  74. bool mIsGPUAllowedForProtected;
  75. bool mIsHDMIPrimary;
  76. private:
  77. #ifdef QTI_BSP
  78. // The mesh used to draw the layer in GLES composition mode for s3d left/top
  79. mutable Mesh mMeshLeftTop;
  80. // The mesh used to draw the layer in GLES composition mode for s3d right/bottom
  81. mutable Mesh mMeshRightBottom;
  82. virtual void drawWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip,
  83. bool useIdentityTransform) const;
  84. };
  85. #endif
  86. }; // namespace android
  87. #endif // ANDROID_EX_LAYER_H