summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrunal Bhargav2018-11-16 10:53:57 -0600
committerKrunal Bhargav2018-11-16 15:50:40 -0600
commit2db3848cd1047e688ea0a94a987e35a292bcbda9 (patch)
tree3645f2fc340779f9345b5fff28c1ceec5f3bdb87
parent54ec5ff165413d41d32bb2672e127487ee37a82b (diff)
downloadvideo-graphics-test-master.tar.gz
video-graphics-test-master.tar.xz
video-graphics-test-master.zip
Added Support for Scaling and StitchingHEADmaster
New feature added to demonstrate GC320's ability to scale images and stitch images together. Signed-off-by: Krunal Bhargav <a0227568@ti.com>
-rwxr-xr-xdisp_obj.cpp2
-rwxr-xr-xgc320.cpp221
-rwxr-xr-xgc320.h27
-rw-r--r--main.cpp2
-rwxr-xr-xvideo_graphics_test.cpp58
5 files changed, 228 insertions, 82 deletions
diff --git a/disp_obj.cpp b/disp_obj.cpp
index 7bbc3dc..79b5a67 100755
--- a/disp_obj.cpp
+++ b/disp_obj.cpp
@@ -137,7 +137,7 @@ int DispObj::set_properties(uint32_t src_w, uint32_t src_h,
137 strcpy(propname[9], "FB_ID"); 137 strcpy(propname[9], "FB_ID");
138 propval[9] = fb_id; //frame buffer id 138 propval[9] = fb_id; //frame buffer id
139 strcpy(propname[10], "global_alpha"); 139 strcpy(propname[10], "global_alpha");
140 propval[10] = 150; //Alpha value for blending 140 propval[10] = 200; //Alpha value for blending
141 141
142 /* Set the plane properties once. After that only set those properties that changes each time a frame is 142 /* Set the plane properties once. After that only set those properties that changes each time a frame is
143 displayed - like fb_id. */ 143 displayed - like fb_id. */
diff --git a/gc320.cpp b/gc320.cpp
index fee3c54..0d09520 100755
--- a/gc320.cpp
+++ b/gc320.cpp
@@ -44,24 +44,37 @@
44* as they cost some performance overhead if configured per frame. Since the 44* as they cost some performance overhead if configured per frame. Since the
45* buffer parameters aren't changing in this application run time, we can save the overhead 45* buffer parameters aren't changing in this application run time, we can save the overhead
46*/ 46*/
47Gc320Obj::Gc320Obj(uint32_t num_src_surf, uint32_t num_dst_surf, BufObj *src_bo, BufObj *dst_bo){ 47Gc320Obj::Gc320Obj(uint32_t num_src, uint32_t num_src_surf, uint32_t num_dst_surf, BufObj **src_bo, BufObj *dst_bo){
48 m_dst_width = dst_bo->m_width; 48 m_dst_width = dst_bo->m_width;
49 m_dst_height = dst_bo->m_height; 49 m_dst_height = dst_bo->m_height;
50 m_dst_stride = dst_bo->m_stride; 50 m_dst_stride = dst_bo->m_stride;
51 m_dst_format = gcvSURF_UYVY; 51 m_dst_format = gcvSURF_UYVY;
52 52 m_num_dst_ctx = num_dst_surf;
53 m_src_width = src_bo->m_width; 53
54 m_src_height = src_bo->m_height; 54 m_num_src = num_src;
55 m_src_stride = src_bo->m_stride; 55 m_num_src_ctx = num_src_surf;
56 m_src_surf_ctxt = (surf_context **) malloc(m_num_src * sizeof(*m_src_surf_ctxt));
57 m_src_width = (uint32_t *) malloc(m_num_src * sizeof(uint32_t));
58 m_src_height = (uint32_t *) malloc(m_num_src * sizeof(uint32_t));
59 m_src_stride = (uint32_t *) malloc(m_num_src * sizeof(uint32_t));
56 m_src_format = gcvSURF_UYVY; 60 m_src_format = gcvSURF_UYVY;
57 61
58 m_src_surf_ctxt = (surf_context *) malloc(num_src_surf * sizeof(surf_context)); 62 for (uint32_t i = 0; i < m_num_src; i++){
59 m_dst_surf_ctxt = (surf_context *) malloc(num_src_surf * sizeof(surf_context)); 63 m_src_width[i] = src_bo[i]->m_width;
64 m_src_height[i] = src_bo[i]->m_height;
65 m_src_stride[i] = src_bo[i]->m_stride;
66 m_src_surf_ctxt[i] = (surf_context *) malloc(m_num_src_ctx * sizeof(surf_context));
67 }
68 m_dst_surf_ctxt = (surf_context *) malloc(m_num_dst_ctx * sizeof(surf_context));
60 69
61 init_gc320(); 70 init_gc320();
62 71
63 configure_surface(m_src_surf_ctxt, num_src_surf, src_bo, m_src_format); 72 for (uint32_t i = 0; i < m_num_src; i++){
64 configure_surface(m_dst_surf_ctxt, num_dst_surf, dst_bo, m_dst_format); 73 configure_surface(m_src_surf_ctxt[i], m_num_src_ctx, src_bo[i], m_src_format);
74 }
75 configure_surface(m_dst_surf_ctxt, m_num_dst_ctx, dst_bo, m_dst_format);
76
77
65} 78}
66 79
67 80
@@ -70,49 +83,55 @@ Gc320Obj::Gc320Obj(uint32_t num_src_surf, uint32_t num_dst_surf, BufObj *src_bo,
70* free all resources 83* free all resources
71*/ 84*/
72Gc320Obj::~Gc320Obj(){ 85Gc320Obj::~Gc320Obj(){
73 if (m_hal != gcvNULL){ 86 if (m_hal != gcvNULL){
74 gcoHAL_Commit(m_hal, true); 87 gcoHAL_Commit(m_hal, true);
75 } 88 }
76 89
77 for(uint32_t i = 0; i < m_num_dst_ctx; i++){ 90 for(uint32_t i = 0; i < m_num_dst_ctx; i++){
78 if (m_dst_surf_ctxt[i].surf != gcvNULL){ 91 if (m_dst_surf_ctxt[i].surf != gcvNULL){
79 gceHARDWARE_TYPE type; 92 gceHARDWARE_TYPE type;
80 93 gcoHAL_GetHardwareType(gcvNULL, &type);
81 gcoHAL_GetHardwareType(gcvNULL, &type); 94 gcmVERIFY_OK(gcoSURF_Unlock(m_dst_surf_ctxt[i].surf, gcvNULL));
82 95 gcmVERIFY_OK(gcoSURF_Destroy(m_dst_surf_ctxt[i].surf));
83 gcmVERIFY_OK(gcoSURF_Unlock(m_dst_surf_ctxt[i].surf, gcvNULL)); 96 gcmVERIFY_OK(gcoHAL_Commit(gcvNULL, true));
84 gcmVERIFY_OK(gcoSURF_Destroy(m_dst_surf_ctxt[i].surf)); 97 gcoHAL_SetHardwareType(gcvNULL, type);
85 gcmVERIFY_OK(gcoHAL_Commit(gcvNULL, true)); 98 }
86 99 }
87 gcoHAL_SetHardwareType(gcvNULL, type); 100
88 } 101 for(uint32_t i = 0; i < m_num_src; i++){
89 } 102 for(uint32_t j = 0; j < m_num_src_ctx; j++){
90 103 if (m_src_surf_ctxt[i][j].surf != gcvNULL){
91 for(uint32_t i = 0; i < m_num_src_ctx; i++){ 104 gceHARDWARE_TYPE type;
92 if (m_src_surf_ctxt[i].surf != gcvNULL){ 105 gcoHAL_GetHardwareType(gcvNULL, &type);
93 gceHARDWARE_TYPE type; 106 gcmVERIFY_OK(gcoSURF_Unlock(m_src_surf_ctxt[i][j].surf, gcvNULL));
107 gcmVERIFY_OK(gcoSURF_Destroy(m_src_surf_ctxt[i][j].surf));
108 gcmVERIFY_OK(gcoHAL_Commit(gcvNULL, true));
109 gcoHAL_SetHardwareType(gcvNULL, type);
110 }
111 }
112 }
94 113
95 gcoHAL_GetHardwareType(gcvNULL, &type); 114 for (uint32_t i = 0; i < m_num_src; i++){
115 free(m_src_surf_ctxt[i]);
116 }
96 117
97 gcmVERIFY_OK(gcoSURF_Unlock(m_src_surf_ctxt[i].surf, gcvNULL)); 118 free(m_src_surf_ctxt);
98 gcmVERIFY_OK(gcoSURF_Destroy(m_src_surf_ctxt[i].surf)); 119 free(m_src_width);
99 gcmVERIFY_OK(gcoHAL_Commit(gcvNULL, true)); 120 free(m_src_height);
121 free(m_src_stride);
100 122
101 gcoHAL_SetHardwareType(gcvNULL, type); 123 free(m_dst_surf_ctxt);
102 }
103 }
104 124
105 if (m_hal != gcvNULL){ 125 if (m_hal != gcvNULL){
106 gcoHAL_Commit(m_hal, true); 126 gcoHAL_Commit(m_hal, true);
107 gcoHAL_Destroy(m_hal); 127 gcoHAL_Destroy(m_hal);
108 } 128 }
109 129
110 if (m_os != gcvNULL){ 130 if (m_os != gcvNULL){
111 gcoOS_Destroy(m_os); 131 gcoOS_Destroy(m_os);
112 } 132 }
113} 133}
114 134
115
116int Gc320Obj::chip_check(){ 135int Gc320Obj::chip_check(){
117 gceSTATUS status; 136 gceSTATUS status;
118 uint32_t i; 137 uint32_t i;
@@ -334,10 +353,11 @@ bool Gc320Obj::rotation_90deg(uint32_t src_surf_indx, uint32_t dst_surf_indx){
334 353
335 // render to dest surface 354 // render to dest surface
336 // blit with 90 rotation 355 // blit with 90 rotation
356 // only have one surface and one destination
337 src_rect.left = 0; 357 src_rect.left = 0;
338 src_rect.top = 0; 358 src_rect.top = 0;
339 src_rect.right = m_src_width; 359 src_rect.right = m_src_width[0];
340 src_rect.bottom = m_src_height; 360 src_rect.bottom = m_src_height[0];
341 361
342 // set the clipping according to the rotation 362 // set the clipping according to the rotation
343 clip_rect.left = 0; 363 clip_rect.left = 0;
@@ -349,14 +369,14 @@ bool Gc320Obj::rotation_90deg(uint32_t src_surf_indx, uint32_t dst_surf_indx){
349 369
350 //Since the buffer is getting rotated 90 degree, make sure the destination buffer width is larger than source buffer height */ 370 //Since the buffer is getting rotated 90 degree, make sure the destination buffer width is larger than source buffer height */
351 dst_rect.left = 0; 371 dst_rect.left = 0;
352 dst_rect.top = (m_dst_width - m_src_height); 372 dst_rect.top = (m_dst_width - m_src_height[0]);
353 dst_rect.right = dst_rect.left + m_src_width; 373 dst_rect.right = dst_rect.left + m_src_width[0];
354 dst_rect.bottom = dst_rect.top + m_src_height; 374 dst_rect.bottom = dst_rect.top + m_src_height[0];
355 375
356 gcmONERROR(gco2D_SetGenericSource(m_engine2d, 376 gcmONERROR(gco2D_SetGenericSource(m_engine2d,
357 m_src_surf_ctxt[src_surf_indx].phys_address, 1, &m_src_stride, 1, 377 m_src_surf_ctxt[0][src_surf_indx].phys_address, 1, &m_src_stride[0], 1,
358 gcvLINEAR, m_src_format, gcvSURF_0_DEGREE, 378 gcvLINEAR, m_src_format, gcvSURF_0_DEGREE,
359 m_src_width, m_src_height)); 379 m_src_width[0], m_src_height[0]));
360 380
361 gcmONERROR(gco2D_SetSource(m_engine2d, &src_rect)); 381 gcmONERROR(gco2D_SetSource(m_engine2d, &src_rect));
362 382
@@ -381,3 +401,98 @@ OnError:
381 ERROR("Failed: %s\n", gcoOS_DebugStatus2Name(status)); 401 ERROR("Failed: %s\n", gcoOS_DebugStatus2Name(status));
382 return false; 402 return false;
383} 403}
404 /** For the following example, we are going to take two identical source images
405 * (640x480), scale the images down (320x480), and stitch them together on one destination image (640x480).
406 *
407 * (0,0)****************************************
408 * *[Source Image -1] *[Source Image -2] *
409 * * * *
410 * *[Rotated 0 degrees] * [Rotated 90 degrees] *
411 * * * *
412 * *[320x480] * [320x480] *
413 * * * *
414 * *****************************************(640x480)
415 */
416bool Gc320Obj::composition(uint32_t src_surf_indx, uint32_t dst_surf_indx){
417
418 // src_rect tells GC320 which area to capture from the source image
419 // dst_rect tells GC320 where to display the captured source image
420 gcsRECT src_rect, dst_rect;
421 gceSTATUS status = gcvSTATUS_OK;
422
423 for(int i = 0; i < 2; i++){
424 gcmONERROR(gco2D_SetCurrentSourceIndex(m_engine2d, i));
425
426 gcmONERROR(gco2D_SetGenericSource(m_engine2d,
427 m_src_surf_ctxt[i][src_surf_indx].phys_address, 1,
428 &m_src_stride[i], 1, gcvLINEAR, m_src_format, gcvSURF_0_DEGREE,
429 m_src_width[i], m_src_height[i]));
430
431 switch (i % 2) {
432 case 0:
433 src_rect.left = 0;
434 src_rect.top = 0;
435 src_rect.right = m_src_width[i];
436 src_rect.bottom = m_src_height[i];
437
438 dst_rect.left = 0;
439 dst_rect.top = 0;
440 dst_rect.right = ((m_dst_width)/2);
441 dst_rect.bottom = m_dst_height;
442 break;
443
444 case 1:
445 src_rect.left = 0;
446 src_rect.top = 0;
447 src_rect.right = m_src_height[i]; // remember we are going to rotate the image by 90 degrees
448 src_rect.bottom = m_src_width[i]; // so our width and height flip
449
450 dst_rect.left = ((m_dst_width)/2);
451 dst_rect.top = 0;
452 dst_rect.right = m_dst_width;
453 dst_rect.bottom = m_dst_height;
454 break;
455
456 }
457
458 gcmONERROR(gco2D_SetSource(m_engine2d, &src_rect));
459
460 gcmONERROR(gco2D_SetGenericTarget(m_engine2d, &m_dst_surf_ctxt[dst_surf_indx].phys_address[0],
461 1, &m_dst_stride, 1, gcvLINEAR,
462 m_dst_format, gcvSURF_0_DEGREE,
463 m_dst_width,m_dst_height));
464
465 gcmONERROR(gco2D_SetClipping(m_engine2d, &dst_rect));
466
467 if (i==1){ // Second image is going to be rotated by 90 degrees
468 gcmONERROR(gco2D_FilterBlitEx2(m_engine2d,
469 m_src_surf_ctxt[i][src_surf_indx].phys_address, 1,
470 &m_src_stride[i], 1,
471 gcvLINEAR, m_src_format, gcvSURF_90_DEGREE, // to disbale the rotation change the parameter to gcvSURF_0_DEGREE
472 m_src_width[i], m_src_height[i], &src_rect,
473 &m_dst_surf_ctxt[dst_surf_indx].phys_address[0], 1, &m_dst_stride, 1,
474 gcvLINEAR, m_dst_format, gcvSURF_0_DEGREE,
475 m_dst_width, m_dst_height, &dst_rect, gcvNULL));
476 }
477
478 else{
479 gcmONERROR(gco2D_FilterBlitEx2(m_engine2d,
480 m_src_surf_ctxt[i][src_surf_indx].phys_address, 1,
481 &m_src_stride[i], 1,
482 gcvLINEAR, m_src_format, gcvSURF_0_DEGREE,
483 m_src_width[i], m_src_height[i], &src_rect,
484 &m_dst_surf_ctxt[dst_surf_indx].phys_address[0], 1, &m_dst_stride, 1,
485 gcvLINEAR, m_dst_format, gcvSURF_0_DEGREE,
486 m_dst_width, m_dst_height, &dst_rect, gcvNULL));
487 }
488
489
490 }
491 gcmONERROR(gco2D_Flush(m_engine2d));
492 gcmONERROR(gcoHAL_Commit(m_hal, true));
493
494 return true;
495OnError:
496 ERROR("Failed: %s\n", gcoOS_DebugStatus2Name(status));
497 return false;
498}
diff --git a/gc320.h b/gc320.h
index 399d9cb..8d98235 100755
--- a/gc320.h
+++ b/gc320.h
@@ -54,7 +54,7 @@ class Gc320Obj
54public: 54public:
55 55
56 /// Constructor 56 /// Constructor
57 Gc320Obj(uint32_t num_src_surf, uint32_t num_dst_surf, BufObj *src_bo, BufObj *dst_bo); 57 Gc320Obj(uint32_t num_src, uint32_t num_src_surf, uint32_t num_dst_surf, BufObj **src_bo, BufObj *dst_bo);
58 ~Gc320Obj(); 58 ~Gc320Obj();
59 59
60 /** 60 /**
@@ -75,6 +75,18 @@ public:
75 */ 75 */
76 bool rotation_90deg(uint32_t a, uint32_t b); 76 bool rotation_90deg(uint32_t a, uint32_t b);
77 77
78 /**
79 * gc320 composition()
80 * Purpose: Program GC320 to stitch two images together
81 * One image will be rotated 90 degrees and the second image will be rotated 0 degrees
82 *
83 * @param index to source surface
84 * @param index to desitination surface
85 *
86 * @return bool true/success or false/failure
87 */
88 bool composition(uint32_t src_surf_indx, uint32_t dst_surf_indx);
89
78 90
79private: 91private:
80 92
@@ -101,7 +113,7 @@ private:
101 gcoHAL m_hal; 113 gcoHAL m_hal;
102 gco2D m_engine2d; 114 gco2D m_engine2d;
103 115
104 /* Dest surface. */ 116 /* Dest surface. (1 Dest. Surface) */
105 gceSURF_FORMAT m_dst_format; 117 gceSURF_FORMAT m_dst_format;
106 uint32_t m_dst_width; 118 uint32_t m_dst_width;
107 uint32_t m_dst_height; 119 uint32_t m_dst_height;
@@ -109,13 +121,14 @@ private:
109 surf_context *m_dst_surf_ctxt; 121 surf_context *m_dst_surf_ctxt;
110 uint32_t m_num_dst_ctx; 122 uint32_t m_num_dst_ctx;
111 123
112 /* Source surface. */ 124 /* Source surface. (1 or more Source Surface) */
113 gceSURF_FORMAT m_src_format; 125 gceSURF_FORMAT m_src_format;
114 uint32_t m_src_width; 126 uint32_t *m_src_width;
115 uint32_t m_src_height; 127 uint32_t *m_src_height;
116 uint32_t m_src_stride; 128 uint32_t *m_src_stride;
117 surf_context *m_src_surf_ctxt; 129 surf_context **m_src_surf_ctxt;
118 uint32_t m_num_src_ctx; 130 uint32_t m_num_src_ctx;
131 uint32_t m_num_src; // Defines number of source surface
119}; 132};
120 133
121#endif // GC320_H 134#endif // GC320_H
diff --git a/main.cpp b/main.cpp
index c7194da..37e349e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -51,7 +51,7 @@ DSS IP like scaling, alpha blending and overlaying. Along with DSS advance capab
51QPA for hardware accelerated rendering of the graphcis content on SGX, this application also 51QPA for hardware accelerated rendering of the graphcis content on SGX, this application also
52demonstrates video rotation feature using GC320 IP, video capture using VIP interface and 52demonstrates video rotation feature using GC320 IP, video capture using VIP interface and
53displaying these content on two screens. The data flow is as follows 53displaying these content on two screens. The data flow is as follows
54 ---->GC320 rotate 90 degree --> QT QPA (draws the graphics content from qml file, scale, alpha blend and overlay (on DSS) the video with SGX output) 54 ---->GC320 stitch/rotate 90 degree --> QT QPA (draws the graphics content from qml file, scale, alpha blend and overlay (on DSS) the video with SGX output)
55 | 55 |
56VIP Capture - 56VIP Capture -
57 | 57 |
diff --git a/video_graphics_test.cpp b/video_graphics_test.cpp
index 248a7d5..7b3a849 100755
--- a/video_graphics_test.cpp
+++ b/video_graphics_test.cpp
@@ -50,11 +50,12 @@
50 ((uint32_t)(uint8_t)(d) << 24 )) 50 ((uint32_t)(uint8_t)(d) << 24 ))
51#define FOURCC_STR(str) FOURCC(str[0], str[1], str[2], str[3]) 51#define FOURCC_STR(str) FOURCC(str[0], str[1], str[2], str[3])
52 52
53#define DISP_QUEUE_DEPTH 4 53#define DISP_QUEUE_DEPTH 2
54#define NUM_CAP_BUFS (DISP_QUEUE_DEPTH+3) 54#define NUM_CAP_BUFS (DISP_QUEUE_DEPTH+3)
55#define NUM_GC320_BUFS (DISP_QUEUE_DEPTH+1) 55#define NUM_GC320_BUFS (DISP_QUEUE_DEPTH+1)
56#define CAP_W 640 56#define CAP_W 640
57#define CAP_H 480 57#define CAP_H 480
58#define NUM_SRC 2 // Defines how many input sources the user wants to use
58#define DEQUEUE_WAIT_TIME 100 //worst case wait for 30 ms before flagging error 59#define DEQUEUE_WAIT_TIME 100 //worst case wait for 30 ms before flagging error
59 60
60uint32_t gc320_buf_idx[NUM_GC320_BUFS]; 61uint32_t gc320_buf_idx[NUM_GC320_BUFS];
@@ -73,8 +74,11 @@ void run_video_graphics_test(BufObj *bo_cap, BufObj *bo_gc320, V4l2Obj *cap,
73 //Get the capture video 74 //Get the capture video
74 int cap_buf_index = cap->dequeue_buf(); 75 int cap_buf_index = cap->dequeue_buf();
75 76
76 //Call GC320 for 90 degree rotation on captured video 77 //Call rotation_90deg for just rotating the image (By default not called)
77 gc320_proc->rotation_90deg(cap_buf_index, gc320_buf_idx); 78 //Call GC320 for stitching two captured video together
79 if(gc320_proc->composition(cap_buf_index, gc320_buf_idx) == false){
80 ERROR("error running gc320 example\n");
81 }
78 82
79 //Queue the GC320 processed video to scale, overlay and alpha blend with graphics and display on DISPLAY1 83 //Queue the GC320 processed video to scale, overlay and alpha blend with graphics and display on DISPLAY1
80 //There can be multiple (on AM57x, upto 3 planes) video planes that can be submitted to same display 84 //There can be multiple (on AM57x, upto 3 planes) video planes that can be submitted to same display
@@ -139,11 +143,16 @@ void VideoGraphicsThread::run(){
139 143
140 uint32_t cap_w = CAP_W; 144 uint32_t cap_w = CAP_W;
141 uint32_t cap_h = CAP_H; 145 uint32_t cap_h = CAP_H;
146 uint32_t num_src = NUM_SRC;// Set the number of source to 1 if running the rotation_90deg test (Default=2 sources)
142 147
143 /* Since in this example GC320 is rotating the capture video input to 90 degree, 148 // Going to create the GC320 output buffer
144 make sure the GC320 output buffer width is larger than capture buffer height */ 149 // Swap the width and height if running the rotation_90deg test (Not required for the composition test)
145 uint32_t gc320_out_w = (cap_w > cap_h) ? cap_w : cap_h; // 150 uint32_t gc320_out_w = cap_w;
146 uint32_t gc320_out_h = gc320_out_w; 151 uint32_t gc320_out_h = cap_h;
152
153 // Set Display width/height
154 uint32_t screen_w = cap_w;
155 uint32_t screen_h = cap_h;
147 156
148 bool dual_display = (g_qt_app->screens().count() > 1) ? true : false; 157 bool dual_display = (g_qt_app->screens().count() > 1) ? true : false;
149 158
@@ -162,15 +171,22 @@ void VideoGraphicsThread::run(){
162 } 171 }
163 172
164 /*Create buffer objects for GC320 output 173 /*Create buffer objects for GC320 output
165 * Vivante needs address to be 0x80 bytes aligned 174 * Vivante needs address to be 0x80 bytes aligned
166 * Vivante HAL needs 16 pixel alignment in width and 4 pixel alignment in 175 * Vivante HAL needs 16 pixel alignment in width and 4 pixel alignment in
167 * height. 176 * height.
168 */ 177 */
169 BufObj bo_gc320_out(gc320_out_w, gc320_out_h, 2, FOURCC_STR("YUYV"), 0x80, NUM_GC320_BUFS); 178 BufObj bo_gc320_out(gc320_out_w, gc320_out_h, 2, FOURCC_STR("YUYV"), 0x80, NUM_GC320_BUFS);
170 179
171 //Create GC320 object 180 //Create GC320 object
172 //Initialize GC320 core, and it's input and output surfaces 181 //Initialize GC320 core, and it's input and output surfaces
173 Gc320Obj gc320_proc(NUM_CAP_BUFS, NUM_GC320_BUFS, &bo_cap, &bo_gc320_out); 182 //
183 //Note for the second input I am passing the same buffer oject as the first input
184 BufObj *gc320_in[num_src];
185 for (uint32_t i = 0; i < num_src; i++){
186 gc320_in[i] = &bo_cap;// this can take buffer objects from different sources
187 }
188
189 Gc320Obj gc320_proc(num_src, NUM_CAP_BUFS, NUM_GC320_BUFS, gc320_in, &bo_gc320_out);
174 190
175 //Create QT QPA object to get handles of various APIs from QT QPA to configure DSS hardware planes for video scaling and overlays 191 //Create QT QPA object to get handles of various APIs from QT QPA to configure DSS hardware planes for video scaling and overlays
176 QpaCtlObj qpa_ctl(g_qt_app); 192 QpaCtlObj qpa_ctl(g_qt_app);
@@ -195,11 +211,12 @@ void VideoGraphicsThread::run(){
195 211
196 uint32_t offset = 0; 212 uint32_t offset = 0;
197 for (uint32_t i = 0; i < NUM_GC320_BUFS; i++) { 213 for (uint32_t i = 0; i < NUM_GC320_BUFS; i++) {
198 /* Export the video overlay buffers to DISPLAY1 214 /* Export the video overlay buffers to DISPLAY1
199 GC320 processed (90 degree rotated) video will be displayed on DISPLAY1 215 GC320 processed (90 degree rotated) video will be displayed on DISPLAY1
200 Since the video is 90 degree rotated to original content, buffer width and height are swapped 216 Since the video is 90 degree rotated to original content, buffer width and height are swapped
201 */ 217 NO swapping required for the composition test
202 disp1.export_buf2_qpa(cap_h, cap_w, FOURCC_STR("YUYV"), &bo_gc320_out.m_stride, &offset, bo_gc320_out.m_fd[i], 218 */
219 disp1.export_buf2_qpa(screen_w, screen_h, FOURCC_STR("YUYV"), &bo_gc320_out.m_stride, &offset, bo_gc320_out.m_fd[i],
203 &bo_gc320_out.m_fb_id[i]); 220 &bo_gc320_out.m_fb_id[i]);
204 } 221 }
205 222
@@ -210,17 +227,18 @@ void VideoGraphicsThread::run(){
210 //Export the video overlay buffers to DISPLAY2 227 //Export the video overlay buffers to DISPLAY2
211 //Camera captured buffers will be displayed on DISPLAY2 228 //Camera captured buffers will be displayed on DISPLAY2
212 if(dual_display) 229 if(dual_display)
213 disp2.export_buf2_qpa(cap_w, cap_h, FOURCC_STR("YUYV"), &bo_cap.m_stride, &offset, bo_cap.m_fd[i], 230 disp2.export_buf2_qpa(screen_w, screen_h, FOURCC_STR("YUYV"), &bo_cap.m_stride, &offset, bo_cap.m_fd[i],
214 &bo_cap.m_fb_id[i]); 231 &bo_cap.m_fb_id[i]);
215 } 232 }
216 233
217 //Set the DSS hardware video plane properties for Display1 234 //Set the DSS hardware video plane properties for Display1
218 //Since we are rotating the capture buffer by 90 degree and displaying it, the width and height are swapped 235 //Since we are rotating the capture buffer by 90 degree and displaying it, the width and height are swapped
219 disp1.set_properties(cap_h, cap_w, bo_gc320_out.m_fb_id[0], 0); 236 //NO swapping required for the composition test
237 disp1.set_properties(screen_w, screen_h, bo_gc320_out.m_fb_id[0], 0);
220 238
221 //Set the DSS hardware video plane properties for Display2 239 //Set the DSS hardware video plane properties for Display2
222 if(dual_display) 240 if(dual_display)
223 disp2.set_properties(cap_w, cap_h, bo_cap.m_fb_id[0], 0); 241 disp2.set_properties(screen_w, screen_h, bo_cap.m_fb_id[0], 0);
224 242
225 //Start camera streaming 243 //Start camera streaming
226 if (vip_cap.stream_on() < 0) exit(-1); 244 if (vip_cap.stream_on() < 0) exit(-1);