tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DMABUFTextureClientOGL.cpp (1874B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #include "DMABUFTextureClientOGL.h"
      8 #include "mozilla/widget/DMABufSurface.h"
      9 #include "gfxPlatform.h"
     10 
     11 namespace mozilla::layers {
     12 
     13 using namespace gfx;
     14 
     15 DMABUFTextureData::DMABUFTextureData(DMABufSurface* aSurface,
     16                                     BackendType aBackend)
     17    : mSurface(aSurface), mBackend(aBackend) {
     18  MOZ_ASSERT(mSurface);
     19 }
     20 
     21 DMABUFTextureData::~DMABUFTextureData() = default;
     22 
     23 bool DMABUFTextureData::Serialize(SurfaceDescriptor& aOutDescriptor) {
     24  return mSurface->Serialize(aOutDescriptor);
     25 }
     26 
     27 void DMABUFTextureData::GetSubDescriptor(
     28    RemoteDecoderVideoSubDescriptor* const aOutDesc) {
     29  SurfaceDescriptor desc;
     30  if (!mSurface->Serialize(desc)) {
     31    return;
     32  }
     33  *aOutDesc = static_cast<SurfaceDescriptorDMABuf>(desc);
     34 }
     35 
     36 void DMABUFTextureData::FillInfo(TextureData::Info& aInfo) const {
     37  aInfo.size = gfx::IntSize(mSurface->GetWidth(), mSurface->GetHeight());
     38  aInfo.format = mSurface->GetFormat();
     39  aInfo.hasSynchronization = false;
     40  aInfo.supportsMoz2D = false;
     41  aInfo.canExposeMappedData = false;
     42 }
     43 
     44 bool DMABUFTextureData::Lock(OpenMode) {
     45  MOZ_DIAGNOSTIC_CRASH("Not implemented.");
     46  return false;
     47 }
     48 
     49 void DMABUFTextureData::Unlock() { MOZ_DIAGNOSTIC_CRASH("Not implemented."); }
     50 
     51 already_AddRefed<DataSourceSurface> DMABUFTextureData::GetAsSurface() {
     52  // TODO: Update for debug purposes.
     53  return nullptr;
     54 }
     55 
     56 void DMABUFTextureData::Deallocate(LayersIPCChannel*) { mSurface = nullptr; }
     57 
     58 void DMABUFTextureData::Forget(LayersIPCChannel*) { mSurface = nullptr; }
     59 
     60 }  // namespace mozilla::layers