add RegisterRenderFeaturesCallBack and PRESENT_METHOD_BYPASS
authordavilla <davilla@4pi.com>
Sun, 5 May 2013 02:02:58 +0000 (22:02 -0400)
committerdavilla <davilla@4pi.com>
Sun, 5 May 2013 02:54:28 +0000 (22:54 -0400)
xbmc/Application.cpp
xbmc/cores/VideoRenderers/BaseRenderer.cpp
xbmc/cores/VideoRenderers/BaseRenderer.h
xbmc/cores/VideoRenderers/LinuxRendererGL.h
xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp
xbmc/cores/VideoRenderers/LinuxRendererGLES.h
xbmc/cores/VideoRenderers/RenderFeatures.h [new file with mode: 0644]
xbmc/cores/VideoRenderers/RenderManager.cpp
xbmc/cores/VideoRenderers/RenderManager.h
xbmc/cores/VideoRenderers/WinRenderer.h
xbmc/guilib/GUIVideoControl.cpp

index 9a493bf..423c3bd 100644 (file)
@@ -2087,7 +2087,7 @@ void CApplication::Render()
     bool extPlayerActive = m_eCurrentPlayer == EPC_EXTPLAYER && IsPlaying() && !m_AppFocused;
 
     m_bPresentFrame = false;
-    if (!extPlayerActive && g_graphicsContext.IsFullScreenVideo() && !IsPaused())
+    if (!extPlayerActive && g_graphicsContext.IsFullScreenVideo() && !IsPaused() && g_renderManager.RendererHandlesPresent())
     {
       CSingleLock lock(m_frameMutex);
 
index 2184200..899cab2 100644 (file)
@@ -69,6 +69,12 @@ void CBaseRenderer::RegisterRenderUpdateCallBack(const void *ctx, RenderUpdateCa
   m_RenderUpdateCallBackCtx = ctx;
 }
 
+void CBaseRenderer::RegisterRenderFeaturesCallBack(const void *ctx, RenderFeaturesCallBackFn fn)
+{
+  m_RenderFeaturesCallBackFn = fn;
+  m_RenderFeaturesCallBackCtx = ctx;
+}
+
 void CBaseRenderer::ChooseBestResolution(float fps)
 {
   if (fps == 0.0) return;
index 90c2d3a..ac1a0c8 100644 (file)
@@ -25,6 +25,7 @@
 #include "guilib/Resolution.h"
 #include "guilib/Geometry.h"
 #include "RenderFormats.h"
+#include "RenderFeatures.h"
 
 #define MAX_PLANES 3
 #define MAX_FIELDS 3
@@ -52,23 +53,6 @@ enum EFIELDSYNC
   FS_BOT
 };
 
-enum ERENDERFEATURE
-{
-  RENDERFEATURE_GAMMA,
-  RENDERFEATURE_BRIGHTNESS,
-  RENDERFEATURE_CONTRAST,
-  RENDERFEATURE_NOISE,
-  RENDERFEATURE_SHARPNESS,
-  RENDERFEATURE_NONLINSTRETCH,
-  RENDERFEATURE_ROTATION,
-  RENDERFEATURE_STRETCH,
-  RENDERFEATURE_CROP,
-  RENDERFEATURE_ZOOM,
-  RENDERFEATURE_VERTICAL_SHIFT,
-  RENDERFEATURE_PIXEL_RATIO,
-  RENDERFEATURE_POSTPROCESS
-};
-
 // Render Methods
 enum RenderMethods
 {
@@ -82,6 +66,7 @@ enum RenderMethods
 };
 
 typedef void (*RenderUpdateCallBackFn)(const void *ctx, const CRect &SrcRect, const CRect &DestRect);
+typedef void (*RenderFeaturesCallBackFn)(const void *ctx, Features &renderFeatures);
 
 struct DVDVideoPicture;
 
@@ -107,6 +92,7 @@ public:
   std::vector<ERenderFormat> SupportedFormats()  { return std::vector<ERenderFormat>(); }
 
   virtual void RegisterRenderUpdateCallBack(const void *ctx, RenderUpdateCallBackFn fn);
+  virtual void RegisterRenderFeaturesCallBack(const void *ctx, RenderFeaturesCallBackFn fn);
 
   static void SettingOptionsRenderMethodsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int &current);
 
@@ -149,4 +135,7 @@ protected:
 
   const void* m_RenderUpdateCallBackCtx;
   RenderUpdateCallBackFn m_RenderUpdateCallBackFn;
+
+  const void* m_RenderFeaturesCallBackCtx;
+  RenderFeaturesCallBackFn m_RenderFeaturesCallBackFn;
 };
index 40e31c5..44e69ac 100644 (file)
@@ -30,6 +30,7 @@
 #include "guilib/Shader.h"
 #include "settings/VideoSettings.h"
 #include "RenderFlags.h"
+#include "RenderFormats.h"
 #include "guilib/GraphicContext.h"
 #include "BaseRenderer.h"
 #include "RenderFormats.h"
