Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: ui/gl/gl_image_ozone_native_pixmap_drm_unittest.cc

Issue 2090343005: ui: Fix faulty drm/gbm DCHECKs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address posciak's comment. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/ozone/platform/drm/gpu/gbm_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | ui/ozone/platform/drm/gpu/gbm_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698