OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <fcntl.h> | 5 #include <fcntl.h> |
6 #include <libdrm/i915_drm.h> | 6 #include <libdrm/i915_drm.h> |
7 #include <linux/types.h> | 7 #include <linux/types.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 struct drm_i915_gem_pwrite gem_pwrite {}; | 82 struct drm_i915_gem_pwrite gem_pwrite {}; |
83 gem_pwrite.handle = gem_create.handle; | 83 gem_pwrite.handle = gem_create.handle; |
84 gem_pwrite.size = byte_number; | 84 gem_pwrite.size = byte_number; |
85 gem_pwrite.data_ptr = reinterpret_cast<uint64_t>(&data[0]); | 85 gem_pwrite.data_ptr = reinterpret_cast<uint64_t>(&data[0]); |
86 ret = drmIoctl(drm_fd.get(), DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite); | 86 ret = drmIoctl(drm_fd.get(), DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite); |
87 DCHECK(!ret) << "Problems with drmIoctl when writing data."; | 87 DCHECK(!ret) << "Problems with drmIoctl when writing data."; |
88 | 88 |
89 gfx::NativePixmapHandle pixmap_handle; | 89 gfx::NativePixmapHandle pixmap_handle; |
90 pixmap_handle.fds.emplace_back(fd, false); | 90 pixmap_handle.fds.emplace_back(fd, false); |
91 for (int i = 0; i < 3; i++) { | 91 for (int i = 0; i < 3; i++) { |
92 pixmap_handle.strides_and_offsets.emplace_back(pitches[i], offsets[i]); | 92 pixmap_handle.planes.emplace_back(pitches[i], offsets[i], 0); |
93 } | 93 } |
94 ui::SurfaceFactoryOzone* surface_factory = | 94 ui::SurfaceFactoryOzone* surface_factory = |
95 ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone(); | 95 ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone(); |
96 return surface_factory->CreateNativePixmapFromHandle( | 96 return surface_factory->CreateNativePixmapFromHandle( |
97 size, gfx::BufferFormat::YVU_420, pixmap_handle); | 97 size, gfx::BufferFormat::YVU_420, pixmap_handle); |
98 } | 98 } |
99 | 99 |
100 // Delegate to test EGL images created directly using drm. | 100 // Delegate to test EGL images created directly using drm. |
101 // YVU420 buffers can't be created yet via Ozone, we still | 101 // YVU420 buffers can't be created yet via Ozone, we still |
102 // want to test them since they can be imported and displayed | 102 // want to test them since they can be imported and displayed |
(...skipping 27 matching lines...) Expand all Loading... |
130 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm, | 130 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm, |
131 GLImageTest, | 131 GLImageTest, |
132 GLImageOzoneNativePixmapDrmTestDelegate); | 132 GLImageOzoneNativePixmapDrmTestDelegate); |
133 | 133 |
134 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm, | 134 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm, |
135 GLImageBindTest, | 135 GLImageBindTest, |
136 GLImageOzoneNativePixmapDrmTestDelegate); | 136 GLImageOzoneNativePixmapDrmTestDelegate); |
137 | 137 |
138 } // namespace | 138 } // namespace |
139 } // namespace gl | 139 } // namespace gl |
OLD | NEW |