xref: /aosp_15_r20/external/angle/src/libANGLE/Stream.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker //
2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2016 The ANGLE Project Authors. All rights reserved.
3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file.
5*8975f5c5SAndroid Build Coastguard Worker //
6*8975f5c5SAndroid Build Coastguard Worker 
7*8975f5c5SAndroid Build Coastguard Worker // Stream.cpp: Implements the egl::Stream class, representing the stream
8*8975f5c5SAndroid Build Coastguard Worker // where frames are streamed in. Implements EGLStreanKHR.
9*8975f5c5SAndroid Build Coastguard Worker 
10*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/Stream.h"
11*8975f5c5SAndroid Build Coastguard Worker 
12*8975f5c5SAndroid Build Coastguard Worker #include <EGL/eglext.h>
13*8975f5c5SAndroid Build Coastguard Worker #include <platform/PlatformMethods.h>
14*8975f5c5SAndroid Build Coastguard Worker 
15*8975f5c5SAndroid Build Coastguard Worker #include "common/debug.h"
16*8975f5c5SAndroid Build Coastguard Worker #include "common/mathutil.h"
17*8975f5c5SAndroid Build Coastguard Worker #include "common/platform.h"
18*8975f5c5SAndroid Build Coastguard Worker #include "common/utilities.h"
19*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/Context.h"
20*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/Display.h"
21*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/renderer/DisplayImpl.h"
22*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/renderer/StreamProducerImpl.h"
23*8975f5c5SAndroid Build Coastguard Worker 
24*8975f5c5SAndroid Build Coastguard Worker namespace egl
25*8975f5c5SAndroid Build Coastguard Worker {
26*8975f5c5SAndroid Build Coastguard Worker 
Stream(Display * display,const AttributeMap & attribs)27*8975f5c5SAndroid Build Coastguard Worker Stream::Stream(Display *display, const AttributeMap &attribs)
28*8975f5c5SAndroid Build Coastguard Worker     : mLabel(nullptr),
29*8975f5c5SAndroid Build Coastguard Worker       mDisplay(display),
30*8975f5c5SAndroid Build Coastguard Worker       mProducerImplementation(nullptr),
31*8975f5c5SAndroid Build Coastguard Worker       mState(EGL_STREAM_STATE_CREATED_KHR),
32*8975f5c5SAndroid Build Coastguard Worker       mProducerFrame(0),
33*8975f5c5SAndroid Build Coastguard Worker       mConsumerFrame(0),
34*8975f5c5SAndroid Build Coastguard Worker       mConsumerLatency(attribs.getAsInt(EGL_CONSUMER_LATENCY_USEC_KHR, 0)),
35*8975f5c5SAndroid Build Coastguard Worker       mConsumerAcquireTimeout(attribs.getAsInt(EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR, 0)),
36*8975f5c5SAndroid Build Coastguard Worker       mPlaneCount(0),
37*8975f5c5SAndroid Build Coastguard Worker       mConsumerType(ConsumerType::NoConsumer),
38*8975f5c5SAndroid Build Coastguard Worker       mProducerType(ProducerType::NoProducer)
39*8975f5c5SAndroid Build Coastguard Worker {
40*8975f5c5SAndroid Build Coastguard Worker     for (auto &plane : mPlanes)
41*8975f5c5SAndroid Build Coastguard Worker     {
42*8975f5c5SAndroid Build Coastguard Worker         plane.textureUnit = -1;
43*8975f5c5SAndroid Build Coastguard Worker         plane.texture     = nullptr;
44*8975f5c5SAndroid Build Coastguard Worker     }
45*8975f5c5SAndroid Build Coastguard Worker }
46*8975f5c5SAndroid Build Coastguard Worker 
~Stream()47*8975f5c5SAndroid Build Coastguard Worker Stream::~Stream()
48*8975f5c5SAndroid Build Coastguard Worker {
49*8975f5c5SAndroid Build Coastguard Worker     SafeDelete(mProducerImplementation);
50*8975f5c5SAndroid Build Coastguard Worker     for (auto &plane : mPlanes)
51*8975f5c5SAndroid Build Coastguard Worker     {
52*8975f5c5SAndroid Build Coastguard Worker         if (plane.texture != nullptr)
53*8975f5c5SAndroid Build Coastguard Worker         {
54*8975f5c5SAndroid Build Coastguard Worker             plane.texture->releaseStream();
55*8975f5c5SAndroid Build Coastguard Worker         }
56*8975f5c5SAndroid Build Coastguard Worker     }
57*8975f5c5SAndroid Build Coastguard Worker }
58*8975f5c5SAndroid Build Coastguard Worker 
setLabel(EGLLabelKHR label)59*8975f5c5SAndroid Build Coastguard Worker void Stream::setLabel(EGLLabelKHR label)
60*8975f5c5SAndroid Build Coastguard Worker {
61*8975f5c5SAndroid Build Coastguard Worker     mLabel = label;
62*8975f5c5SAndroid Build Coastguard Worker }
63*8975f5c5SAndroid Build Coastguard Worker 
getLabel() const64*8975f5c5SAndroid Build Coastguard Worker EGLLabelKHR Stream::getLabel() const
65*8975f5c5SAndroid Build Coastguard Worker {
66*8975f5c5SAndroid Build Coastguard Worker     return mLabel;
67*8975f5c5SAndroid Build Coastguard Worker }
68*8975f5c5SAndroid Build Coastguard Worker 
setConsumerLatency(EGLint latency)69*8975f5c5SAndroid Build Coastguard Worker void Stream::setConsumerLatency(EGLint latency)
70*8975f5c5SAndroid Build Coastguard Worker {
71*8975f5c5SAndroid Build Coastguard Worker     mConsumerLatency = latency;
72*8975f5c5SAndroid Build Coastguard Worker }
73*8975f5c5SAndroid Build Coastguard Worker 
getConsumerLatency() const74*8975f5c5SAndroid Build Coastguard Worker EGLint Stream::getConsumerLatency() const
75*8975f5c5SAndroid Build Coastguard Worker {
76*8975f5c5SAndroid Build Coastguard Worker     return mConsumerLatency;
77*8975f5c5SAndroid Build Coastguard Worker }
78*8975f5c5SAndroid Build Coastguard Worker 
getProducerFrame() const79*8975f5c5SAndroid Build Coastguard Worker EGLuint64KHR Stream::getProducerFrame() const
80*8975f5c5SAndroid Build Coastguard Worker {
81*8975f5c5SAndroid Build Coastguard Worker     return mProducerFrame;
82*8975f5c5SAndroid Build Coastguard Worker }
83*8975f5c5SAndroid Build Coastguard Worker 
getConsumerFrame() const84*8975f5c5SAndroid Build Coastguard Worker EGLuint64KHR Stream::getConsumerFrame() const
85*8975f5c5SAndroid Build Coastguard Worker {
86*8975f5c5SAndroid Build Coastguard Worker     return mConsumerFrame;
87*8975f5c5SAndroid Build Coastguard Worker }
88*8975f5c5SAndroid Build Coastguard Worker 
getState() const89*8975f5c5SAndroid Build Coastguard Worker EGLenum Stream::getState() const
90*8975f5c5SAndroid Build Coastguard Worker {
91*8975f5c5SAndroid Build Coastguard Worker     return mState;
92*8975f5c5SAndroid Build Coastguard Worker }
93*8975f5c5SAndroid Build Coastguard Worker 
setConsumerAcquireTimeout(EGLint timeout)94*8975f5c5SAndroid Build Coastguard Worker void Stream::setConsumerAcquireTimeout(EGLint timeout)
95*8975f5c5SAndroid Build Coastguard Worker {
96*8975f5c5SAndroid Build Coastguard Worker     mConsumerAcquireTimeout = timeout;
97*8975f5c5SAndroid Build Coastguard Worker }
98*8975f5c5SAndroid Build Coastguard Worker 
getConsumerAcquireTimeout() const99*8975f5c5SAndroid Build Coastguard Worker EGLint Stream::getConsumerAcquireTimeout() const
100*8975f5c5SAndroid Build Coastguard Worker {
101*8975f5c5SAndroid Build Coastguard Worker     return mConsumerAcquireTimeout;
102*8975f5c5SAndroid Build Coastguard Worker }
103*8975f5c5SAndroid Build Coastguard Worker 
getProducerType() const104*8975f5c5SAndroid Build Coastguard Worker Stream::ProducerType Stream::getProducerType() const
105*8975f5c5SAndroid Build Coastguard Worker {
106*8975f5c5SAndroid Build Coastguard Worker     return mProducerType;
107*8975f5c5SAndroid Build Coastguard Worker }
108*8975f5c5SAndroid Build Coastguard Worker 
getConsumerType() const109*8975f5c5SAndroid Build Coastguard Worker Stream::ConsumerType Stream::getConsumerType() const
110*8975f5c5SAndroid Build Coastguard Worker {
111*8975f5c5SAndroid Build Coastguard Worker     return mConsumerType;
112*8975f5c5SAndroid Build Coastguard Worker }
113*8975f5c5SAndroid Build Coastguard Worker 
getPlaneCount() const114*8975f5c5SAndroid Build Coastguard Worker EGLint Stream::getPlaneCount() const
115*8975f5c5SAndroid Build Coastguard Worker {
116*8975f5c5SAndroid Build Coastguard Worker     return mPlaneCount;
117*8975f5c5SAndroid Build Coastguard Worker }
118*8975f5c5SAndroid Build Coastguard Worker 
getImplementation()119*8975f5c5SAndroid Build Coastguard Worker rx::StreamProducerImpl *Stream::getImplementation()
120*8975f5c5SAndroid Build Coastguard Worker {
121*8975f5c5SAndroid Build Coastguard Worker     return mProducerImplementation;
122*8975f5c5SAndroid Build Coastguard Worker }
123*8975f5c5SAndroid Build Coastguard Worker 
createConsumerGLTextureExternal(const AttributeMap & attributes,gl::Context * context)124*8975f5c5SAndroid Build Coastguard Worker Error Stream::createConsumerGLTextureExternal(const AttributeMap &attributes, gl::Context *context)
125*8975f5c5SAndroid Build Coastguard Worker {
126*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mState == EGL_STREAM_STATE_CREATED_KHR);
127*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mConsumerType == ConsumerType::NoConsumer);
128*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mProducerType == ProducerType::NoProducer);
129*8975f5c5SAndroid Build Coastguard Worker     ASSERT(context != nullptr);
130*8975f5c5SAndroid Build Coastguard Worker 
131*8975f5c5SAndroid Build Coastguard Worker     const auto &glState = context->getState();
132*8975f5c5SAndroid Build Coastguard Worker     EGLenum bufferType  = attributes.getAsInt(EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
133*8975f5c5SAndroid Build Coastguard Worker     if (bufferType == EGL_RGB_BUFFER)
134*8975f5c5SAndroid Build Coastguard Worker     {
135*8975f5c5SAndroid Build Coastguard Worker         mPlanes[0].texture = glState.getTargetTexture(gl::TextureType::External);
136*8975f5c5SAndroid Build Coastguard Worker         ASSERT(mPlanes[0].texture != nullptr);
137*8975f5c5SAndroid Build Coastguard Worker         mPlanes[0].texture->bindStream(this);
138*8975f5c5SAndroid Build Coastguard Worker         mConsumerType = ConsumerType::GLTextureRGB;
139*8975f5c5SAndroid Build Coastguard Worker         mPlaneCount   = 1;
140*8975f5c5SAndroid Build Coastguard Worker     }
141*8975f5c5SAndroid Build Coastguard Worker     else
142*8975f5c5SAndroid Build Coastguard Worker     {
143*8975f5c5SAndroid Build Coastguard Worker         mPlaneCount = attributes.getAsInt(EGL_YUV_NUMBER_OF_PLANES_EXT, 2);
144*8975f5c5SAndroid Build Coastguard Worker         ASSERT(mPlaneCount <= 3);
145*8975f5c5SAndroid Build Coastguard Worker         for (EGLint i = 0; i < mPlaneCount; i++)
146*8975f5c5SAndroid Build Coastguard Worker         {
147*8975f5c5SAndroid Build Coastguard Worker             // Fetch all the textures
148*8975f5c5SAndroid Build Coastguard Worker             mPlanes[i].textureUnit = attributes.getAsInt(EGL_YUV_PLANE0_TEXTURE_UNIT_NV + i, -1);
149*8975f5c5SAndroid Build Coastguard Worker             if (mPlanes[i].textureUnit != EGL_NONE)
150*8975f5c5SAndroid Build Coastguard Worker             {
151*8975f5c5SAndroid Build Coastguard Worker                 mPlanes[i].texture =
152*8975f5c5SAndroid Build Coastguard Worker                     glState.getSamplerTexture(mPlanes[i].textureUnit, gl::TextureType::External);
153*8975f5c5SAndroid Build Coastguard Worker                 ASSERT(mPlanes[i].texture != nullptr);
154*8975f5c5SAndroid Build Coastguard Worker             }
155*8975f5c5SAndroid Build Coastguard Worker         }
156*8975f5c5SAndroid Build Coastguard Worker 
157*8975f5c5SAndroid Build Coastguard Worker         // Bind them to the stream
158*8975f5c5SAndroid Build Coastguard Worker         for (EGLint i = 0; i < mPlaneCount; i++)
159*8975f5c5SAndroid Build Coastguard Worker         {
160*8975f5c5SAndroid Build Coastguard Worker             if (mPlanes[i].textureUnit != EGL_NONE)
161*8975f5c5SAndroid Build Coastguard Worker             {
162*8975f5c5SAndroid Build Coastguard Worker                 mPlanes[i].texture->bindStream(this);
163*8975f5c5SAndroid Build Coastguard Worker             }
164*8975f5c5SAndroid Build Coastguard Worker         }
165*8975f5c5SAndroid Build Coastguard Worker         mConsumerType = ConsumerType::GLTextureYUV;
166*8975f5c5SAndroid Build Coastguard Worker     }
167*8975f5c5SAndroid Build Coastguard Worker 
168*8975f5c5SAndroid Build Coastguard Worker     mContext = context;
169*8975f5c5SAndroid Build Coastguard Worker     mState   = EGL_STREAM_STATE_CONNECTING_KHR;
170*8975f5c5SAndroid Build Coastguard Worker 
171*8975f5c5SAndroid Build Coastguard Worker     return NoError();
172*8975f5c5SAndroid Build Coastguard Worker }
173*8975f5c5SAndroid Build Coastguard Worker 
createProducerD3D11Texture(const AttributeMap & attributes)174*8975f5c5SAndroid Build Coastguard Worker Error Stream::createProducerD3D11Texture(const AttributeMap &attributes)
175*8975f5c5SAndroid Build Coastguard Worker {
176*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mState == EGL_STREAM_STATE_CONNECTING_KHR);
177*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
178*8975f5c5SAndroid Build Coastguard Worker            mConsumerType == ConsumerType::GLTextureYUV);
179*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mProducerType == ProducerType::NoProducer);
180*8975f5c5SAndroid Build Coastguard Worker 
181*8975f5c5SAndroid Build Coastguard Worker     mProducerImplementation =
182*8975f5c5SAndroid Build Coastguard Worker         mDisplay->getImplementation()->createStreamProducerD3DTexture(mConsumerType, attributes);
183*8975f5c5SAndroid Build Coastguard Worker     mProducerType = ProducerType::D3D11Texture;
184*8975f5c5SAndroid Build Coastguard Worker     mState        = EGL_STREAM_STATE_EMPTY_KHR;
185*8975f5c5SAndroid Build Coastguard Worker 
186*8975f5c5SAndroid Build Coastguard Worker     return NoError();
187*8975f5c5SAndroid Build Coastguard Worker }
188*8975f5c5SAndroid Build Coastguard Worker 
189*8975f5c5SAndroid Build Coastguard Worker // Called when the consumer of this stream starts using the stream
consumerAcquire(const gl::Context * context)190*8975f5c5SAndroid Build Coastguard Worker Error Stream::consumerAcquire(const gl::Context *context)
191*8975f5c5SAndroid Build Coastguard Worker {
192*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mState == EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR ||
193*8975f5c5SAndroid Build Coastguard Worker            mState == EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR);
194*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
195*8975f5c5SAndroid Build Coastguard Worker            mConsumerType == ConsumerType::GLTextureYUV);
196*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mProducerType == ProducerType::D3D11Texture);
197*8975f5c5SAndroid Build Coastguard Worker 
198*8975f5c5SAndroid Build Coastguard Worker     mState = EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR;
199*8975f5c5SAndroid Build Coastguard Worker     mConsumerFrame++;
200*8975f5c5SAndroid Build Coastguard Worker 
201*8975f5c5SAndroid Build Coastguard Worker     // Bind the planes to the gl textures
202*8975f5c5SAndroid Build Coastguard Worker     for (int i = 0; i < mPlaneCount; i++)
203*8975f5c5SAndroid Build Coastguard Worker     {
204*8975f5c5SAndroid Build Coastguard Worker         if (mPlanes[i].texture != nullptr)
205*8975f5c5SAndroid Build Coastguard Worker         {
206*8975f5c5SAndroid Build Coastguard Worker             ANGLE_TRY(ResultToEGL(mPlanes[i].texture->acquireImageFromStream(
207*8975f5c5SAndroid Build Coastguard Worker                 context, mProducerImplementation->getGLFrameDescription(i))));
208*8975f5c5SAndroid Build Coastguard Worker         }
209*8975f5c5SAndroid Build Coastguard Worker     }
210*8975f5c5SAndroid Build Coastguard Worker 
211*8975f5c5SAndroid Build Coastguard Worker     return NoError();
212*8975f5c5SAndroid Build Coastguard Worker }
213*8975f5c5SAndroid Build Coastguard Worker 
consumerRelease(const gl::Context * context)214*8975f5c5SAndroid Build Coastguard Worker Error Stream::consumerRelease(const gl::Context *context)
215*8975f5c5SAndroid Build Coastguard Worker {
216*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mState == EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR ||
217*8975f5c5SAndroid Build Coastguard Worker            mState == EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR);
218*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
219*8975f5c5SAndroid Build Coastguard Worker            mConsumerType == ConsumerType::GLTextureYUV);
220*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mProducerType == ProducerType::D3D11Texture);
221*8975f5c5SAndroid Build Coastguard Worker 
222*8975f5c5SAndroid Build Coastguard Worker     // Release the images
223*8975f5c5SAndroid Build Coastguard Worker     for (int i = 0; i < mPlaneCount; i++)
224*8975f5c5SAndroid Build Coastguard Worker     {
225*8975f5c5SAndroid Build Coastguard Worker         if (mPlanes[i].texture != nullptr)
226*8975f5c5SAndroid Build Coastguard Worker         {
227*8975f5c5SAndroid Build Coastguard Worker             ANGLE_TRY(ResultToEGL(mPlanes[i].texture->releaseImageFromStream(context)));
228*8975f5c5SAndroid Build Coastguard Worker         }
229*8975f5c5SAndroid Build Coastguard Worker     }
230*8975f5c5SAndroid Build Coastguard Worker 
231*8975f5c5SAndroid Build Coastguard Worker     return NoError();
232*8975f5c5SAndroid Build Coastguard Worker }
233*8975f5c5SAndroid Build Coastguard Worker 
isConsumerBoundToContext(const gl::Context * context) const234*8975f5c5SAndroid Build Coastguard Worker bool Stream::isConsumerBoundToContext(const gl::Context *context) const
235*8975f5c5SAndroid Build Coastguard Worker {
236*8975f5c5SAndroid Build Coastguard Worker     ASSERT(context != nullptr);
237*8975f5c5SAndroid Build Coastguard Worker     return (context == mContext);
238*8975f5c5SAndroid Build Coastguard Worker }
239*8975f5c5SAndroid Build Coastguard Worker 
validateD3D11Texture(const void * texture,const AttributeMap & attributes) const240*8975f5c5SAndroid Build Coastguard Worker Error Stream::validateD3D11Texture(const void *texture, const AttributeMap &attributes) const
241*8975f5c5SAndroid Build Coastguard Worker {
242*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
243*8975f5c5SAndroid Build Coastguard Worker            mConsumerType == ConsumerType::GLTextureYUV);
244*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mProducerType == ProducerType::D3D11Texture);
245*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mProducerImplementation != nullptr);
246*8975f5c5SAndroid Build Coastguard Worker 
247*8975f5c5SAndroid Build Coastguard Worker     return mProducerImplementation->validateD3DTexture(texture, attributes);
248*8975f5c5SAndroid Build Coastguard Worker }
249*8975f5c5SAndroid Build Coastguard Worker 
postD3D11Texture(void * texture,const AttributeMap & attributes)250*8975f5c5SAndroid Build Coastguard Worker Error Stream::postD3D11Texture(void *texture, const AttributeMap &attributes)
251*8975f5c5SAndroid Build Coastguard Worker {
252*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
253*8975f5c5SAndroid Build Coastguard Worker            mConsumerType == ConsumerType::GLTextureYUV);
254*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mProducerType == ProducerType::D3D11Texture);
255*8975f5c5SAndroid Build Coastguard Worker 
256*8975f5c5SAndroid Build Coastguard Worker     mProducerImplementation->postD3DTexture(texture, attributes);
257*8975f5c5SAndroid Build Coastguard Worker     mProducerFrame++;
258*8975f5c5SAndroid Build Coastguard Worker 
259*8975f5c5SAndroid Build Coastguard Worker     mState = EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR;
260*8975f5c5SAndroid Build Coastguard Worker 
261*8975f5c5SAndroid Build Coastguard Worker     return NoError();
262*8975f5c5SAndroid Build Coastguard Worker }
263*8975f5c5SAndroid Build Coastguard Worker 
264*8975f5c5SAndroid Build Coastguard Worker // This is called when a texture object associated with this stream is destroyed. Even if multiple
265*8975f5c5SAndroid Build Coastguard Worker // textures are bound, one being destroyed invalidates the stream, so all the remaining textures
266*8975f5c5SAndroid Build Coastguard Worker // will be released and the stream will be invalidated.
releaseTextures()267*8975f5c5SAndroid Build Coastguard Worker void Stream::releaseTextures()
268*8975f5c5SAndroid Build Coastguard Worker {
269*8975f5c5SAndroid Build Coastguard Worker     for (auto &plane : mPlanes)
270*8975f5c5SAndroid Build Coastguard Worker     {
271*8975f5c5SAndroid Build Coastguard Worker         if (plane.texture != nullptr)
272*8975f5c5SAndroid Build Coastguard Worker         {
273*8975f5c5SAndroid Build Coastguard Worker             plane.texture->releaseStream();
274*8975f5c5SAndroid Build Coastguard Worker             plane.texture = nullptr;
275*8975f5c5SAndroid Build Coastguard Worker         }
276*8975f5c5SAndroid Build Coastguard Worker     }
277*8975f5c5SAndroid Build Coastguard Worker     mConsumerType = ConsumerType::NoConsumer;
278*8975f5c5SAndroid Build Coastguard Worker     mProducerType = ProducerType::NoProducer;
279*8975f5c5SAndroid Build Coastguard Worker     mState        = EGL_STREAM_STATE_DISCONNECTED_KHR;
280*8975f5c5SAndroid Build Coastguard Worker }
281*8975f5c5SAndroid Build Coastguard Worker 
282*8975f5c5SAndroid Build Coastguard Worker }  // namespace egl
283