Make offscreen_framebuffer_size test only
It's used only by a test harness, which don't really need it, but it's not trivial change to remove it completely. This CL makes it only available for tests and follow-up will update command decoder codes to ignore it, so we can delete it later. Bug: 1445523 Change-Id: I445edf2eed4fb003c480fd9baa495a0c42863fd2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4615544 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org> Reviewed-by: Saifuddin Hitawala <hitawala@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/main@{#1158175}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
69550b7dad
commit
df83c2d080
gpu
command_buffer
gles2_conform_support
egl
ipc
tools/ipc_fuzzer/fuzzer
@@ -45,11 +45,12 @@ struct GPU_EXPORT ContextCreationAttribs {
|
|||||||
ContextCreationAttribs(const ContextCreationAttribs& other);
|
ContextCreationAttribs(const ContextCreationAttribs& other);
|
||||||
ContextCreationAttribs& operator=(const ContextCreationAttribs& other);
|
ContextCreationAttribs& operator=(const ContextCreationAttribs& other);
|
||||||
|
|
||||||
gfx::Size offscreen_framebuffer_size;
|
// Used only by tests and not serialized over IPC.
|
||||||
|
gfx::Size offscreen_framebuffer_size_for_testing;
|
||||||
gl::GpuPreference gpu_preference = gl::GpuPreference::kLowPower;
|
gl::GpuPreference gpu_preference = gl::GpuPreference::kLowPower;
|
||||||
// -1 if invalid or unspecified.
|
// -1 if invalid or unspecified.
|
||||||
int32_t alpha_size = -1;
|
|
||||||
#if BUILDFLAG(IS_ANDROID)
|
#if BUILDFLAG(IS_ANDROID)
|
||||||
|
int32_t alpha_size = -1;
|
||||||
int32_t blue_size = -1;
|
int32_t blue_size = -1;
|
||||||
int32_t green_size = -1;
|
int32_t green_size = -1;
|
||||||
int32_t red_size = -1;
|
int32_t red_size = -1;
|
||||||
|
@@ -3281,7 +3281,8 @@ gpu::ContextResult GLES2DecoderImpl::Initialize(
|
|||||||
std::min(renderbuffer_manager()->max_renderbuffer_size(),
|
std::min(renderbuffer_manager()->max_renderbuffer_size(),
|
||||||
texture_manager()->MaxSizeForTarget(GL_TEXTURE_2D));
|
texture_manager()->MaxSizeForTarget(GL_TEXTURE_2D));
|
||||||
|
|
||||||
gfx::Size initial_size = attrib_helper.offscreen_framebuffer_size;
|
gfx::Size initial_size =
|
||||||
|
attrib_helper.offscreen_framebuffer_size_for_testing;
|
||||||
if (initial_size.IsEmpty()) {
|
if (initial_size.IsEmpty()) {
|
||||||
// If we're an offscreen surface with zero width and/or height, set to a
|
// If we're an offscreen surface with zero width and/or height, set to a
|
||||||
// non-zero size so that we have a complete framebuffer for operations
|
// non-zero size so that we have a complete framebuffer for operations
|
||||||
|
@@ -1125,8 +1125,10 @@ gpu::ContextResult GLES2DecoderPassthroughImpl::Initialize(
|
|||||||
// devices), there are driver limitations on the minimum size of a buffer.
|
// devices), there are driver limitations on the minimum size of a buffer.
|
||||||
// Thus, we set the initial size to 64x64 here instead of 1x1.
|
// Thus, we set the initial size to 64x64 here instead of 1x1.
|
||||||
gfx::Size initial_size(
|
gfx::Size initial_size(
|
||||||
std::max(64, attrib_helper.offscreen_framebuffer_size.width()),
|
std::max(64,
|
||||||
std::max(64, attrib_helper.offscreen_framebuffer_size.height()));
|
attrib_helper.offscreen_framebuffer_size_for_testing.width()),
|
||||||
|
std::max(
|
||||||
|
64, attrib_helper.offscreen_framebuffer_size_for_testing.height()));
|
||||||
if (!emulated_back_buffer_->Resize(initial_size)) {
|
if (!emulated_back_buffer_->Resize(initial_size)) {
|
||||||
bool was_lost = CheckResetStatus();
|
bool was_lost = CheckResetStatus();
|
||||||
Destroy(true);
|
Destroy(true);
|
||||||
@@ -1153,8 +1155,7 @@ gpu::ContextResult GLES2DecoderPassthroughImpl::Initialize(
|
|||||||
// Bind the emulated default framebuffer and initialize the viewport
|
// Bind the emulated default framebuffer and initialize the viewport
|
||||||
api()->glBindFramebufferEXTFn(
|
api()->glBindFramebufferEXTFn(
|
||||||
GL_FRAMEBUFFER, emulated_back_buffer_->framebuffer_service_id);
|
GL_FRAMEBUFFER, emulated_back_buffer_->framebuffer_service_id);
|
||||||
api()->glViewportFn(0, 0, attrib_helper.offscreen_framebuffer_size.width(),
|
api()->glViewportFn(0, 0, initial_size.width(), initial_size.height());
|
||||||
attrib_helper.offscreen_framebuffer_size.height());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the tracked scissor and viewport state and then apply the
|
// Initialize the tracked scissor and viewport state and then apply the
|
||||||
|
@@ -291,7 +291,7 @@ bool Context::CreateService(gl::GLSurface* gl_surface) {
|
|||||||
helper.fail_if_major_perf_caveat = false;
|
helper.fail_if_major_perf_caveat = false;
|
||||||
helper.lose_context_when_out_of_memory = kLoseContextWhenOutOfMemory;
|
helper.lose_context_when_out_of_memory = kLoseContextWhenOutOfMemory;
|
||||||
helper.context_type = gpu::CONTEXT_TYPE_OPENGLES2;
|
helper.context_type = gpu::CONTEXT_TYPE_OPENGLES2;
|
||||||
helper.offscreen_framebuffer_size = gl_surface->GetSize();
|
helper.offscreen_framebuffer_size_for_testing = gl_surface->GetSize();
|
||||||
|
|
||||||
auto result = decoder->Initialize(gl_surface, gl_context.get(),
|
auto result = decoder->Initialize(gl_surface, gl_context.get(),
|
||||||
gl_surface->IsOffscreen(),
|
gl_surface->IsOffscreen(),
|
||||||
|
@@ -13,8 +13,7 @@ bool StructTraits<gpu::mojom::ContextCreationAttribsDataView,
|
|||||||
gpu::ContextCreationAttribs>::
|
gpu::ContextCreationAttribs>::
|
||||||
Read(gpu::mojom::ContextCreationAttribsDataView data,
|
Read(gpu::mojom::ContextCreationAttribsDataView data,
|
||||||
gpu::ContextCreationAttribs* out) {
|
gpu::ContextCreationAttribs* out) {
|
||||||
if (!data.ReadOffscreenFramebufferSize(&out->offscreen_framebuffer_size) ||
|
if (!data.ReadGpuPreference(&out->gpu_preference) ||
|
||||||
!data.ReadGpuPreference(&out->gpu_preference) ||
|
|
||||||
!data.ReadContextType(&out->context_type) ||
|
!data.ReadContextType(&out->context_type) ||
|
||||||
!data.ReadColorSpace(&out->color_space)) {
|
!data.ReadColorSpace(&out->color_space)) {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -98,11 +98,6 @@ struct GPU_EXPORT EnumTraits<gpu::mojom::ContextType, gpu::ContextType> {
|
|||||||
template <>
|
template <>
|
||||||
struct GPU_EXPORT StructTraits<gpu::mojom::ContextCreationAttribsDataView,
|
struct GPU_EXPORT StructTraits<gpu::mojom::ContextCreationAttribsDataView,
|
||||||
gpu::ContextCreationAttribs> {
|
gpu::ContextCreationAttribs> {
|
||||||
static gfx::Size offscreen_framebuffer_size(
|
|
||||||
const gpu::ContextCreationAttribs& attribs) {
|
|
||||||
return attribs.offscreen_framebuffer_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gl::GpuPreference gpu_preference(
|
static gl::GpuPreference gpu_preference(
|
||||||
const gpu::ContextCreationAttribs& attribs) {
|
const gpu::ContextCreationAttribs& attribs) {
|
||||||
return attribs.gpu_preference;
|
return attribs.gpu_preference;
|
||||||
|
@@ -50,7 +50,6 @@ enum SchedulingPriority {
|
|||||||
|
|
||||||
// Maps to its namesake in gpu/command_buffer/common/context_creation_attribs.h.
|
// Maps to its namesake in gpu/command_buffer/common/context_creation_attribs.h.
|
||||||
struct ContextCreationAttribs {
|
struct ContextCreationAttribs {
|
||||||
gfx.mojom.Size offscreen_framebuffer_size;
|
|
||||||
gl.mojom.GpuPreference gpu_preference = kLowPower;
|
gl.mojom.GpuPreference gpu_preference = kLowPower;
|
||||||
|
|
||||||
// -1 if invalid or unspecified.
|
// -1 if invalid or unspecified.
|
||||||
|
@@ -155,7 +155,6 @@ IPC_STRUCT_TRAITS_BEGIN(gpu::CommandBuffer::State)
|
|||||||
IPC_STRUCT_TRAITS_END()
|
IPC_STRUCT_TRAITS_END()
|
||||||
|
|
||||||
IPC_STRUCT_TRAITS_BEGIN(gpu::ContextCreationAttribs)
|
IPC_STRUCT_TRAITS_BEGIN(gpu::ContextCreationAttribs)
|
||||||
IPC_STRUCT_TRAITS_MEMBER(offscreen_framebuffer_size)
|
|
||||||
IPC_STRUCT_TRAITS_MEMBER(gpu_preference)
|
IPC_STRUCT_TRAITS_MEMBER(gpu_preference)
|
||||||
#if BUILDFLAG(IS_ANDROID)
|
#if BUILDFLAG(IS_ANDROID)
|
||||||
IPC_STRUCT_TRAITS_MEMBER(alpha_size)
|
IPC_STRUCT_TRAITS_MEMBER(alpha_size)
|
||||||
|
@@ -58,8 +58,6 @@ ContextResult GLInProcessContext::Initialize(
|
|||||||
const ContextCreationAttribs& attribs,
|
const ContextCreationAttribs& attribs,
|
||||||
const SharedMemoryLimits& mem_limits) {
|
const SharedMemoryLimits& mem_limits) {
|
||||||
DCHECK(base::SingleThreadTaskRunner::GetCurrentDefault());
|
DCHECK(base::SingleThreadTaskRunner::GetCurrentDefault());
|
||||||
DCHECK_GE(attribs.offscreen_framebuffer_size.width(), 0);
|
|
||||||
DCHECK_GE(attribs.offscreen_framebuffer_size.height(), 0);
|
|
||||||
|
|
||||||
command_buffer_ = std::make_unique<InProcessCommandBuffer>(
|
command_buffer_ = std::make_unique<InProcessCommandBuffer>(
|
||||||
task_executor, GURL("chrome://gpu/GLInProcessContext::Initialize"));
|
task_executor, GURL("chrome://gpu/GLInProcessContext::Initialize"));
|
||||||
|
@@ -1002,8 +1002,6 @@ struct FuzzTraits<gpu::CommandBufferNamespace> {
|
|||||||
template <>
|
template <>
|
||||||
struct FuzzTraits<gpu::ContextCreationAttribs> {
|
struct FuzzTraits<gpu::ContextCreationAttribs> {
|
||||||
static bool Fuzz(gpu::ContextCreationAttribs* p, Fuzzer* fuzzer) {
|
static bool Fuzz(gpu::ContextCreationAttribs* p, Fuzzer* fuzzer) {
|
||||||
if (!FuzzParam(&p->offscreen_framebuffer_size, fuzzer))
|
|
||||||
return false;
|
|
||||||
if (!FuzzParam(&p->gpu_preference, fuzzer))
|
if (!FuzzParam(&p->gpu_preference, fuzzer))
|
||||||
return false;
|
return false;
|
||||||
if (!FuzzParam(&p->context_type, fuzzer))
|
if (!FuzzParam(&p->context_type, fuzzer))
|
||||||
|
Reference in New Issue
Block a user