summaryrefslogtreecommitdiffstats
path: root/gfx/layers/SurfacePoolCA.mm
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /gfx/layers/SurfacePoolCA.mm
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz
firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/SurfacePoolCA.mm')
-rw-r--r--gfx/layers/SurfacePoolCA.mm21
1 files changed, 20 insertions, 1 deletions
diff --git a/gfx/layers/SurfacePoolCA.mm b/gfx/layers/SurfacePoolCA.mm
index 47b2663ed7..4e012350f0 100644
--- a/gfx/layers/SurfacePoolCA.mm
+++ b/gfx/layers/SurfacePoolCA.mm
@@ -6,6 +6,7 @@
#include "mozilla/layers/SurfacePoolCA.h"
#import <CoreVideo/CVPixelBuffer.h>
+#include <IOSurface/IOSurfaceTypes.h>
#include <algorithm>
#include <unordered_set>
@@ -16,7 +17,12 @@
#include "mozilla/StaticMutex.h"
#include "mozilla/StaticPrefs_gfx.h"
-#include "GLContextCGL.h"
+#ifdef XP_MACOSX
+# include "GLContextCGL.h"
+#else
+# include "GLContextEAGL.h"
+#endif
+
#include "MozFramebuffer.h"
#include "ScopedGLHelpers.h"
@@ -28,7 +34,11 @@ using gfx::IntRect;
using gfx::IntRegion;
using gfx::IntSize;
using gl::GLContext;
+#ifdef XP_MACOSX
using gl::GLContextCGL;
+#else
+using gl::GLContextEAGL;
+#endif
/* static */ RefPtr<SurfacePool> SurfacePool::Create(size_t aPoolSizeLimit) {
return new SurfacePoolCA(aPoolSizeLimit);
@@ -306,8 +316,13 @@ Maybe<GLuint> SurfacePoolCA::LockedPool::GetFramebufferForSurface(
"Framebuffer creation", GRAPHICS_TileAllocation,
nsPrintfCString("%dx%d", entry.mSize.width, entry.mSize.height));
+#ifdef XP_MACOSX
RefPtr<GLContextCGL> cgl = GLContextCGL::Cast(aGL);
MOZ_RELEASE_ASSERT(cgl, "Unexpected GLContext type");
+#else
+ RefPtr<GLContextEAGL> eagl = GLContextEAGL::Cast(aGL);
+ MOZ_RELEASE_ASSERT(eagl, "Unexpected GLContext type");
+#endif
if (!aGL->MakeCurrent()) {
// Context may have been destroyed.
@@ -318,10 +333,14 @@ Maybe<GLuint> SurfacePoolCA::LockedPool::GetFramebufferForSurface(
{
const gl::ScopedBindTexture bindTex(aGL, tex,
LOCAL_GL_TEXTURE_RECTANGLE_ARB);
+#ifdef XP_MACOSX
CGLTexImageIOSurface2D(cgl->GetCGLContext(), LOCAL_GL_TEXTURE_RECTANGLE_ARB,
LOCAL_GL_RGBA, entry.mSize.width, entry.mSize.height,
LOCAL_GL_BGRA, LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV,
entry.mIOSurface.get(), 0);
+#else
+ MOZ_CRASH("unimplemented");
+#endif
}
auto fb =