Closed
Bug 1125914
Opened 10 years ago
Closed 9 years ago
Reuse TextureClient/TextureHost for video playback
Categories
(Core :: Graphics: Layers, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: jrmuizel, Unassigned)
Details
(Whiteboard: [gfx-noted])
Attachments
(1 file, 1 obsolete file)
14.77 KB,
patch
|
Details | Diff | Splinter Review |
This can save allocations and expensive binding overhead.
Comment 1•10 years ago
|
||
Bug 1043558 might be similar bug on gonk case.
Updated•10 years ago
|
Whiteboard: [gfx-noted]
Comment 2•10 years ago
|
||
Current software decoder on Gonk platform has the problem, too.
The worst case in video playback would be software codec on B2G.
Since we default to GrallocImage, and no recycler currently.
Each new frame allocates a GraphicBuffer(gralloc allocation is rather expensive and it default to memset before returning) than fill the buffer.
Hardware codec uses GonkBufferQueue, which handles buffer recycling in a decent way.
BTW, the most efficient way to recycle GraphicBuffer is recycling the GraphicBuffer in SharedBufferManagerParent, which able to recycle buffer across process and Content Buffers. However, it would has some security consideration though.
Comment 3•10 years ago
|
||
I write a prototype to do the gralloc image/texture recycle. If this way is okay, we can apply to other image types.
Attachment #8604422 -
Flags: feedback?(chung)
Comment 4•10 years ago
|
||
Comment on attachment 8604422 [details] [diff] [review]
recycle for GrallocImage and GrallocTexutureClient
Review of attachment 8604422 [details] [diff] [review]:
-----------------------------------------------------------------
You missed WebRTC code path, f- for now.
BTW, you do not recycle TextureHost.
Attachment #8604422 -
Flags: feedback?(chung) → feedback-
Comment 5•10 years ago
|
||
BTW, you should comment what case you need CreateImage(format, false) and why.
Comment 6•10 years ago
|
||
(In reply to Chiajung Hung [:chiajung] from comment #4)
> Comment on attachment 8604422 [details] [diff] [review]
> recycle for GrallocImage and GrallocTexutureClient
>
> Review of attachment 8604422 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> You missed WebRTC code path, f- for now.
> BTW, you do not recycle TextureHost.
OK. I will add WebRTC part. This patch is just a prototype for TextureClient.
Comment 7•10 years ago
|
||
In this patch, I use a ImagePool to recycle images for video playback. I only implement the part of Gralloc type. Jeff, do you have any concern of this method?
Attachment #8604422 -
Attachment is obsolete: true
Flags: needinfo?(jmuizelaar)
Updated•10 years ago
|
Attachment #8604562 -
Attachment description: recycle for Gralloc texture → WIP: recycle for Gralloc texture
Comment 8•10 years ago
|
||
Can't we use TextureClientRecycleAllocator? I am not fun of creating a new recycling mechanism from scratch everywhere.
Comment 9•10 years ago
|
||
Bug 1135935 might be also related.
Comment 10•10 years ago
|
||
sotaro, I will study the patch in Bug 1135935 and try the TextureClientRecycleAllocator.
Comment 11•10 years ago
|
||
(In reply to Ethan Lin[:elin] from comment #10)
> sotaro, I will study the patch in Bug 1135935 and try the
> TextureClientRecycleAllocator.
Bug 1043558 might be also related.
Image is a wrapper of video/image buffers. I do not think it is a good idea to recycle at Image level if the buffer is TextureClient. In gralloc case, GrallocTextureClient is used as a video buffer. And actual TextureClient usage is longer than Image's lifetime. Image is until ImageContainer. But TextureClient is delivered to ImageClient and also used in ImageHost as TextureHost. The following might help to understand it.
https://github.com/sotaroikeda/firefox-diagrams/blob/master/gfx/gfx_ImageBridge_FirefoxOS_2_1.pdf
In current gfx layers, TextureClients expects ISurfaceAllocator. In b2g, gecko's media framework always uses ImageBridge for ISurfaceAllocator. But on another platform, it needs to handle also non ImageBridge environment.
CairoImage::GetTextureClient() also does recycling. I added it for animated gif/animated png usage performance on b2g. It is a non-media framework usage.
https://dxr.mozilla.org/mozilla-central/source/gfx/layers/ImageContainer.cpp#494
Comment 12•10 years ago
|
||
And when We recycle TextureClient, we always need to ensure that TextureClient is not used by CompositableHost. RemoveTextureFromCompositableTracker is used to ensure it. On b2g, it is always used related to trigger Fence delivery. But on another platform it is not always ensured.
Comment 13•10 years ago
|
||
On media framework, Image is used for only one CompositableForwarder. But if it is non-media framework case, Image could be used by multiple CompositableForwarder as in CairoImage::GetTextureClient().
https://dxr.mozilla.org/mozilla-central/source/gfx/layers/ImageContainer.cpp#494
Updated•10 years ago
|
Flags: needinfo?(jmuizelaar)
Reporter | ||
Comment 14•9 years ago
|
||
Sotaro does this bug still make sense? Don't we do this already?
Flags: needinfo?(sotaro.ikeda.g)
Comment 15•9 years ago
|
||
It is already done in a different way.
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: needinfo?(sotaro.ikeda.g)
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•