Commit 248fdf13 authored by Adam Barth's avatar Adam Barth Committed by Commit Bot

[fuchsia] Migrate to newer VMAR methods

These methods are the same as the old method, just with a different
argument order that matches the underlying C syscall.

Change-Id: I707cf9da491b5fca79fb1d99ca055f90ada0ec1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2461980
Auto-Submit: Adam Barth <abarth@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815342}
parent 7bbf454d
......@@ -103,7 +103,7 @@ bool PlatformSharedMemoryRegion::MapAtInternal(off_t offset,
if (mode_ != Mode::kReadOnly)
options |= ZX_VM_PERM_WRITE;
zx_status_t status = zx::vmar::root_self()->map(
/*vmar_offset=*/0, handle_, offset, size, options, &addr);
options, /*vmar_offset=*/0, handle_, offset, size, &addr);
if (status != ZX_OK) {
ZX_DLOG(ERROR, status) << "zx_vmar_map";
return false;
......
......@@ -285,8 +285,8 @@ bool TryToRestoreWritablePermissions(void* addr, size_t len) {
return VirtualProtect(addr, len, PAGE_READWRITE, &old_protection);
#elif defined(OS_FUCHSIA)
zx_status_t status =
zx::vmar::root_self()->protect(reinterpret_cast<uintptr_t>(addr), len,
ZX_VM_PERM_READ | ZX_VM_PERM_WRITE);
zx::vmar::root_self()->protect2(ZX_VM_PERM_READ | ZX_VM_PERM_WRITE,
reinterpret_cast<uintptr_t>(addr), len);
return status == ZX_OK;
#else
return false;
......
......@@ -74,7 +74,7 @@ bool CheckReadOnlySharedMemoryFuchsiaHandle(zx::unowned_vmo handle) {
const uint32_t flags = ZX_VM_PERM_READ | ZX_VM_PERM_WRITE;
uintptr_t addr;
const zx_status_t status =
zx::vmar::root_self()->map(0, *handle, 0U, kDataSize, flags, &addr);
zx::vmar::root_self()->map(flags, 0, *handle, 0U, kDataSize, &addr);
if (status == ZX_OK) {
LOG(ERROR) << "zx_vmar_map() should have failed!";
zx::vmar::root_self()->unmap(addr, kDataSize);
......
......@@ -95,8 +95,8 @@ void FuchsiaAudioCapturerSource::Initialize(const AudioParameters& params,
// Map the buffer.
uint64_t addr;
status = zx::vmar::root_self()->map(
/*vmar_offset=*/0, buffer_vmo, /*vmo_offset=*/0, capture_buffer_size_,
ZX_VM_PERM_READ, &addr);
ZX_VM_PERM_READ, /*vmar_offset=*/0, buffer_vmo, /*vmo_offset=*/0,
capture_buffer_size_, &addr);
if (status != ZX_OK) {
ZX_DLOG(ERROR, status) << "zx_vmar_map";
ReportError("Failed to map capture buffer");
......
......@@ -44,8 +44,8 @@ class SysmemBufferWriter::Buffer {
size_t bytes_to_map = base::bits::Align(offset + size, base::GetPageSize());
uintptr_t addr;
zx_status_t status = zx::vmar::root_self()->map(
/*vmar_offset=*/0, vmo, /*vmo_offset=*/0, bytes_to_map,
ZX_VM_PERM_READ | ZX_VM_PERM_WRITE, &addr);
ZX_VM_PERM_READ | ZX_VM_PERM_WRITE, /*vmar_offset=*/0, vmo,
/*vmo_offset=*/0, bytes_to_map, &addr);
if (status != ZX_OK) {
ZX_DLOG(ERROR, status) << "zx_vmar_map";
return false;
......
......@@ -51,8 +51,9 @@ class ClientNativePixmapFuchsia : public gfx::ClientNativePixmap {
mapping_size_ = base::bits::Align(mapping_size_, page_size);
zx_status_t status =
zx::vmar::root_self()->map(0, handle_.planes[0].vmo, 0, mapping_size_,
ZX_VM_PERM_READ | ZX_VM_PERM_WRITE, &addr);
zx::vmar::root_self()->map(ZX_VM_PERM_READ | ZX_VM_PERM_WRITE, 0,
handle_.planes[0].vmo, 0, mapping_size_,
&addr);
if (status != ZX_OK) {
ZX_DLOG(ERROR, status) << "zx_vmar_map";
return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment