[GTK] [TextureMapper] Weird brightness with some videos with acceletared compositing
authorcalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Mar 2014 06:39:51 +0000 (06:39 +0000)
committercalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Mar 2014 06:39:51 +0000 (06:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130665

Reviewed by Martin Robinson.

When we uploaded a video texture to the mapper we were not
considering that some videos could be decoded into a format
without alpha component. Now we check if the video has alpha and
if it does not, we remove the alpha flag when retrieving the
texture from the pool. For this, the method to get the texture
from the pool was modified to receive the flags, that is mapped to
have alpha by default in order not to break any other existing
code.

Though we have a problem with AC in WTR and that makes it
currently not testable, no new tests are needed because once this
is fixed the current test set suffices to detect a possible
regression in this.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::updateTexture): Check
the video format and decide if the texture shall be pulled with
alpha support or not.
* platform/graphics/texmap/TextureMapper.cpp:
(WebCore::TextureMapper::acquireTextureFromPool): Use the flags
when resetting the texture.
* platform/graphics/texmap/TextureMapper.h:
(WebCore::BitmapTexture::Flag::None): Added with 0x00.
(WebCore::TextureMapper::acquireTextureFromPool): Added flag
parameter to set up the texture with the default for including
alpha channel.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166480 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
Source/WebCore/platform/graphics/texmap/TextureMapper.cpp
Source/WebCore/platform/graphics/texmap/TextureMapper.h

index 7ed7841..9a63a89 100644 (file)
@@ -1,3 +1,37 @@
+2014-03-30  Xabier Rodriguez Calvar  <calvaris@igalia.com>
+
+        [GTK] [TextureMapper] Weird brightness with some videos with acceletared compositing
+        https://bugs.webkit.org/show_bug.cgi?id=130665
+
+        Reviewed by Martin Robinson.
+
+        When we uploaded a video texture to the mapper we were not
+        considering that some videos could be decoded into a format
+        without alpha component. Now we check if the video has alpha and
+        if it does not, we remove the alpha flag when retrieving the
+        texture from the pool. For this, the method to get the texture
+        from the pool was modified to receive the flags, that is mapped to
+        have alpha by default in order not to break any other existing
+        code.
+
+        Though we have a problem with AC in WTR and that makes it
+        currently not testable, no new tests are needed because once this
+        is fixed the current test set suffices to detect a possible
+        regression in this.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture): Check
+        the video format and decide if the texture shall be pulled with
+        alpha support or not.
+        * platform/graphics/texmap/TextureMapper.cpp:
+        (WebCore::TextureMapper::acquireTextureFromPool): Use the flags
+        when resetting the texture.
+        * platform/graphics/texmap/TextureMapper.h:
+        (WebCore::BitmapTexture::Flag::None): Added with 0x00.
+        (WebCore::TextureMapper::acquireTextureFromPool): Added flag
+        parameter to set up the texture with the default for including
+        alpha channel.
+
 2014-03-30  Jinwoo Song  <jinwoo7.song@samsung.com>
 
         Adopt range-based for loops to TextCheckerEnchant
index b6ea202..22fcd6a 100644 (file)
@@ -324,7 +324,9 @@ PassRefPtr<BitmapTexture> MediaPlayerPrivateGStreamerBase::updateTexture(Texture
     if (!getVideoSizeAndFormatFromCaps(caps.get(), size, format, pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride))
         return 0;
 
-    RefPtr<BitmapTexture> texture = textureMapper->acquireTextureFromPool(size);
+    const GstVideoFormatInfo* formatInfo = gst_video_format_get_info(format);
+
+    RefPtr<BitmapTexture> texture = textureMapper->acquireTextureFromPool(size, GST_VIDEO_FORMAT_INFO_HAS_ALPHA(formatInfo) ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
 
 #if GST_CHECK_VERSION(1, 1, 0)
     GstVideoGLTextureUploadMeta* meta;
index 4cf4462..3e07f74 100644 (file)
@@ -121,10 +121,10 @@ PassRefPtr<BitmapTexture> BitmapTexturePool::acquireTexture(const IntSize& size,
     return selectedEntry->m_texture;
 }
 
-PassRefPtr<BitmapTexture> TextureMapper::acquireTextureFromPool(const IntSize& size)
+PassRefPtr<BitmapTexture> TextureMapper::acquireTextureFromPool(const IntSize& size, const BitmapTexture::Flags flags)
 {
     RefPtr<BitmapTexture> selectedTexture = m_texturePool->acquireTexture(size, this);
-    selectedTexture->reset(size, BitmapTexture::SupportsAlpha);
+    selectedTexture->reset(size, flags);
     return selectedTexture;
 }
 
index 2c86d72..1996a79 100644 (file)
@@ -47,6 +47,7 @@ class FilterOperations;
 class BitmapTexture : public RefCounted<BitmapTexture> {
 public:
     enum Flag {
+        NoFlag = 0,
         SupportsAlpha = 0x01
     };
 
@@ -156,7 +157,7 @@ public:
 
     virtual IntSize maxTextureSize() const = 0;
 
-    virtual PassRefPtr<BitmapTexture> acquireTextureFromPool(const IntSize&);
+    virtual PassRefPtr<BitmapTexture> acquireTextureFromPool(const IntSize&, const BitmapTexture::Flags = BitmapTexture::SupportsAlpha);
 
     void setPatternTransform(const TransformationMatrix& p) { m_patternTransform = p; }
     void setWrapMode(WrapMode m) { m_wrapMode = m; }