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 20 matching lines...) Expand all Loading... |
31 int RoundTo64(int num) { | 31 int RoundTo64(int num) { |
32 return (num + 63) & ~63; | 32 return (num + 63) & ~63; |
33 } | 33 } |
34 | 34 |
35 // Create a YVU420 NativePixmap using the drm interface directly. | 35 // Create a YVU420 NativePixmap using the drm interface directly. |
36 scoped_refptr<ui::NativePixmap> CreateYVU420Pixmap(const gfx::Size& size, | 36 scoped_refptr<ui::NativePixmap> CreateYVU420Pixmap(const gfx::Size& size, |
37 const uint8_t color[4]) { | 37 const uint8_t color[4]) { |
38 DCHECK_EQ(0, size.width() % 2); | 38 DCHECK_EQ(0, size.width() % 2); |
39 DCHECK_EQ(0, size.height() % 2); | 39 DCHECK_EQ(0, size.height() % 2); |
40 | 40 |
41 // TODO(dcastagna): move the creation of the drmbuf to minigmb, where it's | 41 // TODO(dcastagna): move the creation of the drmbuf to minigbm, where it's |
42 // supposed to be, so we can abastract it and use SurfaceFactoryOzone. | 42 // supposed to be, so we can abstract it and use SurfaceFactoryOzone. |
43 base::ScopedFD drm_fd( | 43 base::ScopedFD drm_fd( |
44 HANDLE_EINTR(open("/dev/dri/card0", O_RDWR | O_CLOEXEC))); | 44 HANDLE_EINTR(open("/dev/dri/card0", O_RDWR | O_CLOEXEC))); |
45 DCHECK(drm_fd.is_valid()) << "Couldn't open '/dev/dri/card0'"; | 45 DCHECK(drm_fd.is_valid()) << "Couldn't open '/dev/dri/card0'"; |
46 | 46 |
47 std::vector<int> pitches{RoundTo64(size.width()), RoundTo64(size.width() / 2), | 47 std::vector<int> pitches{RoundTo64(size.width()), RoundTo64(size.width() / 2), |
48 RoundTo64(size.width() / 2)}; | 48 RoundTo64(size.width() / 2)}; |
49 std::vector<int> offsets{ | 49 std::vector<int> offsets{ |
50 0, pitches[0] * size.height() + pitches[1] * size.height() / 2, | 50 0, pitches[0] * size.height() + pitches[1] * size.height() / 2, |
51 pitches[0] * size.height(), | 51 pitches[0] * size.height(), |
52 }; | 52 }; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |