• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/libva


Commit MetaInfo

Revisióndc4441592451ad3d3cfd4a343459ca25dbb634a4 (tree)
Tiempo2016-07-26 19:50:10
AutorJaap Jan Meijer <jjmeijer88@gmai...>
CommiterJaap Jan Meijer

Log Message

Android: fix Android build

Cambiar Resumen

Diferencia incremental

--- a/test/putsurface/Android.mk
+++ b/test/putsurface/Android.mk
@@ -10,7 +10,7 @@ LOCAL_SRC_FILES := \
1010 #putsurface_x11.c
1111
1212 LOCAL_CFLAGS += \
13- -DANDROID
13+ -DANDROID -Wno-unused-parameter
1414
1515 LOCAL_C_INCLUDES += \
1616 $(TARGET_OUT_HEADERS)/libva
--- a/test/putsurface/Makefile.am
+++ b/test/putsurface/Makefile.am
@@ -22,7 +22,7 @@
2222
2323 bin_PROGRAMS = putsurface
2424
25-AM_CPPFLAGS = \
25+INCLUDES = \
2626 -I$(top_srcdir) \
2727 -I$(top_builddir) \
2828 $(NULL)
--- a/test/putsurface/putsurface_android.cpp
+++ b/test/putsurface/putsurface_android.cpp
@@ -47,7 +47,7 @@ static void close_display(void *win_display);
4747 static int create_window(void *win_display, int x, int y, int width, int height);
4848 static int check_window_event(void *x11_display, void *win, int *width, int *height, int *quit);
4949
50-#define CAST_DRAWABLE(a) static_cast<ANativeWindow *>((void *)(*(unsigned int *)a))
50+#define CAST_DRAWABLE(a) static_cast<ANativeWindow *>((void *)(*(unsigned long *)a))
5151 #include "putsurface_common.c"
5252
5353 static void *open_display()
--- a/test/putsurface/putsurface_common.c
+++ b/test/putsurface/putsurface_common.c
@@ -8,11 +8,11 @@
88 * distribute, sub license, and/or sell copies of the Software, and to
99 * permit persons to whom the Software is furnished to do so, subject to
1010 * the following conditions:
11- *
11+ *
1212 * The above copyright notice and this permission notice (including the
1313 * next paragraph) shall be included in all copies or substantial portions
1414 * of the Software.
15- *
15+ *
1616 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1717 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1818 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -83,13 +83,13 @@ static int box_width = 32;
8383 static int multi_thread = 0;
8484 static int verbose = 0;
8585 static int test_color_conversion = 0;
86-static int csc_src_fourcc = 0, csc_dst_fourcc = 0;
86+static unsigned int csc_src_fourcc = 0, csc_dst_fourcc = 0;
8787 static VAImage csc_dst_fourcc_image;
8888 static VASurfaceID csc_render_surface;
8989
9090
9191 typedef struct {
92- char* fmt_str;
92+ const char * fmt_str;
9393 unsigned int fourcc;
9494 } fourcc_map;
9595 fourcc_map va_fourcc_map[] = {
@@ -104,7 +104,7 @@ fourcc_map va_fourcc_map[] = {
104104 };
105105 unsigned int map_str_to_vafourcc (char * str)
106106 {
107- int i;
107+ unsigned int i;
108108 for (i=0; i< sizeof(va_fourcc_map)/sizeof(fourcc_map); i++) {
109109 if (!strcmp(va_fourcc_map[i].fmt_str, str)) {
110110 return va_fourcc_map[i].fourcc;
@@ -114,10 +114,10 @@ unsigned int map_str_to_vafourcc (char * str)
114114 return 0;
115115
116116 }
117-char* map_vafourcc_to_str (unsigned int format)
117+const char* map_vafourcc_to_str (unsigned int format)
118118 {
119119 static char unknown_format[] = "unknown-format";
120- int i;
120+ unsigned int i;
121121 for (i=0; i< sizeof(va_fourcc_map)/sizeof(fourcc_map); i++) {
122122 if (va_fourcc_map[i].fourcc == format) {
123123 return va_fourcc_map[i].fmt_str;
@@ -161,7 +161,7 @@ ensure_image_formats(void)
161161 if (num_image_formats == 0)
162162 return 0;
163163
164- image_formats = malloc(num_image_formats * sizeof(*image_formats));
164+ image_formats = (VAImageFormat *) malloc(num_image_formats * sizeof(*image_formats));
165165 if (!image_formats)
166166 return 0;
167167
@@ -210,7 +210,7 @@ ensure_surface_attribs(void)
210210 /* Guess the number of surface attributes, thus including any
211211 pixel-format supported by the VA driver */
212212 num_surface_attribs = VASurfaceAttribCount + num_image_formats;
213- surface_attribs = malloc(num_surface_attribs * sizeof(*surface_attribs));
213+ surface_attribs = (VASurfaceAttrib *) malloc(num_surface_attribs * sizeof(*surface_attribs));
214214 if (!surface_attribs)
215215 return 0;
216216
@@ -219,7 +219,7 @@ ensure_surface_attribs(void)
219219 if (va_status == VA_STATUS_SUCCESS)
220220 va_surface_attribs = surface_attribs;
221221 else if (va_status == VA_STATUS_ERROR_MAX_NUM_EXCEEDED) {
222- va_surface_attribs = realloc(surface_attribs,
222+ va_surface_attribs = (VASurfaceAttrib *) realloc(surface_attribs,
223223 num_surface_attribs * sizeof(*va_surface_attribs));
224224 if (!va_surface_attribs) {
225225 free(surface_attribs);
@@ -256,7 +256,8 @@ lookup_surface_attrib(VASurfaceAttribType type, const VAGenericValue *value)
256256 int csc_preparation ()
257257 {
258258 VAStatus va_status;
259-
259+ VASurfaceAttrib surface_attribs[1], * const s_attrib = &surface_attribs[0];
260+
260261 // 1. make sure dst fourcc is supported for vaImage
261262 if (!lookup_image_format(csc_dst_fourcc)) {
262263 test_color_conversion = 0;
@@ -265,7 +266,6 @@ int csc_preparation ()
265266 }
266267
267268 // 2. make sure src_fourcc is supported for vaSurface
268- VASurfaceAttrib surface_attribs[1], * const s_attrib = &surface_attribs[0];
269269 s_attrib->type = VASurfaceAttribPixelFormat;
270270 s_attrib->flags = VA_SURFACE_ATTRIB_SETTABLE;
271271 s_attrib->value.type = VAGenericValueTypeInteger;
@@ -292,18 +292,18 @@ int csc_preparation ()
292292 image_format.fourcc = csc_dst_fourcc;
293293 image_format.byte_order = VA_LSB_FIRST;
294294 image_format.bits_per_pixel = 16;
295-
295+
296296 va_status = vaCreateImage(va_dpy, &image_format,
297297 surface_width, surface_height,
298298 &csc_dst_fourcc_image);
299299 CHECK_VASTATUS(va_status,"vaCreateImage");
300-
300+
301301
302302 // 3.3 create a temp VASurface for final rendering(vaPutSurface)
303303 s_attrib->value.value.i = VA_FOURCC_NV12;
304- va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420,
304+ va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420,
305305 surface_width, surface_height,
306- &csc_render_surface, 1,
306+ &csc_render_surface, 1,
307307 surface_attribs, 1);
308308 CHECK_VASTATUS(va_status,"vaCreateSurfaces");
309309
@@ -328,7 +328,7 @@ static VASurfaceID get_next_free_surface(int *index)
328328
329329 return surface_id[i];
330330 }
331-
331+
332332 for (i=0; i<SURFACE_NUM; i++) {
333333 surface_status = (VASurfaceStatus)0;
334334 vaQuerySurfaceStatus(va_dpy, surface_id[i], &surface_status);
@@ -356,11 +356,11 @@ static int upload_source_YUV_once_for_all()
356356 int box_width_loc=8;
357357 int row_shift_loc=0;
358358 int i;
359-
359+
360360 for (i=0; i<SURFACE_NUM; i++) {
361361 printf("\rLoading data into surface %d.....", i);
362362 upload_surface(va_dpy, surface_id[i], box_width_loc, row_shift_loc, 0);
363-
363+
364364 row_shift_loc++;
365365 if (row_shift_loc==(2*box_width_loc)) row_shift_loc= 0;
366366 }
@@ -384,9 +384,9 @@ static void update_clipbox(VARectangle *cliprects, int width, int height)
384384 {
385385 if (test_clip == 0)
386386 return;
387-
387+
388388 srand((unsigned)time(NULL));
389-
389+
390390 cliprects[0].x = (rand() % width);
391391 cliprects[0].y = (rand() % height);
392392 cliprects[0].width = (rand() % (width - cliprects[0].x));
@@ -412,16 +412,16 @@ static void* putsurface_thread(void *data)
412412 unsigned int frame_num=0, start_time, putsurface_time;
413413 VARectangle cliprects[2]; /* client supplied clip list */
414414 int continue_display = 0;
415-
415+
416416 if (drawable == drawable_thread0)
417417 printf("Enter into thread0\n\n");
418418 if (drawable == drawable_thread1)
419419 printf("Enter into thread1\n\n");
420-
420+
421421 putsurface_time = 0;
422422 while (!quit) {
423423 VASurfaceID surface_id = VA_INVALID_SURFACE;
424-
424+
425425 while (surface_id == VA_INVALID_SURFACE)
426426 surface_id = get_next_free_surface(&index);
427427
@@ -432,9 +432,9 @@ static void* putsurface_thread(void *data)
432432
433433 if (check_event)
434434 pthread_mutex_lock(&gmutex);
435-
435+
436436 start_time = get_tick_count();
437- if ((continue_display == 0) && getenv("FRAME_STOP")) {
437+ if ((continue_display == 0) && getenv("FRAME_STOP")) {
438438 char c;
439439 printf("Press any key to display frame %d...(c/C to continue)\n", frame_num);
440440 c = getchar();
@@ -447,16 +447,16 @@ static void* putsurface_thread(void *data)
447447 printf("do additional colorcoversion from %s to %s\n", map_vafourcc_to_str(csc_src_fourcc), map_vafourcc_to_str(csc_dst_fourcc));
448448 }
449449 // get image from surface, csc_src_fourcc to csc_dst_fourcc conversion happens
450- vaStatus = vaGetImage(va_dpy, surface_id, 0, 0,
450+ vaStatus = vaGetImage(va_dpy, surface_id, 0, 0,
451451 surface_width, surface_height, csc_dst_fourcc_image.image_id);
452452 CHECK_VASTATUS(vaStatus,"vaGetImage");
453-
453+
454454 // render csc_dst_fourcc image to temp surface
455455 vaStatus = vaPutImage(va_dpy, csc_render_surface, csc_dst_fourcc_image.image_id,
456- 0, 0, surface_width, surface_height,
456+ 0, 0, surface_width, surface_height,
457457 0, 0, surface_width, surface_height);
458458 CHECK_VASTATUS(vaStatus,"vaPutImage");
459-
459+
460460 // render the temp surface, it should be same with original surface without color conversion test
461461 vaStatus = vaPutSurface(va_dpy, csc_render_surface, CAST_DRAWABLE(drawable),
462462 0,0,surface_width,surface_height,
@@ -465,7 +465,6 @@ static void* putsurface_thread(void *data)
465465 (test_clip==0)?0:2,
466466 display_field);
467467 CHECK_VASTATUS(vaStatus,"vaPutSurface");
468-
469468 }
470469 else {
471470 vaStatus = vaPutSurface(va_dpy, surface_id, CAST_DRAWABLE(drawable),
@@ -476,20 +475,20 @@ static void* putsurface_thread(void *data)
476475 display_field);
477476 CHECK_VASTATUS(vaStatus,"vaPutSurface");
478477 }
479-
478+
480479 putsurface_time += (get_tick_count() - start_time);
481-
480+
482481 if (check_event)
483482 pthread_mutex_unlock(&gmutex);
484-
483+
485484 pthread_mutex_unlock(&surface_mutex[index]); /* locked in get_next_free_surface */
486-
485+
487486 if ((frame_num % 0xff) == 0) {
488487 fprintf(stderr, "%.2f FPS \r", 256000.0 / (float)putsurface_time);
489488 putsurface_time = 0;
490489 update_clipbox(cliprects, width, height);
491490 }
492-
491+
493492 if (check_event)
494493 check_window_event(win_display, drawable, &width, &height, &quit);
495494
@@ -497,7 +496,7 @@ static void* putsurface_thread(void *data)
497496 row_shift++;
498497 if (row_shift==(2*box_width)) row_shift= 0;
499498 }
500-
499+
501500 if (frame_rate != 0) /* rough framerate control */
502501 usleep(1000/frame_rate*1000);
503502
@@ -505,10 +504,10 @@ static void* putsurface_thread(void *data)
505504 if (frame_num >= frame_num_total)
506505 quit = 1;
507506 }
508-
509- if (drawable == drawable_thread1)
507+
508+ if (drawable == drawable_thread1)
510509 pthread_exit(NULL);
511-
510+
512511 return 0;
513512 }
514513 int main(int argc,char **argv)
@@ -596,8 +595,8 @@ int main(int argc,char **argv)
596595 case '1':
597596 sscanf(optarg, "%s", str_src_fmt);
598597 csc_src_fourcc = map_str_to_vafourcc (str_src_fmt);
599-
600- if (!csc_src_fourcc) {
598+
599+ if (!csc_src_fourcc) {
601600 printf("invalid fmt1: %s\n", str_src_fmt );
602601 exit(0);
603602 }
@@ -605,8 +604,8 @@ int main(int argc,char **argv)
605604 case '2':
606605 sscanf(optarg, "%s", str_dst_fmt);
607606 csc_dst_fourcc = map_str_to_vafourcc (str_dst_fmt);
608-
609- if (!csc_dst_fourcc) {
607+
608+ if (!csc_dst_fourcc) {
610609 printf("invalid fmt1: %s\n", str_dst_fmt );
611610 exit(0);
612611 }
@@ -621,7 +620,7 @@ int main(int argc,char **argv)
621620 if (csc_src_fourcc && csc_dst_fourcc) {
622621 test_color_conversion = 1;
623622 }
624-
623+
625624 win_display = (void *)open_display();
626625 if (win_display == NULL) {
627626 fprintf(stderr, "Can't open the connection of display!\n");
@@ -643,23 +642,23 @@ int main(int argc,char **argv)
643642 &surface_id[0], SURFACE_NUM,
644643 NULL, 0
645644 );
646- }
645+ }
647646 CHECK_VASTATUS(va_status, "vaCreateSurfaces");
648647 if (multi_thread == 0) /* upload the content for all surfaces */
649648 upload_source_YUV_once_for_all();
650-
649+
651650 if (check_event)
652651 pthread_mutex_init(&gmutex, NULL);
653-
652+
654653 for(i = 0; i< SURFACE_NUM; i++)
655654 pthread_mutex_init(&surface_mutex[i], NULL);
656-
657- if (multi_thread == 1)
655+
656+ if (multi_thread == 1)
658657 ret = pthread_create(&thread1, NULL, putsurface_thread, (void*)drawable_thread1);
659658
660659 putsurface_thread((void *)drawable_thread0);
661660
662- if (multi_thread == 1)
661+ if (multi_thread == 1)
663662 pthread_join(thread1, (void **)&ret);
664663 printf("thread1 is free\n");
665664
@@ -667,7 +666,7 @@ int main(int argc,char **argv)
667666 // destroy temp surface/image
668667 va_status = vaDestroySurfaces(va_dpy, &csc_render_surface, 1);
669668 CHECK_VASTATUS(va_status,"vaDestroySurfaces");
670-
669+
671670 va_status = vaDestroyImage(va_dpy, csc_dst_fourcc_image.image_id);
672671 CHECK_VASTATUS(va_status,"vaDestroyImage");
673672 }
@@ -677,12 +676,12 @@ int main(int argc,char **argv)
677676 vpp_config_id = VA_INVALID_ID;
678677 }
679678
680- vaDestroySurfaces(va_dpy,&surface_id[0],SURFACE_NUM);
679+ vaDestroySurfaces(va_dpy,&surface_id[0],SURFACE_NUM);
681680 vaTerminate(va_dpy);
682681
683682 free(va_image_formats);
684683 free(va_surface_attribs);
685684 close_display(win_display);
686-
685+
687686 return 0;
688687 }
--- a/va/Android.mk
+++ b/va/Android.mk
@@ -35,8 +35,8 @@ ALOG_VERSION := $(filter $(ALOG_VERSION_REQ),$(firstword $(sort $(PLATFORM_VERSI
3535
3636 include $(CLEAR_VARS)
3737
38-#LIBVA_MINOR_VERSION := 31
39-#LIBVA_MAJOR_VERSION := 0
38+#LIBVA_MINOR_VERSION := 39
39+#LIBVA_MAJOR_VERSION := 1
4040
4141 LOCAL_SRC_FILES := \
4242 va.c \
@@ -67,16 +67,21 @@ LOCAL_C_INCLUDES += \
6767
6868 LOCAL_COPY_HEADERS := \
6969 va.h \
70- va_backend.h \
70+ va_version.h \
7171 va_dec_hevc.h \
7272 va_dec_jpeg.h \
73- va_drmcommon.h \
73+ va_dec_vp8.h \
74+ va_dec_vp9.h \
75+ va_enc_h264.h \
7476 va_enc_hevc.h \
7577 va_enc_jpeg.h \
78+ va_enc_mpeg2.h \
7679 va_enc_vp8.h \
7780 va_enc_vp9.h \
78- va_dec_vp9.h \
79- va_version.h
81+ va_backend.h \
82+ va_drmcommon.h \
83+ va_vpp.h \
84+ va_backend_vpp.h \
8085
8186 LOCAL_COPY_HEADERS_TO := libva/va
8287
--- a/va/android/va_android.cpp
+++ b/va/android/va_android.cpp
@@ -194,7 +194,7 @@ extern "C" {
194194 VAStatus vaPutSurface (
195195 VADisplay dpy,
196196 VASurfaceID surface,
197- sp<ISurface> draw, /* Android Surface/Window */
197+ sp<ANativeWindow> draw, /* Android Native Window */
198198 short srcx,
199199 short srcy,
200200 unsigned short srcw,
--- a/va/va_android.h
+++ b/va/va_android.h
@@ -48,7 +48,8 @@ VADisplay vaGetDisplay (
4848
4949 #ifdef __cplusplus
5050 #ifdef ANDROID
51-#include <surfaceflinger/ISurface.h>
51+#include <system/window.h>
52+#include <utils/StrongPointer.h>
5253 using namespace android;
5354
5455 /*
@@ -61,8 +62,8 @@ using namespace android;
6162 */
6263 VAStatus vaPutSurface (
6364 VADisplay dpy,
64- VASurfaceID surface,
65- sp<ISurface> draw, /* Android Window/Surface */
65+ VASurfaceID surface,
66+ sp<ANativeWindow> draw, /* Android Native Window */
6667 short srcx,
6768 short srcy,
6869 unsigned short srcw,