WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-239038-20220412181509.patch (text/plain), 4.85 KB, created by
Zan Dobersek
on 2022-04-12 09:15:10 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Zan Dobersek
Created:
2022-04-12 09:15:10 PDT
Size:
4.85 KB
patch
obsolete
>Subversion Revision: 292771 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 741c43159d949745745fcb2df42b449bbc4757c2..75ccd3bb0bd91578f0e417c53f99d1a613688d72 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2022-04-12 Zan Dobersek <zdobersek@igalia.com> >+ >+ [GTK][WPE] Provide WK2 IPC encoding, decoding methods for the DMABufObject type >+ https://bugs.webkit.org/show_bug.cgi?id=239038 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Provide encoding and decoding methods on the DMABufObject class, >+ enabling transport over IPC channels. >+ >+ There are two separate ref-qualified encoding methods. When encoding >+ an object that's managed through an lvalue reference, we duplicate the >+ file descriptor objects since the DMABufObject will live on. When >+ managed through an rvalue object, we know the object's lifetime is >+ intended to be limited to this encoding process, so we can avoid the >+ file descriptor duplication and move the fd values into the encoder. >+ >+ * platform/graphics/gbm/DMABufObject.h: >+ (WebCore::DMABufObject::encode const): >+ (WebCore::DMABufObject::encode): >+ (WebCore::DMABufObject::decode): >+ > 2022-04-12 Zan Dobersek <zdobersek@igalia.com> > > [GTK][WPE] Move DMABuf-backed GraphicsContextGLANGLE functionality into a standalone derivation chain >diff --git a/Source/WebCore/platform/graphics/gbm/DMABufObject.h b/Source/WebCore/platform/graphics/gbm/DMABufObject.h >index b496d9f0b17d457b54506b5d13e1ff8ad0e42813..8a5668126ad19ce1edd28ff0065713a4b72f162a 100644 >--- a/Source/WebCore/platform/graphics/gbm/DMABufObject.h >+++ b/Source/WebCore/platform/graphics/gbm/DMABufObject.h >@@ -31,6 +31,7 @@ > #include <array> > #include <cstddef> > #include <cstdint> >+#include <optional> > #include <unistd.h> > #include <wtf/Noncopyable.h> > #include <wtf/unix/UnixFileDescriptor.h> >@@ -49,6 +50,10 @@ struct DMABufObject { > DMABufObject(DMABufObject&&) = default; > DMABufObject& operator=(DMABufObject&&) = default; > >+ template<class Encoder> void encode(Encoder&) const &; >+ template<class Encoder> void encode(Encoder&) &&; >+ template<class Decoder> static std::optional<DMABufObject> decode(Decoder&); >+ > uintptr_t handle { 0 }; > DMABufFormat format { }; > uint32_t width { 0 }; >@@ -60,4 +65,88 @@ struct DMABufObject { > std::array<uint64_t, DMABufFormat::c_maxPlanes> modifier { 0, 0, 0, 0 }; > }; > >+template<class Encoder> >+void DMABufObject::encode(Encoder& encoder) const & >+{ >+ encoder << handle << uint32_t(format.fourcc) << width << height; >+ encoder << releaseFlag.fd.duplicate(); >+ >+ for (unsigned i = 0; i < DMABufFormat::c_maxPlanes; ++i) { >+ encoder << fd[i].duplicate(); >+ encoder << offset[i] << stride[i] << modifier[i]; >+ } >+} >+ >+template<class Encoder> >+void DMABufObject::encode(Encoder& encoder) && >+{ >+ encoder << handle << uint32_t(format.fourcc) << width << height; >+ encoder << WTFMove(releaseFlag.fd); >+ >+ for (unsigned i = 0; i < DMABufFormat::c_maxPlanes; ++i) { >+ encoder << WTFMove(fd[i]); >+ encoder << offset[i] << stride[i] << modifier[i]; >+ } >+} >+ >+template<class Decoder> >+std::optional<DMABufObject> DMABufObject::decode(Decoder& decoder) >+{ >+ std::optional<uintptr_t> handle; >+ decoder >> handle; >+ if (!handle) >+ return std::nullopt; >+ std::optional<uint32_t> fourcc; >+ decoder >> fourcc; >+ if (!fourcc) >+ return std::nullopt; >+ std::optional<uint32_t> width; >+ decoder >> width; >+ if (!width) >+ return std::nullopt; >+ std::optional<uint32_t> height; >+ decoder >> height; >+ if (!height) >+ return std::nullopt; >+ >+ DMABufObject dmabufObject(*handle); >+ dmabufObject.format = DMABufFormat::create(*fourcc); >+ dmabufObject.width = *width; >+ dmabufObject.height = *height; >+ >+ std::optional<WTF::UnixFileDescriptor> releaseFlag; >+ decoder >> releaseFlag; >+ if (!releaseFlag) >+ return std::nullopt; >+ dmabufObject.releaseFlag.fd = WTFMove(*releaseFlag); >+ >+ for (unsigned i = 0; i < DMABufFormat::c_maxPlanes; ++i) { >+ std::optional<WTF::UnixFileDescriptor> fd; >+ decoder >> fd; >+ if (!fd) >+ return std::nullopt; >+ dmabufObject.fd[i] = WTFMove(*fd); >+ >+ std::optional<size_t> offset; >+ decoder >> offset; >+ if (!offset) >+ return std::nullopt; >+ dmabufObject.offset[i] = *offset; >+ >+ std::optional<uint32_t> stride; >+ decoder >> stride; >+ if (!stride) >+ return std::nullopt; >+ dmabufObject.stride[i] = *stride; >+ >+ std::optional<uint64_t> modifier; >+ decoder >> modifier; >+ if (!modifier) >+ return std::nullopt; >+ dmabufObject.modifier[i] = *modifier; >+ } >+ >+ return dmabufObject; >+} >+ > } // namespace WebCore
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 239038
:
457179
|
457232
| 457335