Commit 31c95bcd authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

Move the supported BufferFormats field from GpuInfo to GpuFeatureInfo

crrev.com/c/1612041 landed the enumeration of supported BufferFormats
on Ozone and wired it to a GpuInfo field; however, for the purpose of
using this information in gpu::gles2::FeatureInfo::FeatureFlags, it's
better to store it in GpuFeatureInfo. This CL moves it to there.

Bug: 967905, 911754
Change-Id: I1279e36af7b2fb2d680b6916f364db71d99e26f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1632597Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664391}
parent c6acfa31
......@@ -311,7 +311,7 @@ std::unique_ptr<base::ListValue> BasicGpuInfoAsListValue(
buffer_formats += ", ";
buffer_formats += gfx::BufferFormatToString(buffer_format);
const bool supported = base::ContainsValue(
gpu_info.supported_buffer_formats_for_allocation_and_texturing,
gpu_feature_info.supported_buffer_formats_for_allocation_and_texturing,
buffer_format);
buffer_formats += supported ? ": supported" : ": not supported";
}
......
......@@ -11,6 +11,10 @@
#include "gpu/config/gpu_feature_type.h"
#include "gpu/gpu_export.h"
namespace gfx {
enum class BufferFormat;
}
namespace gl {
class GLContext;
} // namespace gl
......@@ -77,6 +81,11 @@ struct GPU_EXPORT GpuFeatureInfo {
std::vector<uint32_t> applied_gpu_blacklist_entries;
// Applied gpu driver bug list entry indices.
std::vector<uint32_t> applied_gpu_driver_bug_list_entries;
// BufferFormats that can be allocated and then bound, if known and provided
// by the platform.
std::vector<gfx::BufferFormat>
supported_buffer_formats_for_allocation_and_texturing;
};
} // namespace gpu
......
......@@ -6,8 +6,6 @@
#include "gpu/config/gpu_info.h"
#include "ui/gfx/buffer_format_util.h"
namespace {
void EnumerateGPUDevice(const gpu::GPUInfo::GPUDevice& device,
......@@ -253,9 +251,6 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
ImageDecodeAcceleratorSupportedProfiles
image_decode_accelerator_supported_profiles;
std::vector<gfx::BufferFormat>
supported_buffer_formats_for_allocation_and_texturing;
#if defined(USE_X11)
VisualID system_visual;
VisualID rgba_visual;
......@@ -331,14 +326,6 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
enumerator->AddInt64("rgbaVisual", rgba_visual);
#endif
enumerator->AddBool("oopRasterizationSupported", oop_rasterization_supported);
std::string supported_formats;
for (const auto& format :
supported_buffer_formats_for_allocation_and_texturing) {
supported_formats += gfx::BufferFormatToString(format);
supported_formats += " ";
}
enumerator->AddString("supportedBufferFormatsForAllocationAndTexturing",
supported_formats);
enumerator->EndAuxAttributes();
}
......
......@@ -24,10 +24,6 @@
typedef unsigned long VisualID;
#endif
namespace gfx {
enum class BufferFormat;
}
namespace gpu {
// These values are persisted to logs. Entries should not be renumbered and
......@@ -334,9 +330,6 @@ struct GPU_EXPORT GPUInfo {
ImageDecodeAcceleratorSupportedProfiles
image_decode_accelerator_supported_profiles;
std::vector<gfx::BufferFormat>
supported_buffer_formats_for_allocation_and_texturing;
#if defined(USE_X11)
VisualID system_visual;
VisualID rgba_visual;
......
......@@ -5,6 +5,8 @@
// gpu/config/gpu_feature_info.h
module gpu.mojom;
import "ui/gfx/mojo/buffer_types.mojom";
// gpu::GpuFeatureStatus
enum GpuFeatureStatus {
Enabled,
......@@ -62,4 +64,9 @@ struct GpuFeatureInfo {
// in the current platform. The entries are defined in
// gpu/config/gpu_driver_bug_list.json.
array<uint32> applied_gpu_driver_bug_list_entries;
// BufferFormats that can be allocated and then bound, if known and provided
// by the platform.
array<gfx.mojom.BufferFormat>
supported_buffer_formats_for_allocation_and_texturing;
};
......@@ -28,7 +28,9 @@ bool StructTraits<gpu::mojom::GpuFeatureInfoDataView, gpu::GpuFeatureInfo>::
data.ReadAppliedGpuDriverBugListEntries(
&out->applied_gpu_driver_bug_list_entries) &&
gpu::GpuDriverBugList::AreEntryIndicesValid(
out->applied_gpu_driver_bug_list_entries);
out->applied_gpu_driver_bug_list_entries) &&
data.ReadSupportedBufferFormatsForAllocationAndTexturing(
&out->supported_buffer_formats_for_allocation_and_texturing);
}
} // namespace mojo
......@@ -9,6 +9,7 @@
#include "gpu/config/gpu_driver_bug_list.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/ipc/common/gpu_feature_info.mojom.h"
#include "ui/gfx/mojo/buffer_types_struct_traits.h"
namespace mojo {
......@@ -173,6 +174,12 @@ struct StructTraits<gpu::mojom::GpuFeatureInfoDataView, gpu::GpuFeatureInfo> {
const gpu::GpuFeatureInfo& info) {
return info.applied_gpu_driver_bug_list_entries;
}
static std::vector<gfx::BufferFormat>
supported_buffer_formats_for_allocation_and_texturing(
const gpu::GpuFeatureInfo& input) {
return input.supported_buffer_formats_for_allocation_and_texturing;
}
};
} // namespace mojo
......
......@@ -8,7 +8,6 @@ module gpu.mojom;
import "gpu/ipc/common/dx_diag_node.mojom";
import "mojo/public/mojom/base/time.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
import "ui/gfx/mojo/buffer_types.mojom";
// gpu::GPUInfo::GPUDevice
struct GpuDevice {
......@@ -163,9 +162,6 @@ struct GpuInfo {
array<ImageDecodeAcceleratorSupportedProfile>
image_decode_accelerator_supported_profiles;
array<gfx.mojom.BufferFormat>
supported_buffer_formats_for_allocation_and_texturing;
uint64 system_visual;
uint64 rgba_visual;
bool oop_rasterization_supported;
......
......@@ -393,9 +393,7 @@ bool StructTraits<gpu::mojom::GpuInfoDataView, gpu::GPUInfo>::Read(
data.ReadVideoEncodeAcceleratorSupportedProfiles(
&out->video_encode_accelerator_supported_profiles) &&
data.ReadImageDecodeAcceleratorSupportedProfiles(
&out->image_decode_accelerator_supported_profiles) &&
data.ReadSupportedBufferFormatsForAllocationAndTexturing(
&out->supported_buffer_formats_for_allocation_and_texturing);
&out->image_decode_accelerator_supported_profiles);
}
} // namespace mojo
......@@ -11,7 +11,6 @@
#include "gpu/ipc/common/dx_diag_node_struct_traits.h"
#include "gpu/ipc/common/gpu_info.mojom.h"
#include "ui/gfx/geometry/mojo/geometry_struct_traits.h"
#include "ui/gfx/mojo/buffer_types_struct_traits.h"
namespace mojo {
......@@ -364,12 +363,6 @@ struct StructTraits<gpu::mojom::GpuInfoDataView, gpu::GPUInfo> {
return input.image_decode_accelerator_supported_profiles;
}
static std::vector<gfx::BufferFormat>
supported_buffer_formats_for_allocation_and_texturing(
const gpu::GPUInfo& input) {
return input.supported_buffer_formats_for_allocation_and_texturing;
}
static uint64_t system_visual(const gpu::GPUInfo& input) {
#if defined(USE_X11)
return input.system_visual;
......
......@@ -244,7 +244,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
.requires_mojo;
params.viz_display_compositor = features::IsVizDisplayCompositorEnabled();
ui::OzonePlatform::InitializeForGPU(params);
gpu_info_.supported_buffer_formats_for_allocation_and_texturing =
const std::vector<gfx::BufferFormat> supported_buffer_formats_for_texturing =
ui::OzonePlatform::GetInstance()
->GetSurfaceFactoryOzone()
->GetSupportedFormatsForTexturing();
......@@ -408,6 +408,10 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
base::android::AndroidImageReader::DisableSupport();
}
#endif
#if defined(USE_OZONE)
gpu_feature_info_.supported_buffer_formats_for_allocation_and_texturing =
std::move(supported_buffer_formats_for_texturing);
#endif
return true;
}
......@@ -447,7 +451,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
.requires_mojo;
params.viz_display_compositor = features::IsVizDisplayCompositorEnabled();
ui::OzonePlatform::InitializeForGPU(params);
gpu_info_.supported_buffer_formats_for_allocation_and_texturing =
const std::vector<gfx::BufferFormat> supported_buffer_formats_for_texturing =
ui::OzonePlatform::GetInstance()
->GetSurfaceFactoryOzone()
->GetSupportedFormatsForTexturing();
......@@ -538,6 +542,11 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
AdjustInfoToSwiftShader();
}
#if defined(USE_OZONE)
gpu_feature_info_.supported_buffer_formats_for_allocation_and_texturing =
std::move(supported_buffer_formats_for_texturing);
#endif
UMA_HISTOGRAM_ENUMERATION("GPU.GLImplementation", gl::GetGLImplementation());
}
#endif // OS_ANDROID
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment