Skip to content

Commit

Permalink
Add Chrome OS's minigbm library to third_party
Browse files Browse the repository at this point in the history
This library is used by Chrome on Chrome OS to allocate accelerated
graphics buffers. The version avaiable on Ubuntu is too old, and as a
result we can't run unit tests for the gbm platform code on developer
workstations or on the waterfall.

This adds the library to third_party and fixes up the build files to use
either the OS copy (for Chrome OS release builds) or gardened copy (for
testing on the waterfall) depending on the value of "use_system_minigbm".

BUG=530712
TEST=
  GYP_DEFINES="use_ozone=1 chromeos=1 ozone_platform_gbm=1 use_system_minigbm=0" gclient runhooks
  ninja -C out/Release ozone_unittests
  ./out/Release/ozone_unittests

  gn gen out_gn_ozone --args='target_os="chromeos" use_ozone=true ozone_platform_gbm=true use_system_minigbm=false'
  ninja -C out_gn_ozone ozone_unittests
  ./out_gn_ozone/Release/ozone_unittests

Review URL: https://codereview.chromium.org/1341473003

Cr-Commit-Position: refs/heads/master@{#348758}
  • Loading branch information
mspang authored and Commit bot committed Sep 14, 2015
1 parent e8619bf commit c231bff
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ v8.log
/third_party/lss
/third_party/mesa/src
/third_party/mingw-w64
/third_party/minigbm/src
/third_party/mkl
/third_party/mocha
/third_party/mockito/src
Expand Down
4 changes: 4 additions & 0 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ deps_os = {
# ANGLE uses dEQP for GPU testing
'src/third_party/deqp/src':
Var('deqp_url') + '@' + Var('deqp_revision'),

# Graphics buffer allocator for Chrome OS.
'src/third_party/minigbm/src':
Var('chromium_git') + '/chromiumos/platform/minigbm.git' + '@' + 'f9d2ab79a15a1bb6a1307f3b608964c81c27791b',
},
'android': {
'src/third_party/android_protobuf/src':
Expand Down
21 changes: 0 additions & 21 deletions build/linux/system.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -571,27 +571,6 @@
},
],
}],
['ozone_platform_gbm==1', {
'targets': [
{
'target_name': 'gbm',
'type': 'none',
'direct_dependent_settings': {
'cflags': [
'<!@(<(pkg-config) --cflags gbm)',
],
},
'link_settings': {
'ldflags': [
'<!@(<(pkg-config) --libs-only-L --libs-only-other gbm)',
],
'libraries': [
'<!@(<(pkg-config) --libs-only-l gbm)',
],
},
},
],
}],
['ozone_platform_drm==1 or ozone_platform_gbm==1', {
'targets': [
{
Expand Down
58 changes: 58 additions & 0 deletions third_party/minigbm/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/linux/pkg_config.gni")

assert(is_linux)

declare_args() {
# Controls whether the build should use the version of minigbm library
# shipped with the system. In release builds of Chrome OS we use the
# system version, but when building on dev workstations or the Chrome
# waterfall we bundle it because Ubuntu doesn't ship a usable version.
use_system_minigbm = false
}

if (!use_system_minigbm) {
config("minigbm_config") {
include_dirs = [ "src" ]
}

pkg_config("libdrm") {
packages = [ "libdrm" ]
}

static_library("minigbm") {
sources = [
"src/cirrus.c",
"src/exynos.c",
"src/gbm.c",
"src/gma500.c",
"src/helpers.c",
"src/i915.c",
"src/mediatek.c",
"src/rockchip.c",
"src/tegra.c",
"src/udl.c",
]

configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":libdrm",
"//build/config/compiler:no_chromium_code",
]

public_configs = [ ":minigbm_config" ]
}
}

if (use_system_minigbm) {
pkg_config("libgbm") {
packages = [ "gbm" ]
}

group("minigbm") {
public_configs = [ ":libgbm" ]
}
}
27 changes: 27 additions & 0 deletions third_party/minigbm/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2014 The Chromium OS Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 2 additions & 0 deletions third_party/minigbm/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
marcheu@chromium.org
spang@chromium.org
13 changes: 13 additions & 0 deletions third_party/minigbm/README.chromium
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Name: minigbm
Short Name: minigbm
URL: https://chromium.googlesource.com/chromiumos/platform/minigbm
Version: 0
License: BSD
License File: LICENSE
Security Critical: yes

Description:
This contains the graphics buffer allocator library for Chrome OS.

Local Modifications:
None
62 changes: 62 additions & 0 deletions third_party/minigbm/minigbm.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

{
'variables': {
'use_system_minigbm%': 0,
},
'conditions': [
['use_system_minigbm==0', {
'targets': [
{
'target_name': 'minigbm',
'type': 'static_library',
'dependencies' : [
'../../build/linux/system.gyp:libdrm',
],
'sources': [
'src/cirrus.c',
'src/exynos.c',
'src/gbm.c',
'src/gma500.c',
'src/helpers.c',
'src/i915.c',
'src/mediatek.c',
'src/rockchip.c',
'src/tegra.c',
'src/udl.c',
],
'include_dirs': [
'src',
],
'direct_dependent_settings': {
'include_dirs': [
'src',
],
},
},
],
}, { # 'use_system_minigbm!=0
'targets': [
{
'target_name': 'minigbm',
'type': 'none',
'direct_dependent_settings': {
'cflags': [
'<!@(<(pkg-config) --cflags gbm)',
],
},
'link_settings': {
'ldflags': [
'<!@(<(pkg-config) --libs-only-L --libs-only-other gbm)',
],
'libraries': [
'<!@(<(pkg-config) --libs-only-l gbm)',
],
},
},
],
}],
],
}
10 changes: 2 additions & 8 deletions ui/ozone/platform/drm/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@ if (ozone_platform_drm) {
}

if (ozone_platform_gbm) {
pkg_config("libgbm") {
packages = [ "gbm" ]
}

source_set("gbm") {
sources = [
"common/client_native_pixmap_factory_gbm.cc",
Expand All @@ -190,14 +186,12 @@ if (ozone_platform_gbm) {
":drm_common",
"//base",
"//skia",
"//third_party/minigbm",
"//ui/events/ozone:events_ozone_evdev",
"//ui/events/ozone:events_ozone_layout",
]

public_configs = [
":libgbm",
"//third_party/khronos:khronos_headers",
]
public_configs = [ "//third_party/khronos:khronos_headers" ]

defines = []

Expand Down
2 changes: 1 addition & 1 deletion ui/ozone/platform/drm/gbm.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'dependencies': [
'../../base/base.gyp:base',
'../../build/linux/system.gyp:libdrm',
'../../build/linux/system.gyp:gbm',
'../../third_party/minigbm/minigbm.gyp:minigbm',
'../../skia/skia.gyp:skia',
'../../third_party/khronos/khronos.gyp:khronos_headers',
'../base/ui_base.gyp:ui_base',
Expand Down

0 comments on commit c231bff

Please sign in to comment.