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

Side by Side Diff: components/exo/display_unittest.cc

Issue 2039813002: Add format modifier IDs for EGL_EXT_image_dma_buf_import extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add format modifier IDs for EGL_EXT_image_dma_buf_import extension Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ash/common/shell_window_ids.h" 5 #include "ash/common/shell_window_ids.h"
6 #include "components/exo/buffer.h" 6 #include "components/exo/buffer.h"
7 #include "components/exo/display.h" 7 #include "components/exo/display.h"
8 #include "components/exo/shared_memory.h" 8 #include "components/exo/shared_memory.h"
9 #include "components/exo/shell_surface.h" 9 #include "components/exo/shell_surface.h"
10 #include "components/exo/sub_surface.h" 10 #include "components/exo/sub_surface.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 std::unique_ptr<Display> display(new Display); 61 std::unique_ptr<Display> display(new Display);
62 62
63 // Creating a prime buffer from a native pixmap handle should succeed. 63 // Creating a prime buffer from a native pixmap handle should succeed.
64 scoped_refptr<ui::NativePixmap> pixmap = 64 scoped_refptr<ui::NativePixmap> pixmap =
65 ui::OzonePlatform::GetInstance() 65 ui::OzonePlatform::GetInstance()
66 ->GetSurfaceFactoryOzone() 66 ->GetSurfaceFactoryOzone()
67 ->CreateNativePixmap(gfx::kNullAcceleratedWidget, buffer_size, 67 ->CreateNativePixmap(gfx::kNullAcceleratedWidget, buffer_size,
68 gfx::BufferFormat::RGBA_8888, 68 gfx::BufferFormat::RGBA_8888,
69 gfx::BufferUsage::GPU_READ); 69 gfx::BufferUsage::GPU_READ);
70 gfx::NativePixmapHandle native_pixmap_handle = pixmap->ExportHandle(); 70 gfx::NativePixmapHandle native_pixmap_handle = pixmap->ExportHandle();
71 std::vector<int> strides; 71 std::vector<gfx::GbmBufferPlane> planes;
72 std::vector<int> offsets;
73 std::vector<base::ScopedFD> fds; 72 std::vector<base::ScopedFD> fds;
74 strides.push_back(native_pixmap_handle.strides_and_offsets[0].first); 73 planes.push_back(native_pixmap_handle.planes[0]);
75 offsets.push_back(native_pixmap_handle.strides_and_offsets[0].second);
76 fds.push_back(base::ScopedFD(native_pixmap_handle.fds[0].fd)); 74 fds.push_back(base::ScopedFD(native_pixmap_handle.fds[0].fd));
77 75
78 std::unique_ptr<Buffer> buffer1 = display->CreateLinuxDMABufBuffer( 76 std::unique_ptr<Buffer> buffer1 = display->CreateLinuxDMABufBuffer(
79 buffer_size, gfx::BufferFormat::RGBA_8888, strides, offsets, 77 buffer_size, gfx::BufferFormat::RGBA_8888, planes, std::move(fds));
80 std::move(fds));
81 EXPECT_TRUE(buffer1); 78 EXPECT_TRUE(buffer1);
82 79
83 std::vector<base::ScopedFD> invalid_fds; 80 std::vector<base::ScopedFD> invalid_fds;
84 invalid_fds.push_back(base::ScopedFD()); 81 invalid_fds.push_back(base::ScopedFD());
85 // Creating a prime buffer using an invalid fd should fail. 82 // Creating a prime buffer using an invalid fd should fail.
86 std::unique_ptr<Buffer> buffer2 = display->CreateLinuxDMABufBuffer( 83 std::unique_ptr<Buffer> buffer2 = display->CreateLinuxDMABufBuffer(
87 buffer_size, gfx::BufferFormat::RGBA_8888, strides, offsets, 84 buffer_size, gfx::BufferFormat::RGBA_8888, planes,
88 std::move(invalid_fds)); 85 std::move(invalid_fds));
89 EXPECT_FALSE(buffer2); 86 EXPECT_FALSE(buffer2);
90 } 87 }
91 88
92 // TODO(dcastagna): Add YV12 unittest once we can allocate the buffer 89 // TODO(dcastagna): Add YV12 unittest once we can allocate the buffer
93 // via Ozone. crbug.com/618516 90 // via Ozone. crbug.com/618516
94 91
95 #endif 92 #endif
96 93
97 TEST_F(DisplayTest, CreateShellSurface) { 94 TEST_F(DisplayTest, CreateShellSurface) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // Attempting to create a sub surface for parent with grandchild as its parent 217 // Attempting to create a sub surface for parent with grandchild as its parent
221 // should fail. 218 // should fail.
222 EXPECT_FALSE(display->CreateSubSurface(parent.get(), grandchild.get())); 219 EXPECT_FALSE(display->CreateSubSurface(parent.get(), grandchild.get()));
223 220
224 // Create a sub surface for parent. 221 // Create a sub surface for parent.
225 EXPECT_TRUE(display->CreateSubSurface(parent.get(), toplevel.get())); 222 EXPECT_TRUE(display->CreateSubSurface(parent.get(), toplevel.get()));
226 } 223 }
227 224
228 } // namespace 225 } // namespace
229 } // namespace exo 226 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698