wayland_tbm_client_get_bufmgr (display->tbm_client);
g_return_val_if_fail (display->flush_tbm_bufmgr != NULL, FALSE);
- for (i = 0; i < NV_BUF_PLANE_NUM; i++) {
+ for (i = 0; i < display->tbm_bo_num; i++) {
if (mm_video_buf->handle.bo[i] != NULL) {
tbm_bo_handle src;
tbm_bo_handle dst;
g_return_val_if_fail (mm_video_buf != NULL, FALSE);
FUNCTION;
+ display->plane_num = mm_video_buf->plane_num;
+ display->tbm_bo_num = mm_video_buf->handle_num;
ret = gst_wayland_sink_make_flush_buffer (display, mm_video_buf);
if (ret) {
int i;
- for (i = 0; i < NV_BUF_PLANE_NUM; i++) {
+ for (i = 0; i < display->plane_num; i++) {
if (display->flush_buffer->bo[i] != NULL) {
display->bo[i] = display->flush_buffer->bo[i];
GST_LOG ("bo %p", display->bo[i]);
g_return_if_fail (mm_video_buf != NULL);
FUNCTION;
- for (i = 0; i < NV_BUF_PLANE_NUM; i++) {
+ display->plane_num = mm_video_buf->plane_num;
+ display->tbm_bo_num = mm_video_buf->handle_num;
+ for (i = 0; i < display->plane_num; i++) {
if (mm_video_buf->handle.bo[i] != NULL) {
display->bo[i] = mm_video_buf->handle.bo[i];
} else {
GST_ERROR ("Buffer type is not TBM");
return NULL;
}
- GST_DEBUG ("TBM: handle.bo[0]:%p, handle.bo[1]:%p",
- mm_video_buf->handle.bo[0], mm_video_buf->handle.bo[1]);
-
+ GST_DEBUG ("TBM bo: handle.bo[0]:%p, handle.bo[1]:%p, handle.bo[2]:%p",
+ mm_video_buf->handle.bo[0], mm_video_buf->handle.bo[1],
+ mm_video_buf->handle.bo[2]);
+ GST_DEBUG ("Number of TBM bo is %d", mm_video_buf->handle_num);
+ GST_DEBUG ("Number of plane is %d", mm_video_buf->plane_num);
return mm_video_buf;
}
*/
#include "wlbuffer.h"
-#define NV_BUF_PLANE_NUM 2 /*SN12 or ST12 has 2 plane */
GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
#define GST_CAT_DEFAULT gstwayland_debug
if (self->is_flush_request) {
self->display->flush_tbm_bufmgr = NULL;
if (self->display->flush_buffer) {
- for (i = 0; i < NV_BUF_PLANE_NUM; i++) {
+ for (i = 0; i < self->display->tbm_bo_num; i++) {
if (self->display->flush_buffer->bo[i]) {
- GST_LOG ("tbm_bo_unref (bo@%p)",
+ GST_LOG ("flush buffer: tbm_bo_unref (bo@%p)",
self->display->flush_buffer->bo[i]);
tbm_bo_unref (self->display->flush_buffer->bo[i]);
self->display->flush_buffer->bo[i] = NULL;
#include <wayland-client.h>
#include "scaler-client-protocol.h"
#ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT
+#include <gst/video/video.h>
#include <tbm_bufmgr.h>
#include <wayland-tbm-client.h>
#include <tizen-extension-client-protocol.h>
-#define NV_BUF_PLANE_NUM 2 /*SN12 or ST12 has 2 plane */
#define USE_WL_FLUSH_BUFFER
#endif
#ifdef USE_WL_FLUSH_BUFFER
typedef struct
{
- void *bo[NV_BUF_PLANE_NUM];
+ void *bo[GST_VIDEO_MAX_PLANES];
} GstWlFlushBuffer;
#endif
struct wayland_tbm_client *tbm_client;
tbm_bufmgr tbm_bufmgr;
tbm_bo tbm_bo[TBM_BO_NUM];
- int tbm_bo_idx;
+ gint tbm_bo_idx;
tbm_surface_h tsurface;
gboolean USE_TBM;
#ifdef USE_WL_FLUSH_BUFFER
GstWlFlushBuffer *flush_buffer;
tbm_bufmgr flush_tbm_bufmgr;
- int flush_request;
+ gint flush_request;
#endif
gboolean dump_video;
guint total_dump;
guint dump_count;
- gboolean is_native_format; /*SN12, ST12 */
- void *bo[NV_BUF_PLANE_NUM];
- int plane_size[NV_BUF_PLANE_NUM];
- int stride_width[NV_BUF_PLANE_NUM];
- int stride_height[NV_BUF_PLANE_NUM];
- int width[NV_BUF_PLANE_NUM];
- int height[NV_BUF_PLANE_NUM];
- int native_video_size;
- unsigned int wl_surface_id;
- int buffer_width, buffer_height;
+ gboolean is_native_format; /*SN12, ST12, SR32, S420 */
+ gpointer bo[GST_VIDEO_MAX_PLANES];
+ gint plane_size[GST_VIDEO_MAX_PLANES];
+ gint stride_width[GST_VIDEO_MAX_PLANES];
+ gint stride_height[GST_VIDEO_MAX_PLANES];
+ gint width[GST_VIDEO_MAX_PLANES];
+ gint height[GST_VIDEO_MAX_PLANES];
+ gint native_video_size;
+ guint wl_surface_id;
+ gint buffer_width, buffer_height;
+ gint plane_num;
+ gint tbm_bo_num;
#endif
#if 1
const GstVideoInfo * info)
{
GstWlShmMemory *shm_mem = (GstWlShmMemory *) mem;
- gint width, height, stride, offset;
+ gint width, height, stride;
gsize size;
gint plane_size[GST_VIDEO_MAX_PLANES], n_planes, i;
enum wl_shm_format format;
#ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT
if (display->USE_TBM) {
tbm_surface_info_s ts_info;
- int num_bo;
+ int offset[GST_VIDEO_MAX_PLANES];
if (display->is_native_format == TRUE) {
/* In case of native format, use MMVideoBuffer data instead of GstVideoInfo */
width = display->width[0];
height = display->height[0];
format = gst_video_format_to_wl_tbm_format (GST_VIDEO_INFO_FORMAT (info));
- offset = display->stride_width[0] * display->stride_height[0];
ts_info.width = width;
ts_info.height = height;
ts_info.format = format;
ts_info.bpp = tbm_surface_internal_get_bpp (ts_info.format);
ts_info.num_planes = tbm_surface_internal_get_num_planes (ts_info.format);
- ts_info.planes[0].size = display->plane_size[0];
- ts_info.planes[1].size = display->plane_size[1];
- ts_info.planes[0].stride = display->stride_width[0];
- ts_info.planes[1].stride = display->stride_width[1];
- ts_info.planes[0].offset = 0;
- ts_info.planes[1].offset = (display->bo[1]) ? 0 : offset;
+
+ for (i = 0; i < display->plane_num; i++) {
+ ts_info.planes[i].size = display->plane_size[i];
+ ts_info.planes[i].stride = display->stride_width[i];
+ offset[i] = display->stride_width[i] * display->stride_height[i];
+ }
+
+ if (display->tbm_bo_num == 1) {
+ ts_info.planes[0].offset = 0;
+ ts_info.planes[1].offset = offset[0];
+ if (display->plane_num == 3)
+ ts_info.planes[2].offset = offset[0] + offset[1];
+ } else if (display->tbm_bo_num == 2) {
+ ts_info.planes[0].offset = 0;
+ ts_info.planes[1].offset = 0;
+ if (display->plane_num == 3)
+ ts_info.planes[2].offset = offset[1];
+ } else if (display->tbm_bo_num == 3) {
+ ts_info.planes[0].offset = 0;
+ ts_info.planes[1].offset = 0;
+ ts_info.planes[2].offset = 0;
+ }
GST_LOG
("set tbm_surface_info_s: width(%d) height(%d) format(%s) bpp(%d) num_planes(%d)",
ts_info.width, ts_info.height, gst_wl_tbm_format_to_string (format),
ts_info.bpp, ts_info.num_planes);
GST_LOG
- ("set tbm_surface_info_s: planse[0].stride(%d) planes[1].stride(%d) planes[0].offset(%d) planes[1].offset(%d)",
+ ("set tbm_surface_info_s: planse[0].stride(%d) planes[1].stride(%d) planes[2].stride(%d) planes[0].offset(%d) planes[1].offset(%d) planes[2].offset(%d)",
ts_info.planes[0].stride, ts_info.planes[1].stride,
- ts_info.planes[0].offset, ts_info.planes[1].offset);
-
- num_bo = (display->bo[1]) ? 2 : 1;
- GST_LOG ("num_bo(%d)", num_bo);
+ ts_info.planes[2].stride, ts_info.planes[0].offset,
+ ts_info.planes[1].offset, ts_info.planes[2].offset);
display->tsurface =
tbm_surface_internal_create_with_bos (&ts_info,
- (tbm_bo *) display->bo, num_bo);
+ (tbm_bo *) display->bo, display->tbm_bo_num);
GST_LOG ("create tbm surface(%p)", display->tsurface);
wbuffer =
wayland_tbm_client_create_buffer (display->tbm_client,
#ifndef __GST_WL_SHM_ALLOCATOR_H__
#define __GST_WL_SHM_ALLOCATOR_H__
-#include <gst/video/video.h>
#include <wayland-client-protocol.h>
#include "wldisplay.h"