<arg name="width" type="int"/>
<arg name="height" type="int"/>
<arg name="format" type="uint"/>
+ <arg name="bpp" type="int"/>
+ <arg name="size" type="int"/>
<arg name="num_plane" type="int"/>
- <arg name="buf_idx0" type="int"/>
- <arg name="offset0" type="int"/>
- <arg name="stride0" type="int"/>
- <arg name="buf_idx1" type="int"/>
- <arg name="offset1" type="int"/>
- <arg name="stride1" type="int"/>
- <arg name="buf_idx2" type="int"/>
- <arg name="offset2" type="int"/>
- <arg name="stride2" type="int"/>
+ <arg name="plane_buf_idx" type="array"/>
+ <arg name="plane_offset" type="array"/>
+ <arg name="plane_stride" type="array"/>
+ <arg name="plane_size" type="array"/>
<arg name="flags" type="uint"/>
<arg name="num_buf" type="int"/>
- <arg name="buf0" type="uint"/>
- <arg name="buf1" type="uint"/>
- <arg name="buf2" type="uint"/>
+ <arg name="buf0" type="uint"/>
+ <arg name="buf1" type="uint"/>
+ <arg name="buf2" type="uint"/>
</request>
<request name="create_buffer_with_fd">
<arg name="width" type="int"/>
<arg name="height" type="int"/>
<arg name="format" type="uint"/>
+ <arg name="bpp" type="int"/>
+ <arg name="size" type="int"/>
<arg name="num_plane" type="int"/>
- <arg name="buf_idx0" type="int"/>
- <arg name="offset0" type="int"/>
- <arg name="stride0" type="int"/>
- <arg name="buf_idx1" type="int"/>
- <arg name="offset1" type="int"/>
- <arg name="stride1" type="int"/>
- <arg name="buf_idx2" type="int"/>
- <arg name="offset2" type="int"/>
- <arg name="stride2" type="int"/>
+ <arg name="plane_buf_idx" type="array"/>
+ <arg name="plane_offset" type="array"/>
+ <arg name="plane_stride" type="array"/>
+ <arg name="plane_size" type="array"/>
<arg name="flags" type="uint"/>
<arg name="num_buf" type="int"/>
- <arg name="buf0" type="fd"/>
- <arg name="buf1" type="fd"/>
- <arg name="buf2" type="fd"/>
+ <arg name="buf0" type="fd"/>
+ <arg name="buf1" type="fd"/>
+ <arg name="buf2" type="fd"/>
</request>
<!-- version 2 -->
<arg name="width" type="int"/>
<arg name="height" type="int"/>
<arg name="format" type="uint"/>
+ <arg name="bpp" type="int"/>
+ <arg name="size" type="int"/>
<arg name="num_plane" type="int"/>
- <arg name="buf_idx0" type="int"/>
- <arg name="offset0" type="int"/>
- <arg name="stride0" type="int"/>
- <arg name="buf_idx1" type="int"/>
- <arg name="offset1" type="int"/>
- <arg name="stride1" type="int"/>
- <arg name="buf_idx2" type="int"/>
- <arg name="offset2" type="int"/>
- <arg name="stride2" type="int"/>
+ <arg name="plane_buf_idx" type="array"/>
+ <arg name="plane_offset" type="array"/>
+ <arg name="plane_stride" type="array"/>
+ <arg name="plane_size" type="array"/>
<arg name="flags" type="uint"/>
<arg name="num_buf" type="int"/>
- <arg name="buf0" type="uint"/>
- <arg name="buf1" type="uint"/>
- <arg name="buf2" type="uint"/>
+ <arg name="buf0" type="uint"/>
+ <arg name="buf1" type="uint"/>
+ <arg name="buf2" type="uint"/>
</event>
<event name="buffer_import_with_fd">
<arg name="width" type="int"/>
<arg name="height" type="int"/>
<arg name="format" type="uint"/>
+ <arg name="bpp" type="int"/>
+ <arg name="size" type="int"/>
<arg name="num_plane" type="int"/>
- <arg name="buf_idx0" type="int"/>
- <arg name="offset0" type="int"/>
- <arg name="stride0" type="int"/>
- <arg name="buf_idx1" type="int"/>
- <arg name="offset1" type="int"/>
- <arg name="stride1" type="int"/>
- <arg name="buf_idx2" type="int"/>
- <arg name="offset2" type="int"/>
- <arg name="stride2" type="int"/>
+ <arg name="plane_buf_idx" type="array"/>
+ <arg name="plane_offset" type="array"/>
+ <arg name="plane_stride" type="array"/>
+ <arg name="plane_size" type="array"/>
<arg name="flags" type="uint"/>
<arg name="num_buf" type="int"/>
- <arg name="buf0" type="fd"/>
- <arg name="buf1" type="fd"/>
- <arg name="buf2" type="fd"/>
+ <arg name="buf0" type="fd"/>
+ <arg name="buf1" type="fd"/>
+ <arg name="buf2" type="fd"/>
</event>
<request name="set_sync_timeline">
int32_t width,
int32_t height,
uint32_t format,
+ int32_t bpp,
+ int32_t size,
int32_t num_plane,
- int32_t buf_idx0,
- int32_t offset0,
- int32_t stride0,
- int32_t buf_idx1,
- int32_t offset1,
- int32_t stride1,
- int32_t buf_idx2,
- int32_t offset2,
- int32_t stride2,
+ struct wl_array *plane_buf_idx,
+ struct wl_array *plane_offset,
+ struct wl_array *plane_stride,
+ struct wl_array *plane_size,
uint32_t flags,
int32_t num_buf,
uint32_t buf0,
int32_t width,
int32_t height,
uint32_t format,
+ int32_t bpp,
+ int32_t size,
int32_t num_plane,
- int32_t buf_idx0,
- int32_t offset0,
- int32_t stride0,
- int32_t buf_idx1,
- int32_t offset1,
- int32_t stride1,
- int32_t buf_idx2,
- int32_t offset2,
- int32_t stride2,
+ struct wl_array *plane_buf_idx,
+ struct wl_array *plane_offset,
+ struct wl_array *plane_stride,
+ struct wl_array *plane_size,
uint32_t flags,
int32_t num_buf,
uint32_t buf0,
char debug_id[64] = {0, };
tbm_surface = _wayland_tbm_client_create_surface_from_param(tbm_client->bufmgr, 0,
- width, height, format,
+ width, height, format, bpp, size,
num_plane,
- buf_idx0, offset0, stride0,
- buf_idx1, offset1, stride1,
- buf_idx2, offset2, stride2,
+ plane_buf_idx, plane_offset, plane_stride, plane_size,
0,
num_buf,
buf0, buf1, buf2);
int32_t width,
int32_t height,
uint32_t format,
+ int32_t bpp,
+ int32_t size,
int32_t num_plane,
- int32_t buf_idx0,
- int32_t offset0,
- int32_t stride0,
- int32_t buf_idx1,
- int32_t offset1,
- int32_t stride1,
- int32_t buf_idx2,
- int32_t offset2,
- int32_t stride2,
+ struct wl_array *plane_buf_idx,
+ struct wl_array *plane_offset,
+ struct wl_array *plane_stride,
+ struct wl_array *plane_size,
uint32_t flags,
int32_t num_buf,
int32_t buf0,
char debug_id[64] = {0, };
tbm_surface = _wayland_tbm_client_create_surface_from_param(tbm_client->bufmgr, 1,
- width, height, format,
+ width, height, format, bpp, size,
num_plane,
- buf_idx0, offset0, stride0,
- buf_idx1, offset1, stride1,
- buf_idx2, offset2, stride2,
+ plane_buf_idx, plane_offset, plane_stride, plane_size,
0,
num_buf,
buf0, buf1, buf2);
char debug_id[64] = {0, };
tbm_surface_info_s info;
uint32_t flags = 0;
+ struct wl_array plane_buf_idx, plane_offset, plane_stride, plane_size;
+ int *p;
/*
* if the surface is the attached surface from display server,
}
}
+ wl_array_init(&plane_buf_idx);
+ wl_array_init(&plane_offset);
+ wl_array_init(&plane_stride);
+ wl_array_init(&plane_size);
+
+ for (i = 0; i < 3; i++) {
+ p = wl_array_add(&plane_buf_idx, sizeof(int));
+ *p = tbm_surface_internal_get_plane_bo_idx(surface, i);
+ p = wl_array_add(&plane_offset, sizeof(int));
+ *p = info.planes[i].offset;
+ p = wl_array_add(&plane_stride, sizeof(int));
+ *p = info.planes[i].stride;
+ p = wl_array_add(&plane_size, sizeof(int));
+ *p = info.planes[i].size;
+ }
+
if (is_fd == 1)
wl_buffer = wl_tbm_create_buffer_with_fd(tbm_client->wl_tbm,
- info.width, info.height, info.format, info.num_planes,
- tbm_surface_internal_get_plane_bo_idx(surface, 0),
- info.planes[0].offset, info.planes[0].stride,
- tbm_surface_internal_get_plane_bo_idx(surface, 1),
- info.planes[1].offset, info.planes[1].stride,
- tbm_surface_internal_get_plane_bo_idx(surface, 2),
- info.planes[2].offset, info.planes[2].stride,
+ info.width, info.height, info.format, info.bpp, info.size, info.num_planes,
+ &plane_buf_idx, &plane_offset, &plane_stride, &plane_size,
flags, num_buf, bufs[0],
(bufs[1] == -1) ? bufs[0] : bufs[1],
(bufs[2] == -1) ? bufs[0] : bufs[2]);
else
wl_buffer = wl_tbm_create_buffer(tbm_client->wl_tbm,
- info.width, info.height, info.format, info.num_planes,
- tbm_surface_internal_get_plane_bo_idx(surface, 0),
- info.planes[0].offset, info.planes[0].stride,
- tbm_surface_internal_get_plane_bo_idx(surface, 1),
- info.planes[1].offset, info.planes[1].stride,
- tbm_surface_internal_get_plane_bo_idx(surface, 2),
- info.planes[2].offset, info.planes[2].stride,
+ info.width, info.height, info.format, info.bpp, info.size, info.num_planes,
+ &plane_buf_idx, &plane_offset, &plane_stride, &plane_size,
flags,
num_buf, bufs[0], bufs[1], bufs[2]);
+ wl_array_release(&plane_buf_idx);
+ wl_array_release(&plane_offset);
+ wl_array_release(&plane_stride);
+ wl_array_release(&plane_size);
+
if (!wl_buffer) {
WL_TBM_LOG("Failed to create wl_buffer\n");
goto err;
int32_t width,
int32_t height,
uint32_t format,
+ int32_t bpp,
+ int32_t size,
int32_t num_plane,
- int32_t buf_idx0,
- int32_t offset0,
- int32_t stride0,
- int32_t buf_idx1,
- int32_t offset1,
- int32_t stride1,
- int32_t buf_idx2,
- int32_t offset2,
- int32_t stride2,
+ struct wl_array *plane_buf_idx,
+ struct wl_array *plane_offset,
+ struct wl_array *plane_stride,
+ struct wl_array *plane_size,
uint32_t flags,
int32_t num_buf,
uint32_t buf0,
int32_t names[TBM_SURF_PLANE_MAX] = { -1, -1, -1, -1};
tbm_surface_info_s info = { 0, };
tbm_bo bos[TBM_SURF_PLANE_MAX];
- int bpp, i, numPlane, numName;
+ int i, numPlane, numName;
tbm_surface_h tbm_surface;
- bpp = tbm_surface_internal_get_bpp(format);
numPlane = tbm_surface_internal_get_num_planes(format);
WL_TBM_RETURN_VAL_IF_FAIL(numPlane == num_plane, NULL);
info.height = height;
info.format = format;
info.bpp = bpp;
+ info.size = size;
info.num_planes = numPlane;
/*Fill plane info*/
- if (numPlane > 0) {
- info.planes[0].offset = offset0;
- info.planes[0].stride = stride0;
- numPlane--;
- if (numPlane > 0) {
- info.planes[1].offset = offset1;
- info.planes[1].stride = stride1;
- numPlane--;
- if (numPlane > 0) {
- info.planes[2].offset = offset2;
- info.planes[2].stride = stride2;
- numPlane--;
- }
- }
+ for (i = 0; i < numPlane; i++) {
+ info.planes[i].offset = *WL_TBM_ARRAY_NTH_DATA(plane_offset, int32_t, i);
+ info.planes[i].stride = *WL_TBM_ARRAY_NTH_DATA(plane_stride, int32_t, i);
+ info.planes[i].size = *WL_TBM_ARRAY_NTH_DATA(plane_size, int32_t, i);
}
/*Fill buffer*/
} \
}
+#define WL_TBM_ARRAY_NTH_DATA(array, type, n) (((type*)((array)->data)) + n)
+
typedef enum {
WL_TBM_MONITOR_COMMAND_LIST,
WL_TBM_MONITOR_COMMAND_SHOW,
_wayland_tbm_server_impl_create_buffer(struct wl_client *client,
struct wl_resource *wl_tbm,
uint32_t id,
- int32_t width, int32_t height, uint32_t format, int32_t num_plane,
- int32_t buf_idx0, int32_t offset0, int32_t stride0,
- int32_t buf_idx1, int32_t offset1, int32_t stride1,
- int32_t buf_idx2, int32_t offset2, int32_t stride2,
+ int32_t width, int32_t height, uint32_t format,
+ int32_t bpp, int32_t size, int32_t num_plane,
+ struct wl_array *plane_buf_idx, struct wl_array *plane_offset,
+ struct wl_array *plane_stride, struct wl_array *plane_size,
uint32_t flags,
int32_t num_buf, uint32_t buf0, uint32_t buf1, uint32_t buf2)
{
info.width = width;
info.height = height;
info.format = format;
- info.bpp = tbm_surface_internal_get_bpp(format);
+ info.bpp = bpp;
+ info.size = size;
info.num_planes = numPlane;
/*Fill plane info*/
- if (numPlane > 0) {
- info.planes[0].offset = offset0;
- info.planes[0].stride = stride0;
- numPlane--;
- if (numPlane > 0) {
- info.planes[1].offset = offset1;
- info.planes[1].stride = stride1;
- numPlane--;
- if (numPlane > 0) {
- info.planes[2].offset = offset2;
- info.planes[2].stride = stride2;
- numPlane--;
- }
- }
+ for (i = 0; i < numPlane; i++) {
+ info.planes[i].offset = *WL_TBM_ARRAY_NTH_DATA(plane_offset, int32_t, i);
+ info.planes[i].stride = *WL_TBM_ARRAY_NTH_DATA(plane_stride, int32_t, i);
+ info.planes[i].size = *WL_TBM_ARRAY_NTH_DATA(plane_size, int32_t, i);
}
/*Fill buffer*/
_wayland_tbm_server_impl_create_buffer_with_fd(struct wl_client *client,
struct wl_resource *wl_tbm,
uint32_t id,
- int32_t width, int32_t height, uint32_t format, int32_t num_plane,
- int32_t buf_idx0, int32_t offset0, int32_t stride0,
- int32_t buf_idx1, int32_t offset1, int32_t stride1,
- int32_t buf_idx2, int32_t offset2, int32_t stride2,
+ int32_t width, int32_t height, uint32_t format,
+ int32_t bpp, int32_t size, int32_t num_plane,
+ struct wl_array *plane_buf_idx, struct wl_array *plane_offset,
+ struct wl_array *plane_stride, struct wl_array *plane_size,
uint32_t flags,
int32_t num_buf, int32_t buf0, int32_t buf1, int32_t buf2)
{
info.num_planes = numPlane;
/*Fill plane info*/
- if (numPlane > 0) {
- info.planes[0].offset = offset0;
- info.planes[0].stride = stride0;
- numPlane--;
- if (numPlane > 0) {
- info.planes[1].offset = offset1;
- info.planes[1].stride = stride1;
- numPlane--;
- if (numPlane > 0) {
- info.planes[2].offset = offset2;
- info.planes[2].stride = stride2;
- numPlane--;
- }
- }
+ for (i = 0; i < numPlane; i++) {
+ info.planes[i].offset = *WL_TBM_ARRAY_NTH_DATA(plane_offset, int32_t, i);
+ info.planes[i].stride = *WL_TBM_ARRAY_NTH_DATA(plane_stride, int32_t, i);
+ info.planes[i].size = *WL_TBM_ARRAY_NTH_DATA(plane_size, int32_t, i);
}
/*Fill buffer*/
int bufs[TBM_SURF_PLANE_MAX] = { -1, -1, -1, -1};
int flag, i, is_fd = -1, num_buf;
tbm_surface_info_s info;
+ struct wl_array plane_buf_idx, plane_offset, plane_stride, plane_size;
+ int *p;
if (tbm_surface_get_info(surface, &info) != TBM_SURFACE_ERROR_NONE) {
WL_TBM_S_LOG("Failed to create buffer from surface\n");
}
}
+ wl_array_init(&plane_buf_idx);
+ wl_array_init(&plane_offset);
+ wl_array_init(&plane_stride);
+ wl_array_init(&plane_size);
+
+ for (i = 0; i < 3; i++) {
+ p = wl_array_add(&plane_buf_idx, sizeof(int));
+ *p = tbm_surface_internal_get_plane_bo_idx(surface, i);
+ p = wl_array_add(&plane_offset, sizeof(int));
+ *p = info.planes[i].offset;
+ p = wl_array_add(&plane_stride, sizeof(int));
+ *p = info.planes[i].stride;
+ p = wl_array_add(&plane_size, sizeof(int));
+ *p = info.planes[i].size;
+ }
+
if (is_fd == 1)
wl_tbm_send_buffer_import_with_fd(wl_tbm,
wl_buffer,
- info.width, info.height, info.format, info.num_planes,
- tbm_surface_internal_get_plane_bo_idx(surface, 0),
- info.planes[0].offset, info.planes[0].stride,
- tbm_surface_internal_get_plane_bo_idx(surface, 1),
- info.planes[1].offset, info.planes[1].stride,
- tbm_surface_internal_get_plane_bo_idx(surface, 2),
- info.planes[2].offset, info.planes[2].stride,
+ info.width, info.height, info.format, info.bpp, info.size, info.num_planes,
+ &plane_buf_idx, &plane_offset, &plane_stride, &plane_size,
flag, num_buf, bufs[0],
(bufs[1] == -1) ? bufs[0] : bufs[1],
(bufs[2] == -1) ? bufs[0] : bufs[2]);
else
wl_tbm_send_buffer_import_with_id(wl_tbm,
wl_buffer,
- info.width, info.height, info.format, info.num_planes,
- tbm_surface_internal_get_plane_bo_idx(surface, 0),
- info.planes[0].offset, info.planes[0].stride,
- tbm_surface_internal_get_plane_bo_idx(surface, 1),
- info.planes[1].offset, info.planes[1].stride,
- tbm_surface_internal_get_plane_bo_idx(surface, 2),
- info.planes[2].offset, info.planes[2].stride,
+ info.width, info.height, info.format, info.bpp, info.size, info.num_planes,
+ &plane_buf_idx, &plane_offset, &plane_stride, &plane_size,
flag, num_buf, bufs[0],
(bufs[1] == -1) ? bufs[0] : bufs[1],
(bufs[2] == -1) ? bufs[0] : bufs[2]);
+ wl_array_release(&plane_buf_idx);
+ wl_array_release(&plane_offset);
+ wl_array_release(&plane_stride);
+ wl_array_release(&plane_size);
+
for (i = 0; i < TBM_SURF_PLANE_MAX; i++) {
if (is_fd == 1 && (bufs[i] >= 0))
close(bufs[i]);