summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/gl_common/evas_gl_texture.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-08-31 10:25:02 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-08-31 10:25:02 +0900
commit133ab7f58cc7e51d567fc0ef6a9dcb07333ee208 (patch)
treed95fb312e1e84693f879afe939128d43d8883d7e /src/modules/evas/engines/gl_common/evas_gl_texture.c
parentd71182af7a3c787b30cd6a5747b9d5f055fee003 (diff)
evas - gl common - make yuv gl textures double-bufffered like yuy2
this pulls yuv in line with yuy2 textures and dobule buffers them. this is a workaround some driver bugs where either the driver doesnt block and wait for the gpu to finish with a texture when updating OR it does wait, and when it does it blocks and spins using cpu.
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_texture.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c b/src/modules/evas/engines/gl_common/evas_gl_texture.c
index f6d41dafa3..7e54283e11 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -1453,6 +1453,14 @@ evas_gl_common_texture_free(Evas_GL_Texture *tex, Eina_Bool force EINA_UNUSED)
1453 pt_unref(tex->pt); 1453 pt_unref(tex->pt);
1454 tex->pt = NULL; 1454 tex->pt = NULL;
1455 } 1455 }
1456 if (tex->pt2)
1457 {
1458 tex->pt2->allocations = eina_list_remove(tex->pt2->allocations, tex->apt);
1459 if (tex->apt) eina_rectangle_pool_release(tex->apt);
1460 tex->apt = NULL;
1461 pt_unref(tex->pt2);
1462 tex->pt2 = NULL;
1463 }
1456 if (tex->ptt) 1464 if (tex->ptt)
1457 { 1465 {
1458 tex->ptt->allocations = eina_list_remove(tex->ptt->allocations, tex->aptt); 1466 tex->ptt->allocations = eina_list_remove(tex->ptt->allocations, tex->aptt);
@@ -1464,8 +1472,12 @@ evas_gl_common_texture_free(Evas_GL_Texture *tex, Eina_Bool force EINA_UNUSED)
1464 if (tex->ptu) pt_unref(tex->ptu); 1472 if (tex->ptu) pt_unref(tex->ptu);
1465 if (tex->ptv) pt_unref(tex->ptv); 1473 if (tex->ptv) pt_unref(tex->ptv);
1466 if (tex->ptuv) pt_unref(tex->ptuv); 1474 if (tex->ptuv) pt_unref(tex->ptuv);
1475 if (tex->ptu2) pt_unref(tex->ptu2);
1476 if (tex->ptv2) pt_unref(tex->ptv2);
1467 tex->ptu = NULL; 1477 tex->ptu = NULL;
1468 tex->ptv = NULL; 1478 tex->ptv = NULL;
1479 tex->ptu2 = NULL;
1480 tex->ptv2 = NULL;
1469 tex->ptuv = NULL; 1481 tex->ptuv = NULL;
1470 1482
1471 evas_gl_common_texture_light_free(tex); 1483 evas_gl_common_texture_light_free(tex);
@@ -1695,6 +1707,8 @@ evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigne
1695 tex = evas_gl_common_texture_alloc(gc, w, h, EINA_FALSE); 1707 tex = evas_gl_common_texture_alloc(gc, w, h, EINA_FALSE);
1696 if (!tex) return NULL; 1708 if (!tex) return NULL;
1697 1709
1710 //////////////////////////////////////////////////////////////////////
1711
1698 tex->ptu = _pool_tex_new(gc, (w + 1) / 2, (h + 1) / 2, lum_ifmt, lum_fmt); 1712 tex->ptu = _pool_tex_new(gc, (w + 1) / 2, (h + 1) / 2, lum_ifmt, lum_fmt);
1699 if (!tex->ptu) 1713 if (!tex->ptu)
1700 { 1714 {
@@ -1705,10 +1719,25 @@ evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigne
1705 tex->ptu->slot = -1; 1719 tex->ptu->slot = -1;
1706 tex->ptu->fslot = -1; 1720 tex->ptu->fslot = -1;
1707 tex->ptu->whole = 1; 1721 tex->ptu->whole = 1;
1722
1723 tex->ptu2 = _pool_tex_new(gc, (w + 1) / 2, (h + 1) / 2, lum_ifmt, lum_fmt);
1724 if (!tex->ptu2)
1725 {
1726 evas_gl_common_texture_light_free(tex);
1727 return NULL;
1728 }
1729 gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, tex->ptu2);
1730 tex->ptu2->slot = -1;
1731 tex->ptu2->fslot = -1;
1732 tex->ptu2->whole = 1;
1733
1734 //////////////////////////////////////////////////////////////////////
1735
1708 tex->ptv = _pool_tex_new(gc, tex->ptu->w, tex->ptu->h, lum_ifmt, lum_fmt); 1736 tex->ptv = _pool_tex_new(gc, tex->ptu->w, tex->ptu->h, lum_ifmt, lum_fmt);
1709 if (!tex->ptv) 1737 if (!tex->ptv)
1710 { 1738 {
1711 pt_unref(tex->ptu); 1739 pt_unref(tex->ptu);
1740 pt_unref(tex->ptu2);
1712 evas_gl_common_texture_light_free(tex); 1741 evas_gl_common_texture_light_free(tex);
1713 return NULL; 1742 return NULL;
1714 } 1743 }
@@ -1716,20 +1745,60 @@ evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigne
1716 tex->ptv->slot = -1; 1745 tex->ptv->slot = -1;
1717 tex->ptv->fslot = -1; 1746 tex->ptv->fslot = -1;
1718 tex->ptv->whole = 1; 1747 tex->ptv->whole = 1;
1748
1749 tex->ptv2 = _pool_tex_new(gc, tex->ptu->w, tex->ptu->h, lum_ifmt, lum_fmt);
1750 if (!tex->ptv2)
1751 {
1752 pt_unref(tex->ptu);
1753 pt_unref(tex->ptu2);
1754 pt_unref(tex->ptv);
1755 evas_gl_common_texture_light_free(tex);
1756 return NULL;
1757 }
1758 gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, tex->ptv2);
1759 tex->ptv2->slot = -1;
1760 tex->ptv2->fslot = -1;
1761 tex->ptv2->whole = 1;
1762
1763 //////////////////////////////////////////////////////////////////////
1764
1719 tex->pt = _pool_tex_new(gc, tex->ptu->w * 2, tex->ptu->h * 2, lum_ifmt, lum_fmt); 1765 tex->pt = _pool_tex_new(gc, tex->ptu->w * 2, tex->ptu->h * 2, lum_ifmt, lum_fmt);
1720 if (!tex->pt) 1766 if (!tex->pt)
1721 { 1767 {
1722 pt_unref(tex->ptu); 1768 pt_unref(tex->ptu);
1769 pt_unref(tex->ptu2);
1723 pt_unref(tex->ptv); 1770 pt_unref(tex->ptv);
1771 pt_unref(tex->ptv2);
1724 evas_gl_common_texture_light_free(tex); 1772 evas_gl_common_texture_light_free(tex);
1725 return NULL; 1773 return NULL;
1726 } 1774 }
1727 gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, tex->pt); 1775 gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, tex->pt);
1728 tex->pt->fslot = -1; 1776 tex->pt->fslot = -1;
1729 tex->pt->whole = 1; 1777 tex->pt->whole = 1;
1778
1779 tex->pt2 = _pool_tex_new(gc, tex->ptu->w * 2, tex->ptu->h * 2, lum_ifmt, lum_fmt);
1780 if (!tex->pt2)
1781 {
1782 pt_unref(tex->ptu);
1783 pt_unref(tex->ptu2);
1784 pt_unref(tex->ptv);
1785 pt_unref(tex->ptv2);
1786 pt_unref(tex->pt);
1787 evas_gl_common_texture_light_free(tex);
1788 return NULL;
1789 }
1790 gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, tex->pt2);
1791 tex->pt2->fslot = -1;
1792 tex->pt2->whole = 1;
1793
1794 //////////////////////////////////////////////////////////////////////
1795
1730 tex->pt->references++; 1796 tex->pt->references++;
1731 tex->ptu->references++; 1797 tex->ptu->references++;
1732 tex->ptv->references++; 1798 tex->ptv->references++;
1799 tex->pt2->references++;
1800 tex->ptu2->references++;
1801 tex->ptv2->references++;
1733 evas_gl_common_texture_yuv_update(tex, rows, w, h); 1802 evas_gl_common_texture_yuv_update(tex, rows, w, h);
1734 return tex; 1803 return tex;
1735} 1804}
@@ -1737,7 +1806,20 @@ evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigne
1737void 1806void
1738evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned int w, unsigned int h) 1807evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned int w, unsigned int h)
1739{ 1808{
1809 Evas_GL_Texture_Pool *pt, *ptu, *ptv;
1810
1740 if (!tex->pt) return; 1811 if (!tex->pt) return;
1812
1813 pt = tex->pt;
1814 ptu = tex->ptu;
1815 ptv = tex->ptv;
1816 tex->pt = tex->pt2;
1817 tex->ptu = tex->ptu2;
1818 tex->ptv = tex->ptv2;
1819 tex->pt2 = pt;
1820 tex->ptu2 = ptu;
1821 tex->ptv2 = ptv;
1822
1741 // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2 1823 // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2
1742 if (tex->gc->shared->info.unpack_row_length) 1824 if (tex->gc->shared->info.unpack_row_length)
1743 { 1825 {