Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Unified Diff: cc/resources/resource_provider.cc

Issue 2122573003: media: replace LUMINANCE_F16 by RG_88 for 9/10-bit h264 videos Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to ToT Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/video_resource_updater.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 42eda06e3e5863520b709e78d1df3256e52dc008..fc85129702aa10d9998c0d11a0ea6c69e97f9c5c 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -92,6 +92,7 @@ GLenum TextureToStorageFormat(ResourceFormat format) {
case RGB_565:
case ETC1:
case RED_8:
+ case RG_88:
case LUMINANCE_F16:
NOTREACHED();
break;
@@ -112,6 +113,7 @@ bool IsFormatSupportedForStorage(ResourceFormat format, bool use_bgra) {
case RGB_565:
case ETC1:
case RED_8:
+ case RG_88:
case LUMINANCE_F16:
return false;
}
@@ -411,7 +413,6 @@ ResourceProvider::ResourceProvider(
use_texture_format_bgra_(false),
use_texture_usage_hint_(false),
use_compressed_texture_etc1_(false),
- yuv_resource_format_(LUMINANCE_8),
max_texture_size_(0),
best_texture_format_(RGBA_8888),
best_render_buffer_format_(RGBA_8888),
@@ -449,15 +450,6 @@ ResourceProvider::ResourceProvider(
use_texture_format_bgra_ = caps.texture_format_bgra8888;
use_texture_usage_hint_ = caps.texture_usage;
use_compressed_texture_etc1_ = caps.texture_format_etc1;
-
- if (caps.disable_one_component_textures) {
- yuv_resource_format_ = yuv_highbit_resource_format_ = RGBA_8888;
- } else {
- yuv_resource_format_ = caps.texture_rg ? RED_8 : LUMINANCE_8;
- yuv_highbit_resource_format_ =
- caps.texture_half_float_linear ? LUMINANCE_F16 : yuv_resource_format_;
- }
-
use_sync_query_ = caps.sync_query;
GLES2Interface* gl = ContextGL();
@@ -523,6 +515,7 @@ bool ResourceProvider::IsResourceFormatSupported(ResourceFormat format) const {
case ETC1:
return caps.texture_format_etc1;
case RED_8:
+ case RG_88:
return caps.texture_rg;
case LUMINANCE_F16:
return caps.texture_half_float_linear;
@@ -549,14 +542,6 @@ void ResourceProvider::LoseResourceForTesting(ResourceId id) {
resource->lost = true;
}
-ResourceFormat ResourceProvider::YuvResourceFormat(int bits) const {
- if (bits > 8) {
- return yuv_highbit_resource_format_;
- } else {
- return yuv_resource_format_;
- }
-}
-
ResourceId ResourceProvider::CreateResource(
const gfx::Size& size,
TextureHint hint,
@@ -656,6 +641,7 @@ ResourceId ResourceProvider::CreateBitmap(const gfx::Size& size,
ResourceId ResourceProvider::CreateResourceFromTextureMailbox(
const TextureMailbox& mailbox,
+ ResourceFormat format,
std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl,
bool read_lock_fences_enabled) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -665,11 +651,10 @@ ResourceId ResourceProvider::CreateResourceFromTextureMailbox(
Resource* resource = nullptr;
if (mailbox.IsTexture()) {
resource = InsertResource(
- id,
- Resource(0, mailbox.size_in_pixels(), Resource::EXTERNAL,
- mailbox.target(),
- mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR,
- TEXTURE_HINT_IMMUTABLE, RESOURCE_TYPE_GL_TEXTURE, RGBA_8888));
+ id, Resource(0, mailbox.size_in_pixels(), Resource::EXTERNAL,
+ mailbox.target(),
+ mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR,
+ TEXTURE_HINT_IMMUTABLE, RESOURCE_TYPE_GL_TEXTURE, format));
} else {
DCHECK(mailbox.IsSharedMemory());
SharedBitmap* shared_bitmap = mailbox.shared_bitmap();
@@ -678,6 +663,7 @@ ResourceId ResourceProvider::CreateResourceFromTextureMailbox(
resource = InsertResource(
id, Resource(pixels, shared_bitmap, mailbox.size_in_pixels(),
Resource::EXTERNAL, GL_LINEAR));
+ resource->format = format;
}
resource->allocated = true;
resource->set_mailbox(mailbox);
@@ -692,6 +678,15 @@ ResourceId ResourceProvider::CreateResourceFromTextureMailbox(
return id;
}
+// TODO(dswang): remove this method. crbug.com/624436
+ResourceId ResourceProvider::CreateResourceFromTextureMailbox(
+ const TextureMailbox& mailbox,
+ std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl,
+ bool read_lock_fences_enabled) {
+ return CreateResourceFromTextureMailbox(
+ mailbox, RGBA_8888, std::move(release_callback_impl), false);
+}
+
ResourceId ResourceProvider::CreateResourceFromTextureMailbox(
const TextureMailbox& mailbox,
std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl) {
@@ -825,6 +820,10 @@ GLenum ResourceProvider::GetResourceTextureTarget(ResourceId id) {
return GetResource(id)->target;
}
+ResourceFormat ResourceProvider::GetResourceFormat(ResourceId id) {
+ return GetResource(id)->format;
+}
+
bool ResourceProvider::IsImmutable(ResourceId id) {
if (IsGpuResourceType(default_resource_type_)) {
return GetTextureHint(id) == TEXTURE_HINT_IMMUTABLE;
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/video_resource_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698