diff options
author | Lars Op den Kamp <lars@opdenkamp.eu> | 2011-01-07 01:58:24 +0100 |
---|---|---|
committer | Lars Op den Kamp <lars@opdenkamp.eu> | 2011-01-07 01:58:24 +0100 |
commit | 60cdc1303f6fe7e44c743137d08ee17dfd10f360 (patch) | |
tree | 1593672e14416a25a5701064f2764e3994d40321 | |
parent | 84c533c79336f69cd66237d7afd3df878ea2aebf (diff) | |
parent | 569648f2a3b8e094c33d102edd41397ca04b07be (diff) |
Merge remote branch 'upstream/master'
22 files changed, 337 insertions, 403 deletions
diff --git a/.gitignore b/.gitignore index 0a28144739..ce46e354b3 100644 --- a/.gitignore +++ b/.gitignore @@ -67,7 +67,7 @@ autom4te.cache /stamp-h1 /xbmc.bin /xbmc-xrandr -/svn_revision.h +/git_revision.h # /addons/ /addons/com.nullsoft.milkdrop.xbmc/*.vis diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj index e6fd8da169..05e30d6975 100644 --- a/XBMC.xcodeproj/project.pbxproj +++ b/XBMC.xcodeproj/project.pbxproj @@ -7336,7 +7336,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Update version in Info.plist with SVN revision\nSVN_REVISION=\"Unknown\"\nBUNDLE_NAME=\"XBMC\"\n\nSVN_REVISION=\"SVN-\"$(cat svn_revision.h | sed -n 's/\\(.*\\)\\\"\\(.*\\)\\\"\\(.*\\)/\\2/p')\nperl -p -i -e \"s/r####/$SVN_REVISION/\" \"$TARGET_BUILD_DIR/$BUNDLE_NAME.app/Contents/Info.plist\"\n"; + shellScript = "# Update version in Info.plist with Git revision\nGIT_REVISION=\"Unknown\"\nBUNDLE_NAME=\"XBMC\"\n\nGIT_REVISION=\"Git-\"$(cat git_revision.h | sed -n 's/\\(.*\\)\\\"\\(.*\\)\\\"\\(.*\\)/\\2/p')\nperl -p -i -e \"s/r####/$GIT_REVISION/\" \"$TARGET_BUILD_DIR/$BUNDLE_NAME.app/Contents/Info.plist\"\n"; }; F5A1CBDE0F6B0B4700A96ABD /* copy root files */ = { isa = PBXShellScriptBuildPhase; @@ -7379,7 +7379,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Update version in Info.plist with SVN revision\nSVN_REVISION=\"Unknown\"\nBUNDLE_NAME=\"XBMC\"\n\nSVN_REVISION=\"SVN-\"$(cat svn_revision.h | sed -n 's/\\(.*\\)\\\"\\(.*\\)\\\"\\(.*\\)/\\2/p')\nperl -p -i -e \"s/r####/$SVN_REVISION/\" \"$TARGET_BUILD_DIR/$BUNDLE_NAME.app/Contents/Info.plist\"\n"; + shellScript = "# Update version in Info.plist with Git revision\nGIT_REVISION=\"Unknown\"\nBUNDLE_NAME=\"XBMC\"\n\nGIT_REVISION=\"Git-\"$(cat git_revision.h | sed -n 's/\\(.*\\)\\\"\\(.*\\)\\\"\\(.*\\)/\\2/p')\nperl -p -i -e \"s/r####/$GIT_REVISION/\" \"$TARGET_BUILD_DIR/$BUNDLE_NAME.app/Contents/Info.plist\"\n"; }; F5DEC3580E6DEBB2005A4E24 /* copy root files */ = { isa = PBXShellScriptBuildPhase; diff --git a/configure.in b/configure.in index f965216191..7ec2edecb3 100644 --- a/configure.in +++ b/configure.in @@ -1085,7 +1085,6 @@ if test "$ARCH" != "x86_64-linux"; then fi fi -AC_CHECK_PROG(HAVE_SVNVERSION,svnversion,"yes","no",) AC_CHECK_PROG(HAVE_GIT,git,"yes","no",) # Checks for header files. @@ -1258,23 +1257,16 @@ else final_message="$final_message\n Avahi:\tNo" fi -if ! test -n "$SVN_REV" -a "$SVN_REV" != "" ; then - if test "$HAVE_SVNVERSION" = "yes" ; then - SVN_REV=$(svnversion -n -c 2>/dev/null | grep -iv ^exported | sed -e 's/.*\://') - fi - if test "$SVN_REV" = ""; then - if test "$HAVE_GIT" = "yes"; then - SVN_REV=$(./gitrev.sh) - fi - fi - if test "$SVN_REV" = ""; then - SVN_REV="Unknown" - fi +if test "$HAVE_GIT" = "yes"; then + GIT_REV=$(git rev-parse --short HEAD) +fi +if test "$GIT_REV" = ""; then + GIT_REV="Unknown" fi if test "$host_vendor" = "apple"; then - echo "#define SVN_REV \"$SVN_REV\"" > svn_revision.h + echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h else - SDL_DEFINES="$SDL_DEFINES -D'SVN_REV=\"$SVN_REV\"'" + SDL_DEFINES="$SDL_DEFINES -D'GIT_REV=\"$GIT_REV\"'" fi if test "$use_nonfree" = "yes"; then diff --git a/guilib/system.h b/guilib/system.h index 29a4b4244a..73c2244bd6 100644 --- a/guilib/system.h +++ b/guilib/system.h @@ -145,15 +145,15 @@ #endif /***************** - * SVN revision + * Git revision *****************/ #ifdef __APPLE__ -#include "../svn_revision.h" +#include "../git_revision.h" #endif -#ifndef SVN_REV -#define SVN_REV "Unknown" +#ifndef GIT_REV +#define GIT_REV "Unknown" #endif /**************************************** diff --git a/language/Chinese (Simple)/strings.xml b/language/Chinese (Simple)/strings.xml index b03a301f67..0a6e03715e 100644 --- a/language/Chinese (Simple)/strings.xml +++ b/language/Chinese (Simple)/strings.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <!--$Revision$--> -<!--Based on english strings version 35649 --> +<!--Date of translation: 01/06/2011--> <strings> <string id="0">程序</string> <string id="1">图片</string> @@ -142,11 +142,9 @@ <string id="164">无盘</string> <string id="165">当前光盘</string> <string id="166">皮肤</string> - <string id="167"></string> - <string id="168"></string> + <string id="169">分辨率</string> <string id="170">调整显示器刷新率适应视频</string> - <string id="171"></string> <string id="172">发行时间</string> <string id="173">将 4:3 视频显示为</string> @@ -256,7 +254,7 @@ <string id="282">找到%i条</string> <string id="283">查找结果</string> <string id="284">无结果</string> - <string id="286"></string> + <string id="287">字幕</string> <string id="288">字体</string> <string id="289">- 尺寸</string> @@ -276,11 +274,7 @@ <string id="304">语言</string> <string id="305">开启</string> <string id="306">去交错(隔行变逐行)</string> - <string id="307"></string> - <string id="308"></string> - <string id="309"></string> - <string id="310"></string> - <string id="311"></string> + <string id="312">(0=自动)</string> <string id="313">清理资料库</string> <string id="314">准备中...</string> @@ -373,8 +367,7 @@ <string id="404">风</string> <string id="405">露点</string> <string id="406">湿度</string> - <string id="407"></string> - <string id="408"></string> + <string id="409">默认</string> <string id="410">访问天气服务</string> <string id="411">取得天气数据:</string> @@ -477,7 +470,7 @@ <string id="517">最近播放的专辑</string> <string id="518">运行</string> <string id="519">运行方式</string> - <string id="520"></string> + <string id="521">合辑</string> <string id="522">移除源</string> <string id="523">切换媒体</string> @@ -628,7 +621,7 @@ <string id="715">- 分配方式</string> <string id="716">自动(动态分配)</string> <string id="717">手动(静态分配)</string> - <string id="718"></string> + <string id="719">- IP 地址</string> <string id="720">- 子网掩码</string> <string id="721">- 默认网关</string> @@ -639,9 +632,9 @@ <string id="726">修改未保存,继续且不保存吗?</string> <string id="727">Web 服务器</string> <string id="728">FTP 服务器</string> - <string id="729"></string> + <string id="730">- 端口</string> - <string id="731"></string> + <string id="732">保存和应用</string> <string id="733">- 密码</string> <string id="734">无密码</string> @@ -680,7 +673,7 @@ <!-- strings 768 and 769 reserved for more subtitle colors --> <string id="770">错误 %i:不能共享</string> - <string id="771"></string> + <string id="772">音频输出</string> <string id="773">搜索中</string> <string id="774">幻灯图片目录</string> @@ -799,10 +792,6 @@ <string id="1234">程序和图片和音乐</string> <string id="1235">程序和图片和视频</string> - <string id="1245"></string> - <string id="1246"></string> - <string id="1247"></string> - <string id="1250">自动检测</string> <string id="1251">自动检测系统</string> <string id="1252">昵称</string> @@ -855,8 +844,6 @@ <string id="2100">脚本错误!:%s</string> <string id="2101">需要新版本 - 详见日志</string> - <string id="2102"></string> - <string id="2103"></string> <string id="4501">启用 LCD/VFD</string> @@ -927,18 +914,9 @@ <string id="12009">重新生成索引...</string> <string id="12010">返回到音乐窗口</string> <string id="12011">返回到视频窗口</string> - <string id="12012"></string> - <string id="12013"></string> - <string id="12014"></string> - <string id="12015"></string> - <string id="12016"></string> - <string id="12017"></string> - <string id="12018"></string> - <string id="12019"></string> - <string id="12020"></string> + <string id="12021">从头开始播放</string> <string id="12022">从 %s 处继续播放</string> - <string id="12023"></string> <string id="12310">0</string> <string id="12311">1</string> @@ -989,9 +967,7 @@ <string id="12377">将要初始化所有配置</string> <string id="12378">每幅图片显示时间</string> <string id="12379">使用移动和缩放特效</string> - <string id="12380"></string> - <string id="12381"></string> - <string id="12382"></string> + <string id="12383">12小时制</string> <string id="12384">24小时制</string> <string id="12385">日/月</string> @@ -1014,8 +990,7 @@ <string id="13003">- 延迟</string> <string id="13004">- 最小影音文件时长</string> <string id="13005">关机</string> - <string id="13006"></string> - <string id="13007"></string> + <string id="13008">自动关机功能</string> <string id="13009">退出</string> <string id="13010">休眠</string> @@ -1071,28 +1046,11 @@ <string id="13146">控制 XBMC,修改这些设置将影响对</string> <string id="13147">系统的控制。你确认要处理吗?</string> - <string id="13150"></string> - <string id="13151"></string> - <string id="13152"></string> - <string id="13153"></string> - <string id="13154"></string> - <string id="13155"></string> - <string id="13156"></string> - <string id="13157"></string> - <string id="13158"></string> <string id="13159">子网掩码</string> <string id="13160">网关地址</string> <string id="13161">首选 DNS 服务器地址</string> <string id="13162">初始化失败</string> - <string id="13163"></string> - <string id="13164"></string> - <string id="13165"></string> - <string id="13166"></string> - <string id="13167"></string> - <string id="13168"></string> - <string id="13169"></string> - <string id="13170">从不</string> <string id="13171">立即</string> <string id="13172">隔%i秒以后</string> @@ -1132,20 +1090,17 @@ <string id="13283">操作系统:</string> <string id="13284">CPU 速度:</string> - <string id="13285"></string> + <string id="13286">视频芯片:</string> <string id="13287">屏幕分辨率:</string> - <string id="13288"></string> - <string id="13289"></string> - <string id="13290"></string> - <string id="13291"></string> + <string id="13292">A/V 线:</string> - <string id="13293"></string> + <string id="13294">DVD 区域:</string> <string id="13295">互联网:</string> <string id="13296">已经连接到互联网</string> <string id="13297">无法联网,请检查网络设置!</string> - <string id="13298"></string> + <string id="13299">目标温度</string> <string id="13300">风扇转速</string> <string id="13301">自动控温</string> @@ -1184,8 +1139,7 @@ <string id="13334">编辑标签</string> <string id="13335">设为默认</string> <string id="13336">移除按键</string> - <string id="13338"></string> - <string id="13339"></string> + <string id="13340">默认</string> <string id="13341">绿色</string> <string id="13342">橙色</string> @@ -1460,7 +1414,7 @@ <string id="15275">%name% 歌曲周排行</string> <string id="15276">收听 %name% 在 Last.fm 的同好</string> <string id="15277">收听 %name% 的个人 Last.fm</string> - <string id="15278"></string> + <string id="15278">收听 %name% 的 mix Last.fm radio</string> <string id="15279">正在从 Last.fm 获取列表</string> <string id="15280">不能从 Last.fm 获取列表...</string> <string id="15281">输入艺人名来寻找相关资料</string> @@ -1468,7 +1422,7 @@ <string id="15283">%name% 最近听过的歌曲</string> <string id="15284">收听 %name% 在 Last.fm 的推荐</string> <string id="15285">%name% 的排行</string> - <string id="15286"></string> + <string id="15287">你想把目前歌曲加入你的最爱吗?</string> <string id="15288">你想封锁目前的歌曲吗?</string> <string id="15289">加入你的最爱歌曲:'%s'</string> @@ -1531,11 +1485,6 @@ <string id="16103">标记为已观看</string> <string id="16104">标记为未观看</string> <string id="16105">编辑标题</string> - <string id="16106"></string> - <string id="16107"></string> - <string id="16108"></string> - <string id="16109"></string> - <string id="16110"></string> <string id="16200">操作被中断</string> <string id="16201">复制文件失败</string> @@ -1567,9 +1516,6 @@ <string id="16319">DXVA</string> <string id="16400">后处理</string> - <string id="16401"></string> - <string id="16402"></string> - <string id="16403"></string> <string id="17500">显示睡眠时间</string> @@ -1754,8 +1700,7 @@ <string id="20184">根据 EXIF 信息旋转图片</string> <string id="20185">使用海报模式显示剧集</string> <string id="20186">请稍候...</string> - <string id="20187"></string> - <string id="20188"></string> + <string id="20189">启用剧情和评论自动滚动</string> <string id="20190">自定义</string> <string id="20191">显示除错信息</string> @@ -1786,24 +1731,17 @@ <string id="20303">你要跳过并继续吗?</string> <string id="20304">RSS 信源</string> - <string id="20306"></string> <string id="20307">备用 DNS 服务器地址</string> <string id="20308">DHCP 服务器:</string> <string id="20309">新建文件夹</string> <string id="20310">播放时关闭 LCD 背光</string> <string id="20311">未知或板载(保护状态)</string> <string id="20312">暂停时关闭 LCD 背光</string> - <string id="20313"></string> + <string id="20314">视频 - 资料库</string> - <string id="20315"></string> + <string id="20316">排序:标签</string> - <string id="20317"></string> - <string id="20318"></string> - <string id="20319"></string> - <string id="20320"></string> - <string id="20321"></string> - <string id="20322"></string> - <string id="20323"></string> + <string id="20324">分段播放...</string> <string id="20325">重新校准</string> <string id="20326">这个操作会重新校准%s的配置</string> @@ -2252,12 +2190,6 @@ <string id="24089">重新启动扩展功能</string> <string id="24090">锁定扩展功能管理器</string> - <string id="24091"></string> - <string id="24092"></string> - <string id="24093"></string> - <string id="24094"></string> - <string id="24095"></string> - <string id="24096">库中的扩展功能被标记为已损坏。</string> <string id="24097">要在系统中禁用它吗?</string> <string id="24098">已损坏</string> @@ -2269,8 +2201,6 @@ <string id="29801">QWERTY 键盘</string> <string id="29802">音频直通输出启用中</string> - <string id="29999"></string> - <!-- strings 30000 thru 30999 reserved for plugins and plugin settings --> <!-- strings 31000 thru 31999 reserved for skins --> <!-- strings 32000 thru 32999 reserved for scripts --> diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index ea1cafafd3..fced9da792 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -515,9 +515,9 @@ bool CApplication::Create() CLog::Log(LOGNOTICE, "-----------------------------------------------------------------------"); #if defined(__APPLE__) - CLog::Log(LOGNOTICE, "Starting XBMC, Platform: Mac OS X (%s). Built on %s (SVN:%s)", g_sysinfo.GetUnameVersion().c_str(), __DATE__, SVN_REV); + CLog::Log(LOGNOTICE, "Starting XBMC, Platform: Mac OS X (%s). Built on %s (Git:%s)", g_sysinfo.GetUnameVersion().c_str(), __DATE__, GIT_REV); #elif defined(_LINUX) - CLog::Log(LOGNOTICE, "Starting XBMC, Platform: Linux (%s, %s). Built on %s (SVN:%s)", g_sysinfo.GetLinuxDistro().c_str(), g_sysinfo.GetUnameVersion().c_str(), __DATE__, SVN_REV); + CLog::Log(LOGNOTICE, "Starting XBMC, Platform: Linux (%s, %s). Built on %s (Git:%s)", g_sysinfo.GetLinuxDistro().c_str(), g_sysinfo.GetUnameVersion().c_str(), __DATE__, GIT_REV); #elif defined(_WIN32) CLog::Log(LOGNOTICE, "Starting XBMC, Platform: %s. Built on %s (SVN:%s, compiler %i)",g_sysinfo.GetKernelVersion().c_str(), __DATE__, SVN_REV, _MSC_VER); CLog::Log(LOGNOTICE, g_cpuInfo.getCPUModel().c_str()); diff --git a/xbmc/GUISettings.cpp b/xbmc/GUISettings.cpp index 3e03f20a89..19b748e6e6 100644 --- a/xbmc/GUISettings.cpp +++ b/xbmc/GUISettings.cpp @@ -598,7 +598,6 @@ void CGUISettings::Initialize() stretch.insert(make_pair(631,VIEW_MODE_ZOOM)); AddInt(vp, "videoplayer.stretch43", 173, VIEW_MODE_NORMAL, stretch, SPIN_CONTROL_TEXT); #ifdef HAVE_LIBVDPAU - AddBool(NULL, "videoplayer.strictbinding", 13120, false); AddBool(NULL, "videoplayer.vdpau_allow_xrandr", 13122, false); #endif #if defined(HAS_GL) || HAS_GLES == 2 // May need changing for GLES diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp index f5ff4fa5ec..608554489e 100644 --- a/xbmc/Util.cpp +++ b/xbmc/Util.cpp @@ -3273,8 +3273,7 @@ void CUtil::ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CSt for (int i=0;i<iSize;++i) { CStdString strPath2 = CUtil::AddFileToFolder(strLookInPaths[i],cdDir); - if (!HasSlashAtEnd(strPath2)) - strPath2 += "/"; //Should work for both remote and local files + CUtil::AddSlashAtEnd(strPath2); bool pathAlreadyAdded = false; for (unsigned int i=0; i<strLookInPaths.size(); i++) { @@ -3292,8 +3291,7 @@ void CUtil::ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CSt if (g_settings.iAdditionalSubtitleDirectoryChecked == 1) { strPath = g_guiSettings.GetString("subtitles.custompath"); - if (!HasSlashAtEnd(strPath)) - strPath += "/"; //Should work for both remote and local files + CUtil::AddSlashAtEnd(strPath); strLookInPaths.push_back(strPath); } diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp index 30be0510fd..fa3dc03055 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp @@ -154,12 +154,7 @@ CLinuxRendererGL::CLinuxRendererGL() m_rgbBuffer = NULL; m_rgbBufferSize = 0; m_context = NULL; - -#ifdef HAVE_LIBVDPAU - m_StrictBinding = g_guiSettings.GetBool("videoplayer.strictbinding"); -#endif - - m_pboused = false; + m_rgbPbo = 0; m_dllAvUtil = new DllAvUtil; m_dllAvCodec = new DllAvCodec; @@ -172,10 +167,18 @@ CLinuxRendererGL::~CLinuxRendererGL() for (int i = 0; i < NUM_BUFFERS; i++) CloseHandle(m_eventTexturesDone[i]); - if (m_rgbBuffer != NULL) { + if (m_rgbPbo) + { + glDeleteBuffersARB(1, &m_rgbPbo); + m_rgbPbo = 0; + m_rgbBuffer = NULL; + } + else + { delete [] m_rgbBuffer; m_rgbBuffer = NULL; } + if (m_context) { m_dllSwScale->sws_freeContext(m_context); @@ -256,6 +259,9 @@ bool CLinuxRendererGL::Configure(unsigned int width, unsigned int height, unsign m_nonLinStretch = false; m_nonLinStretchGui = false; m_pixelRatio = 1.0; + + m_pboSupported = glewIsSupported("GL_ARB_pixel_buffer_object") && g_guiSettings.GetBool("videoplayer.usepbo"); + return true; } @@ -393,13 +399,20 @@ void CLinuxRendererGL::CalculateTextureSourceRects(int source, int num_planes) void CLinuxRendererGL::LoadPlane( YUVPLANE& plane, int type, unsigned flipindex , unsigned width, unsigned height - , int stride, void* data ) + , int stride, void* data, GLuint* pbo/*= NULL*/ ) { if(plane.flipindex == flipindex) return; - if(plane.pbo) - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, plane.pbo); + //if no pbo given, use the plane pbo + GLuint currPbo; + if (pbo) + currPbo = *pbo; + else + currPbo = plane.pbo; + + if(currPbo) + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, currPbo); glPixelStorei(GL_UNPACK_ROW_LENGTH, stride); glBindTexture(m_textureTarget, plane.id); @@ -420,7 +433,7 @@ void CLinuxRendererGL::LoadPlane( YUVPLANE& plane, int type, unsigned flipindex glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glBindTexture(m_textureTarget, 0); - if(plane.pbo) + if(currPbo) glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); plane.flipindex = flipindex; @@ -432,14 +445,6 @@ void CLinuxRendererGL::UploadYV12Texture(int source) YV12Image* im = &buf.image; YUVFIELDS& fields = buf.fields; -#ifdef HAVE_LIBVDPAU - if ((m_renderMethod & RENDER_VDPAU)) - { - SetEvent(m_eventTexturesDone[source]); - glPixelStorei(GL_UNPACK_ALIGNMENT,1); - return; - } -#endif if (!(im->flags&IMAGE_FLAG_READY)) { SetEvent(m_eventTexturesDone[source]); @@ -571,11 +576,7 @@ void CLinuxRendererGL::RenderUpdate(bool clear, DWORD flags, DWORD alpha) m_iLastRenderBuffer = index; if (clear) - { - glClearColor(m_clearColour, m_clearColour, m_clearColour, 0); - glClear(GL_COLOR_BUFFER_BIT); - glClearColor(0,0,0,0); - } + DrawBlackBars(); if (alpha<255) { @@ -611,6 +612,55 @@ void CLinuxRendererGL::RenderUpdate(bool clear, DWORD flags, DWORD alpha) g_graphicsContext.EndPaint(); } +//draw black bars around the video quad, this is more efficient than glClear() +//since it only sets pixels to black that aren't going to be overwritten by the video +void CLinuxRendererGL::DrawBlackBars() +{ + const CRect& view = g_graphicsContext.GetViewWindow(); + + glColor4f(m_clearColour, m_clearColour, m_clearColour, 1.0f); + glDisable(GL_BLEND); + glBegin(GL_QUADS); + + //top quad + if (m_destRect.y1 > 0.0) + { + glVertex4f(0.0, 0.0, 0.0, 1.0); + glVertex4f(view.Width(), 0.0, 0.0, 1.0); + glVertex4f(view.Width(), m_destRect.y1, 0.0, 1.0); + glVertex4f(0.0, m_destRect.y1, 0.0, 1.0); + } + + //bottom quad + if (m_destRect.y2 < view.Height()) + { + glVertex4f(0.0, m_destRect.y2, 0.0, 1.0); + glVertex4f(view.Width(), m_destRect.y2, 0.0, 1.0); + glVertex4f(view.Width(), view.Height(), 0.0, 1.0); + glVertex4f(0.0, view.Height(), 0.0, 1.0); + } + + //left quad + if (m_destRect.x1 > 0.0) + { + glVertex4f(0.0, m_destRect.y1, 0.0, 1.0); + glVertex4f(m_destRect.x1, m_destRect.y1, 0.0, 1.0); + glVertex4f(m_destRect.x1, m_destRect.y2, 0.0, 1.0); + glVertex4f(0.0, m_destRect.y2, 0.0, 1.0); + } + + //right quad + if (m_destRect.x2 < view.Width()) + { + glVertex4f(m_destRect.x2, m_destRect.y1, 0.0, 1.0); + glVertex4f(view.Width(), m_destRect.y1, 0.0, 1.0); + glVertex4f(view.Width(), m_destRect.y2, 0.0, 1.0); + glVertex4f(m_destRect.x2, m_destRect.y2, 0.0, 1.0); + } + + glEnd(); +} + void CLinuxRendererGL::FlipPage(int source) { UnBindPbo(m_buffers[m_iYV12RenderBuffer]); @@ -715,8 +765,6 @@ unsigned int CLinuxRendererGL::PreInit() m_dllSwScale->sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2); #endif - m_pboused = g_guiSettings.GetBool("videoplayer.usepbo"); - return true; } @@ -960,14 +1008,14 @@ void CLinuxRendererGL::LoadShaders(int field) else CLog::Log(LOGNOTICE, "GL: NPOT texture support detected"); - if (glewIsSupported("GL_ARB_pixel_buffer_object") - && g_guiSettings.GetBool("videoplayer.usepbo") && !(m_renderMethod & RENDER_SW)) + + if (m_pboSupported && !(m_renderMethod & RENDER_SW)) { CLog::Log(LOGNOTICE, "GL: Using GL_ARB_pixel_buffer_object"); - m_pboused = true; + m_pboUsed = true; } else - m_pboused = false; + m_pboUsed = false; // Now that we now the render method, setup texture function handlers if (CONF_FLAGS_FORMAT_MASK(m_iFlags) == CONF_FLAGS_FORMAT_NV12) @@ -983,6 +1031,12 @@ void CLinuxRendererGL::LoadShaders(int field) m_textureCreate = &CLinuxRendererGL::CreateYUV422PackedTexture; m_textureDelete = &CLinuxRendererGL::DeleteYUV422PackedTexture; } + else if (CONF_FLAGS_FORMAT_MASK(m_iFlags) == CONF_FLAGS_FORMAT_VDPAU) + { + m_textureUpload = &CLinuxRendererGL::UploadVDPAUTexture; + m_textureCreate = &CLinuxRendererGL::CreateVDPAUTexture; + m_textureDelete = &CLinuxRendererGL::DeleteVDPAUTexture; + } else if (CONF_FLAGS_FORMAT_MASK(m_iFlags) == CONF_FLAGS_FORMAT_VAAPI) { m_textureUpload = &CLinuxRendererGL::UploadVAAPITexture; @@ -1007,12 +1061,19 @@ void CLinuxRendererGL::UnInit() CLog::Log(LOGDEBUG, "LinuxRendererGL: Cleaning up GL resources"); CSingleLock lock(g_graphicsContext); - if (m_rgbBuffer != NULL) + if (m_rgbPbo) + { + glDeleteBuffersARB(1, &m_rgbPbo); + m_rgbPbo = 0; + m_rgbBuffer = NULL; + } + else { delete [] m_rgbBuffer; m_rgbBuffer = NULL; } m_rgbBufferSize = 0; + if (m_context) { m_dllSwScale->sws_freeContext(m_context); @@ -1336,7 +1397,11 @@ void CLinuxRendererGL::RenderMultiPass(int index, int field) if (m_pVideoFilterShader) { - m_fbo.SetFiltering(GL_TEXTURE_2D, m_pVideoFilterShader->GetTextureFilter()); + GLint filter; + if (!m_pVideoFilterShader->GetTextureFilter(filter)) + filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + + m_fbo.SetFiltering(GL_TEXTURE_2D, filter); m_pVideoFilterShader->SetSourceTexture(0); m_pVideoFilterShader->SetWidth(m_sourceWidth); m_pVideoFilterShader->SetHeight(m_sourceHeight); @@ -1351,7 +1416,10 @@ void CLinuxRendererGL::RenderMultiPass(int index, int field) m_pVideoFilterShader->Enable(); } else - m_fbo.SetFiltering(GL_TEXTURE_2D, GL_LINEAR); + { + GLint filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + m_fbo.SetFiltering(GL_TEXTURE_2D, filter); + } VerifyGLState(); @@ -1388,31 +1456,30 @@ void CLinuxRendererGL::RenderMultiPass(int index, int field) void CLinuxRendererGL::RenderVDPAU(int index, int field) { #ifdef HAVE_LIBVDPAU - CVDPAU *vdpau = m_buffers[m_iYV12RenderBuffer].vdpau; + YUVPLANE &plane = m_buffers[index].fields[field][0]; + CVDPAU *vdpau = m_buffers[m_iYV12RenderBuffer].vdpau; + if (!vdpau) return; glEnable(m_textureTarget); + glActiveTextureARB(GL_TEXTURE0); + glBindTexture(m_textureTarget, plane.id); - if (!vdpau->m_glPixmapTexture) - { - glGenTextures (1, &(vdpau->m_glPixmapTexture)); - CLog::Log(LOGNOTICE,"Created m_glPixmapTexture (%i)",(int)vdpau->m_glPixmapTexture); - } - - glBindTexture(m_textureTarget, vdpau->m_glPixmapTexture); vdpau->BindPixmap(); - glActiveTextureARB(GL_TEXTURE0); - // Try some clamping or wrapping glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); if (m_pVideoFilterShader) { - glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, m_pVideoFilterShader->GetTextureFilter()); - glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, m_pVideoFilterShader->GetTextureFilter()); + GLint filter; + if (!m_pVideoFilterShader->GetTextureFilter(filter)) + filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, filter); + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, filter); m_pVideoFilterShader->SetSourceTexture(0); m_pVideoFilterShader->SetWidth(m_sourceWidth); m_pVideoFilterShader->SetHeight(m_sourceHeight); @@ -1428,8 +1495,9 @@ void CLinuxRendererGL::RenderVDPAU(int index, int field) } else { - glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + GLint filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, filter); + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, filter); } glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); @@ -1452,15 +1520,12 @@ void CLinuxRendererGL::RenderVDPAU(int index, int field) } glEnd(); VerifyGLState(); - if (m_StrictBinding) - { - glBindTexture(m_textureTarget, vdpau->m_glPixmapTexture); - vdpau->ReleasePixmap(); - } if (m_pVideoFilterShader) m_pVideoFilterShader->Disable(); + vdpau->ReleasePixmap(); + glBindTexture (m_textureTarget, 0); glDisable(m_textureTarget); #endif @@ -1500,8 +1565,12 @@ void CLinuxRendererGL::RenderVAAPI(int index, int field) if (m_pVideoFilterShader) { - glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, m_pVideoFilterShader->GetTextureFilter()); - glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, m_pVideoFilterShader->GetTextureFilter()); + GLint filter; + if (!m_pVideoFilterShader->GetTextureFilter(filter)) + filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, filter); + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, filter); m_pVideoFilterShader->SetSourceTexture(0); m_pVideoFilterShader->SetWidth(m_sourceWidth); m_pVideoFilterShader->SetHeight(m_sourceHeight); @@ -1517,8 +1586,9 @@ void CLinuxRendererGL::RenderVAAPI(int index, int field) } else { - glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + GLint filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, filter); + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, filter); } glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); @@ -1626,10 +1696,6 @@ void CLinuxRendererGL::DeleteYV12Texture(int index) YUVFIELDS &fields = m_buffers[index].fields; GLuint *pbo = m_buffers[index].pbo; -#ifdef HAVE_LIBVDPAU - SAFE_RELEASE(m_buffers[index].vdpau); -#endif - if( fields[FIELD_FULL][0].id == 0 ) return; /* finish up all textures, and delete them */ @@ -1698,7 +1764,7 @@ bool CLinuxRendererGL::CreateYV12Texture(int index) im.planesize[2] = im.stride[2] * ( im.height >> im.cshift_y ); bool pboSetup = false; - if (m_pboused) + if (m_pboUsed) { pboSetup = true; glGenBuffersARB(3, pbo); @@ -1930,7 +1996,7 @@ bool CLinuxRendererGL::CreateNV12Texture(int index) im.planesize[2] = 0; bool pboSetup = false; - if (m_pboused) + if (m_pboUsed) { pboSetup = true; glGenBuffersARB(2, pbo); @@ -2110,6 +2176,55 @@ void CLinuxRendererGL::DeleteNV12Texture(int index) } } +void CLinuxRendererGL::DeleteVDPAUTexture(int index) +{ +#ifdef HAVE_LIBVDPAU + YUVPLANE &plane = m_buffers[index].fields[0][0]; + + SAFE_RELEASE(m_buffers[index].vdpau); + + if(plane.id && glIsTexture(plane.id)) + glDeleteTextures(1, &plane.id); + plane.id = 0; +#endif +} + +bool CLinuxRendererGL::CreateVDPAUTexture(int index) +{ +#ifdef HAVE_LIBVDPAU + YV12Image &im = m_buffers[index].image; + YUVFIELDS &fields = m_buffers[index].fields; + YUVPLANE &plane = fields[0][0]; + + DeleteVDPAUTexture(index); + + memset(&im , 0, sizeof(im)); + memset(&fields, 0, sizeof(fields)); + im.height = m_sourceHeight; + im.width = m_sourceWidth; + + plane.texwidth = im.width; + plane.texheight = im.height; + + plane.pixpertex_x = 1; + plane.pixpertex_y = 1; + + glGenTextures(1, &plane.id); + + SetEvent(m_eventTexturesDone[index]); +#endif + return true; +} + +void CLinuxRendererGL::UploadVDPAUTexture(int index) +{ +#ifdef HAVE_LIBVDPAU + SetEvent(m_eventTexturesDone[index]); + glPixelStorei(GL_UNPACK_ALIGNMENT,1); //what's this for? +#endif +} + + void CLinuxRendererGL::DeleteVAAPITexture(int index) { #ifdef HAVE_LIBVA @@ -2385,7 +2500,7 @@ bool CLinuxRendererGL::CreateYUV422PackedTexture(int index) im.planesize[2] = 0; bool pboSetup = false; - if (m_pboused) + if (m_pboUsed) { pboSetup = true; glGenBuffersARB(1, pbo); @@ -2501,12 +2616,8 @@ bool CLinuxRendererGL::CreateYUV422PackedTexture(int index) void CLinuxRendererGL::ToRGBFrame(YV12Image* im, unsigned flipIndexPlane, unsigned flipIndexBuf) { - if(m_rgbBufferSize < m_sourceWidth * m_sourceHeight * 4) - { - delete [] m_rgbBuffer; - m_rgbBufferSize = m_sourceWidth * m_sourceHeight * 4; - m_rgbBuffer = new BYTE[m_rgbBufferSize]; - } + if(m_rgbBufferSize != m_sourceWidth * m_sourceHeight * 4) + SetupRGBBuffer(); else if(flipIndexPlane == flipIndexBuf) return; //conversion already done on the previous iteration @@ -2550,23 +2661,32 @@ void CLinuxRendererGL::ToRGBFrame(YV12Image* im, unsigned flipIndexPlane, unsign return; } + if (m_rgbPbo) + { + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_rgbPbo); + m_rgbBuffer = (BYTE*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY_ARB) + PBO_OFFSET; + } + m_context = m_dllSwScale->sws_getCachedContext(m_context, im->width, im->height, srcFormat, im->width, im->height, PIX_FMT_BGRA, - SWS_FAST_BILINEAR, NULL, NULL, NULL); + SWS_FAST_BILINEAR | SwScaleCPUFlags(), NULL, NULL, NULL); uint8_t *dst[] = { m_rgbBuffer, 0, 0, 0 }; int dstStride[] = { m_sourceWidth * 4, 0, 0, 0 }; m_dllSwScale->sws_scale(m_context, src, srcStride, 0, im->height, dst, dstStride); + + if (m_rgbPbo) + { + glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB); + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); + m_rgbBuffer = (BYTE*)PBO_OFFSET; + } } void CLinuxRendererGL::ToRGBFields(YV12Image* im, unsigned flipIndexPlaneTop, unsigned flipIndexPlaneBot, unsigned flipIndexBuf) { - if(m_rgbBufferSize < m_sourceWidth * m_sourceHeight * 4) - { - delete [] m_rgbBuffer; - m_rgbBufferSize = m_sourceWidth*m_sourceHeight*4; - m_rgbBuffer = new BYTE[m_rgbBufferSize]; - } + if(m_rgbBufferSize != m_sourceWidth * m_sourceHeight * 4) + SetupRGBBuffer(); else if(flipIndexPlaneTop == flipIndexBuf && flipIndexPlaneBot == flipIndexBuf) return; //conversion already done on the previous iteration @@ -2620,10 +2740,16 @@ void CLinuxRendererGL::ToRGBFields(YV12Image* im, unsigned flipIndexPlaneTop, un return; } + if (m_rgbPbo) + { + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_rgbPbo); + m_rgbBuffer = (BYTE*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY_ARB) + PBO_OFFSET; + } + m_context = m_dllSwScale->sws_getCachedContext(m_context, im->width, im->height >> 1, srcFormat, im->width, im->height >> 1, PIX_FMT_BGRA, - SWS_FAST_BILINEAR, NULL, NULL, NULL); + SWS_FAST_BILINEAR | SwScaleCPUFlags(), NULL, NULL, NULL); uint8_t *dstTop[] = { m_rgbBuffer, 0, 0, 0 }; uint8_t *dstBot[] = { m_rgbBuffer + m_sourceWidth * m_sourceHeight * 2, 0, 0, 0 }; int dstStride[] = { m_sourceWidth * 4, 0, 0, 0 }; @@ -2632,6 +2758,50 @@ void CLinuxRendererGL::ToRGBFields(YV12Image* im, unsigned flipIndexPlaneTop, un //the bottom field is placed at the bottom of the rgb buffer m_dllSwScale->sws_scale(m_context, srcTop, srcStrideTop, 0, im->height >> 1, dstTop, dstStride); m_dllSwScale->sws_scale(m_context, srcBot, srcStrideBot, 0, im->height >> 1, dstBot, dstStride); + + if (m_rgbPbo) + { + glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB); + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); + m_rgbBuffer = (BYTE*)PBO_OFFSET; + } +} + +void CLinuxRendererGL::SetupRGBBuffer() +{ + m_rgbBufferSize = m_sourceWidth * m_sourceHeight * 4; + + if (!m_rgbPbo) + delete [] m_rgbBuffer; + + if (m_pboSupported) + { + CLog::Log(LOGNOTICE, "GL: Using GL_ARB_pixel_buffer_object"); + + if (!m_rgbPbo) + glGenBuffersARB(1, &m_rgbPbo); + + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_rgbPbo); + glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_rgbBufferSize + PBO_OFFSET, 0, GL_STREAM_DRAW_ARB); + m_rgbBuffer = (BYTE*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY_ARB) + PBO_OFFSET; + + if (!m_rgbBuffer) + { + CLog::Log(LOGWARNING,"GL: failed to set up pixel buffer object"); + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); + glDeleteBuffersARB(1, &m_rgbPbo); + m_rgbPbo = 0; + } + else + { + glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB); + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); + m_rgbBuffer = (BYTE*)PBO_OFFSET; + } + } + + if (!m_rgbPbo) + m_rgbBuffer = new BYTE[m_rgbBufferSize]; } void CLinuxRendererGL::UploadRGBTexture(int source) @@ -2710,17 +2880,26 @@ void CLinuxRendererGL::UploadRGBTexture(int source) { LoadPlane( fields[FIELD_TOP][0] , GL_BGRA, buf.flipindex , im->width, im->height >> 1 - , m_sourceWidth, m_rgbBuffer ); + , m_sourceWidth, m_rgbBuffer, &m_rgbPbo ); LoadPlane( fields[FIELD_BOT][0], GL_BGRA, buf.flipindex , im->width, im->height >> 1 - , m_sourceWidth, m_rgbBuffer + m_sourceWidth*m_sourceHeight*2); + , m_sourceWidth, m_rgbBuffer + m_sourceWidth*m_sourceHeight*2, &m_rgbPbo ); } else { LoadPlane( fields[FIELD_FULL][0], GL_BGRA, buf.flipindex , im->width, im->height - , m_sourceWidth, m_rgbBuffer ); + , m_sourceWidth, m_rgbBuffer, &m_rgbPbo ); + } + + //after using the pbo to upload, allocate a new buffer so we don't have to wait + //for the upload to finish when mapping the buffer + if (m_rgbPbo) + { + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_rgbPbo); + glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_rgbBufferSize + PBO_OFFSET, 0, GL_STREAM_DRAW_ARB); + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); } if (imaging==2) diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h index 155868f447..06a82b6d8a 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h @@ -157,6 +157,7 @@ public: protected: virtual void Render(DWORD flags, int renderBuffer); + void DrawBlackBars(); virtual void ManageTextures(); int NextYV12Texture(); @@ -178,6 +179,10 @@ protected: void DeleteNV12Texture(int index); bool CreateNV12Texture(int index); + void UploadVDPAUTexture(int index); + void DeleteVDPAUTexture(int index); + bool CreateVDPAUTexture(int index); + void UploadVAAPITexture(int index); void DeleteVAAPITexture(int index); bool CreateVAAPITexture(int index); @@ -189,6 +194,7 @@ protected: void UploadRGBTexture(int index); void ToRGBFrame(YV12Image* im, unsigned flipIndexPlane, unsigned flipIndexBuf); void ToRGBFields(YV12Image* im, unsigned flipIndexPlaneTop, unsigned flipIndexPlaneBot, unsigned flipIndexBuf); + void SetupRGBBuffer(); void CalculateTextureSourceRects(int source, int num_planes); @@ -213,7 +219,6 @@ protected: unsigned short m_renderMethod; RenderQuality m_renderQuality; unsigned int m_flipindex; // just a counter to keep track of if a image has been uploaded - bool m_StrictBinding; // Raw data used by renderer int m_currentField; @@ -268,7 +273,7 @@ protected: void LoadPlane( YUVPLANE& plane, int type, unsigned flipindex , unsigned width, unsigned height - , int stride, void* data ); + , int stride, void* data, GLuint* pbo = NULL ); Shaders::BaseYUV2RGBShader *m_pYUVShader; @@ -285,13 +290,15 @@ protected: DllSwScale *m_dllSwScale; BYTE *m_rgbBuffer; // if software scale is used, this will hold the result image unsigned int m_rgbBufferSize; + GLuint m_rgbPbo; struct SwsContext *m_context; HANDLE m_eventTexturesDone[NUM_BUFFERS]; void BindPbo(YUVBUFFER& buff); void UnBindPbo(YUVBUFFER& buff); - bool m_pboused; + bool m_pboSupported; + bool m_pboUsed; bool m_nonLinStretch; bool m_nonLinStretchGui; diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp index 4dcb40a990..8df3a93e2e 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp @@ -73,10 +73,6 @@ CLinuxRendererGLES::CLinuxRendererGLES() m_pVideoFilterShader = NULL; m_scalingMethod = VS_SCALINGMETHOD_LINEAR; m_scalingMethodGui = (ESCALINGMETHOD)-1; - m_upscalingWidth = 0; - m_upscalingHeight = 0; - memset(&m_imScaled, 0, sizeof(m_imScaled)); - m_isSoftwareUpscaling = false; // default texture handlers to YUV m_textureUpload = &CLinuxRendererGLES::UploadYV12Texture; @@ -101,14 +97,6 @@ CLinuxRendererGLES::~CLinuxRendererGLES() delete [] m_rgbBuffer; m_rgbBuffer = NULL; } - for (int i=0; i<3; i++) - { - if (m_imScaled.plane[i]) - { - delete [] m_imScaled.plane[i]; - m_imScaled.plane[i] = 0; - } - } if (m_pYUVShader) { @@ -161,8 +149,6 @@ bool CLinuxRendererGLES::Configure(unsigned int width, unsigned int height, unsi SetViewMode(g_settings.m_currentVideoSettings.m_ViewMode); ManageDisplay(); - ChooseUpscalingMethod(); - m_bConfigured = true; m_bImageReady = false; m_scalingMethodGui = (ESCALINGMETHOD)-1; @@ -178,84 +164,6 @@ bool CLinuxRendererGLES::Configure(unsigned int width, unsigned int height, unsi return true; } -void CLinuxRendererGLES::ChooseUpscalingMethod() -{ - m_upscalingWidth = m_destRect.Width(); - m_upscalingHeight = m_destRect.Height(); - - int upscale = g_advancedSettings.m_videoHighQualityScaling; - - // See if we're a candiate for upscaling. - bool candidateForUpscaling = false; - if (upscale != SOFTWARE_UPSCALING_DISABLED && (int)m_sourceWidth < m_upscalingWidth && (int)m_sourceHeight < m_upscalingHeight) - { - CLog::Log(LOGWARNING, "Upscale: possible given resolution increase."); - candidateForUpscaling = true; - } - - // Turn if off if we're told to upscale HD content and we're not always on. - if (upscale == SOFTWARE_UPSCALING_SD_CONTENT && (m_sourceHeight >= 720 || m_sourceWidth >= 1280)) - { - CLog::Log(LOGWARNING, "Upscale: Disabled due to HD source."); - candidateForUpscaling = false; - } - - if (candidateForUpscaling) - { - ESCALINGMETHOD ret = (ESCALINGMETHOD)g_advancedSettings.m_videoHighQualityScalingMethod; - - // Make sure to override the default setting for the video - g_settings.m_currentVideoSettings.m_ScalingMethod = ret; - - // Initialize software upscaling. - if (g_advancedSettings.m_videoHighQualityScalingMethod < 10) //non-hardware - { - InitializeSoftwareUpscaling(); - CLog::Log(LOGWARNING, "Upscale: selected algorithm %d", ret); - } - } -} - -void CLinuxRendererGLES::InitializeSoftwareUpscaling() -{ - // Allocate a new destination image. - m_imScaled.cshift_x = m_imScaled.cshift_y = 1; - - // Free the old planes if they exist. - for (int i=0; i<3; i++) - { - if (m_imScaled.plane[i]) - { - delete [] m_imScaled.plane[i]; - m_imScaled.plane[i] = 0; - } - } - - m_imScaled.stride[0] = ALIGN((m_upscalingWidth) , 16); - m_imScaled.stride[1] = ALIGN((m_upscalingWidth>>1), 16); - m_imScaled.stride[2] = ALIGN((m_upscalingWidth>>1), 16); - m_imScaled.plane[0] = new BYTE[m_imScaled.stride[0] * ALIGN((m_upscalingHeight) , 16)]; - m_imScaled.plane[1] = new BYTE[m_imScaled.stride[1] * ALIGN((m_upscalingHeight>>1), 16)]; - m_imScaled.plane[2] = new BYTE[m_imScaled.stride[2] * ALIGN((m_upscalingHeight>>1), 16)]; - m_imScaled.width = m_upscalingWidth; - m_imScaled.height = m_upscalingHeight; - m_imScaled.flags = 0; -} - -bool CLinuxRendererGLES::IsSoftwareUpscaling() -{ - // See if we should be performing software upscaling on this frame. - if (m_scalingMethod < VS_SCALINGMETHOD_BICUBIC_SOFTWARE || - (m_currentField != FIELD_FULL && - g_settings.m_currentVideoSettings.m_InterlaceMethod!=VS_INTERLACEMETHOD_NONE && - g_settings.m_currentVideoSettings.m_InterlaceMethod!=VS_INTERLACEMETHOD_DEINTERLACE)) - { - return false; - } - - return true; -} - int CLinuxRendererGLES::NextYV12Texture() { return (m_iYV12RenderBuffer + 1) % m_NumYV12Buffers; @@ -335,12 +243,7 @@ void CLinuxRendererGLES::CalculateTextureSourceRects(int source, int num_planes) { YUVPLANE& p = fields[field][plane]; - /* software upscaling is precropped */ - if(IsSoftwareUpscaling()) - p.rect.SetRect(0, 0, im->width, im->height); - else - p.rect = m_sourceRect; - + p.rect = m_sourceRect; p.width = im->width; p.height = im->height; @@ -442,15 +345,6 @@ void CLinuxRendererGLES::UploadYV12Texture(int source) return; } - // See if we need to recreate textures. - if (m_isSoftwareUpscaling != IsSoftwareUpscaling()) - { - for (int i = 0 ; i < m_NumYV12Buffers ; i++) - (this->*m_textureCreate)(i); - - im->flags = IMAGE_FLAG_READY; - } - // if we don't have a shader, fallback to SW YUV2RGB for now if (m_renderMethod & RENDER_SW) { @@ -472,32 +366,6 @@ void CLinuxRendererGLES::UploadYV12Texture(int source) m_dllSwScale->sws_freeContext(context); SetEvent(m_eventTexturesDone[source]); } - else if (IsSoftwareUpscaling()) // FIXME: s/w upscaling + RENDER_SW => broken - { - // Perform the scaling. - uint8_t* src[] = { im->plane[0], im->plane[1], im->plane[2], 0 }; - int srcStride[] = { im->stride[0], im->stride[1], im->stride[2], 0 }; - uint8_t* dst[] = { m_imScaled.plane[0], m_imScaled.plane[1], m_imScaled.plane[2], 0 }; - int dstStride[] = { m_imScaled.stride[0], m_imScaled.stride[1], m_imScaled.stride[2], 0 }; - int algorithm = 0; - - switch (m_scalingMethod) - { - case VS_SCALINGMETHOD_BICUBIC_SOFTWARE: algorithm = SWS_BICUBIC; break; - case VS_SCALINGMETHOD_LANCZOS_SOFTWARE: algorithm = SWS_LANCZOS; break; - case VS_SCALINGMETHOD_SINC_SOFTWARE: algorithm = SWS_SINC; break; - default: break; - } - - struct SwsContext *ctx = m_dllSwScale->sws_getContext(im->width, im->height, PIX_FMT_YUV420P, - m_upscalingWidth, m_upscalingHeight, PIX_FMT_YUV420P, - algorithm, NULL, NULL, NULL); - m_dllSwScale->sws_scale(ctx, src, srcStride, 0, im->height, dst, dstStride); - m_dllSwScale->sws_freeContext(ctx); - - im = &m_imScaled; - im->flags = IMAGE_FLAG_READY; - } bool deinterlacing; if (m_currentField == FIELD_FULL) @@ -824,13 +692,6 @@ void CLinuxRendererGLES::UpdateVideoFilter() CLog::Log(LOGERROR, "GL: TODO: This scaler has not yet been implemented"); break; - case VS_SCALINGMETHOD_BICUBIC_SOFTWARE: - case VS_SCALINGMETHOD_LANCZOS_SOFTWARE: - case VS_SCALINGMETHOD_SINC_SOFTWARE: - InitializeSoftwareUpscaling(); - m_renderQuality = RQ_SINGLEPASS; - return; - default: break; } @@ -1007,10 +868,6 @@ void CLinuxRendererGLES::RenderSinglePass(int index, int field) YUVFIELDS &fields = m_buffers[index].fields; YUVPLANES &planes = fields[field]; - // set scissors if we are not in fullscreen video - if ( !(g_graphicsContext.IsFullScreenVideo() || g_graphicsContext.IsCalibrating() )) - g_graphicsContext.ClipToViewWindow(); - if (m_reloadShaders) { m_reloadShaders = 0; @@ -1119,10 +976,6 @@ void CLinuxRendererGLES::RenderMultiPass(int index, int field) YV12Image &im = m_buffers[index].image; YUVPLANES &planes = m_buffers[index].fields[field]; - // set scissors if we are not in fullscreen video - if ( !(g_graphicsContext.IsFullScreenVideo() || g_graphicsContext.IsCalibrating() )) - g_graphicsContext.ClipToViewWindow(); - if (m_reloadShaders) { m_reloadShaders = 0; @@ -1308,10 +1161,6 @@ void CLinuxRendererGLES::RenderSoftware(int index, int field) { YUVPLANES &planes = m_buffers[index].fields[field]; - // set scissors if we are not in fullscreen video - if ( !(g_graphicsContext.IsFullScreenVideo() || g_graphicsContext.IsCalibrating() )) - g_graphicsContext.ClipToViewWindow(); - glDisable(GL_DEPTH_TEST); // Y @@ -1363,7 +1212,7 @@ void CLinuxRendererGLES::RenderSoftware(int index, int field) void CLinuxRendererGLES::CreateThumbnail(CBaseTexture* texture, unsigned int width, unsigned int height) { // get our screen rect - const CRect& rv = g_graphicsContext.GetViewWindow(); + const CRect rv = g_graphicsContext.GetViewWindow(); // save current video rect CRect saveSize = m_destRect; @@ -1432,9 +1281,6 @@ void CLinuxRendererGLES::DeleteYV12Texture(int index) bool CLinuxRendererGLES::CreateYV12Texture(int index) { - // Remember if we're software upscaling. - m_isSoftwareUpscaling = IsSoftwareUpscaling(); - /* since we also want the field textures, pitch must be texture aligned */ YV12Image &im = m_buffers[index].image; YUVFIELDS &fields = m_buffers[index].fields; @@ -1476,16 +1322,8 @@ bool CLinuxRendererGLES::CreateYV12Texture(int index) int fieldshift = (f==FIELD_FULL) ? 0 : 1; YUVPLANES &planes = fields[f]; - if(m_isSoftwareUpscaling) - { - planes[0].texwidth = m_upscalingWidth; - planes[0].texheight = m_upscalingHeight >> fieldshift; - } - else - { - planes[0].texwidth = im.width; - planes[0].texheight = im.height >> fieldshift; - } + planes[0].texwidth = im.width; + planes[0].texheight = im.height >> fieldshift; if (m_renderMethod & RENDER_SW) { @@ -1617,14 +1455,6 @@ bool CLinuxRendererGLES::Supports(ESCALINGMETHOD method) || method == VS_SCALINGMETHOD_LINEAR) return true; - if (g_advancedSettings.m_videoHighQualityScaling != SOFTWARE_UPSCALING_DISABLED) - { - if(method == VS_SCALINGMETHOD_BICUBIC_SOFTWARE - || method == VS_SCALINGMETHOD_LANCZOS_SOFTWARE - || method == VS_SCALINGMETHOD_SINC_SOFTWARE) - return true; - } - return false; } diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h index ec946ddafb..6b41215664 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.h +++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.h @@ -147,10 +147,6 @@ public: protected: virtual void Render(DWORD flags, int renderBuffer); - void ChooseUpscalingMethod(); - bool IsSoftwareUpscaling(); - void InitializeSoftwareUpscaling(); - virtual void ManageTextures(); int NextYV12Texture(); virtual bool ValidateRenderTarget(); @@ -190,12 +186,6 @@ protected: unsigned int m_flipindex; // just a counter to keep track of if a image has been uploaded bool m_StrictBinding; - // Software upscaling. - int m_upscalingWidth; - int m_upscalingHeight; - YV12Image m_imScaled; - bool m_isSoftwareUpscaling; - // Raw data used by renderer int m_currentField; int m_reloadShaders; diff --git a/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h b/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h index 2e990eb094..fc6a050633 100644 --- a/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h +++ b/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h @@ -40,7 +40,7 @@ namespace Shaders { virtual void SetWidth(int w) { m_width = w; m_stepX = w>0?1.0f/w:0; } virtual void SetHeight(int h) { m_height = h; m_stepY = h>0?1.0f/h:0; } virtual void SetNonLinStretch(float stretch) { m_stretch = stretch; } - virtual GLint GetTextureFilter() { return GL_NEAREST; } + virtual bool GetTextureFilter(GLint& filter) { return false; } protected: int m_width; @@ -64,6 +64,8 @@ namespace Shaders { bool OnEnabled(); void Free(); + virtual bool GetTextureFilter(GLint& filter) { filter = GL_NEAREST; return true; } + protected: // kernel textures GLuint m_kernelTex1; @@ -82,7 +84,6 @@ namespace Shaders { StretchFilterShader(); void OnCompiledAndLinked(); bool OnEnabled(); - GLint GetTextureFilter() { return GL_LINEAR; } }; } // end namespace diff --git a/xbmc/cores/dvdplayer/Codecs/DllSwScale.h b/xbmc/cores/dvdplayer/Codecs/DllSwScale.h index a16645a44e..da43968fa0 100644 --- a/xbmc/cores/dvdplayer/Codecs/DllSwScale.h +++ b/xbmc/cores/dvdplayer/Codecs/DllSwScale.h @@ -66,6 +66,17 @@ extern "C" { #endif } +inline int SwScaleCPUFlags() +{ +#if !defined(__powerpc__) && !defined(__ppc__) && !defined(__arm__) + return SWS_CPU_CAPS_MMX; +#elif defined(__powerpc__) || defined(__ppc__) + return SWS_CPU_CAPS_ALTIVEC; +#else + return 0; +#endif +} + class DllSwScaleInterface { public: diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.cpp index 1e2074ff7e..ef10f83f17 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.cpp @@ -267,7 +267,7 @@ DVDVideoPicture* CDVDCodecUtils::ConvertToYUV422PackedPicture(DVDVideoPicture *p struct SwsContext *ctx = dllSwScale.sws_getContext(pSrc->iWidth, pSrc->iHeight, PIX_FMT_YUV420P, pPicture->iWidth, pPicture->iHeight, dstformat, - SWS_FAST_BILINEAR, NULL, NULL, NULL); + SWS_FAST_BILINEAR | SwScaleCPUFlags(), NULL, NULL, NULL); dllSwScale.sws_scale(ctx, src, srcStride, 0, pSrc->iHeight, dst, dstStride); dllSwScale.sws_freeContext(ctx); } diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp index 01dd3f6928..d3920a0936 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp @@ -873,7 +873,7 @@ bool CMPCOutputThread::GetDecoderOutput(void) m_sw_scale_ctx = m_dllSwScale->sws_getCachedContext(m_sw_scale_ctx, pBuffer->m_width, pBuffer->m_height, PIX_FMT_YUYV422, pBuffer->m_width, pBuffer->m_height, PIX_FMT_YUV420P, - SWS_FAST_BILINEAR, NULL, NULL, NULL); + SWS_FAST_BILINEAR | SwScaleCPUFlags(), NULL, NULL, NULL); m_dllSwScale->sws_scale(m_sw_scale_ctx, src, srcStride, 0, pBuffer->m_height, dst, dstStride); } break; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp index 3a00e83186..911dc53435 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -451,7 +451,7 @@ int CDVDVideoCodecFFmpeg::Decode(BYTE* pData, int iSize, double dts, double pts) // convert the picture struct SwsContext *context = m_dllSwScale.sws_getContext(m_pCodecContext->width, m_pCodecContext->height, m_pCodecContext->pix_fmt, m_pCodecContext->width, m_pCodecContext->height, - PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL); + PIX_FMT_YUV420P, SWS_FAST_BILINEAR | SwScaleCPUFlags(), NULL, NULL, NULL); if(context == NULL) { diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp index f99d2dbfc1..1dc39d0ac6 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp @@ -738,7 +738,7 @@ void CDVDVideoCodecVDA::UYVY422_to_YUV420P(uint8_t *yuv422_ptr, int yuv422_strid struct SwsContext *swcontext = m_dllSwScale->sws_getContext( m_videobuffer.iWidth, m_videobuffer.iHeight, PIX_FMT_UYVY422, m_videobuffer.iWidth, m_videobuffer.iHeight, PIX_FMT_YUV420P, - SWS_FAST_BILINEAR, NULL, NULL, NULL); + SWS_FAST_BILINEAR | SwScaleCPUFlags(), NULL, NULL, NULL); if (swcontext) { uint8_t *src[] = { yuv422_ptr, 0, 0, 0 }; @@ -758,7 +758,7 @@ void CDVDVideoCodecVDA::BGRA_to_YUV420P(uint8_t *bgra_ptr, int bgra_stride, DVDV struct SwsContext *swcontext = m_dllSwScale->sws_getContext( m_videobuffer.iWidth, m_videobuffer.iHeight, PIX_FMT_BGRA, m_videobuffer.iWidth, m_videobuffer.iHeight, PIX_FMT_YUV420P, - SWS_FAST_BILINEAR, NULL, NULL, NULL); + SWS_FAST_BILINEAR | SwScaleCPUFlags(), NULL, NULL, NULL); if (swcontext) { uint8_t *src[] = { bgra_ptr, 0, 0, 0 }; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp index fc3eca1d99..8ab52a7a57 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp @@ -97,7 +97,6 @@ CVDPAU::CVDPAU() m_mixerstep = 0; m_glPixmap = 0; - m_glPixmapTexture = 0; m_Pixmap = 0; m_glContext = 0; if (!glXBindTexImageEXT) @@ -380,7 +379,6 @@ void CVDPAU::BindPixmap() } } - glXReleaseTexImageEXT(m_Display, m_glPixmap, GLX_FRONT_LEFT_EXT); glXBindTexImageEXT(m_Display, m_glPixmap, GLX_FRONT_LEFT_EXT, NULL); } else CLog::Log(LOGERROR,"(VDPAU) BindPixmap called without valid pixmap"); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h index 77792d362f..f74ac2766d 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h @@ -88,7 +88,6 @@ public: PFNGLXRELEASETEXIMAGEEXTPROC glXReleaseTexImageEXT; GLXPixmap m_glPixmap; Pixmap m_Pixmap; - GLuint m_glPixmapTexture; GLXContext m_glContext; static void FFReleaseBuffer(AVCodecContext *avctx, AVFrame *pic); diff --git a/xbmc/cores/dvdplayer/DVDFileInfo.cpp b/xbmc/cores/dvdplayer/DVDFileInfo.cpp index 6dc6a2983d..046bc26015 100644 --- a/xbmc/cores/dvdplayer/DVDFileInfo.cpp +++ b/xbmc/cores/dvdplayer/DVDFileInfo.cpp @@ -210,7 +210,7 @@ bool CDVDFileInfo::ExtractThumb(const CStdString &strPath, const CStdString &str BYTE *pOutBuf = new BYTE[nWidth * nHeight * 4]; struct SwsContext *context = dllSwScale.sws_getContext(picture.iWidth, picture.iHeight, - PIX_FMT_YUV420P, nWidth, nHeight, PIX_FMT_BGRA, SWS_FAST_BILINEAR, NULL, NULL, NULL); + PIX_FMT_YUV420P, nWidth, nHeight, PIX_FMT_BGRA, SWS_FAST_BILINEAR | SwScaleCPUFlags(), NULL, NULL, NULL); uint8_t *src[] = { picture.data[0], picture.data[1], picture.data[2], 0 }; int srcStride[] = { picture.iLineSize[0], picture.iLineSize[1], picture.iLineSize[2], 0 }; uint8_t *dst[] = { pOutBuf, 0, 0, 0 }; diff --git a/xbmc/utils/GUIInfoManager.cpp b/xbmc/utils/GUIInfoManager.cpp index cf99e3c0ee..a8973375b6 100644 --- a/xbmc/utils/GUIInfoManager.cpp +++ b/xbmc/utils/GUIInfoManager.cpp @@ -3679,8 +3679,8 @@ CTemperature CGUIInfoManager::GetGPUTemperature() CStdString CGUIInfoManager::GetVersion() { CStdString tmp; -#ifdef SVN_REV - tmp.Format("%s r%s", VERSION_STRING, SVN_REV); +#ifdef GIT_REV + tmp.Format("%s Git:%s", VERSION_STRING, GIT_REV); #else tmp.Format("%s", VERSION_STRING); #endif |