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

Side by Side Diff: content/renderer/pepper/video_decoder_shim.cc

Issue 1132283003: Merge Group Markers into Chromium Traces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make SwapBuffers use the GLES2Decoder GL_Category Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/pepper/video_decoder_shim.h" 5 #include "content/renderer/pepper/video_decoder_shim.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 10
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 format_ = GL_LUMINANCE; 305 format_ = GL_LUMINANCE;
306 } 306 }
307 307
308 if (context_provider_->ContextCapabilities().gpu.max_texture_image_units < 308 if (context_provider_->ContextCapabilities().gpu.max_texture_image_units <
309 4) { 309 4) {
310 // We support YUVA textures and require 4 texture units in the fragment 310 // We support YUVA textures and require 4 texture units in the fragment
311 // stage. 311 // stage.
312 return false; 312 return false;
313 } 313 }
314 314
315 gl_->PushGroupMarkerEXT(0, "YUVConverterContext"); 315 gl_->TraceBeginCHROMIUM("YUVConverter", "YUVConverterContext");
316
317 gl_->GenFramebuffers(1, &frame_buffer_); 316 gl_->GenFramebuffers(1, &frame_buffer_);
318 317
319 y_texture_ = CreateTexture(); 318 y_texture_ = CreateTexture();
320 u_texture_ = CreateTexture(); 319 u_texture_ = CreateTexture();
321 v_texture_ = CreateTexture(); 320 v_texture_ = CreateTexture();
322 a_texture_ = CreateTexture(); 321 a_texture_ = CreateTexture();
323 322
324 // Vertex positions. Also converted to texcoords in vertex shader. 323 // Vertex positions. Also converted to texcoords in vertex shader.
325 GLfloat vertex_positions[] = {-1.f, -1.f, 1.f, -1.f, -1.f, 1.f, 1.f, 1.f}; 324 GLfloat vertex_positions[] = {-1.f, -1.f, 1.f, -1.f, -1.f, 1.f, 1.f, 1.f};
326 325
327 gl_->GenBuffers(1, &vertex_buffer_); 326 gl_->GenBuffers(1, &vertex_buffer_);
328 gl_->BindBuffer(GL_ARRAY_BUFFER, vertex_buffer_); 327 gl_->BindBuffer(GL_ARRAY_BUFFER, vertex_buffer_);
329 gl_->BufferData(GL_ARRAY_BUFFER, 2 * sizeof(GLfloat) * 4, vertex_positions, 328 gl_->BufferData(GL_ARRAY_BUFFER, 2 * sizeof(GLfloat) * 4, vertex_positions,
330 GL_STATIC_DRAW); 329 GL_STATIC_DRAW);
331 gl_->BindBuffer(GL_ARRAY_BUFFER, 0); 330 gl_->BindBuffer(GL_ARRAY_BUFFER, 0);
332 331
333 program_ = CreateShader(); 332 program_ = CreateShader();
334 333
335 gl_->PopGroupMarkerEXT(); 334 gl_->TraceEndCHROMIUM();
336 335
337 context_provider_->InvalidateGrContext(kGrInvalidateState); 336 context_provider_->InvalidateGrContext(kGrInvalidateState);
338 337
339 return (program_ != 0); 338 return (program_ != 0);
340 } 339 }
341 340
342 void VideoDecoderShim::YUVConverter::Convert( 341 void VideoDecoderShim::YUVConverter::Convert(
343 const scoped_refptr<media::VideoFrame>& frame, 342 const scoped_refptr<media::VideoFrame>& frame,
344 GLuint tex_out) { 343 GLuint tex_out) {
345 const float* yuv_matrix = 0; 344 const float* yuv_matrix = 0;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 default: 406 default:
408 NOTREACHED(); 407 NOTREACHED();
409 } 408 }
410 409
411 video_format_ = frame->format(); 410 video_format_ = frame->format();
412 411
413 // Zero these so everything is reset below. 412 // Zero these so everything is reset below.
414 y_width_ = y_height_ = 0; 413 y_width_ = y_height_ = 0;
415 } 414 }
416 415
417 gl_->PushGroupMarkerEXT(0, "YUVConverterContext"); 416 gl_->TraceBeginCHROMIUM("YUVConverter", "YUVConverterContext");
418 417
419 uint32_t ywidth = frame->coded_size().width(); 418 uint32_t ywidth = frame->coded_size().width();
420 uint32_t yheight = frame->coded_size().height(); 419 uint32_t yheight = frame->coded_size().height();
421 420
422 DCHECK_EQ(frame->stride(media::VideoFrame::kUPlane), 421 DCHECK_EQ(frame->stride(media::VideoFrame::kUPlane),
423 frame->stride(media::VideoFrame::kVPlane)); 422 frame->stride(media::VideoFrame::kVPlane));
424 423
425 uint32_t ystride = frame->stride(media::VideoFrame::kYPlane); 424 uint32_t ystride = frame->stride(media::VideoFrame::kYPlane);
426 uint32_t uvstride = frame->stride(media::VideoFrame::kUPlane); 425 uint32_t uvstride = frame->stride(media::VideoFrame::kUPlane);
427 426
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 gl_->ActiveTexture(GL_TEXTURE2); 557 gl_->ActiveTexture(GL_TEXTURE2);
559 gl_->BindTexture(GL_TEXTURE_2D, 0); 558 gl_->BindTexture(GL_TEXTURE_2D, 0);
560 559
561 gl_->ActiveTexture(GL_TEXTURE1); 560 gl_->ActiveTexture(GL_TEXTURE1);
562 gl_->BindTexture(GL_TEXTURE_2D, 0); 561 gl_->BindTexture(GL_TEXTURE_2D, 0);
563 562
564 gl_->ActiveTexture(GL_TEXTURE0); 563 gl_->ActiveTexture(GL_TEXTURE0);
565 gl_->BindTexture(GL_TEXTURE_2D, 0); 564 gl_->BindTexture(GL_TEXTURE_2D, 0);
566 gl_->PixelStorei(GL_UNPACK_ROW_LENGTH, 0); 565 gl_->PixelStorei(GL_UNPACK_ROW_LENGTH, 0);
567 566
568 gl_->PopGroupMarkerEXT(); 567 gl_->TraceEndCHROMIUM();
569 568
570 context_provider_->InvalidateGrContext(kGrInvalidateState); 569 context_provider_->InvalidateGrContext(kGrInvalidateState);
571 } 570 }
572 571
573 struct VideoDecoderShim::PendingDecode { 572 struct VideoDecoderShim::PendingDecode {
574 PendingDecode(uint32_t decode_id, 573 PendingDecode(uint32_t decode_id,
575 const scoped_refptr<media::DecoderBuffer>& buffer); 574 const scoped_refptr<media::DecoderBuffer>& buffer);
576 ~PendingDecode(); 575 ~PendingDecode();
577 576
578 const uint32_t decode_id; 577 const uint32_t decode_id;
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { 1086 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) {
1088 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); 1087 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL();
1089 gles2->DeleteTextures(1, &texture_id); 1088 gles2->DeleteTextures(1, &texture_id);
1090 } 1089 }
1091 1090
1092 void VideoDecoderShim::FlushCommandBuffer() { 1091 void VideoDecoderShim::FlushCommandBuffer() {
1093 context_provider_->ContextGL()->Flush(); 1092 context_provider_->ContextGL()->Flush();
1094 } 1093 }
1095 1094
1096 } // namespace content 1095 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/in_process/context_provider_in_process.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698