|
37 | 37 | #include <gui/DebugEGLImageTracker.h> |
38 | 38 | #include <gui/GLConsumer.h> |
39 | 39 | #include <gui/ISurfaceComposer.h> |
| 40 | +#include <gui/Surface.h> |
40 | 41 | #include <gui/SurfaceComposerClient.h> |
41 | 42 |
|
42 | 43 | #include <private/gui/ComposerService.h> |
@@ -101,6 +102,50 @@ static bool hasEglProtectedContent() { |
101 | 102 | return hasIt; |
102 | 103 | } |
103 | 104 |
|
| 105 | +std::tuple<sp<GLConsumer>, sp<Surface>> GLConsumer::create(uint32_t tex, uint32_t textureTarget, |
| 106 | + bool useFenceSync, |
| 107 | + bool isControlledByApp) { |
| 108 | +#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ) |
| 109 | + sp<GLConsumer> consumer = |
| 110 | + sp<GLConsumer>::make(tex, textureTarget, useFenceSync, isControlledByApp); |
| 111 | + return {consumer, consumer->getSurface()}; |
| 112 | +#else |
| 113 | + sp<IGraphicBufferProducer> igbp; |
| 114 | + sp<IGraphicBufferConsumer> igbc; |
| 115 | + BufferQueue::createBufferQueue(&igbp, &igbc); |
| 116 | + |
| 117 | + return {sp<GLConsumer>::make(igbc, tex, textureTarget, useFenceSync, isControlledByApp), |
| 118 | + sp<Surface>::make(igbp, isControlledByApp)}; |
| 119 | +#endif |
| 120 | +} |
| 121 | + |
| 122 | +std::tuple<sp<GLConsumer>, sp<Surface>> GLConsumer::create(uint32_t textureTarget, |
| 123 | + bool useFenceSync, |
| 124 | + bool isControlledByApp) { |
| 125 | +#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ) |
| 126 | + sp<GLConsumer> consumer = sp<GLConsumer>::make(textureTarget, useFenceSync, isControlledByApp); |
| 127 | + return {consumer, consumer->getSurface()}; |
| 128 | +#else |
| 129 | + sp<IGraphicBufferProducer> igbp; |
| 130 | + sp<IGraphicBufferConsumer> igbc; |
| 131 | + BufferQueue::createBufferQueue(&igbp, &igbc); |
| 132 | + |
| 133 | + return {sp<GLConsumer>::make(igbc, textureTarget, useFenceSync, isControlledByApp), |
| 134 | + sp<Surface>::make(igbp, isControlledByApp)}; |
| 135 | +#endif |
| 136 | +} |
| 137 | + |
| 138 | +sp<GLConsumer> GLConsumer::create(const sp<IGraphicBufferConsumer>& bq, uint32_t tex, |
| 139 | + uint32_t textureTarget, bool useFenceSync, |
| 140 | + bool isControlledByApp) { |
| 141 | + return sp<GLConsumer>::make(bq, tex, textureTarget, useFenceSync, isControlledByApp); |
| 142 | +} |
| 143 | + |
| 144 | +sp<GLConsumer> GLConsumer::create(const sp<IGraphicBufferConsumer>& bq, uint32_t textureTarget, |
| 145 | + bool useFenceSync, bool isControlledByApp) { |
| 146 | + return sp<GLConsumer>::make(bq, textureTarget, useFenceSync, isControlledByApp); |
| 147 | +} |
| 148 | + |
104 | 149 | #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ) |
105 | 150 | GLConsumer::GLConsumer(uint32_t tex, uint32_t texTarget, bool useFenceSync, bool isControlledByApp) |
106 | 151 | : ConsumerBase(isControlledByApp, /* isConsumerSurfaceFlinger */ false), |
|
0 commit comments