Bug 1347062 - P2: use WrImageDescriptor for wr_api_add_external_image_handle(). r=nical,sotaro

MozReview-Commit-ID: 1dNQRZGeKaA
This commit is contained in:
JerryShih
2017-03-31 22:29:14 +08:00
parent 9d5de27a3c
commit 857444c0cf
4 changed files with 11 additions and 22 deletions

View File

@@ -46,10 +46,10 @@ public:
layers::AutoCompleteTask complete(mTask); layers::AutoCompleteTask complete(mTask);
RefPtr<gl::GLContext> gl; RefPtr<gl::GLContext> gl;
if (gfxVars::UseWebRenderANGLE()) { if (gfx::gfxVars::UseWebRenderANGLE()) {
gl = gl::GLContextProviderEGL::CreateForCompositorWidget(mCompositorWidget, true); gl = gl::GLContextProviderEGL::CreateForCompositorWidget(mCompositorWidget, true);
if (!gl || !gl->IsANGLE()) { if (!gl || !gl->IsANGLE()) {
gfxCriticalNote << "Failed ANGLE GL context creation for WebRender: " << hexa(gl.get()); gfxCriticalNote << "Failed ANGLE GL context creation for WebRender: " << gfx::hexa(gl.get());
return; return;
} }
} }
@@ -57,7 +57,7 @@ public:
gl = gl::GLContextProvider::CreateForCompositorWidget(mCompositorWidget, true); gl = gl::GLContextProvider::CreateForCompositorWidget(mCompositorWidget, true);
} }
if (!gl || !gl->MakeCurrent()) { if (!gl || !gl->MakeCurrent()) {
gfxCriticalNote << "Failed GL context creation for WebRender: " << hexa(gl.get()); gfxCriticalNote << "Failed GL context creation for WebRender: " << gfx::hexa(gl.get());
return; return;
} }
@@ -327,14 +327,12 @@ WebRenderAPI::AddBlobImage(ImageKey key, const ImageDescriptor& aDescriptor,
void void
WebRenderAPI::AddExternalImageHandle(ImageKey key, WebRenderAPI::AddExternalImageHandle(ImageKey key,
gfx::IntSize aSize, const ImageDescriptor& aDescriptor,
gfx::SurfaceFormat aFormat,
uint64_t aHandle) uint64_t aHandle)
{ {
auto format = SurfaceFormatToWrImageFormat(aFormat).value();
wr_api_add_external_image_handle(mWrApi, wr_api_add_external_image_handle(mWrApi,
key, key,
aSize.width, aSize.height, format, &aDescriptor,
aHandle); aHandle);
} }

View File

@@ -72,8 +72,7 @@ public:
Range<uint8_t> aBytes); Range<uint8_t> aBytes);
void AddExternalImageHandle(ImageKey key, void AddExternalImageHandle(ImageKey key,
gfx::IntSize aSize, const ImageDescriptor& aDescriptor,
gfx::SurfaceFormat aFormat,
uint64_t aHandle); uint64_t aHandle);
void AddExternalImageBuffer(ImageKey key, void AddExternalImageBuffer(ImageKey key,

View File

@@ -804,20 +804,11 @@ pub extern "C" fn wr_api_add_blob_image(api: &mut RenderApi,
#[no_mangle] #[no_mangle]
pub extern "C" fn wr_api_add_external_image_handle(api: &mut RenderApi, pub extern "C" fn wr_api_add_external_image_handle(api: &mut RenderApi,
image_key: ImageKey, image_key: ImageKey,
width: u32, descriptor: &WrImageDescriptor,
height: u32,
format: ImageFormat,
external_image_id: u64) { external_image_id: u64) {
assert!(unsafe { is_in_compositor_thread() }); assert!(unsafe { is_in_compositor_thread() });
api.add_image(image_key, api.add_image(image_key,
ImageDescriptor { descriptor.to_descriptor(),
width: width,
height: height,
stride: None,
format: format,
is_opaque: false,
offset: 0,
},
ImageData::ExternalHandle(ExternalImageId(external_image_id)), ImageData::ExternalHandle(ExternalImageId(external_image_id)),
None); None);
} }

View File

@@ -545,8 +545,9 @@ wr_api_add_blob_image(WrAPI* api, WrImageKey key, const WrImageDescriptor* descr
WR_FUNC; WR_FUNC;
WR_INLINE void WR_INLINE void
wr_api_add_external_image_handle(WrAPI* api, WrImageKey key, uint32_t width, uint32_t height, wr_api_add_external_image_handle(WrAPI* api, WrImageKey key,
WrImageFormat format, uint64_t external_image_id) const WrImageDescriptor* descriptor,
uint64_t external_image_id)
WR_FUNC; WR_FUNC;
WR_INLINE void WR_INLINE void