summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-15 19:58:43 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-05 15:43:43 +0900
commit1adc3cd915f9bd55337e37fb782bd1c38080478c (patch)
tree0136f4586d45d1c793fd82d2224e24bd502500a0
parent9bd36f7c434f6700979f61bf73d34734b1cd52f8 (diff)
ector: add drawable flag to buffers
This indicates that a buffer can be used as a source to draw pixels. Can't they all do that? Well, not exactly. A CPU buffer can't be drawn by the GPU... not directly at least. That's what this flag is for.
-rw-r--r--src/lib/ector/ector_generic_buffer.eo13
-rw-r--r--src/lib/ector/software/ector_software_buffer.c7
2 files changed, 14 insertions, 6 deletions
diff --git a/src/lib/ector/ector_generic_buffer.eo b/src/lib/ector/ector_generic_buffer.eo
index ae9a87c0ee..a196829c1c 100644
--- a/src/lib/ector/ector_generic_buffer.eo
+++ b/src/lib/ector/ector_generic_buffer.eo
@@ -1,12 +1,13 @@
1enum Ector.Buffer.Flag { 1enum Ector.Buffer.Flag {
2 none = 0x00, [[Buffer may not have any backing]] 2 none = 0x00, [[Buffer may not have any backing, indicates an invalid buffer.]]
3 cpu_readable = 0x01, [[Can be read from the CPU after map. Reading may still be very slow.]] 3 cpu_readable = 0x01, [[Can be read from the CPU after map. Reading may still be very slow.]]
4 cpu_writable = 0x02, [[Can be written to by the CPU after map. Writing may still be very slow.]] 4 cpu_writable = 0x02, [[Can be written to by the CPU after map. Writing may still be very slow.]]
5 renderable = 0x04, [[Can be rendered to, ie CPU memory for SW rendering, or an FBO for GL engine]] 5 renderable = 0x04, [[Can be rendered to, ie CPU memory for SW rendering, or an FBO for GL engine.]]
6 cpu_readable_fast = 0x08, [[Can be read by the CPU at high speed, ie no need for glReadPixels]] 6 drawable = 0x08, [[Can be used as a source of pixels to draw on Evas.]]
7 cpu_writable_fast = 0x0A, [[Can be written by the CPU at high speed, ie no need for GPU texture upload]] 7 cpu_readable_fast = 0x10, [[Can be read by the CPU at high speed, ie no need for glReadPixels.]]
8 uncached = 0x10, [[Backed by uncached memory, ie. slow-ish reads but faster than glReadPixels]] 8 cpu_writable_fast = 0x20, [[Can be written by the CPU at high speed, ie no need for GPU texture upload.]]
9/* non_coherent = 0x20, [[Memory may be mapped but will not be coherent between GPU and CPU. Call flush or invalidate to synchronize it.]] */ 9 uncached = 0x40, [[Backed by uncached memory, ie. slow-ish reads but faster than glReadPixels.]]
10/* non_coherent = 0x80, [[Memory may be mapped but will not be coherent between GPU and CPU. Call flush or invalidate to synchronize it.]] */
10} 11}
11 12
12enum Ector.Buffer.Access_Flag { 13enum Ector.Buffer.Access_Flag {
diff --git a/src/lib/ector/software/ector_software_buffer.c b/src/lib/ector/software/ector_software_buffer.c
index f96d05ad17..376228f5c8 100644
--- a/src/lib/ector/software/ector_software_buffer.c
+++ b/src/lib/ector/software/ector_software_buffer.c
@@ -63,6 +63,12 @@ _ector_software_buffer_base_pixels_clear(Eo *obj, Ector_Software_Buffer_Base_Dat
63 if (!pd->pixels.u8) 63 if (!pd->pixels.u8)
64 return; 64 return;
65 65
66 if (pd->internal.maps)
67 {
68 CRI("Can not call pixels_clear when the buffer is mapped.");
69 return;
70 }
71
66 eo_do(obj, eo_event_callback_call(ECTOR_GENERIC_BUFFER_EVENT_DETACHED, pd->pixels.u8)); 72 eo_do(obj, eo_event_callback_call(ECTOR_GENERIC_BUFFER_EVENT_DETACHED, pd->pixels.u8));
67 if (!pd->nofree) 73 if (!pd->nofree)
68 { 74 {
@@ -320,6 +326,7 @@ EOLIAN static Ector_Buffer_Flag
320_ector_software_buffer_base_ector_generic_buffer_flags_get(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Base_Data *pd) 326_ector_software_buffer_base_ector_generic_buffer_flags_get(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Base_Data *pd)
321{ 327{
322 return ECTOR_BUFFER_FLAG_CPU_READABLE | 328 return ECTOR_BUFFER_FLAG_CPU_READABLE |
329 ECTOR_BUFFER_FLAG_DRAWABLE |
323 ECTOR_BUFFER_FLAG_CPU_READABLE_FAST | 330 ECTOR_BUFFER_FLAG_CPU_READABLE_FAST |
324 ECTOR_BUFFER_FLAG_RENDERABLE | 331 ECTOR_BUFFER_FLAG_RENDERABLE |
325 (pd->writable ? (ECTOR_BUFFER_FLAG_CPU_WRITABLE | 332 (pd->writable ? (ECTOR_BUFFER_FLAG_CPU_WRITABLE |