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

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

Issue 2102443003: Break //ui/gl/ dependency on //ui/ozone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gl_bindings
Patch Set: Rebase again. 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 | « ui/gl/gl_image_ozone_native_pixmap.cc ('k') | ui/gl/gl_image_ozone_native_pixmap_unittest.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>
11 #include <xf86drm.h> 11 #include <xf86drm.h>
12 12
13 #include "base/files/scoped_file.h" 13 #include "base/files/scoped_file.h"
14 #include "base/posix/eintr_wrapper.h" 14 #include "base/posix/eintr_wrapper.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "ui/gfx/buffer_types.h" 16 #include "ui/gfx/buffer_types.h"
17 #include "ui/gl/gl_image_ozone_native_pixmap.h"
18 #include "ui/gl/test/gl_image_test_template.h" 17 #include "ui/gl/test/gl_image_test_template.h"
18 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h"
19 #include "ui/ozone/public/ozone_platform.h" 19 #include "ui/ozone/public/ozone_platform.h"
20 #include "ui/ozone/public/surface_factory_ozone.h" 20 #include "ui/ozone/public/surface_factory_ozone.h"
21 21
22 namespace gl { 22 namespace gl {
23 namespace { 23 namespace {
24 24
25 // These values are picked so that RGB -> YVU on the CPU converted 25 // These values are picked so that RGB -> YVU on the CPU converted
26 // back to RGB on the GPU produces the original RGB values without 26 // back to RGB on the GPU produces the original RGB values without
27 // any error. 27 // any error.
28 const uint8_t kImageColor[] = {0x10, 0x20, 0, 0xFF}; 28 const uint8_t kImageColor[] = {0x10, 0x20, 0, 0xFF};
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // via exo. 104 // via exo.
105 // TODO(dcastagna): once it's possible to allocate and map YV12 format 105 // TODO(dcastagna): once it's possible to allocate and map YV12 format
106 // using Ozone merge this test with GLImageOzoneNativePixmapTestDelegate. 106 // using Ozone merge this test with GLImageOzoneNativePixmapTestDelegate.
107 class GLImageOzoneNativePixmapDrmTestDelegate { 107 class GLImageOzoneNativePixmapDrmTestDelegate {
108 public: 108 public:
109 GLImageOzoneNativePixmapDrmTestDelegate() {} 109 GLImageOzoneNativePixmapDrmTestDelegate() {}
110 scoped_refptr<GLImage> CreateSolidColorImage(const gfx::Size& size, 110 scoped_refptr<GLImage> CreateSolidColorImage(const gfx::Size& size,
111 const uint8_t color[4]) const { 111 const uint8_t color[4]) const {
112 scoped_refptr<ui::NativePixmap> pixmap = CreateYVU420Pixmap(size, color); 112 scoped_refptr<ui::NativePixmap> pixmap = CreateYVU420Pixmap(size, color);
113 113
114 scoped_refptr<GLImageOzoneNativePixmap> image( 114 scoped_refptr<ui::GLImageOzoneNativePixmap> image(
115 new GLImageOzoneNativePixmap(size, GL_RGB_YCRCB_420_CHROMIUM)); 115 new ui::GLImageOzoneNativePixmap(size, GL_RGB_YCRCB_420_CHROMIUM));
116 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat())); 116 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat()));
117 return image; 117 return image;
118 } 118 }
119 119
120 unsigned GetTextureTarget() const { return GL_TEXTURE_EXTERNAL_OES; } 120 unsigned GetTextureTarget() const { return GL_TEXTURE_EXTERNAL_OES; }
121 121
122 const uint8_t* GetImageColor() { return kImageColor; } 122 const uint8_t* GetImageColor() { return kImageColor; }
123 123
124 private: 124 private:
125 }; 125 };
126 126
127 127
128 // TODO(crbug.com/618516) - The tests in this file can only be run 128 // TODO(crbug.com/618516) - The tests in this file can only be run
129 // on a real device, and not on linux desktop builds, so they are 129 // on a real device, and not on linux desktop builds, so they are
130 // disabled until they can correctly detect the environment and do 130 // disabled until they can correctly detect the environment and do
131 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm, 131 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm,
132 GLImageTest, 132 GLImageTest,
133 GLImageOzoneNativePixmapDrmTestDelegate); 133 GLImageOzoneNativePixmapDrmTestDelegate);
134 134
135 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm, 135 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapDrm,
136 GLImageBindTest, 136 GLImageBindTest,
137 GLImageOzoneNativePixmapDrmTestDelegate); 137 GLImageOzoneNativePixmapDrmTestDelegate);
138 138
139 } // namespace 139 } // namespace
140 } // namespace gl 140 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_image_ozone_native_pixmap.cc ('k') | ui/gl/gl_image_ozone_native_pixmap_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698