Skip to content

Commit

Permalink
third_party: Add libdrm.
Browse files Browse the repository at this point in the history
libdrm shipped with the sysroot or our workstation is older than libdrm
we use on chromeos.
This forces us to redefine symbols/defines (fourcc code for example) and
doesn't allow us to compile newer drm code on trybots (drm atomic).

This CLs adds libdrm to third_party, so that we can build the third_party
one when we build on our workstation or on the trybot, similar to what
we currently do with minigbm.

BUG=

Review-Url: https://codereview.chromium.org/2594483002
Cr-Commit-Position: refs/heads/master@{#439907}
  • Loading branch information
DCastagna authored and Commit bot committed Dec 20, 2016
1 parent 0ab5beb commit 1418305
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 16 deletions.
4 changes: 4 additions & 0 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ deps_os = {
'src/third_party/minigbm/src':
Var('chromium_git') + '/chromiumos/platform/minigbm.git' + '@' + '3345977b5e9ef13f97e2e858241297fc4bfc7401',

# Userspace interface to kernel DRM services.
'src/third_party/libdrm/src':
Var('chromium_git') + '/chromiumos/third_party/libdrm.git' + '@' + '4c4778123b7b11f750577199644f5d6820851dbb',

# Display server protocol for Linux.
'src/third_party/wayland/src':
Var('chromium_git') + '/external/anongit.freedesktop.org/git/wayland/wayland.git' + '@' + '6a18a87727c64719c68168568b9ab1e4d7c2d9c1',
Expand Down
54 changes: 54 additions & 0 deletions third_party/libdrm/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2016 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 libdrm
# library shipped with the system. In release builds of Chrome OS we
# use the system version, but when building on dev workstations we
# bundle it because Ubuntu doesn't ship a usable version.
use_system_libdrm = true
}

if (!use_system_libdrm) {
config("libdrm_config") {
include_dirs = [
"src",
"src/include",
"src/include/drm",
]
if (is_clang) {
cflags = [ "-Wno-enum-conversion" ]
}
}

static_library("libdrm") {
sources = [
"src/xf86drm.c",
"src/xf86drmHash.c",
"src/xf86drmMode.c",
"src/xf86drmRandom.c",
]

include_dirs = [
"src",
"src/include",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]

public_configs = [ ":libdrm_config" ]
}
}

if (use_system_libdrm) {
pkg_config("libdrm_config") {
packages = [ "libdrm" ]
}
group("libdrm") {
public_configs = [ ":libdrm_config" ]
}
}
2 changes: 2 additions & 0 deletions third_party/libdrm/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dcastagna@chromium.org
reveman@chromium.org
13 changes: 13 additions & 0 deletions third_party/libdrm/README.chromium
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Name: libdrm
Short Name: libdrm
URL: https://chromium.googlesource.com/chromiumos/third_party/libdrm
Version: 2.4.70
License: MIT, GPL
License File: NOT_SHIPPED
Security Critical: yes

Description:
Userspace interface to kernel DRM services.

Local Modifications:
None
12 changes: 4 additions & 8 deletions third_party/minigbm/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ if (!use_system_minigbm) {
include_dirs = [ "src" ]
}

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

shared_library("minigbm") {
sources = [
"src/amdgpu.c",
Expand All @@ -45,11 +41,11 @@ if (!use_system_minigbm) {
]

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

deps = [
"//third_party/libdrm",
]
public_configs = [ ":minigbm_config" ]

# Clients need this to pick up the shared library correctly.
Expand Down
10 changes: 2 additions & 8 deletions ui/ozone/platform/drm/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ declare_args() {

visibility = [ "//ui/ozone/*" ]

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

config("drm_atomic") {
if (use_drm_atomic) {
defines = [ "USE_DRM_ATOMIC" ]
Expand Down Expand Up @@ -129,6 +125,7 @@ source_set("gbm") {
"//services/service_manager/public/cpp:sources",
"//services/ui/public/interfaces:constants",
"//skia",
"//third_party/libdrm",
"//third_party/minigbm",
"//ui/base",
"//ui/display",
Expand All @@ -150,8 +147,6 @@ source_set("gbm") {
"//ui/platform_window",
]

configs += [ ":libdrm" ]

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

defines = [ "OZONE_IMPLEMENTATION" ]
Expand Down Expand Up @@ -194,10 +189,9 @@ source_set("gbm_unittests") {
":gbm",
"//skia",
"//testing/gtest",
"//third_party/libdrm",
"//ui/gfx",
"//ui/ozone:platform",
"//ui/ozone/common",
]

public_configs = [ ":libdrm" ]
}

0 comments on commit 1418305

Please sign in to comment.