| 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 25 matching lines...) Expand all Loading... |
| 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 minigmb, where it's |
| 42 // supposed to be, so we can abastract it and use SurfaceFactoryOzone. | 42 // supposed to be, so we can abastract 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 { // Check we have permissions | |
| 47 drm_magic_t magic{}; | |
| 48 bool ret = !drmGetMagic(drm_fd.get(), &magic) && | |
| 49 !drmAuthMagic(drm_fd.get(), magic); | |
| 50 DCHECK(ret); | |
| 51 } | |
| 52 | 46 |
| 53 std::vector<int> pitches{RoundTo64(size.width()), RoundTo64(size.width() / 2), | 47 std::vector<int> pitches{RoundTo64(size.width()), RoundTo64(size.width() / 2), |
| 54 RoundTo64(size.width() / 2)}; | 48 RoundTo64(size.width() / 2)}; |
| 55 std::vector<int> offsets{ | 49 std::vector<int> offsets{ |
| 56 0, pitches[0] * size.height() + pitches[1] * size.height() / 2, | 50 0, pitches[0] * size.height() + pitches[1] * size.height() / 2, |
| 57 pitches[0] * size.height(), | 51 pitches[0] * size.height(), |
| 58 }; | 52 }; |
| 59 size_t byte_number = pitches[0] * size.height() + | 53 size_t byte_number = pitches[0] * size.height() + |
| 60 pitches[1] * size.height() / 2 + | 54 pitches[1] * size.height() / 2 + |
| 61 pitches[2] * size.height() / 2; | 55 pitches[2] * size.height() / 2; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm, | 130 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm, |
| 137 GLImageTest, | 131 GLImageTest, |
| 138 GLImageOzoneNativePixmapDrmTestDelegate); | 132 GLImageOzoneNativePixmapDrmTestDelegate); |
| 139 | 133 |
| 140 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm, | 134 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm, |
| 141 GLImageBindTest, | 135 GLImageBindTest, |
| 142 GLImageOzoneNativePixmapDrmTestDelegate); | 136 GLImageOzoneNativePixmapDrmTestDelegate); |
| 143 | 137 |
| 144 } // namespace | 138 } // namespace |
| 145 } // namespace gl | 139 } // namespace gl |
| OLD | NEW |