Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
frameworks_native
Commits
ba93b3f8
Commit
ba93b3f8
authored
11 years ago
by
Mathias Agopian
Browse files
Options
Download
Email Patches
Plain Diff
log an error when dequeueBuffer gets a NULL Fence
Bug: 9858745 Change-Id: If35d6a7d770bf0a42d55bc55880a9ddb721fcfd0
parent
87f9b877
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
16 deletions
+20
-16
libs/gui/BufferQueue.cpp
libs/gui/BufferQueue.cpp
+9
-4
libs/gui/IGraphicBufferProducer.cpp
libs/gui/IGraphicBufferProducer.cpp
+4
-7
libs/gui/Surface.cpp
libs/gui/Surface.cpp
+6
-4
libs/gui/SurfaceComposerClient.cpp
libs/gui/SurfaceComposerClient.cpp
+1
-1
No files found.
libs/gui/BufferQueue.cpp
View file @
ba93b3f8
...
...
@@ -406,6 +406,13 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool async
returnFlags
|=
IGraphicBufferProducer
::
BUFFER_NEEDS_REALLOCATION
;
}
if
(
CC_UNLIKELY
(
mSlots
[
buf
].
mFence
==
NULL
))
{
ST_LOGE
(
"dequeueBuffer: about to return a NULL fence from mSlot. "
"buf=%d, w=%d, h=%d, format=%d"
,
buf
,
buffer
->
width
,
buffer
->
height
,
buffer
->
format
);
}
dpy
=
mSlots
[
buf
].
mEglDisplay
;
eglFence
=
mSlots
[
buf
].
mEglFence
;
*
outFence
=
mSlots
[
buf
].
mFence
;
...
...
@@ -416,11 +423,9 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool async
if
(
returnFlags
&
IGraphicBufferProducer
::
BUFFER_NEEDS_REALLOCATION
)
{
status_t
error
;
sp
<
GraphicBuffer
>
graphicBuffer
(
mGraphicBufferAlloc
->
createGraphicBuffer
(
w
,
h
,
format
,
usage
,
&
error
));
mGraphicBufferAlloc
->
createGraphicBuffer
(
w
,
h
,
format
,
usage
,
&
error
));
if
(
graphicBuffer
==
0
)
{
ST_LOGE
(
"dequeueBuffer: SurfaceComposer::createGraphicBuffer "
"failed"
);
ST_LOGE
(
"dequeueBuffer: SurfaceComposer::createGraphicBuffer failed"
);
return
error
;
}
...
...
This diff is collapsed.
Click to expand it.
libs/gui/IGraphicBufferProducer.cpp
View file @
ba93b3f8
...
...
@@ -94,13 +94,10 @@ public:
return
result
;
}
*
buf
=
reply
.
readInt32
();
bool
fenceWasWritten
=
reply
.
readInt32
();
if
(
fenceWasWritten
)
{
// If the fence was written by the callee, then overwrite the
// caller's fence here. If it wasn't written then don't touch the
// caller's fence.
bool
nonNull
=
reply
.
readInt32
();
if
(
nonNull
)
{
*
fence
=
new
Fence
();
reply
.
read
(
*
(
fence
->
get
())
);
reply
.
read
(
*
*
fence
);
}
result
=
reply
.
readInt32
();
return
result
;
...
...
@@ -209,7 +206,7 @@ status_t BnGraphicBufferProducer::onTransact(
reply
->
writeInt32
(
buf
);
reply
->
writeInt32
(
fence
!=
NULL
);
if
(
fence
!=
NULL
)
{
reply
->
write
(
*
fence
.
get
()
);
reply
->
write
(
*
fence
);
}
reply
->
writeInt32
(
result
);
return
NO_ERROR
;
...
...
This diff is collapsed.
Click to expand it.
libs/gui/Surface.cpp
View file @
ba93b3f8
...
...
@@ -175,8 +175,7 @@ int Surface::setSwapInterval(int interval) {
return
NO_ERROR
;
}
int
Surface
::
dequeueBuffer
(
android_native_buffer_t
**
buffer
,
int
*
fenceFd
)
{
int
Surface
::
dequeueBuffer
(
android_native_buffer_t
**
buffer
,
int
*
fenceFd
)
{
ATRACE_CALL
();
ALOGV
(
"Surface::dequeueBuffer"
);
Mutex
::
Autolock
lock
(
mMutex
);
...
...
@@ -193,6 +192,10 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer,
return
result
;
}
sp
<
GraphicBuffer
>&
gbuf
(
mSlots
[
buf
].
buffer
);
// this should never happen
ALOGE_IF
(
fence
==
NULL
,
"Surface::dequeueBuffer: received null Fence! buf=%d"
,
buf
);
if
(
result
&
IGraphicBufferProducer
::
RELEASE_ALL_BUFFERS
)
{
freeAllBuffers
();
}
...
...
@@ -200,8 +203,7 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer,
if
((
result
&
IGraphicBufferProducer
::
BUFFER_NEEDS_REALLOCATION
)
||
gbuf
==
0
)
{
result
=
mGraphicBufferProducer
->
requestBuffer
(
buf
,
&
gbuf
);
if
(
result
!=
NO_ERROR
)
{
ALOGE
(
"dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: %d"
,
result
);
ALOGE
(
"dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: %d"
,
result
);
return
result
;
}
}
...
...
This diff is collapsed.
Click to expand it.
libs/gui/SurfaceComposerClient.cpp
View file @
ba93b3f8
...
...
@@ -653,7 +653,7 @@ status_t ScreenshotClient::update(const sp<IBinder>& display,
mHaveBuffer
=
false
;
}
status_t
err
=
s
->
captureScreen
(
display
,
cpuConsumer
->
getBufferQueue
(),
status_t
err
=
s
->
captureScreen
(
display
,
cpuConsumer
->
getBufferQueue
(),
reqWidth
,
reqHeight
,
minLayerZ
,
maxLayerZ
,
true
);
if
(
err
==
NO_ERROR
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment