@@ -249,7 +249,7 @@ droid_window_dequeue_buffer(struct dri2_egl_surface *dri2_surf)
249
249
* for updating buffer's age in swap_buffers.
250
250
*/
251
251
EGLBoolean updated = EGL_FALSE ;
252
- for (int i = 0 ; i < dri2_surf -> color_buffers_count ; i ++ ) {
252
+ for (int i = 0 ; i < ARRAY_SIZE ( dri2_surf -> color_buffers ) ; i ++ ) {
253
253
if (!dri2_surf -> color_buffers [i ].buffer ) {
254
254
dri2_surf -> color_buffers [i ].buffer = dri2_surf -> buffer ;
255
255
}
@@ -264,7 +264,7 @@ droid_window_dequeue_buffer(struct dri2_egl_surface *dri2_surf)
264
264
/* In case of all the buffers were recreated by ANativeWindow, reset
265
265
* the color_buffers
266
266
*/
267
- for (int i = 0 ; i < dri2_surf -> color_buffers_count ; i ++ ) {
267
+ for (int i = 0 ; i < ARRAY_SIZE ( dri2_surf -> color_buffers ) ; i ++ ) {
268
268
dri2_surf -> color_buffers [i ].buffer = NULL ;
269
269
dri2_surf -> color_buffers [i ].age = 0 ;
270
270
}
@@ -419,7 +419,6 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
419
419
420
420
if (type == EGL_WINDOW_BIT ) {
421
421
int format ;
422
- int buffer_count ;
423
422
424
423
if (window -> common .magic != ANDROID_NATIVE_WINDOW_MAGIC ) {
425
424
_eglError (EGL_BAD_NATIVE_WINDOW , "droid_create_surface" );
@@ -430,26 +429,6 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
430
429
goto cleanup_surface ;
431
430
}
432
431
433
- /* Query ANativeWindow for MIN_UNDEQUEUED_BUFFER, set buffer count
434
- * and allocate color_buffers.
435
- */
436
- if (window -> query (window , NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS ,
437
- & buffer_count )) {
438
- _eglError (EGL_BAD_NATIVE_WINDOW , "droid_create_surface" );
439
- goto cleanup_surface ;
440
- }
441
- if (native_window_set_buffer_count (window , buffer_count + 1 )) {
442
- _eglError (EGL_BAD_NATIVE_WINDOW , "droid_create_surface" );
443
- goto cleanup_surface ;
444
- }
445
- dri2_surf -> color_buffers = calloc (buffer_count + 1 ,
446
- sizeof (* dri2_surf -> color_buffers ));
447
- if (!dri2_surf -> color_buffers ) {
448
- _eglError (EGL_BAD_ALLOC , "droid_create_surface" );
449
- goto cleanup_surface ;
450
- }
451
- dri2_surf -> color_buffers_count = buffer_count + 1 ;
452
-
453
432
if (format != dri2_conf -> base .NativeVisualID ) {
454
433
_eglLog (_EGL_WARNING , "Native format mismatch: 0x%x != 0x%x" ,
455
434
format , dri2_conf -> base .NativeVisualID );
@@ -477,8 +456,6 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
477
456
return & dri2_surf -> base ;
478
457
479
458
cleanup_surface :
480
- if (dri2_surf -> color_buffers_count )
481
- free (dri2_surf -> color_buffers );
482
459
free (dri2_surf );
483
460
484
461
return NULL ;
@@ -531,7 +508,6 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
531
508
dri2_dpy -> core -> destroyDrawable (dri2_surf -> dri_drawable );
532
509
533
510
dri2_fini_surface (surf );
534
- free (dri2_surf -> color_buffers );
535
511
free (dri2_surf );
536
512
537
513
return EGL_TRUE ;
@@ -780,7 +756,7 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
780
756
return EGL_TRUE ;
781
757
}
782
758
783
- for (int i = 0 ; i < dri2_surf -> color_buffers_count ; i ++ ) {
759
+ for (int i = 0 ; i < ARRAY_SIZE ( dri2_surf -> color_buffers ) ; i ++ ) {
784
760
if (dri2_surf -> color_buffers [i ].age > 0 )
785
761
dri2_surf -> color_buffers [i ].age ++ ;
786
762
}
0 commit comments