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

Side by Side Diff: ui/ozone/demo/surfaceless_gl_renderer.cc

Issue 2213273002: ozone: Consolidate primary plane format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment on a single line. Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/ozone/demo/surfaceless_gl_renderer.h" 5 #include "ui/ozone/demo/surfaceless_gl_renderer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/trace_event/trace_event.h" 11 #include "base/trace_event/trace_event.h"
12 #include "ui/display/types/display_snapshot.h"
12 #include "ui/gl/gl_bindings.h" 13 #include "ui/gl/gl_bindings.h"
13 #include "ui/gl/gl_context.h" 14 #include "ui/gl/gl_context.h"
14 #include "ui/gl/gl_image.h" 15 #include "ui/gl/gl_image.h"
15 #include "ui/gl/gl_surface.h" 16 #include "ui/gl/gl_surface.h"
16 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h" 17 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h"
17 #include "ui/ozone/public/ozone_platform.h" 18 #include "ui/ozone/public/ozone_platform.h"
18 #include "ui/ozone/public/surface_factory_ozone.h" 19 #include "ui/ozone/public/surface_factory_ozone.h"
19 20
20 namespace ui { 21 namespace ui {
21 22
(...skipping 10 matching lines...) Expand all
32 image_->Destroy(true); 33 image_->Destroy(true);
33 } 34 }
34 } 35 }
35 36
36 bool SurfacelessGlRenderer::BufferWrapper::Initialize( 37 bool SurfacelessGlRenderer::BufferWrapper::Initialize(
37 gfx::AcceleratedWidget widget, 38 gfx::AcceleratedWidget widget,
38 const gfx::Size& size) { 39 const gfx::Size& size) {
39 glGenFramebuffersEXT(1, &gl_fb_); 40 glGenFramebuffersEXT(1, &gl_fb_);
40 glGenTextures(1, &gl_tex_); 41 glGenTextures(1, &gl_tex_);
41 42
43 gfx::BufferFormat format = ui::DisplaySnapshot::PrimaryFormat();
42 scoped_refptr<NativePixmap> pixmap = 44 scoped_refptr<NativePixmap> pixmap =
43 OzonePlatform::GetInstance() 45 OzonePlatform::GetInstance()
44 ->GetSurfaceFactoryOzone() 46 ->GetSurfaceFactoryOzone()
45 ->CreateNativePixmap(widget, size, gfx::BufferFormat::BGRX_8888, 47 ->CreateNativePixmap(widget, size, format, gfx::BufferUsage::SCANOUT);
46 gfx::BufferUsage::SCANOUT);
47 scoped_refptr<ui::GLImageOzoneNativePixmap> image( 48 scoped_refptr<ui::GLImageOzoneNativePixmap> image(
48 new ui::GLImageOzoneNativePixmap(size, GL_RGB)); 49 new ui::GLImageOzoneNativePixmap(size, GL_RGB));
49 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRX_8888)) { 50 if (!image->Initialize(pixmap.get(), format)) {
50 LOG(ERROR) << "Failed to create GLImage"; 51 LOG(ERROR) << "Failed to create GLImage";
51 return false; 52 return false;
52 } 53 }
53 image_ = image; 54 image_ = image;
54 55
55 glBindFramebufferEXT(GL_FRAMEBUFFER, gl_fb_); 56 glBindFramebufferEXT(GL_FRAMEBUFFER, gl_fb_);
56 glBindTexture(GL_TEXTURE_2D, gl_tex_); 57 glBindTexture(GL_TEXTURE_2D, gl_tex_);
57 image_->BindTexImage(GL_TEXTURE_2D); 58 image_->BindTexImage(GL_TEXTURE_2D);
58 59
59 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 60 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 case gfx::SwapResult::SWAP_ACK: 134 case gfx::SwapResult::SWAP_ACK:
134 GlRenderer::PostRenderFrameTask(result); 135 GlRenderer::PostRenderFrameTask(result);
135 break; 136 break;
136 case gfx::SwapResult::SWAP_FAILED: 137 case gfx::SwapResult::SWAP_FAILED:
137 LOG(FATAL) << "Failed to swap buffers"; 138 LOG(FATAL) << "Failed to swap buffers";
138 break; 139 break;
139 } 140 }
140 } 141 }
141 142
142 } // namespace ui 143 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/types/display_snapshot.cc ('k') | ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698