Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/mythtv/libs/libmythtv/openglvideo.cpp b/mythtv/libs/libmythtv/openglvideo.cpp
- index 33a5ea0582..f978362ea2 100644
- --- a/mythtv/libs/libmythtv/openglvideo.cpp
- +++ b/mythtv/libs/libmythtv/openglvideo.cpp
- @@ -291,6 +291,7 @@ bool OpenGLVideo::Init(MythRenderOpenGL *glcontext, VideoColourSpace *colourspac
- LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("MMX: %1 PBO: %2")
- .arg(mmx).arg((gl_features & kGLExtPBufObj) > 0));
- + DebugFilterChain();
- return true;
- }
- @@ -462,7 +463,7 @@ bool OpenGLVideo::AddFilter(OpenGLFilterType filter)
- break;
- case kGLFilterBicubic:
- - if (!(gl_features & kGLExtFragProg) || !(gl_features & kGLExtFBufObj))
- + if ((!(gl_features & kGLExtFragProg) && !(gl_features & kGLSL)) || !(gl_features & kGLExtFBufObj))
- {
- LOG(VB_PLAYBACK, LOG_ERR, LOC +
- "Features not available for bicubic filter.");
- @@ -506,7 +507,10 @@ bool OpenGLVideo::AddFilter(OpenGLFilterType filter)
- helperTexture = gl_context->CreateHelperTexture();
- if (!helperTexture)
- + {
- + LOG(VB_GENERAL, LOG_ERR, "Failed to create bicubic helper texture");
- success = false;
- + }
- }
- if (success &&
- @@ -801,7 +805,7 @@ uint OpenGLVideo::CreateVideoTexture(QSize size, QSize &tex_size)
- QSize OpenGLVideo::GetTextureSize(const QSize &size)
- {
- - if (textureRects)
- + if (!textureParametric)
- return size;
- int w = 64;
- @@ -978,7 +982,7 @@ void OpenGLVideo::PrepareFrame(bool topfieldfirst, FrameScanType scan,
- video_rect.left() + video_rect.width(),
- video_rect.top() + video_rect.height());
- - if (!textureRects && (inputsize.height() > 0))
- + if (textureParametric && (inputsize.height() > 0))
- trueheight /= inputsize.height();
- // software bobdeint
- @@ -1426,9 +1430,9 @@ QString OpenGLVideo::GetProgramString(OpenGLFilterType name,
- void OpenGLVideo::CustomiseProgramString(QString &string)
- {
- - string.replace("%1", textureRects ? "RECT" : "2D");
- + string.replace("%1", (textureRects && !textureParametric) ? "RECT" : "2D");
- - if (!textureRects)
- + if (textureParametric)
- {
- string.replace("GLSL_SAMPLER", "sampler2D");
- string.replace("GLSL_TEXTURE", "texture2D");
- @@ -1439,7 +1443,7 @@ void OpenGLVideo::CustomiseProgramString(QString &string)
- float yselect = 1.0f;
- QSize fb_size = GetTextureSize(video_disp_dim);
- - if (!textureRects &&
- + if (textureParametric &&
- (inputTextureSize.height() > 0))
- {
- lineHeight /= inputTextureSize.height();
- @@ -1878,3 +1882,136 @@ void OpenGLVideo::GetProgramStrings(QString &vertex, QString &fragment,
- CustomiseProgramString(vertex);
- CustomiseProgramString(fragment);
- }
- +
- +QString OpenGLVideo::TextureInfo(uint Type, QSize Size)
- +{
- + QString typestr = "Unknown";
- + uint data_type = GL_UNSIGNED_BYTE;
- + QSize size(Size);
- + switch (Type)
- + {
- + case GL_RGBA: typestr = "GL_RGBA"; break;
- + case GL_BGRA: typestr = "GL_BGRA"; break;
- + case GL_YCBCR_MESA: typestr = "GL_YCBCR_MESA"; break;
- + case GL_YCBCR_422_APPLE: typestr = "GL_YCBCR_422_APPLE"; break;
- + case MYTHTV_YV12: typestr = "Mythtv YV12"; break;
- + case MYTHTV_UYVY: typestr = "UYVY (YUV422)"; break;
- + default: break;
- + }
- +
- + return QString("%1 (%2x%3: %4 bytes)")
- + .arg(typestr).arg(size.width()).arg(size.height()).arg(MythRenderOpenGL::GetBufferSize(size, Type, data_type));
- +}
- +
- +void OpenGLVideo::DebugFilterChain(void)
- +{
- + LOG(VB_GENERAL, LOG_INFO, "------------ OpenGLVideo Filter stages ------------");
- + QString cpuload = "High - software YUV to RGB conversion";
- + QSize inputtexturesize(video_dim);
- +
- + if (GL_RGBA == videoTextureType)
- + {
- + cpuload = "None";
- + LOG(VB_GENERAL, LOG_INFO, QString("GPU accceleration\t\t: Video frame already in GPU memory"));
- + }
- + else
- + {
- + cpuload = "Medium - repack from planar to packed format";
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory video frame\t: %1")
- + .arg(QString("YV12/YV420P (%1x%2: %3 bytes)").arg(video_dim.width()).arg(video_dim.height()).arg(video_dim.width() * video_dim.height() * 3 / 2)));
- +
- + if (MYTHTV_UYVY == videoTextureType || GL_YCBCR_422_APPLE == videoTextureType || GL_YCBCR_MESA == videoTextureType)
- + {
- + if (gl_features & kGLExtPBufObj)
- + {
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory to GPU\t\t: Packed with FFmpeg directly to %1").arg(TextureInfo(videoTextureType, inputTextureSize)));
- + LOG(VB_GENERAL, LOG_INFO, QString("\t\t\t\t in GPU memory (PixelBufferObject support)"));
- + }
- + else
- + {
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory processing\t : Packed using FFmpeg to %1").arg(TextureInfo(videoTextureType, video_dim)));
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory to GPU\t: Uploaded to GPU with standard glTexSubImage2D"));
- + }
- +
- + if (MYTHTV_UYVY == videoTextureType)
- + inputtexturesize.setWidth(video_dim.width() >> 1);
- + }
- + else if (MYTHTV_YV12 == videoTextureType)
- + {
- + cpuload = "Low - no repacking/conversion";
- + if (gl_features & kGLExtPBufObj)
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory to GPU\t\t: Simple copy direct to GPU memory (PixelBufferObject support)"));
- + else
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory to GPU\t: Uploaded to GPU with standard glTexSubImage2D"));
- + }
- + else if (GL_BGRA == videoTextureType) // no custom texturing
- + {
- +#ifdef MMX
- + cpuload = "Medium - MMX assisted repack to packed format";
- + if (gl_features & kGLExtPBufObj)
- + {
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory to GPU\t\t: Packed with MMX directly to %1").arg(TextureInfo(videoTextureType, inputTextureSize)));
- + LOG(VB_GENERAL, LOG_INFO, QString("\t\t\t\t in GPU memory (PixelBufferObject support) (No YUV to RGB conversion)"));
- + }
- + else
- + {
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory processing\t : Packed with MMX to %1 (NO YUV to RGB conversion)").arg(TextureInfo(videoTextureType, video_dim)));
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory to GPU\t: Uploaded to GPU with standard glTexSubImage2D"));
- + }
- +#else
- + cpuload = "Medium to high - plain 'C' used to repack. No CPU architecture support";
- + if (gl_features & kGLExtPBufObj)
- + {
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory to GPU\t\t: Packed usinf 'C' code directly to %1").arg(TextureInfo(videoTextureType, inputTextureSize)));
- + LOG(VB_GENERAL, LOG_INFO, QString("\t\t\t\t in GPU memory (PixelBufferObject support) (NO YUV to RGB conversion)"));
- + }
- + else
- + {
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory processing\t : Packed using 'C' code to %1 (NO YUV to RGB conversion)").arg(TextureInfo(videoTextureType, video_dim)));
- + LOG(VB_GENERAL, LOG_INFO, QString("Main memory to GPU\t: Uploaded to GPU with standard glTexSubImage2D"));
- + }
- +#endif
- + }
- + else //
- + { /* software RGB to YUV conversion is broken... */ }
- + }
- +
- + QString source = TextureInfo(GL_RGBA == videoTextureType ? GL_RGBA : GL_BGRA, inputtexturesize);
- + LOG(VB_GENERAL, LOG_INFO, QString("GPU unpacked texture \t: %1").arg(source));
- +
- + // GPU stages
- + source = "Tex " + source;
- + uint fboswitches = 0;
- + glfilt_map_t::iterator it;
- + for (it = filters.begin(); it != filters.end(); ++it)
- + {
- + if (it != filters.begin())
- + fboswitches++;
- +
- + OpenGLFilterType type = it->first;
- + OpenGLFilter *filter = it->second;
- +
- + QString filt;
- + switch (type)
- + {
- + case kGLFilterNone: filt = "None"; break;
- + case kGLFilterResize: filt = "Resize"; break;
- + case kGLFilterBicubic: filt = "Bicubic upsize"; break;
- + case kGLFilterYUV2RGB: filt = "YUV2 to RGB"; break;
- + case kGLFilterYV12RGB: filt = "YV12 to RGB"; break;
- + }
- +
- + QString dest = QString("FBO %1").arg(TextureInfo(GL_RGBA, frameBufferRect.size()));
- + if (filter->outputBuffer == kDefaultBuffer)
- + dest = QString("Screen %1x%2").arg(display_visible_rect.width()).arg(display_visible_rect.height());
- + LOG(VB_GENERAL, LOG_INFO, QString("Source: %1\t Dest: %2\t Filter: %3")
- + .arg(source).arg(dest).arg(filt));
- +
- + source = dest;
- + }
- +
- + LOG(VB_GENERAL, LOG_INFO, QString("Analysis"));
- + LOG(VB_GENERAL, LOG_INFO, QString("CPU usage\t\t\t: ") + cpuload);
- + LOG(VB_GENERAL, LOG_INFO, QString("Framebuffer switches\t: %1").arg(fboswitches));
- + LOG(VB_GENERAL, LOG_INFO, "------------ ------------------------- ------------");
- +}
- diff --git a/mythtv/libs/libmythtv/openglvideo.h b/mythtv/libs/libmythtv/openglvideo.h
- index 08dfb3daf4..cd42a4793e 100644
- --- a/mythtv/libs/libmythtv/openglvideo.h
- +++ b/mythtv/libs/libmythtv/openglvideo.h
- @@ -98,6 +98,8 @@ class OpenGLVideo
- void SetTextureFilters(vector<GLuint> *textures, int filt, int clamp);
- void DeleteTextures(vector<GLuint> *textures);
- void TearDownDeinterlacer(void);
- + QString TextureInfo(uint Type, QSize Size);
- + void DebugFilterChain(void);
- MythRenderOpenGL *gl_context;
- QSize video_disp_dim;
- @@ -122,6 +124,7 @@ class OpenGLVideo
- bool inputUpdated;
- int refsNeeded;
- bool textureRects;
- + bool textureParametric;
- uint textureType;
- uint helperTexture;
- OpenGLFilterType defaultUpsize;
Add Comment
Please, Sign In to add comment