Bug 907292 - Change gfxImageSurface to gfx::DataSourceSurface in TextureHost et al

This commit is contained in:
Andreas Pehrson 2013-11-27 10:59:01 +01:00
parent 02706dbc0a
commit 801b8841c8
20 changed files with 107 additions and 93 deletions

View File

@ -122,7 +122,7 @@ protected:
return EnsureSurface();
}
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE {
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE {
return nullptr;
}

View File

@ -6,7 +6,6 @@
#include "CanvasLayerComposite.h"
#include "composite/CompositableHost.h" // for CompositableHost
#include "gfx2DGlue.h" // for ToFilter, ToMatrix4x4
#include "gfxImageSurface.h" // for gfxImageSurface
#include "GraphicsFilter.h" // for GraphicsFilter
#include "gfxUtils.h" // for gfxUtils, etc
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
@ -71,7 +70,13 @@ CanvasLayerComposite::RenderLayer(const nsIntRect& aClipRect)
#ifdef MOZ_DUMP_PAINTING
if (gfxUtils::sDumpPainting) {
nsRefPtr<gfxImageSurface> surf = mImageHost->GetAsSurface();
RefPtr<gfx::DataSourceSurface> dSurf = mImageHost->GetAsSurface();
gfxPlatform *platform = gfxPlatform::GetPlatform();
RefPtr<gfx::DrawTarget> dt = platform->CreateDrawTargetForData(dSurf->GetData(),
dSurf->GetSize(),
dSurf->Stride(),
dSurf->GetFormat());
nsRefPtr<gfxASurface> surf = platform->GetThebesSurfaceForDrawTarget(dt);
WriteSnapshotToDumpFile(this, surf);
}
#endif

View File

@ -10,7 +10,6 @@
#include "Effects.h" // for EffectMask, Effect, etc
#include "ImageHost.h" // for DeprecatedImageHostBuffered, etc
#include "TiledContentHost.h" // for TiledContentHost
#include "gfxImageSurface.h" // for gfxImageSurface
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
#include "mozilla/layers/TextureHost.h" // for TextureHost, etc
#include "nsAutoPtr.h" // for nsRefPtr
@ -212,7 +211,13 @@ CompositableHost::DumpDeprecatedTextureHost(FILE* aFile, DeprecatedTextureHost*
if (!aTexture) {
return;
}
nsRefPtr<gfxImageSurface> surf = aTexture->GetAsSurface();
RefPtr<gfx::DataSourceSurface> dSurf = aTexture->GetAsSurface();
gfxPlatform *platform = gfxPlatform::GetPlatform();
RefPtr<gfx::DrawTarget> dt = platform->CreateDrawTargetForData(dSurf->GetData(),
dSurf->GetSize(),
dSurf->Stride(),
dSurf->GetFormat());
nsRefPtr<gfxASurface> surf = platform->GetThebesSurfaceForDrawTarget(dt);
if (!surf) {
return;
}
@ -225,7 +230,13 @@ CompositableHost::DumpTextureHost(FILE* aFile, TextureHost* aTexture)
if (!aTexture) {
return;
}
nsRefPtr<gfxImageSurface> surf = aTexture->GetAsSurface();
RefPtr<gfx::DataSourceSurface> dSurf = aTexture->GetAsSurface();
gfxPlatform *platform = gfxPlatform::GetPlatform();
RefPtr<gfx::DrawTarget> dt = platform->CreateDrawTargetForData(dSurf->GetData(),
dSurf->GetSize(),
dSurf->Stride(),
dSurf->GetFormat());
nsRefPtr<gfxASurface> surf = platform->GetThebesSurfaceForDrawTarget(dt);
if (!surf) {
return;
}

View File

@ -26,13 +26,13 @@
#include "nscore.h" // for nsACString
#include "Units.h" // for CSSToScreenScale
class gfxImageSurface;
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace gfx {
class Matrix4x4;
class DataSourceSurface;
}
namespace layers {
@ -289,7 +289,7 @@ public:
static void DumpDeprecatedTextureHost(FILE* aFile, DeprecatedTextureHost* aTexture);
static void DumpTextureHost(FILE* aFile, TextureHost* aTexture);
virtual already_AddRefed<gfxImageSurface> GetAsSurface() { return nullptr; }
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() { return nullptr; }
#endif
virtual void PrintInfo(nsACString& aTo, const char* aPrefix) { }

View File

@ -16,8 +16,6 @@
#include "nsPrintfCString.h" // for nsPrintfCString
#include "nsString.h" // for nsAutoCString
class gfxImageSurface;
namespace mozilla {
namespace gfx {
class Matrix4x4;
@ -846,7 +844,7 @@ ContentHostBase::GetRenderState()
}
#ifdef MOZ_DUMP_PAINTING
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
ContentHostBase::GetAsSurface()
{
return mDeprecatedTextureHost->GetAsSurface();

View File

@ -33,8 +33,6 @@
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
#include "nscore.h" // for nsACString
class gfxImageSurface;
namespace mozilla {
namespace gfx {
class Matrix4x4;
@ -112,7 +110,7 @@ public:
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
#ifdef MOZ_DUMP_PAINTING
virtual already_AddRefed<gfxImageSurface> GetAsSurface();
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface();
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",

View File

@ -14,7 +14,6 @@
#include "nsPrintfCString.h" // for nsPrintfCString
#include "nsString.h" // for nsAutoCString
class gfxImageSurface;
class nsIntRegion;
namespace mozilla {
@ -200,7 +199,7 @@ ImageHost::GetRenderState()
}
#ifdef MOZ_DUMP_PAINTING
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
ImageHost::GetAsSurface()
{
return mFrontBuffer->GetAsSurface();
@ -399,7 +398,7 @@ DeprecatedImageHostSingle::Dump(FILE* aFile,
}
}
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
DeprecatedImageHostSingle::GetAsSurface()
{
return mDeprecatedTextureHost->GetAsSurface();

View File

@ -21,8 +21,7 @@
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsRect.h" // for nsIntRect
#include "nscore.h" // for nsACString
class gfxImageSurface;
class nsIntRegion;
namespace mozilla {
@ -82,7 +81,7 @@ public:
const char* aPrefix="",
bool aDumpHtml=false) MOZ_OVERRIDE;
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
#endif
protected:
@ -149,7 +148,7 @@ public:
const char* aPrefix="",
bool aDumpHtml=false) MOZ_OVERRIDE;
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
#endif
protected:

View File

@ -8,7 +8,6 @@
#include "Layers.h" // for WriteSnapshotToDumpFile, etc
#include "gfx2DGlue.h" // for ToFilter, ToMatrix4x4
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxImageSurface.h" // for gfxImageSurface
#include "gfxPoint.h" // for gfxIntSize
#include "gfxRect.h" // for gfxRect
#include "gfxUtils.h" // for gfxUtils, etc
@ -86,7 +85,13 @@ ImageLayerComposite::RenderLayer(const nsIntRect& aClipRect)
#ifdef MOZ_DUMP_PAINTING
if (gfxUtils::sDumpPainting) {
nsRefPtr<gfxImageSurface> surf = mImageHost->GetAsSurface();
RefPtr<gfx::DataSourceSurface> dSurf = mImageHost->GetAsSurface();
gfxPlatform *platform = gfxPlatform::GetPlatform();
RefPtr<gfx::DrawTarget> dt = platform->CreateDrawTargetForData(dSurf->GetData(),
dSurf->GetSize(),
dSurf->Stride(),
dSurf->GetFormat());
nsRefPtr<gfxASurface> surf = platform->GetThebesSurfaceForDrawTarget(dt);
WriteSnapshotToDumpFile(this, surf);
}
#endif

View File

@ -459,10 +459,10 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
return true;
}
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
BufferTextureHost::GetAsSurface()
{
nsRefPtr<gfxImageSurface> result;
RefPtr<gfx::DataSourceSurface> result;
if (mFormat == gfx::FORMAT_UNKNOWN) {
NS_WARNING("BufferTextureHost: unsupported format!");
return nullptr;
@ -471,17 +471,13 @@ BufferTextureHost::GetAsSurface()
if (!yuvDeserializer.IsValid()) {
return nullptr;
}
result = new gfxImageSurface(yuvDeserializer.GetYData(),
yuvDeserializer.GetYSize(),
yuvDeserializer.GetYStride(),
gfxImageFormatA8);
result = yuvDeserializer.ToDataSourceSurface();
} else {
ImageDataDeserializer deserializer(GetBuffer());
if (!deserializer.IsValid()) {
return nullptr;
}
RefPtr<gfxImageSurface> surf = deserializer.GetAsThebesSurface();
result = surf.get();
result = deserializer.GetAsSurface();
}
return result.forget();
}

View File

@ -357,7 +357,7 @@ public:
* Debug facility.
* XXX - cool kids use Moz2D. See bug 882113.
*/
virtual already_AddRefed<gfxImageSurface> GetAsSurface() = 0;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() = 0;
/**
* XXX - Flags should only be set at creation time, this will be removed.
@ -445,7 +445,7 @@ public:
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
protected:
bool Upload(nsIntRegion *aRegion = nullptr);
@ -662,7 +662,7 @@ public:
return LayerRenderState();
}
virtual already_AddRefed<gfxImageSurface> GetAsSurface() = 0;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() = 0;
virtual const char *Name() = 0;
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);

View File

@ -9,7 +9,6 @@
#include "Units.h" // for CSSRect, LayerPixel, etc
#include "gfx2DGlue.h" // for ToMatrix4x4
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxImageSurface.h" // for gfxImageSurface
#include "gfxUtils.h" // for gfxUtils, etc
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
@ -112,8 +111,14 @@ ThebesLayerComposite::RenderLayer(const nsIntRect& aClipRect)
#ifdef MOZ_DUMP_PAINTING
if (gfxUtils::sDumpPainting) {
nsRefPtr<gfxImageSurface> surf = mBuffer->GetAsSurface();
if (surf) {
RefPtr<gfx::DataSourceSurface> dSurf = mBuffer->GetAsSurface();
if (dSurf) {
gfxPlatform *platform = gfxPlatform::GetPlatform();
RefPtr<gfx::DrawTarget> dt = platform->CreateDrawTargetForData(dSurf->GetData(),
dSurf->GetSize(),
dSurf->Stride(),
dSurf->GetFormat());
nsRefPtr<gfxASurface> surf = platform->GetThebesSurfaceForDrawTarget(dt);
WriteSnapshotToDumpFile(this, surf);
}
}

View File

@ -144,7 +144,7 @@ public:
virtual bool Lock() MOZ_OVERRIDE { return true; }
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
{
return nullptr; // TODO: cf bug 872568
}
@ -207,7 +207,7 @@ public:
virtual bool Lock() MOZ_OVERRIDE;
virtual void Unlock() MOZ_OVERRIDE;
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
{
return nullptr; // TODO: cf bug 872568
}
@ -243,7 +243,7 @@ public:
virtual bool IsYCbCrSource() const MOZ_OVERRIDE { return true; }
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
{
return nullptr; // TODO: cf bug 872568
}

View File

@ -163,7 +163,7 @@ public:
virtual bool Lock() MOZ_OVERRIDE { return true; }
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
{
return nullptr; // TODO: cf bug 872568
}
@ -245,7 +245,7 @@ public:
virtual bool IsYCbCrSource() const MOZ_OVERRIDE { return true; }
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
{
return nullptr; // TODO: cf bug 872568
}

View File

@ -10,6 +10,7 @@
#include "GrallocImages.h" // for GrallocImage
#include "mozilla/layers/GrallocTextureHost.h"
#include "mozilla/layers/CompositorOGL.h"
#include "GLContextUtils.h"
namespace mozilla {
namespace layers {
@ -297,13 +298,13 @@ GrallocTextureHostOGL::GetRenderState()
return LayerRenderState();
}
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
GrallocTextureHostOGL::GetAsSurface() {
return mTextureSource ? mTextureSource->GetAsSurface()
: nullptr;
}
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
GrallocTextureSourceOGL::GetAsSurface() {
MOZ_ASSERT(gl());
gl()->MakeCurrent();
@ -316,8 +317,9 @@ GrallocTextureSourceOGL::GetAsSurface() {
}
gl()->fEGLImageTargetTexture2D(GetTextureTarget(), mEGLImage);
nsRefPtr<gfxImageSurface> surf = IsValid() ? gl()->GetTexImage(tex, false, GetFormat())
: nullptr;
RefPtr<gfx::DataSourceSurface> surf =
IsValid() ? ReadBackSurface(gl(), tex, false, GetFormat())
: nullptr;
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
return surf.forget();

View File

@ -60,7 +60,7 @@ public:
mGraphicBuffer = nullptr;
}
already_AddRefed<gfxImageSurface> GetAsSurface();
TemporaryRef<gfx::DataSourceSurface> GetAsSurface();
GLuint GetGLTexture();
@ -104,7 +104,7 @@ public:
return mTextureSource;
}
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData) MOZ_OVERRIDE;

View File

@ -83,7 +83,7 @@ public:
return mTextureSource;
}
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
{
return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
}

View File

@ -5,6 +5,7 @@
#include "TextureHostOGL.h"
#include "GLContext.h" // for GLContext, etc
#include "GLContextUtils.h" // for GLContextUtils
#include "SharedSurface.h" // for SharedSurface
#include "SharedSurfaceEGL.h" // for SharedSurface_EGLImage
#include "SharedSurfaceGL.h" // for SharedSurface_GLTexture, etc
@ -1297,58 +1298,50 @@ GrallocDeprecatedTextureHostOGL::GetGLTexture()
#endif // MOZ_WIDGET_GONK
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
TextureImageDeprecatedTextureHostOGL::GetAsSurface() {
nsRefPtr<gfxImageSurface> surf = IsValid() ?
mGL->GetTexImage(mTexture->GetTextureID(),
false,
mTexture->GetTextureFormat())
: nullptr;
RefPtr<gfx::DataSourceSurface> surf =
IsValid() ? ReadBackSurface(mGL, mTexture->GetTextureID(),
false, mTexture->GetTextureFormat())
: nullptr;
return surf.forget();
}
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
YCbCrDeprecatedTextureHostOGL::GetAsSurface() {
nsRefPtr<gfxImageSurface> surf = IsValid() ?
mGL->GetTexImage(mYTexture->mTexImage->GetTextureID(),
false,
mYTexture->mTexImage->GetTextureFormat())
: nullptr;
RefPtr<gfx::DataSourceSurface> surf =
IsValid() ? ReadBackSurface(mGL, mYTexture->mTexImage->GetTextureID(),
false, mYTexture->mTexImage->GetTextureFormat())
: nullptr;
return surf.forget();
}
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
SharedDeprecatedTextureHostOGL::GetAsSurface() {
nsRefPtr<gfxImageSurface> surf = IsValid() ?
mGL->GetTexImage(GetTextureHandle(),
false,
GetFormat())
: nullptr;
RefPtr<gfx::DataSourceSurface> surf =
IsValid() ? ReadBackSurface(mGL, GetTextureHandle(), false, GetFormat())
: nullptr;
return surf.forget();
}
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
SurfaceStreamHostOGL::GetAsSurface() {
nsRefPtr<gfxImageSurface> surf = IsValid() ?
mGL->GetTexImage(mTextureHandle,
false,
GetFormat())
: nullptr;
RefPtr<gfx::DataSourceSurface> surf =
IsValid() ? ReadBackSurface(mGL, mTextureHandle, false, GetFormat())
: nullptr;
return surf.forget();
}
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
TiledDeprecatedTextureHostOGL::GetAsSurface() {
nsRefPtr<gfxImageSurface> surf = IsValid() ?
mGL->GetTexImage(mTextureHandle,
false,
GetFormat())
: nullptr;
RefPtr<DataSourceSurface> surf =
IsValid() ? ReadBackSurface(mGL, mTextureHandle, false, GetFormat())
: nullptr;
return surf.forget();
}
#ifdef MOZ_WIDGET_GONK
already_AddRefed<gfxImageSurface>
TemporaryRef<gfx::DataSourceSurface>
GrallocDeprecatedTextureHostOGL::GetAsSurface() {
gl()->MakeCurrent();
@ -1360,11 +1353,9 @@ GrallocDeprecatedTextureHostOGL::GetAsSurface() {
}
gl()->fEGLImageTargetTexture2D(mTextureTarget, mEGLImage);
nsRefPtr<gfxImageSurface> surf = IsValid() ?
gl()->GetTexImage(tex,
false,
GetFormat())
: nullptr;
RefPtr<gfx::DataSourceSurface> surf =
IsValid() ? ReadBackSurface(gl(), tex, false, GetFormat())
: nullptr;
return surf.forget();
}
#endif // MOZ_WIDGET_GONK

View File

@ -323,7 +323,7 @@ public:
return mTextureSource;
}
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
{
return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
}
@ -399,7 +399,7 @@ public:
virtual bool Lock() MOZ_OVERRIDE;
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
// textureSource
void BindTexture(GLenum aTextureUnit) MOZ_OVERRIDE
@ -572,7 +572,7 @@ public:
return mYTexture->GetSize();
}
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
virtual const char* Name() { return "YCbCrDeprecatedTextureHostOGL"; }
@ -662,7 +662,7 @@ public:
virtual gfx3DMatrix GetTextureTransform() MOZ_OVERRIDE;
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
virtual const char* Name() { return "SharedDeprecatedTextureHostOGL"; }
@ -741,7 +741,7 @@ public:
GFX_CONTENT_COLOR;
}
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
virtual const char* Name() { return "SurfaceStreamHostOGL"; }
@ -803,7 +803,7 @@ public:
nsIntRegion* aRegion = nullptr)
{ MOZ_ASSERT(false, "Tiles should not use this path"); }
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
virtual const char* Name() { return "TiledDeprecatedTextureHostOGL"; }
@ -871,7 +871,7 @@ public:
bool IsValid() const MOZ_OVERRIDE;
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
virtual const char* Name() { return "GrallocDeprecatedTextureHostOGL"; }

View File

@ -136,9 +136,14 @@ void TestTextureClientSurface(TextureClient* texture, gfxImageSurface* surface)
// host read
ASSERT_TRUE(host->Lock());
nsRefPtr<gfxImageSurface> hostSurface = host->GetAsSurface();
RefPtr<mozilla::gfx::DataSourceSurface> hostDataSurface = host->GetAsSurface();
host->Unlock();
nsRefPtr<gfxImageSurface> hostSurface =
new gfxImageSurface(hostDataSurface->GetData(),
ThebesIntSize(hostDataSurface->GetSize()),
hostDataSurface->Stride(),
SurfaceFormatToImageFormat(hostDataSurface->GetFormat()));
AssertSurfacesEqual(surface, hostSurface.get());
// host deallocation