diff options
author | Carsten Haitzler <raster@rasterman.com> | 2010-01-24 05:11:54 +0000 |
---|---|---|
committer | Carsten Haitzler <raster@rasterman.com> | 2010-01-24 05:11:54 +0000 |
commit | b06b71050a70354c69ac5fc86a1c23ba89b2305f (patch) | |
tree | 973640206c3b33bbe18fdb53d2268cf8258faa0b /legacy/evas/src/modules/engines/gl_x11/evas_engine.c | |
parent | f5ab46c84e61273f8d13c09a48affa603ffc127e (diff) |
ok. work on native pixmap suppport. have problmes - not sure why. see
comments (create/destory glx pixmap needed for updates to work, but this
makes rendering dead-slow. without it rendering is fast, but updates dont
happen (useless).
anyone know why glxcreatepixmap is needed as well as bindteximage+release
(and destroy pixmap) vs just bind/unbind?
SVN revision: 45508
Diffstat (limited to '')
-rw-r--r-- | legacy/evas/src/modules/engines/gl_x11/evas_engine.c | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/legacy/evas/src/modules/engines/gl_x11/evas_engine.c b/legacy/evas/src/modules/engines/gl_x11/evas_engine.c index 0506f7a729..d9edd392f3 100644 --- a/legacy/evas/src/modules/engines/gl_x11/evas_engine.c +++ b/legacy/evas/src/modules/engines/gl_x11/evas_engine.c | |||
@@ -1024,6 +1024,15 @@ struct _Native | |||
1024 | #endif | 1024 | #endif |
1025 | }; | 1025 | }; |
1026 | 1026 | ||
1027 | // FIXME: this is enabled so updates happen - but its SLOOOOOOOOOOOOOOOW | ||
1028 | // (i am sure this is the reason) not to mention seemingly superfluous. but | ||
1029 | // i need to enable it for it to work on fglrx at least. havent tried nvidia. | ||
1030 | // | ||
1031 | // why is this the case? does anyone know? has anyone tried it on other gfx | ||
1032 | // drivers? | ||
1033 | // | ||
1034 | //#define GLX_TEX_PIXMAP_RECREATE 1 | ||
1035 | |||
1027 | static void | 1036 | static void |
1028 | _native_bind_cb(void *data, void *image) | 1037 | _native_bind_cb(void *data, void *image) |
1029 | { | 1038 | { |
@@ -1040,6 +1049,7 @@ _native_bind_cb(void *data, void *image) | |||
1040 | # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT | 1049 | # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT |
1041 | if (glsym_glXBindTexImage) | 1050 | if (glsym_glXBindTexImage) |
1042 | { | 1051 | { |
1052 | #ifdef GLX_TEX_PIXMAP_RECREATE | ||
1043 | const int pixmap_att[] = | 1053 | const int pixmap_att[] = |
1044 | { | 1054 | { |
1045 | GLX_TEXTURE_TARGET_EXT, | 1055 | GLX_TEXTURE_TARGET_EXT, |
@@ -1051,8 +1061,10 @@ _native_bind_cb(void *data, void *image) | |||
1051 | 1061 | ||
1052 | n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc, | 1062 | n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc, |
1053 | n->pixmap, pixmap_att); | 1063 | n->pixmap, pixmap_att); |
1054 | glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, | 1064 | #endif |
1055 | GLX_FRONT_LEFT_EXT, NULL); | 1065 | if (!im->native.loose) |
1066 | glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, | ||
1067 | GLX_FRONT_LEFT_EXT, NULL); | ||
1056 | } | 1068 | } |
1057 | # endif | 1069 | # endif |
1058 | #endif | 1070 | #endif |
@@ -1074,10 +1086,13 @@ _native_unbind_cb(void *data, void *image) | |||
1074 | # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT | 1086 | # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT |
1075 | if (glsym_glXReleaseTexImage) | 1087 | if (glsym_glXReleaseTexImage) |
1076 | { | 1088 | { |
1077 | glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, | 1089 | if (!im->native.loose) |
1078 | GLX_FRONT_LEFT_EXT); | 1090 | glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, |
1091 | GLX_FRONT_LEFT_EXT); | ||
1092 | #ifdef GLX_TEX_PIXMAP_RECREATE | ||
1079 | glXDestroyPixmap(re->win->disp, n->glx_pixmap); | 1093 | glXDestroyPixmap(re->win->disp, n->glx_pixmap); |
1080 | n->glx_pixmap = 0; | 1094 | n->glx_pixmap = 0; |
1095 | #endif | ||
1081 | } | 1096 | } |
1082 | # endif | 1097 | # endif |
1083 | #endif | 1098 | #endif |
@@ -1100,8 +1115,12 @@ _native_free_cb(void *data, void *image) | |||
1100 | # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT | 1115 | # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT |
1101 | if (n->glx_pixmap) | 1116 | if (n->glx_pixmap) |
1102 | { | 1117 | { |
1103 | glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, | 1118 | if (im->native.loose) |
1104 | GLX_FRONT_LEFT_EXT); | 1119 | { |
1120 | if (glsym_glXReleaseTexImage) | ||
1121 | glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, | ||
1122 | GLX_FRONT_LEFT_EXT); | ||
1123 | } | ||
1105 | glXDestroyPixmap(re->win->disp, n->glx_pixmap); | 1124 | glXDestroyPixmap(re->win->disp, n->glx_pixmap); |
1106 | n->glx_pixmap = 0; | 1125 | n->glx_pixmap = 0; |
1107 | } | 1126 | } |
@@ -1176,18 +1195,19 @@ eng_image_native_set(void *data, void *image, void *native) | |||
1176 | 1195 | ||
1177 | eglChooseConfig(re->win->egl_disp, config_attrs, | 1196 | eglChooseConfig(re->win->egl_disp, config_attrs, |
1178 | &egl_config, 1, &num_config); | 1197 | &egl_config, 1, &num_config); |
1179 | n->egl_surface = eglCreatePixmapSurface(re->win->egl_disp, | ||
1180 | egl_config, pm, | ||
1181 | NULL); | ||
1182 | evas_gl_common_image_native_enable(im); | ||
1183 | n->pixmap = pm; | 1198 | n->pixmap = pm; |
1184 | n->visual = vis; | 1199 | n->visual = vis; |
1185 | im->native.yinvert = 1; | 1200 | im->native.yinvert = 1; |
1201 | im->native.loose = 0; | ||
1186 | im->native.data = n; | 1202 | im->native.data = n; |
1187 | im->native.func.data = re; | 1203 | im->native.func.data = re; |
1188 | im->native.func.bind = _native_bind_cb; | 1204 | im->native.func.bind = _native_bind_cb; |
1189 | im->native.func.unbind = _native_unbind_cb; | 1205 | im->native.func.unbind = _native_unbind_cb; |
1190 | im->native.func.free = _native_free_cb; | 1206 | im->native.func.free = _native_free_cb; |
1207 | n->egl_surface = eglCreatePixmapSurface(re->win->egl_disp, | ||
1208 | egl_config, pm, | ||
1209 | NULL); | ||
1210 | evas_gl_common_image_native_enable(im); | ||
1191 | } | 1211 | } |
1192 | } | 1212 | } |
1193 | #else | 1213 | #else |
@@ -1254,18 +1274,33 @@ eng_image_native_set(void *data, void *image, void *native) | |||
1254 | n = calloc(1, sizeof(Native)); | 1274 | n = calloc(1, sizeof(Native)); |
1255 | if (n) | 1275 | if (n) |
1256 | { | 1276 | { |
1257 | evas_gl_common_image_native_enable(im); | 1277 | #ifndef GLX_TEX_PIXMAP_RECREATE |
1278 | const int pixmap_att[] = | ||
1279 | { | ||
1280 | GLX_TEXTURE_TARGET_EXT, | ||
1281 | GLX_TEXTURE_2D_EXT, | ||
1282 | GLX_TEXTURE_FORMAT_EXT, | ||
1283 | GLX_TEXTURE_FORMAT_RGBA_EXT, | ||
1284 | 0 | ||
1285 | }; | ||
1286 | #endif | ||
1258 | memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); | 1287 | memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); |
1259 | n->pixmap = pm; | 1288 | n->pixmap = pm; |
1260 | n->visual = vis; | 1289 | n->visual = vis; |
1261 | memcpy(&(n->fbc), fbc, sizeof(GLXFBConfig)); | 1290 | memcpy(&(n->fbc), fbc, sizeof(GLXFBConfig)); |
1262 | n->fbc = *fbc; | 1291 | n->fbc = *fbc; |
1263 | im->native.yinvert = yinvert; | 1292 | im->native.yinvert = yinvert; |
1293 | im->native.loose = 0; | ||
1264 | im->native.data = n; | 1294 | im->native.data = n; |
1265 | im->native.func.data = re; | 1295 | im->native.func.data = re; |
1266 | im->native.func.bind = _native_bind_cb; | 1296 | im->native.func.bind = _native_bind_cb; |
1267 | im->native.func.unbind = _native_unbind_cb; | 1297 | im->native.func.unbind = _native_unbind_cb; |
1268 | im->native.func.free = _native_free_cb; | 1298 | im->native.func.free = _native_free_cb; |
1299 | #ifndef GLX_TEX_PIXMAP_RECREATE | ||
1300 | n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc, | ||
1301 | n->pixmap, pixmap_att); | ||
1302 | #endif | ||
1303 | evas_gl_common_image_native_enable(im); | ||
1269 | } | 1304 | } |
1270 | } | 1305 | } |
1271 | } | 1306 | } |