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

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: GYP 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
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // via exo. 103 // via exo.
104 // TODO(dcastagna): once it's possible to allocate and map YV12 format 104 // TODO(dcastagna): once it's possible to allocate and map YV12 format
105 // using Ozone merge this test with GLImageOzoneNativePixmapTestDelegate. 105 // using Ozone merge this test with GLImageOzoneNativePixmapTestDelegate.
106 class GLImageOzoneNativePixmapDrmTestDelegate { 106 class GLImageOzoneNativePixmapDrmTestDelegate {
107 public: 107 public:
108 GLImageOzoneNativePixmapDrmTestDelegate() {} 108 GLImageOzoneNativePixmapDrmTestDelegate() {}
109 scoped_refptr<GLImage> CreateSolidColorImage(const gfx::Size& size, 109 scoped_refptr<GLImage> CreateSolidColorImage(const gfx::Size& size,
110 const uint8_t color[4]) const { 110 const uint8_t color[4]) const {
111 scoped_refptr<ui::NativePixmap> pixmap = CreateYVU420Pixmap(size, color); 111 scoped_refptr<ui::NativePixmap> pixmap = CreateYVU420Pixmap(size, color);
112 112
113 scoped_refptr<GLImageOzoneNativePixmap> image( 113 scoped_refptr<ui::GLImageOzoneNativePixmap> image(
114 new GLImageOzoneNativePixmap(size, GL_RGB_YCRCB_420_CHROMIUM)); 114 new ui::GLImageOzoneNativePixmap(size, GL_RGB_YCRCB_420_CHROMIUM));
115 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat())); 115 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat()));
116 return image; 116 return image;
117 } 117 }
118 118
119 unsigned GetTextureTarget() const { return GL_TEXTURE_EXTERNAL_OES; } 119 unsigned GetTextureTarget() const { return GL_TEXTURE_EXTERNAL_OES; }
120 120
121 const uint8_t* GetImageColor() { return kImageColor; } 121 const uint8_t* GetImageColor() { return kImageColor; }
122 122
123 private: 123 private:
124 }; 124 };
125 125
126 126
127 // TODO(crbug.com/618516) - The tests in this file can only be run 127 // TODO(crbug.com/618516) - The tests in this file can only be run
128 // on a real device, and not on linux desktop builds, so they are 128 // on a real device, and not on linux desktop builds, so they are
129 // disabled until they can correctly detect the environment and do 129 // disabled until they can correctly detect the environment and do
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698