summary refs log tree commit diff
path: root/gpu_buffer
diff options
context:
space:
mode:
authorGurchetan Singh <gurchetansingh@chromium.org>2019-04-24 19:58:31 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-05-24 15:09:25 -0700
commit56ebd1238048a71ab5e58c3b20b81c92770eca54 (patch)
tree8dc71666e717bc5e01ab03970fd1d5dd2ef1a0cc /gpu_buffer
parentcf68e762800c61b9e12ab2a4b2a65f451b9eef1e (diff)
downloadcrosvm-56ebd1238048a71ab5e58c3b20b81c92770eca54.tar
crosvm-56ebd1238048a71ab5e58c3b20b81c92770eca54.tar.gz
crosvm-56ebd1238048a71ab5e58c3b20b81c92770eca54.tar.bz2
crosvm-56ebd1238048a71ab5e58c3b20b81c92770eca54.tar.lz
crosvm-56ebd1238048a71ab5e58c3b20b81c92770eca54.tar.xz
crosvm-56ebd1238048a71ab5e58c3b20b81c92770eca54.tar.zst
crosvm-56ebd1238048a71ab5e58c3b20b81c92770eca54.zip
virtio-gpu: add plane size
This is useful if the guests wants to map a host GBM
buffer.

BUG=chromium:924405
TEST=compile

Change-Id: I7fb68aa49c4ce4f2a020b8ce96ad558290380b5f
Reviewed-on: https://chromium-review.googlesource.com/1591460
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'gpu_buffer')
-rw-r--r--gpu_buffer/src/lib.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/gpu_buffer/src/lib.rs b/gpu_buffer/src/lib.rs
index f35f5fd..16aae50 100644
--- a/gpu_buffer/src/lib.rs
+++ b/gpu_buffer/src/lib.rs
@@ -466,6 +466,12 @@ impl Buffer {
         unsafe { gbm_bo_get_stride_for_plane(self.0, plane) }
     }
 
+    /// Size of a plane, in bytes.
+    pub fn plane_size(&self, plane: usize) -> u32 {
+        // This is always safe to call with a valid gbm_bo pointer.
+        unsafe { gbm_bo_get_plane_size(self.0, plane) }
+    }
+
     /// Exports a new dmabuf/prime file descriptor for the given plane.
     pub fn export_plane_fd(&self, plane: usize) -> Result<File, i32> {
         // This is always safe to call with a valid gbm_bo pointer.