summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2014-01-29 15:26:40 +0000
committerChris Michael <cp.michael@samsung.com>2014-01-29 15:27:24 +0000
commitefbb4d612f98ab3d2e81fd910169a2b27482adf2 (patch)
treef4920faf808c3ac1c64392f98efdd8e7db88bb38
parentdd93f55773c96ae51d60efafac27cd52550e44ea (diff)
Comment out drm/gbm specific code (for now), while implementing Bufferdevs/devilhorns/drm
Abstraction stuff. Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/modules/evas/engines/drm/evas_swapper.c124
1 files changed, 56 insertions, 68 deletions
diff --git a/src/modules/evas/engines/drm/evas_swapper.c b/src/modules/evas/engines/drm/evas_swapper.c
index bb51fb0d96..79f960a95f 100644
--- a/src/modules/evas/engines/drm/evas_swapper.c
+++ b/src/modules/evas/engines/drm/evas_swapper.c
@@ -91,7 +91,8 @@ evas_swapper_setup(int dx, int dy, int w, int h, Outbuf_Depth depth, Eina_Bool a
91 /* try to create new internal Wl_Buffer */ 91 /* try to create new internal Wl_Buffer */
92 if (!_evas_swapper_buffer_new(ws, &(ws->buff[i]))) 92 if (!_evas_swapper_buffer_new(ws, &(ws->buff[i])))
93 { 93 {
94 /* failed to create wl_buffer. free the swapper */ 94 /* failed to create buffer. free the swapper */
95 ERR("Failed to create new buffer");
95 evas_swapper_free(ws); 96 evas_swapper_free(ws);
96 return NULL; 97 return NULL;
97 } 98 }
@@ -108,11 +109,7 @@ evas_swapper_reconfigure(Wl_Swapper *ws, int dx, int dy, int w, int h, Outbuf_De
108 109
109 LOGFN(__FILE__, __LINE__, __FUNCTION__); 110 LOGFN(__FILE__, __LINE__, __FUNCTION__);
110 111
111 if (!ws) 112 if (!ws) return NULL;
112 {
113 ERR("No swapper to reconfigure.");
114 return NULL;
115 }
116 113
117 /* loop the swapper's buffers and free them */ 114 /* loop the swapper's buffers and free them */
118 for (i = 0; i < ws->buff_num; i++) 115 for (i = 0; i < ws->buff_num; i++)
@@ -260,9 +257,9 @@ evas_swapper_buffer_idle_flush(Wl_Swapper *ws)
260static Eina_Bool 257static Eina_Bool
261_evas_swapper_buffer_new(Wl_Swapper *ws, Wl_Buffer *wb) 258_evas_swapper_buffer_new(Wl_Swapper *ws, Wl_Buffer *wb)
262{ 259{
263 struct drm_mode_create_dumb carg; 260 /* struct drm_mode_create_dumb carg; */
264 struct drm_mode_map_dumb marg; 261 /* struct drm_mode_map_dumb marg; */
265 struct drm_mode_destroy_dumb darg; 262 /* struct drm_mode_destroy_dumb darg; */
266 int ret; 263 int ret;
267 264
268 LOGFN(__FILE__, __LINE__, __FUNCTION__); 265 LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -270,69 +267,60 @@ _evas_swapper_buffer_new(Wl_Swapper *ws, Wl_Buffer *wb)
270 wb->w = ws->w; 267 wb->w = ws->w;
271 wb->h = ws->h; 268 wb->h = ws->h;
272 269
273 memset(&carg, 0, sizeof(struct drm_mode_create_dumb)); 270 /* NB: Create drm Dumb FB for software rendering */
274 carg.bpp = 32; 271 /* memset(&carg, 0, sizeof(struct drm_mode_create_dumb)); */
275 carg.width = wb->w; 272 /* carg.bpp = 32; */
276 carg.height = wb->h; 273 /* carg.width = wb->w; */
277 274 /* carg.height = wb->h; */
278 ret = drmIoctl(ws->drm_fd, DRM_IOCTL_MODE_CREATE_DUMB, &carg); 275
279 if (ret < 0) 276 /* ret = drmIoctl(ws->drm_fd, DRM_IOCTL_MODE_CREATE_DUMB, &carg); */
280 { 277 /* if (ret < 0) */
281 ERR("Failed to create dumb buffer: %m"); 278 /* { */
282 return EINA_FALSE; 279 /* ERR("Failed to create dumb buffer: %m"); */
283 } 280 /* return EINA_FALSE; */
284 281 /* } */
285 ret = drmModeAddFB(ws->drm_fd, wb->w, wb->h, 24, 32, 282
286 carg.pitch, carg.handle, &wb->id); 283 /* ret = drmModeAddFB(ws->drm_fd, wb->w, wb->h, 24, 32, */
287 if (ret) 284 /* carg.pitch, carg.handle, &wb->id); */
288 { 285 /* if (ret) */
289 ERR("Failed to add fb: %m"); 286 /* { */
290 goto err; 287 /* ERR("Failed to add fb: %m"); */
291 } 288 /* goto err; */
292 289 /* } */
293 memset(&marg, 0, sizeof(struct drm_mode_map_dumb)); 290
294 marg.handle = carg.handle; 291 /* memset(&marg, 0, sizeof(struct drm_mode_map_dumb)); */
295 ret = drmIoctl(ws->drm_fd, DRM_IOCTL_MODE_MAP_DUMB, &marg); 292 /* marg.handle = carg.handle; */
296 if (ret) 293 /* ret = drmIoctl(ws->drm_fd, DRM_IOCTL_MODE_MAP_DUMB, &marg); */
297 { 294 /* if (ret) */
298 ERR("Failed to Map fb: %m"); 295 /* { */
299 goto err_map; 296 /* ERR("Failed to Map fb: %m"); */
300 } 297 /* goto err_map; */
301 298 /* } */
302 wb->data = mmap(0, carg.size, PROT_WRITE | PROT_READ, MAP_SHARED, 299
303 ws->drm_fd, marg.offset); 300 /* wb->data = mmap(0, carg.size, PROT_WRITE | PROT_READ, MAP_SHARED, */
304 memset(wb->data, 0, carg.size); 301 /* ws->drm_fd, marg.offset); */
305 302 /* memset(wb->data, 0, carg.size); */
306 wb->hdl = marg.handle; 303
307 304 /* wb->hdl = marg.handle; */
308 /* create actual wl_buffer */
309 /* wb->buffer = */
310 /* wl_shm_pool_create_buffer(ws->pool, ws->used_size, wb->w, wb->h, */
311 /* (wb->w * sizeof(int)), format); */
312
313 /* add wayland buffer listener */
314 /* wl_buffer_add_listener(wb->buffer, &_evas_swapper_buffer_listener, wb); */
315
316 /* wb->data = (char *)ws->data + ws->used_size; */
317 305
318 wb->ws = ws; 306 wb->ws = ws;
319 307
320 /* return allocated buffer */ 308 /* return allocated buffer */
321 return EINA_TRUE; 309 return EINA_TRUE;
322 310
323err_map: 311/* err_map: */
324 drmModeRmFB(ws->drm_fd, wb->id); 312/* drmModeRmFB(ws->drm_fd, wb->id); */
325err: 313/* err: */
326 memset(&darg, 0, sizeof(darg)); 314/* memset(&darg, 0, sizeof(darg)); */
327 darg.handle = carg.handle; 315/* darg.handle = carg.handle; */
328 drmIoctl(ws->drm_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &darg); 316/* drmIoctl(ws->drm_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &darg); */
329 return EINA_FALSE; 317/* return EINA_FALSE; */
330} 318}
331 319
332static void 320static void
333_evas_swapper_buffer_free(Wl_Swapper *ws, Wl_Buffer *wb) 321_evas_swapper_buffer_free(Wl_Swapper *ws, Wl_Buffer *wb)
334{ 322{
335 struct drm_mode_destroy_dumb darg; 323 /* struct drm_mode_destroy_dumb darg; */
336 324
337 LOGFN(__FILE__, __LINE__, __FUNCTION__); 325 LOGFN(__FILE__, __LINE__, __FUNCTION__);
338 326
@@ -340,18 +328,18 @@ _evas_swapper_buffer_free(Wl_Swapper *ws, Wl_Buffer *wb)
340 if ((!wb) || (wb->valid)) return; 328 if ((!wb) || (wb->valid)) return;
341 329
342 /* unmap the buffer data */ 330 /* unmap the buffer data */
343 if (wb->data) munmap(wb->data, wb->size); 331 /* if (wb->data) munmap(wb->data, wb->size); */
344 wb->data = NULL; 332 /* wb->data = NULL; */
345 333
346 /* kill the wl_buffer */ 334 /* kill the wl_buffer */
347 if (wb->id) drmModeRmFB(ws->drm_fd, wb->id); 335 /* if (wb->id) drmModeRmFB(ws->drm_fd, wb->id); */
348 336
349 /* if (wb->buffer) wl_buffer_destroy(wb->buffer); */ 337 /* if (wb->buffer) wl_buffer_destroy(wb->buffer); */
350 /* wb->buffer = NULL; */ 338 /* wb->buffer = NULL; */
351 339
352 memset(&darg, 0, sizeof(darg)); 340 /* memset(&darg, 0, sizeof(darg)); */
353 darg.handle = wb->hdl; 341 /* darg.handle = wb->hdl; */
354 drmIoctl(ws->drm_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &darg); 342 /* drmIoctl(ws->drm_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &darg); */
355} 343}
356 344
357static void 345static void
@@ -375,7 +363,7 @@ _evas_swapper_buffer_put(Wl_Swapper *ws, Wl_Buffer *wb, Eina_Rectangle *rects, u
375 { 363 {
376 /* call function to mmap buffer data */ 364 /* call function to mmap buffer data */
377 if (!_evas_swapper_buffer_new(ws, wb)) 365 if (!_evas_swapper_buffer_new(ws, wb))
378 return; 366 return;
379 } 367 }
380 368
381 rect = eina_rectangle_new(0, 0, 0, 0); 369 rect = eina_rectangle_new(0, 0, 0, 0);