| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 struct drm_i915_gem_pwrite gem_pwrite {}; | 88 struct drm_i915_gem_pwrite gem_pwrite {}; |
| 89 gem_pwrite.handle = gem_create.handle; | 89 gem_pwrite.handle = gem_create.handle; |
| 90 gem_pwrite.size = byte_number; | 90 gem_pwrite.size = byte_number; |
| 91 gem_pwrite.data_ptr = reinterpret_cast<uint64_t>(&data[0]); | 91 gem_pwrite.data_ptr = reinterpret_cast<uint64_t>(&data[0]); |
| 92 ret = drmIoctl(drm_fd.get(), DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite); | 92 ret = drmIoctl(drm_fd.get(), DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite); |
| 93 DCHECK(!ret) << "Problems with drmIoctl when writing data."; | 93 DCHECK(!ret) << "Problems with drmIoctl when writing data."; |
| 94 | 94 |
| 95 gfx::NativePixmapHandle pixmap_handle; | 95 gfx::NativePixmapHandle pixmap_handle; |
| 96 pixmap_handle.fds.emplace_back(fd, false); | 96 pixmap_handle.fds.emplace_back(fd, false); |
| 97 for (int i = 0; i < 3; i++) { | 97 for (int i = 0; i < 3; i++) { |
| 98 pixmap_handle.strides_and_offsets.emplace_back(pitches[i], offsets[i]); | 98 pixmap_handle.planes.emplace_back(pitches[i], offsets[i], 0); |
| 99 } | 99 } |
| 100 ui::SurfaceFactoryOzone* surface_factory = | 100 ui::SurfaceFactoryOzone* surface_factory = |
| 101 ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone(); | 101 ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone(); |
| 102 return surface_factory->CreateNativePixmapFromHandle( | 102 return surface_factory->CreateNativePixmapFromHandle( |
| 103 size, gfx::BufferFormat::YVU_420, pixmap_handle); | 103 size, gfx::BufferFormat::YVU_420, pixmap_handle); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // Delegate to test EGL images created directly using drm. | 106 // Delegate to test EGL images created directly using drm. |
| 107 // YVU420 buffers can't be created yet via Ozone, we still | 107 // YVU420 buffers can't be created yet via Ozone, we still |
| 108 // want to test them since they can be imported and displayed | 108 // want to test them since they can be imported and displayed |
| (...skipping 23 matching lines...) Expand all Loading... |
| 132 INSTANTIATE_TYPED_TEST_CASE_P(GLImageOzoneNativePixmapDrm, | 132 INSTANTIATE_TYPED_TEST_CASE_P(GLImageOzoneNativePixmapDrm, |
| 133 GLImageTest, | 133 GLImageTest, |
| 134 GLImageOzoneNativePixmapDrmTestDelegate); | 134 GLImageOzoneNativePixmapDrmTestDelegate); |
| 135 | 135 |
| 136 INSTANTIATE_TYPED_TEST_CASE_P(GLImageOzoneNativePixmapDrm, | 136 INSTANTIATE_TYPED_TEST_CASE_P(GLImageOzoneNativePixmapDrm, |
| 137 GLImageBindTest, | 137 GLImageBindTest, |
| 138 GLImageOzoneNativePixmapDrmTestDelegate); | 138 GLImageOzoneNativePixmapDrmTestDelegate); |
| 139 | 139 |
| 140 } // namespace | 140 } // namespace |
| 141 } // namespace gl | 141 } // namespace gl |
| OLD | NEW |