summaryrefslogtreecommitdiffstats
path: root/src/core/delegated_frame_node.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-10-28 10:58:35 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-10-28 12:26:52 +0000
commitb76be3dfc52ee7eb508e2837c9d83c8f79a5cb26 (patch)
treec4f5103ae55c7a8ae71f99ba2229cfd2fc63ae20 /src/core/delegated_frame_node.cpp
parent2cb021c2978d5d8ab5ba565f10d9eddc27c6347f (diff)
Support IOSurface frames
Support getting video as IOSurface frames on OS X. With Chromium 45 we only get IOSurface frame when using non-default command-line flags. Change-Id: Ibf5226db53fa6fb51112bec9061d701918798ddd Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'src/core/delegated_frame_node.cpp')
-rw-r--r--src/core/delegated_frame_node.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp
index aebdfd027..1b6a80f82 100644
--- a/src/core/delegated_frame_node.cpp
+++ b/src/core/delegated_frame_node.cpp
@@ -57,6 +57,7 @@
#include "cc/quads/checkerboard_draw_quad.h"
#include "cc/quads/debug_border_draw_quad.h"
#include "cc/quads/draw_quad.h"
+#include "cc/quads/io_surface_draw_quad.h"
#include "cc/quads/render_pass_draw_quad.h"
#include "cc/quads/solid_color_draw_quad.h"
#include "cc/quads/stream_video_draw_quad.h"
@@ -80,6 +81,10 @@
#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
#endif
+#ifndef GL_TEXTURE_RECTANGLE
+#define GL_TEXTURE_RECTANGLE 0x84F5
+#endif
+
namespace QtWebEngineCore {
class MailboxTexture : public QSGTexture, protected QOpenGLFunctions {
@@ -655,13 +660,29 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData,
MailboxTexture *texture = static_cast<MailboxTexture *>(initAndHoldTexture(resource, quad->ShouldDrawWithBlending()));
texture->setTarget(GL_TEXTURE_EXTERNAL_OES); // since this is not default TEXTURE_2D type
- StreamVideoNode *svideoNode = new StreamVideoNode(texture);
+ StreamVideoNode *svideoNode = new StreamVideoNode(texture, false, ExternalTarget);
svideoNode->setRect(toQt(squad->rect));
svideoNode->setTextureMatrix(toQt(squad->matrix.matrix()));
currentLayerChain->appendChildNode(svideoNode);
break;
#endif
- } default:
+ }
+ case cc::DrawQuad::IO_SURFACE_CONTENT: {
+ const cc::IOSurfaceDrawQuad *ioquad = cc::IOSurfaceDrawQuad::MaterialCast(quad);
+ ResourceHolder *resource = findAndHoldResource(ioquad->io_surface_resource_id(), resourceCandidates);
+ MailboxTexture *texture = static_cast<MailboxTexture *>(initAndHoldTexture(resource, quad->ShouldDrawWithBlending()));
+ texture->setTarget(GL_TEXTURE_RECTANGLE);
+
+ bool flip = ioquad->orientation != cc::IOSurfaceDrawQuad::FLIPPED;
+ StreamVideoNode *svideoNode = new StreamVideoNode(texture, flip, RectangleTarget);
+ QMatrix4x4 matrix;
+ matrix.scale(ioquad->io_surface_size.width(), ioquad->io_surface_size.height());
+ svideoNode->setRect(toQt(ioquad->rect));
+ svideoNode->setTextureMatrix(matrix);
+ currentLayerChain->appendChildNode(svideoNode);
+ break;
+ }
+ default:
qWarning("Unimplemented quad material: %d", quad->material);
}
}