index 402f338..a6dd363 100644 (file)
@@ -202,6 +202,18 @@ bool CLinuxRendererGLES::Configure(unsigned int width, unsigned int height, unsi
   m_RenderUpdateCallBackCtx = NULL;
   if ((m_format == RENDER_FMT_BYPASS) && g_application.GetCurrentPlayer())
   {
+    m_renderFeatures.clear();
+    m_scalingMethods.clear();
+    m_deinterlaceModes.clear();
+    m_deinterlaceMethods.clear();
+
+    if (m_RenderFeaturesCallBackFn)
+    {
+      (*m_RenderFeaturesCallBackFn)(m_RenderFeaturesCallBackCtx, m_renderFeatures);
+      // after setting up m_renderFeatures, we are done with the callback
+      m_RenderFeaturesCallBackFn = NULL;
+      m_RenderFeaturesCallBackCtx = NULL;
+    }
     g_application.m_pPlayer->GetRenderFeatures(m_renderFeatures);
     g_application.m_pPlayer->GetDeinterlaceMethods(m_deinterlaceMethods);
     g_application.m_pPlayer->GetDeinterlaceModes(m_deinterlaceModes);
@@ -758,6 +770,8 @@ void CLinuxRendererGLES::UnInit()
   m_bConfigured = false;
   m_RenderUpdateCallBackFn = NULL;
   m_RenderUpdateCallBackCtx = NULL;
+  m_RenderFeaturesCallBackFn = NULL;
+  m_RenderFeaturesCallBackCtx = NULL;
 }
 
 inline void CLinuxRendererGLES::ReorderDrawPoints()
index cf814d7..ce93e3d 100644 (file)
@@ -29,6 +29,7 @@
 #include "xbmc/guilib/Shader.h"
 #include "settings/VideoSettings.h"
 #include "RenderFlags.h"
+#include "RenderFormats.h"
 #include "guilib/GraphicContext.h"
 #include "BaseRenderer.h"
 #include "xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h"
diff --git a/xbmc/cores/VideoRenderers/RenderFeatures.h b/xbmc/cores/VideoRenderers/RenderFeatures.h
new file mode 100644 (file)
index 0000000..82c2800
--- /dev/null
@@ -0,0 +1,39 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2012 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+enum ERENDERFEATURE
+{
+  RENDERFEATURE_GAMMA,
+  RENDERFEATURE_BRIGHTNESS,
+  RENDERFEATURE_CONTRAST,
+  RENDERFEATURE_NOISE,
+  RENDERFEATURE_SHARPNESS,
+  RENDERFEATURE_NONLINSTRETCH,
+  RENDERFEATURE_ROTATION,
+  RENDERFEATURE_STRETCH,
+  RENDERFEATURE_CROP,
+  RENDERFEATURE_ZOOM,
+  RENDERFEATURE_VERTICAL_SHIFT,
+  RENDERFEATURE_PIXEL_RATIO,
+  RENDERFEATURE_POSTPROCESS
+};
+
+typedef std::vector<int> Features;
index 61410a8..16a2855 100644 (file)
@@ -261,6 +261,9 @@ bool CXBMCRenderManager::Configure(unsigned int width, unsigned int height, unsi
       CApplicationMessenger::Get().SwitchToFullscreen();
       lock.Enter();
     }
+    if( format & RENDER_FMT_BYPASS )
+      m_presentmethod = PRESENT_METHOD_BYPASS;
+
     m_pRenderer->Update(false);
     m_bIsStarted = true;
     m_bReconfigured = true;
@@ -271,6 +274,11 @@ bool CXBMCRenderManager::Configure(unsigned int width, unsigned int height, unsi
   return result;
 }
 
+bool CXBMCRenderManager::RendererHandlesPresent()
+{
+  return IsConfigured() && m_presentmethod != PRESENT_METHOD_BYPASS;
+}
+
 bool CXBMCRenderManager::IsConfigured()
 {
   if (!m_pRenderer)
@@ -657,6 +665,12 @@ void CXBMCRenderManager::RegisterRenderUpdateCallBack(const void *ctx, RenderUpd
     m_pRenderer->RegisterRenderUpdateCallBack(ctx, fn);
 }
 
+void CXBMCRenderManager::RegisterRenderFeaturesCallBack(const void *ctx, RenderFeaturesCallBackFn fn)
+{
+  if (m_pRenderer)
+    m_pRenderer->RegisterRenderFeaturesCallBack(ctx, fn);
+}
+
 void CXBMCRenderManager::Render(bool clear, DWORD flags, DWORD alpha)
 {
   CSharedLock lock(m_sharedSection);
index e79a12b..486bde9 100644 (file)
@@ -110,6 +110,8 @@ public:
 
   void UpdateResolution();
 
+  bool RendererHandlesPresent();
+
 #ifdef HAS_GL
   CLinuxRendererGL    *m_pRenderer;
 #elif HAS_GLES == 2
@@ -131,6 +133,7 @@ public:
   CSharedSection& GetSection() { return m_sharedSection; };
 
   void RegisterRenderUpdateCallBack(const void *ctx, RenderUpdateCallBackFn fn);
+  void RegisterRenderFeaturesCallBack(const void *ctx, RenderFeaturesCallBackFn fn);
 
 protected:
   void Render(bool clear, DWORD flags, DWORD alpha);
@@ -164,6 +167,7 @@ protected:
     PRESENT_METHOD_BLEND,
     PRESENT_METHOD_WEAVE,
     PRESENT_METHOD_BOB,
+    PRESENT_METHOD_BYPASS,
   };
 
   double m_displayLatency;
index 251aa31..3887343 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "guilib/GraphicContext.h"
 #include "RenderFlags.h"
+#include "RenderFormats.h"
 #include "BaseRenderer.h"
 #include "guilib/D3DResource.h"
 #include "RenderCapture.h"
index 4f159e1..7d322ba 100644 (file)
@@ -43,7 +43,8 @@ CGUIVideoControl::~CGUIVideoControl(void)
 void CGUIVideoControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
 {
   // TODO Proper processing which marks when its actually changed. Just mark always for now.
-  MarkDirtyRegion();
+  if (g_renderManager.RendererHandlesPresent())
+    MarkDirtyRegion();
 
   CGUIControl::Process(currentTime, dirtyregions);
 }