зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1608800 [Wayland] Refactor dmabuf buffer mapping, r=jhorak
Refactor dmabuf buffer mapping, warn when we're mapping buffer with modifiers. Differential Revision: https://phabricator.services.mozilla.com/D59676 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
dc4e8c242a
Коммит
a3bc93170c
|
@ -389,41 +389,43 @@ void WaylandDMABufSurface::ReleaseDMABufSurface() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void* WaylandDMABufSurface::MapReadOnly(uint32_t aX, uint32_t aY,
|
void* WaylandDMABufSurface::MapInternal(uint32_t aX, uint32_t aY,
|
||||||
uint32_t aWidth, uint32_t aHeight,
|
uint32_t aWidth, uint32_t aHeight,
|
||||||
uint32_t* aStride) {
|
uint32_t* aStride, int aGbmFlags) {
|
||||||
NS_ASSERTION(!IsMapped(), "Already mapped!");
|
NS_ASSERTION(!IsMapped(), "Already mapped!");
|
||||||
|
if (mSurfaceFlags & DMABUF_USE_MODIFIERS) {
|
||||||
|
NS_WARNING("We should not map dmabuf surfaces with modifiers!");
|
||||||
|
}
|
||||||
|
|
||||||
void* map_data = nullptr;
|
void* map_data = nullptr;
|
||||||
mMappedRegionStride = 0;
|
mMappedRegionStride = 0;
|
||||||
mMappedRegion =
|
mMappedRegion = nsGbmLib::Map(mGbmBufferObject, aX, aY, aWidth, aHeight,
|
||||||
nsGbmLib::Map(mGbmBufferObject, aX, aY, aWidth, aHeight,
|
aGbmFlags, &mMappedRegionStride, &map_data);
|
||||||
GBM_BO_TRANSFER_READ, &mMappedRegionStride, &map_data);
|
|
||||||
if (aStride) {
|
if (aStride) {
|
||||||
*aStride = mMappedRegionStride;
|
*aStride = mMappedRegionStride;
|
||||||
}
|
}
|
||||||
return mMappedRegion;
|
return mMappedRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* WaylandDMABufSurface::MapReadOnly(uint32_t aX, uint32_t aY,
|
||||||
|
uint32_t aWidth, uint32_t aHeight,
|
||||||
|
uint32_t* aStride) {
|
||||||
|
return MapInternal(aX, aY, aWidth, aHeight, aStride, GBM_BO_TRANSFER_READ);
|
||||||
|
}
|
||||||
|
|
||||||
void* WaylandDMABufSurface::MapReadOnly(uint32_t* aStride) {
|
void* WaylandDMABufSurface::MapReadOnly(uint32_t* aStride) {
|
||||||
return MapReadOnly(0, 0, mWidth, mHeight, aStride);
|
return MapInternal(0, 0, mWidth, mHeight, aStride, GBM_BO_TRANSFER_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* WaylandDMABufSurface::Map(uint32_t aX, uint32_t aY, uint32_t aWidth,
|
void* WaylandDMABufSurface::Map(uint32_t aX, uint32_t aY, uint32_t aWidth,
|
||||||
uint32_t aHeight, uint32_t* aStride) {
|
uint32_t aHeight, uint32_t* aStride) {
|
||||||
NS_ASSERTION(!IsMapped(), "Already mapped!");
|
return MapInternal(aX, aY, aWidth, aHeight, aStride,
|
||||||
void* map_data = nullptr;
|
GBM_BO_TRANSFER_READ_WRITE);
|
||||||
mMappedRegionStride = 0;
|
|
||||||
mMappedRegion = nsGbmLib::Map(mGbmBufferObject, aX, aY, aWidth, aHeight,
|
|
||||||
GBM_BO_TRANSFER_READ_WRITE,
|
|
||||||
&mMappedRegionStride, &map_data);
|
|
||||||
if (aStride) {
|
|
||||||
*aStride = mMappedRegionStride;
|
|
||||||
}
|
|
||||||
return mMappedRegion;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void* WaylandDMABufSurface::Map(uint32_t* aStride) {
|
void* WaylandDMABufSurface::Map(uint32_t* aStride) {
|
||||||
return Map(0, 0, mWidth, mHeight, aStride);
|
return MapInternal(0, 0, mWidth, mHeight, aStride,
|
||||||
|
GBM_BO_TRANSFER_READ_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandDMABufSurface::Unmap() {
|
void WaylandDMABufSurface::Unmap() {
|
||||||
|
|
|
@ -90,6 +90,9 @@ class WaylandDMABufSurface {
|
||||||
void FillFdData(struct gbm_import_fd_data& aData);
|
void FillFdData(struct gbm_import_fd_data& aData);
|
||||||
void ImportSurfaceDescriptor(const mozilla::layers::SurfaceDescriptor& aDesc);
|
void ImportSurfaceDescriptor(const mozilla::layers::SurfaceDescriptor& aDesc);
|
||||||
|
|
||||||
|
void* MapInternal(uint32_t aX, uint32_t aY, uint32_t aWidth, uint32_t aHeight,
|
||||||
|
uint32_t* aStride, int aGbmFlags);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mSurfaceFlags;
|
int mSurfaceFlags;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче