0

Fix build rules for //media/gpu:buffer_validation

- Avoid defining this target outside of Linux or CrOS to avoid compile
  errors on systems where native pixmap GpuMemoryBufferHandles aren't
  supported. While this isn't a problem currently, future CLs are
  stricter about only defining GpuMemoryBufferHandle types on platforms
  where they are used.
- Remove unused compiler configs that suppress warnings for global
  constructors/global destructors. This library has no global
  constructors or destructors.

Bug: 40584691
Change-Id: I8d478633dfa10e3d21e4577a2f2cbdb853f28ffe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6373153
Reviewed-by: Andres Calderon Jaramillo <andrescj@chromium.org>
Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
Auto-Submit: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1436074}
This commit is contained in:
Daniel Cheng
2025-03-21 08:51:29 -07:00
committed by Chromium LUCI CQ
parent 5586c3deb5
commit 3d6d573c4e
2 changed files with 14 additions and 29 deletions

@ -440,24 +440,21 @@ source_set("common") {
}
}
# The buffer validation functionality is in its own component so that it can be
# depended on without pulling the entire //media/gpu target.
component("buffer_validation") {
defines = [ "IS_MEDIA_GPU_BUFFER_VALIDATION_IMPL" ]
sources = [
"buffer_validation.cc",
"buffer_validation.h",
]
if (is_linux || is_chromeos) {
# The buffer validation functionality is in its own component so that it can be
# depended on without pulling the entire //media/gpu target.
component("buffer_validation") {
defines = [ "IS_MEDIA_GPU_BUFFER_VALIDATION_IMPL" ]
sources = [
"buffer_validation.cc",
"buffer_validation.h",
]
configs += [
"//build/config/compiler:wexit_time_destructors",
"//build/config/compiler:wglobal_constructors",
]
public_deps = [
"//base",
"//media",
]
public_deps = [
"//base",
"//media",
]
}
}
source_set("command_buffer_helper") {

@ -15,15 +15,12 @@
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#include <sys/types.h>
#include <unistd.h>
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
namespace media {
bool GetFileSize(const int fd, size_t* size) {
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
if (fd < 0) {
VLOG(1) << "Invalid file descriptor";
return false;
@ -49,10 +46,6 @@ bool GetFileSize(const int fd, size_t* size) {
*size = base::checked_cast<size_t>(fd_size);
return true;
#else
NOTIMPLEMENTED();
return false;
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
}
bool VerifyGpuMemoryBufferHandle(
@ -77,7 +70,6 @@ bool VerifyGpuMemoryBufferHandle(
VLOG(1) << "Unsupported: " << pixel_format;
return false;
}
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
const size_t num_planes = media::VideoFrame::NumPlanes(pixel_format);
if (num_planes != gmb_handle.native_pixmap_handle.planes.size() ||
num_planes == 0) {
@ -133,10 +125,6 @@ bool VerifyGpuMemoryBufferHandle(
}
}
return true;
#else
NOTIMPLEMENTED();
return false;
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
}
} // namespace media