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

Side by Side Diff: ui/ozone/common/egl_util.cc

Issue 1285183008: Ozone integration. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: add missing license header Created 5 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
« no previous file with comments | « ui/ozone/common/egl_util.h ('k') | ui/ozone/common/gpu/ozone_gpu_message_params.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/ozone/common/egl_util.h"
6
7 #include "base/files/file_path.h"
8
9 namespace ui {
10 namespace {
11
12 const char kDefaultEglSoname[] = "libEGL.so.1";
13 const char kDefaultGlesSoname[] = "libGLESv2.so.2";
14
15 } // namespace
16
17 bool LoadDefaultEGLGLES2Bindings(
18 SurfaceFactoryOzone::AddGLLibraryCallback add_gl_library,
19 SurfaceFactoryOzone::SetGLGetProcAddressProcCallback
20 set_gl_get_proc_address) {
21 return LoadEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address,
22 kDefaultEglSoname, kDefaultGlesSoname);
23 }
24
25 bool LoadEGLGLES2Bindings(
26 SurfaceFactoryOzone::AddGLLibraryCallback add_gl_library,
27 SurfaceFactoryOzone::SetGLGetProcAddressProcCallback
28 set_gl_get_proc_address,
29 const char* egl_library_name,
30 const char* gles_library_name) {
31 base::NativeLibraryLoadError error;
32 base::NativeLibrary gles_library =
33 base::LoadNativeLibrary(base::FilePath(gles_library_name), &error);
34 if (!gles_library) {
35 LOG(WARNING) << "Failed to load GLES library: " << error.ToString();
36 return false;
37 }
38
39 base::NativeLibrary egl_library =
40 base::LoadNativeLibrary(base::FilePath(egl_library_name), &error);
41 if (!egl_library) {
42 LOG(WARNING) << "Failed to load EGL library: " << error.ToString();
43 base::UnloadNativeLibrary(gles_library);
44 return false;
45 }
46
47 SurfaceFactoryOzone::GLGetProcAddressProc get_proc_address =
48 reinterpret_cast<SurfaceFactoryOzone::GLGetProcAddressProc>(
49 base::GetFunctionPointerFromNativeLibrary(egl_library,
50 "eglGetProcAddress"));
51 if (!get_proc_address) {
52 LOG(ERROR) << "eglGetProcAddress not found.";
53 base::UnloadNativeLibrary(egl_library);
54 base::UnloadNativeLibrary(gles_library);
55 return false;
56 }
57
58 set_gl_get_proc_address.Run(get_proc_address);
59 add_gl_library.Run(egl_library);
60 add_gl_library.Run(gles_library);
61
62 return true;
63 }
64
65 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/common/egl_util.h ('k') | ui/ozone/common/gpu/ozone_gpu_message_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698