* Taeheon Kim <th908.kim@samsung.com>,
* YoungJun Cho <yj44.cho@samsung.com>,
* SooChan Lim <sc1.lim@samsung.com>,
- * Boram Park <sc1.lim@samsung.com>
+ * Boram Park <boram1288.park@samsung.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
#endif
#include <png.h>
-#include <string.h>
-#include <tbm_surface.h>
-#include <tbm_surface_internal.h>
-#include <string.h>
-#include <time.h>
#include <pixman.h>
-#include "tdm.h"
#include "tdm_private.h"
-#include "tdm_helper.h"
#define PNG_DEPTH 8
-static const char *file_exts[2] = {"png", "yuv"};
+static const char *file_exts[2] = {"png", "raw"};
int tdm_dump_enable;
+char *tdm_debug_dump_dir;
-INTERN unsigned long
-tdm_helper_get_time_in_millis(void)
+EXTERN double
+tdm_helper_get_time(void)
{
struct timespec tp;
if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
- return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
+ return (double)tp.tv_sec + ((double)tp.tv_nsec) / 1000000000.0;
return 0;
}
-INTERN unsigned long
-tdm_helper_get_time_in_micros(void)
+static int
+_tdm_helper_check_file_is_symbolic_link(const char* path)
{
- struct timespec tp;
+ struct stat sb;
- if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
- return (tp.tv_sec * 1000000) + (tp.tv_nsec / 1000L);
+ if (!path)
+ return 0;
+
+ if (stat(path, &sb) != 0)
+ return 0;
+
+ if (S_ISLNK(sb.st_mode))
+ return 1;
return 0;
}
int size2, void *data3, int size3)
{
unsigned int *blocks;
- FILE *fp = fopen(file, "w+");
+ FILE *fp;
+
+ if (_tdm_helper_check_file_is_symbolic_link(file)) {
+ TDM_ERR("'%s' may be symbolic link\n", file);
+ return;
+ }
+
+ fp = fopen(file, "w+");
TDM_RETURN_IF_FAIL(fp != NULL);
blocks = (unsigned int *)data1;
_tdm_helper_dump_png(const char *file, const void *data, int width,
int height)
{
- FILE *fp = fopen(file, "wb");
+ FILE *fp;
+
+ if (_tdm_helper_check_file_is_symbolic_link(file)) {
+ TDM_ERR("'%s' may be symbolic link\n", file);
+ return;
+ }
+
+ fp = fopen(file, "wb");
TDM_RETURN_IF_FAIL(fp != NULL);
png_structp pPngStruct =
const int pixel_size = 4; // RGBA
png_bytep *row_pointers =
png_malloc(pPngStruct, height * sizeof(png_byte *));
+ if (!row_pointers) {
+ png_destroy_write_struct(&pPngStruct, &pPngInfo);
+ fclose(fp);
+ return;
+ }
unsigned int *blocks = (unsigned int *)data;
int y = 0;
for (; y < height; ++y) {
png_bytep row =
png_malloc(pPngStruct, sizeof(png_byte) * width * pixel_size);
+ if (!row) {
+ for (x = 0; x < y; x++)
+ png_free(pPngStruct, row_pointers[x]);
+ png_free(pPngStruct, row_pointers);
+ png_destroy_write_struct(&pPngStruct, &pPngInfo);
+ fclose(fp);
+ return;
+ }
+
row_pointers[y] = (png_bytep)row;
for (x = 0; x < width; ++x) {
unsigned int curBlock = blocks[y * width + x];
fclose(fp);
}
-INTERN void
-tdm_helper_dump_buffer_str(tbm_surface_h buffer, const char *str)
+/* LCOV_EXCL_START */
+INTERN char *
+tdm_helper_dump_make_directory(const char *path, char *reply, int *len)
+{
+ char *fullpath = NULL;
+ time_t timer;
+ struct tm *t, *buf = NULL;
+
+ timer = time(NULL);
+
+ buf = calloc(1, sizeof(struct tm));
+ TDM_GOTO_IF_FAIL(buf != NULL, failed_make);
+
+ fullpath = calloc(1, TDM_PATH_LEN * sizeof(char));
+ TDM_GOTO_IF_FAIL(fullpath != NULL, failed_make);
+
+ t = localtime_r(&timer, buf);
+ TDM_GOTO_IF_FAIL(t != NULL, failed_make);
+
+ snprintf(fullpath, TDM_PATH_LEN, "%s/dump_%04d%02d%02d.%02d%02d%02d", path,
+ t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
+
+ if ((mkdir(fullpath, 0755)) < 0) {
+ TDM_ERR("mkdir '%s' fail\n", fullpath);
+ TDM_SNPRINTF(reply, len, "mkdir '%s' fail\n", fullpath);
+ goto failed_make;
+ }
+
+ free(buf);
+
+ return fullpath;
+failed_make:
+ if (fullpath)
+ free(fullpath);
+ if (buf)
+ free(buf);
+ return NULL;
+}
+
+EXTERN void
+tdm_helper_dump_buffer_str(tbm_surface_h buffer, char *dir, char *str)
{
tbm_surface_info_s info;
- const char *dir = "/tmp/dump-tdm";
- const char *ext;
char file[TDM_PATH_LEN];
- int ret, bw;
+ int ret, bw, bh;
TDM_RETURN_IF_FAIL(buffer != NULL);
TDM_RETURN_IF_FAIL(str != NULL);
+ if (!dir)
+ dir = ".";
+
ret = tbm_surface_get_info(buffer, &info);
TDM_RETURN_IF_FAIL(ret == TBM_SURFACE_ERROR_NONE);
- if (info.format == TBM_FORMAT_ARGB8888 || info.format == TBM_FORMAT_XRGB8888) {
- ext = file_exts[0];
- bw = info.planes[0].stride >> 2;
- } else {
- ext = file_exts[1];
- bw = info.planes[0].stride;
- }
+ tdm_helper_get_buffer_full_size(buffer, &bw, &bh);
- snprintf(file, TDM_PATH_LEN, "%s/%c%c%c%c_%dx%d_%s.%s",
- dir, FOURCC_STR(info.format), bw, info.height, str, ext);
+ snprintf(file, TDM_PATH_LEN, "%s/%c%c%c%c_%dx%d_%dx%d_%s",
+ dir, FOURCC_STR(info.format), bw, bh, info.width, info.height, str);
tdm_helper_dump_buffer(buffer, file);
}
+/* LCOV_EXCL_STOP */
EXTERN void
tdm_helper_dump_buffer(tbm_surface_h buffer, const char *file)
{
+ char temp[TDM_PATH_LEN] = {0,};
tbm_surface_info_s info;
int len, ret;
const char *ext;
+ int bo_cnt;
+ int bw, bh;
+ char *dot, *p = temp;
TDM_RETURN_IF_FAIL(buffer != NULL);
TDM_RETURN_IF_FAIL(file != NULL);
ret = tbm_surface_map(buffer, TBM_OPTION_READ, &info);
TDM_RETURN_IF_FAIL(ret == TBM_SURFACE_ERROR_NONE);
- len = strnlen(file, 1024);
- if (info.format == TBM_FORMAT_ARGB8888 || info.format == TBM_FORMAT_XRGB8888)
+ if (IS_RGB(info.format))
ext = file_exts[0];
else
ext = file_exts[1];
- if (strncmp(file + (len - 3), ext, 3)) {
- TDM_ERR("can't dump to '%s' file", file + (len - 3));
- tbm_surface_unmap(buffer);
- return;
+ dot = strrchr(file, '.');
+ if (!dot || strlen(dot + 1) != 3 || strncmp(dot + 1, ext, 3)) {
+ len = strnlen(file, TDM_PATH_LEN - 5);
+ strncat(p, file, len);
+ p += len;
+ *(p++) = '.';
+ strncat(p, ext, 3);
+ p += 3;
+ *p = '\0';
+ } else {
+ len = strnlen(file, TDM_PATH_LEN - 1);
+ strncat(p, file, len);
+ p += len;
+ *p = '\0';
}
+ tdm_helper_get_buffer_full_size(buffer, &bw, &bh);
+
+ bo_cnt = tbm_surface_internal_get_num_bos(buffer);
+ TDM_DBG("buffer: bo_cnt(%d) %dx%d(%dx%d) %c%c%c%c, plane: (%p+%d, %d,%d) (%p+%d, %d,%d) (%p+%d, %d,%d)",
+ bo_cnt, bw, bh, info.width, info.height, FOURCC_STR(info.format),
+ info.planes[0].ptr, info.planes[0].offset, info.planes[0].stride, info.planes[0].size,
+ info.planes[1].ptr, info.planes[1].offset, info.planes[1].stride, info.planes[1].size,
+ info.planes[2].ptr, info.planes[2].offset, info.planes[2].stride, info.planes[2].size);
+
switch (info.format) {
case TBM_FORMAT_ARGB8888:
case TBM_FORMAT_XRGB8888:
- _tdm_helper_dump_png(file, info.planes[0].ptr,
- info.planes[0].stride >> 2, info.height);
+ _tdm_helper_dump_png(temp, info.planes[0].ptr, bw, bh);
break;
case TBM_FORMAT_YVU420:
case TBM_FORMAT_YUV420:
- _tdm_helper_dump_raw(file,
+ _tdm_helper_dump_raw((const char*)temp,
info.planes[0].ptr,
- info.planes[0].stride * info.height,
+ info.planes[0].size,
info.planes[1].ptr,
- info.planes[1].stride * (info.height >> 1),
+ info.planes[1].size,
info.planes[2].ptr,
- info.planes[2].stride * (info.height >> 1));
+ info.planes[2].size);
break;
case TBM_FORMAT_NV12:
case TBM_FORMAT_NV21:
- _tdm_helper_dump_raw(file,
+ _tdm_helper_dump_raw((const char*)temp,
info.planes[0].ptr,
- info.planes[0].stride * info.height,
+ info.planes[0].size,
info.planes[1].ptr,
- info.planes[1].stride * (info.height >> 1), NULL,
+ info.planes[1].size, NULL,
0);
break;
- case TBM_FORMAT_YUYV:
- case TBM_FORMAT_UYVY:
- _tdm_helper_dump_raw(file,
+ default:
+ _tdm_helper_dump_raw((const char*)temp,
info.planes[0].ptr,
- info.planes[0].stride * info.height, NULL, 0,
- NULL, 0);
+ info.planes[0].size,
+ info.planes[1].ptr,
+ info.planes[1].size,
+ info.planes[2].ptr,
+ info.planes[2].size);
+ break;
+ }
+
+ tbm_surface_unmap(buffer);
+
+ TDM_INFO("dump %s", temp);
+}
+
+EXTERN void
+tdm_helper_clear_buffer_color(tbm_surface_h buffer, tdm_pos *pos, unsigned int color)
+{
+ tbm_surface_info_s info;
+ int ret;
+
+ TDM_RETURN_IF_FAIL(buffer != NULL);
+
+ ret = tbm_surface_map(buffer, TBM_OPTION_READ, &info);
+ TDM_RETURN_IF_FAIL(ret == TBM_SURFACE_ERROR_NONE);
+
+ switch (info.format) {
+ case TBM_FORMAT_ARGB8888:
+ case TBM_FORMAT_XRGB8888:
+ if (!pos) {
+ memset(info.planes[0].ptr, 0, info.planes[0].stride * info.height);
+ } else {
+ unsigned char *p;
+ int x, y;
+ for (y = pos->y; y <= (pos->y + pos->h); y++) {
+ p = info.planes[0].ptr + info.planes[0].stride * y;
+ for (x = pos->x; x <= (pos->x + pos->w); x++) {
+ unsigned int *ibuf = (unsigned int*)p;
+ ibuf[x] = color;
+ }
+ }
+ }
+ break;
+ case TBM_FORMAT_YVU420:
+ case TBM_FORMAT_YUV420:
+ memset((char*)info.planes[0].ptr, 0x10, info.planes[0].stride * info.height);
+ memset((char*)info.planes[1].ptr, 0x80, info.planes[1].stride * (info.height >> 1));
+ memset((char*)info.planes[2].ptr, 0x80, info.planes[2].stride * (info.height >> 1));
+ break;
+ case TBM_FORMAT_NV12:
+ case TBM_FORMAT_NV21:
+ memset((char*)info.planes[0].ptr, 0x10, info.planes[0].stride * info.height);
+ memset((char*)info.planes[1].ptr, 0x80, info.planes[1].stride * (info.height >> 1));
break;
default:
- TDM_ERR("can't dump %c%c%c%c buffer", FOURCC_STR(info.format));
- tbm_surface_unmap(buffer);
- return;
+ TDM_ERR("can't clear %c%c%c%c buffer", FOURCC_STR(info.format));
+ break;
}
tbm_surface_unmap(buffer);
+}
+
+EXTERN void
+tdm_helper_clear_buffer_pos(tbm_surface_h buffer, tdm_pos *pos)
+{
+ TDM_RETURN_IF_FAIL(buffer != NULL);
- TDM_INFO("dump %s", file);
+ tdm_helper_clear_buffer_color(buffer, pos, 0);
}
-EXTERN int
-tdm_helper_get_fd(const char *env)
+EXTERN void
+tdm_helper_clear_buffer(tbm_surface_h buffer)
{
- const char *value;
- int fd, newfd, flags, ret;
+ TDM_RETURN_IF_FAIL(buffer != NULL);
- value = (const char*)getenv(env);
- if (!value)
- return -1;
+ tdm_helper_clear_buffer_pos(buffer, NULL);
+}
- ret = sscanf(value, "%d", &fd);
- if (ret < 0) {
- TDM_ERR("sscanf failed: %m");
- return -1;
+EXTERN void
+tdm_helper_get_buffer_full_size(tbm_surface_h buffer, int *buffer_w, int *buffer_h)
+{
+ tbm_surface_info_s info;
+ int ret;
+
+ TDM_RETURN_IF_FAIL(buffer != NULL);
+
+ ret = tbm_surface_get_info(buffer, &info);
+ TDM_RETURN_IF_FAIL(ret == TBM_SURFACE_ERROR_NONE);
+
+ if (buffer_w) {
+ if (IS_RGB(info.format))
+ *buffer_w = info.planes[0].stride >> 2;
+ else
+ *buffer_w = info.planes[0].stride;
}
- flags = fcntl(fd, F_GETFD);
- if (flags == -1) {
- TDM_ERR("fcntl failed: %m");
- return -1;
+ if (buffer_h)
+ *buffer_h = info.planes[0].size / info.planes[0].stride;
+}
+
+static pixman_format_code_t
+_tdm_helper_pixman_format_get(tbm_format format)
+{
+ switch (format) {
+ case TBM_FORMAT_ARGB8888:
+ return PIXMAN_a8r8g8b8;
+ case TBM_FORMAT_XRGB8888:
+ return PIXMAN_x8r8g8b8;
+ default:
+ return 0;
}
- newfd = dup(fd);
- if (newfd < 0) {
- TDM_ERR("dup failed: %m");
- return -1;
+ return 0;
+}
+
+EXTERN tdm_error
+tdm_helper_convert_buffer(tbm_surface_h srcbuf, tbm_surface_h dstbuf,
+ tdm_pos *srcpos, tdm_pos *dstpos,
+ tdm_transform transform, int over)
+{
+ tbm_surface_info_s src_info, dst_info;
+ pixman_image_t *src_img = NULL, *dst_img = NULL;
+ pixman_format_code_t src_format, dst_format;
+ double scale_x, scale_y;
+ int rotate_step, bos;
+ pixman_transform_t t;
+ struct pixman_f_transform ft;
+ pixman_op_t op;
+ int src_stride, dst_stride;
+ int buf_width, err;
+ tdm_error ret = TDM_ERROR_OPERATION_FAILED;
+
+ TDM_RETURN_VAL_IF_FAIL(srcbuf != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(dstbuf != NULL, TDM_ERROR_INVALID_PARAMETER);
+
+ bos = tbm_surface_internal_get_num_bos(srcbuf);
+ TDM_RETURN_VAL_IF_FAIL(bos == 1, TDM_ERROR_OPERATION_FAILED);
+
+ bos = tbm_surface_internal_get_num_bos(dstbuf);
+ TDM_RETURN_VAL_IF_FAIL(bos == 1, TDM_ERROR_OPERATION_FAILED);
+
+ err = tbm_surface_map(srcbuf, TBM_OPTION_READ, &src_info);
+ TDM_RETURN_VAL_IF_FAIL(err == TBM_SURFACE_ERROR_NONE, TDM_ERROR_OPERATION_FAILED);
+
+ err = tbm_surface_map(dstbuf, TBM_OPTION_WRITE, &dst_info);
+ TDM_GOTO_IF_FAIL(err == TBM_SURFACE_ERROR_NONE, unmap_srcbuf);
+
+ /* not handle buffers which have 2 more gem handles */
+ TDM_GOTO_IF_FAIL(src_info.planes[0].ptr != NULL, unmap_dstbuf);
+ TDM_GOTO_IF_FAIL(dst_info.planes[0].ptr != NULL, unmap_dstbuf);
+
+ src_format = _tdm_helper_pixman_format_get(src_info.format);
+ TDM_GOTO_IF_FAIL(src_format > 0, unmap_dstbuf);
+ dst_format = _tdm_helper_pixman_format_get(dst_info.format);
+ TDM_GOTO_IF_FAIL(dst_format > 0, unmap_dstbuf);
+
+ buf_width = src_info.planes[0].stride >> 2;
+ src_stride = src_info.planes[0].stride;
+ src_img = pixman_image_create_bits(src_format, buf_width, src_info.height,
+ (uint32_t*)src_info.planes[0].ptr, src_stride);
+ TDM_GOTO_IF_FAIL(src_img, unref_img);
+
+ buf_width = dst_info.planes[0].stride >> 2;
+ dst_stride = dst_info.planes[0].stride;
+ dst_img = pixman_image_create_bits(dst_format, buf_width, dst_info.height,
+ (uint32_t*)dst_info.planes[0].ptr, dst_stride);
+ TDM_GOTO_IF_FAIL(dst_img, unref_img);
+
+ pixman_f_transform_init_identity(&ft);
+
+ if (transform & TDM_TRANSFORM_FLIPPED) {
+ pixman_f_transform_scale(&ft, NULL, -1, 1);
+ pixman_f_transform_translate(&ft, NULL, dstpos->w, 0);
}
- TDM_INFO("%s: fd(%d) newfd(%d)", env, fd, newfd);
+ rotate_step = transform & 0x3;
+ if (rotate_step > 0) {
+ int c, s, tx = 0, ty = 0;
+ switch (rotate_step) {
+ case 1:
+ c = 0, s = -1, tx = -dstpos->w;
+ break;
+ case 2:
+ c = -1, s = 0, tx = -dstpos->w, ty = -dstpos->h;
+ break;
+ case 3:
+ c = 0, s = 1, ty = -dstpos->h;
+ break;
+ }
+ pixman_f_transform_translate(&ft, NULL, tx, ty);
+ pixman_f_transform_rotate(&ft, NULL, c, s);
+ }
+
+ if (rotate_step % 2 == 0) {
+ scale_x = (double)srcpos->w / dstpos->w;
+ scale_y = (double)srcpos->h / dstpos->h;
+ } else {
+ scale_x = (double)srcpos->w / dstpos->h;
+ scale_y = (double)srcpos->h / dstpos->w;
+ }
+
+ pixman_f_transform_scale(&ft, NULL, scale_x, scale_y);
+ pixman_f_transform_translate(&ft, NULL, srcpos->x, srcpos->y);
+ pixman_transform_from_pixman_f_transform(&t, &ft);
+ pixman_image_set_transform(src_img, &t);
+
+ op = (!over) ? PIXMAN_OP_SRC : PIXMAN_OP_OVER;
+
+ pixman_image_composite(op, src_img, NULL, dst_img, 0, 0, 0, 0,
+ dstpos->x, dstpos->y, dstpos->w, dstpos->h);
- fcntl(newfd, F_SETFD, flags | FD_CLOEXEC);
+ ret = TDM_ERROR_NONE;
- return newfd;
+unref_img:
+ if (src_img)
+ pixman_image_unref(src_img);
+ if (dst_img)
+ pixman_image_unref(dst_img);
+unmap_dstbuf:
+ tbm_surface_unmap(dstbuf);
+unmap_srcbuf:
+ tbm_surface_unmap(srcbuf);
+
+ return ret;
}
-EXTERN void
-tdm_helper_set_fd(const char *env, int fd)
+/* LCOV_EXCL_START */
+EXTERN int
+tdm_helper_get_fd(const char *env)
{
- char buf[32];
- int ret;
+ if (strncmp(env, "TBM_DRM_MASTER_FD", 17) && strncmp(env, "TDM_DRM_MASTER_FD", 17)) {
+ TDM_INFO("DEPRECATED! '%s'", env);
+ return -1;
+ }
- snprintf(buf, sizeof(buf), "%d", fd);
+ return tbm_drm_helper_get_master_fd();
+}
- ret = setenv(env, (const char*)buf, 1);
- if (ret) {
- TDM_ERR("setenv failed: %m");
+EXTERN void
+tdm_helper_set_fd(const char *env, int fd)
+{
+ if (strncmp(env, "TBM_DRM_MASTER_FD", 17) && strncmp(env, "TDM_DRM_MASTER_FD", 17)) {
+ TDM_INFO("DEPRECATED! '%s'", env);
return;
}
- if (fd >= 0)
- TDM_INFO("%s: fd(%d)", env, fd);
+ tbm_drm_helper_set_tbm_master_fd(fd);
}
+/* LCOV_EXCL_STOP */
EXTERN void
tdm_helper_dump_start(char *dumppath, int *count)
TDM_DBG("tdm_helper_dump stop.");
}
-static pixman_format_code_t
-_tdm_helper_pixman_format_get(tbm_format format)
-{
- switch (format) {
- case TBM_FORMAT_ARGB8888:
- return PIXMAN_a8r8g8b8;
- case TBM_FORMAT_XRGB8888:
- return PIXMAN_x8r8g8b8;
- default:
- return 0;
- }
-
- return 0;
-}
-
+/* LCOV_EXCL_START */
static tdm_error
_tdm_helper_buffer_convert(tbm_surface_h srcbuf, tbm_surface_h dstbuf,
int dx, int dy, int dw, int dh, int count)
TDM_RETURN_VAL_IF_FAIL(srcbuf != NULL, TDM_ERROR_INVALID_PARAMETER);
TDM_RETURN_VAL_IF_FAIL(dstbuf != NULL, TDM_ERROR_INVALID_PARAMETER);
- if (tbm_surface_map(srcbuf, TBM_SURF_OPTION_READ, &src_info)
- != TBM_SURFACE_ERROR_NONE) {
+ if (tbm_surface_map(srcbuf, TBM_SURF_OPTION_READ, &src_info) != TBM_SURFACE_ERROR_NONE) {
TDM_ERR("cannot mmap srcbuf\n");
return TDM_ERROR_OPERATION_FAILED;
}
- if (tbm_surface_map(dstbuf, TBM_SURF_OPTION_WRITE, &dst_info)
- != TBM_SURFACE_ERROR_NONE) {
+ if (tbm_surface_map(dstbuf, TBM_SURF_OPTION_WRITE, &dst_info) != TBM_SURFACE_ERROR_NONE) {
TDM_ERR("cannot mmap dstbuf\n");
tbm_surface_unmap(srcbuf);
return TDM_ERROR_OPERATION_FAILED;
return TDM_ERROR_OPERATION_FAILED;
}
+/* LCOV_EXCL_STOP */
+
EXTERN tdm_error
tdm_helper_capture_output(tdm_output *output, tbm_surface_h dst_buffer,
TDM_RETURN_VAL_IF_FAIL(w >= 0, TDM_ERROR_INVALID_PARAMETER);
TDM_RETURN_VAL_IF_FAIL(h >= 0, TDM_ERROR_INVALID_PARAMETER);
TDM_RETURN_VAL_IF_FAIL(func != NULL, TDM_ERROR_INVALID_PARAMETER);
- TDM_RETURN_VAL_IF_FAIL(data != NULL, TDM_ERROR_INVALID_PARAMETER);
err = tdm_output_get_layer_count(output, &count);
if (err != TDM_ERROR_NONE) {
return TDM_ERROR_NONE;
}
-EXTERN void
-tdm_helper_get_display_information(tdm_display *dpy, char *reply, int *len)
+static char *
+_tdm_helper_get_backend_information(tdm_private_module *private_module, char *reply, int *len)
{
- const char *name, *vendor;
- int major, minor;
+ tdm_backend_module *module_data;
+ tdm_func_output *func_output;
+ tdm_func_layer *func_layer;
+ tdm_private_output *private_output = NULL;
+ tdm_private_layer *private_layer = NULL;
+ tdm_private_pp *private_pp = NULL;
+ tdm_private_capture *private_capture = NULL;
tdm_error ret;
- int i, count;
- tdm_output *output;
- const tdm_prop *props;
- int min_w, min_h, max_w, max_h, preferred_align;
- const tbm_format *formats;
- tdm_display_capability display_caps;
-
- ret = tdm_display_get_backend_info(dpy, &name, &vendor, &major, &minor);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
-
- TDM_SNPRINTF(reply, len, "TDM backend name: %s\n", name);
- TDM_SNPRINTF(reply, len, "TDM backend vendor: %s\n", vendor);
- TDM_SNPRINTF(reply, len, "TDM backend version: %d.%d\n\n", major, minor);
-
- ret = tdm_display_get_output_count(dpy, &count);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
-
- TDM_SNPRINTF(reply, len, "[Output information]\n");
- TDM_SNPRINTF(reply, len, "-------------------------------------------------------------------------------------------\n");
- TDM_SNPRINTF(reply, len, "idx maker model name type status dpms subpix prefer min max phy\n");
- TDM_SNPRINTF(reply, len, "-------------------------------------------------------------------------------------------\n");
-
- for (i = 0; i < count; i++) {
- /* idx maker model name type status dpms subpix prefer min max phy */
- const char *maker, *model, *name;
- tdm_output_type type;
- tdm_output_conn_status status;
- unsigned int subpixel;
- unsigned int mmWidth, mmHeight;
- tdm_output_dpms dpms;
- const tdm_output_mode *mode, *modes;
- int j, cnt;
-
- output = tdm_display_get_output(dpy, i, &ret);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_output_get_model_info(output, &maker, &model, &name);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_output_get_output_type(output, &type);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_output_get_conn_status(output, &status);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_output_get_dpms(output, &dpms);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_output_get_subpixel(output, &subpixel);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_output_get_available_size(output, &min_w, &min_h, &max_w, &max_h, &preferred_align);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_output_get_physical_size(output, &mmWidth, &mmHeight);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
-
- TDM_SNPRINTF(reply, len, "%d %s %s %s %s %s %s %d %d %dx%d %dx%d %dx%d\n",
- i, maker, model, name, tdm_conn_str(type), tdm_status_str(status),
- tdm_dpms_str(dpms), subpixel, preferred_align,
- min_w, min_h, max_w, max_h, mmWidth, mmHeight);
-
- ret = tdm_output_get_mode(output, &mode);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
-
- ret = tdm_output_get_available_modes(output, &modes, &cnt);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
-
- TDM_SNPRINTF(reply, len, "\t%d modes:\n", cnt);
-
- if (cnt > 0) {
- TDM_SNPRINTF(reply, len, "\t\tname refresh (Hz) hdisp hss hse htot vdisp vss vse vtot\n");
- for (j = 0; j < cnt; j++) {
- char *current = (mode == modes + j) ? "*" : " ";
- TDM_SNPRINTF(reply, len, "\t\t%s%s %d %d %d %d %d %d %d %d %d ",
+ int i;
+
+ func_output = &private_module->func_output;
+ func_layer = &private_module->func_layer;
+
+ /* module information */
+ module_data = private_module->module_data;
+ TDM_SNPRINTF(reply, len, "['%s' backend information]\n", module_data->name);
+ TDM_SNPRINTF(reply, len, "vendor: %s\n", module_data->vendor);
+ TDM_SNPRINTF(reply, len, "version: %d.%d\n\n",
+ (int)TDM_BACKEND_GET_ABI_MAJOR(module_data->abi_version),
+ (int)TDM_BACKEND_GET_ABI_MINOR(module_data->abi_version));
+
+ /* output information */
+ TDM_SNPRINTF(reply, len, "['%s' backend output information]\n", module_data->name);
+ TDM_SNPRINTF(reply, len, "--------------------------------------------------------------------------------------------\n");
+ TDM_SNPRINTF(reply, len, "idx maker model name type status dpms subpixel align_w min max phy(mm)\n");
+ TDM_SNPRINTF(reply, len, "--------------------------------------------------------------------------------------------\n");
+ LIST_FOR_EACH_ENTRY(private_output, &private_module->output_list, link) {
+ TDM_SNPRINTF(reply, len, "%d %s %s %s %s %s %s %u %d %dx%d %dx%d %ux%u\n",
+ private_output->index, private_output->caps.maker,
+ private_output->caps.model, private_output->caps.name,
+ tdm_conn_str(private_output->caps.type),
+ tdm_status_str(private_output->caps.status),
+ tdm_dpms_str(private_output->current_dpms_value),
+ private_output->caps.subpixel,
+ TDM_FRONT_VALUE(private_output->caps.preferred_align),
+ TDM_FRONT_VALUE(private_output->caps.min_w),
+ TDM_FRONT_VALUE(private_output->caps.min_h),
+ TDM_FRONT_VALUE(private_output->caps.max_w),
+ TDM_FRONT_VALUE(private_output->caps.max_h),
+ private_output->caps.mmWidth, private_output->caps.mmHeight);
+
+ TDM_SNPRINTF(reply, len, "\t%u modes:\n", private_output->caps.mode_count);
+
+ if (private_output->caps.mode_count > 0) {
+ TDM_SNPRINTF(reply, len, "\t\t name refresh (Hz) clk hdisp hss hse htot vdisp vss vse vtot vscan\n");
+ for (i = 0; i < private_output->caps.mode_count; i++) {
+ char *current = (private_output->current_mode == private_output->caps.modes + i) ? "*" : " ";
+ TDM_SNPRINTF(reply, len, "\t\t%s%s %u %u %u %u %u %u %u %u %u %u %u ",
current,
- modes[j].name,
- modes[j].vrefresh,
- modes[j].hdisplay,
- modes[j].hsync_start,
- modes[j].hsync_end,
- modes[j].htotal,
- modes[j].vdisplay,
- modes[j].vsync_start,
- modes[j].vsync_end,
- modes[j].vtotal);
- tdm_mode_flag_str(modes[j].flags, &reply, len);
+ private_output->caps.modes[i].name,
+ private_output->caps.modes[i].vrefresh,
+ private_output->caps.modes[i].clock,
+ private_output->caps.modes[i].hdisplay,
+ private_output->caps.modes[i].hsync_start,
+ private_output->caps.modes[i].hsync_end,
+ private_output->caps.modes[i].htotal,
+ private_output->caps.modes[i].vdisplay,
+ private_output->caps.modes[i].vsync_start,
+ private_output->caps.modes[i].vsync_end,
+ private_output->caps.modes[i].vtotal,
+ private_output->caps.modes[i].vscan);
+ tdm_mode_flag_str(private_output->caps.modes[i].flags, &reply, len);
TDM_SNPRINTF(reply, len, " ");
- tdm_mode_type_str(modes[j].type, &reply, len);
+ tdm_mode_type_str(private_output->caps.modes[i].type, &reply, len);
TDM_SNPRINTF(reply, len, "\n");
}
}
- ret = tdm_output_get_available_properties(output, &props, &cnt);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
-
- TDM_SNPRINTF(reply, len, "\t%d properties:\n", cnt);
- if (cnt > 0) {
- TDM_SNPRINTF(reply, len, "\t\tname idx value\n");
- for (j = 0; j < cnt; j++) {
+ TDM_SNPRINTF(reply, len, "\t%d properties:\n", private_output->caps.prop_count);
+ if (private_output->caps.prop_count > 0) {
+ TDM_SNPRINTF(reply, len, "\t\tname\ttype\tidx\tvalue\n");
+ for (i = 0; i < private_output->caps.prop_count; i++) {
tdm_value value;
- ret = tdm_output_get_property(output, props[j].id, &value);
- TDM_SNPRINTF(reply, len, "\t\t%s %d %d\n",
- props[j].name,
- props[j].id,
- value.u32);
+ TDM_DBG_RETURN_VAL_IF_FAIL(func_output->output_get_property, reply);
+ ret = func_output->output_get_property(private_output->output_backend,
+ private_output->caps.props[i].id,
+ &value);
+ TDM_DBG_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, reply);
+ TDM_SNPRINTF(reply, len, "\t\t%s\t%s\t%u\t",
+ private_output->caps.props[i].name,
+ tdm_value_type_str(private_output->caps.props[i].type),
+ private_output->caps.props[i].id);
+ switch (private_output->caps.props[i].type) {
+ case TDM_VALUE_TYPE_PTR:
+ TDM_SNPRINTF(reply, len, "%p\n", value.ptr);
+ break;
+ case TDM_VALUE_TYPE_INT32:
+ TDM_SNPRINTF(reply, len, "%d\n", value.s32);
+ break;
+ case TDM_VALUE_TYPE_INT64:
+ TDM_SNPRINTF(reply, len, "%"PRId64"\n", value.s64);
+ break;
+ case TDM_VALUE_TYPE_UINT64:
+ TDM_SNPRINTF(reply, len, "%"PRIu64"\n", value.u64);
+ break;
+ case TDM_VALUE_TYPE_UINT32:
+ default:
+ TDM_SNPRINTF(reply, len, "%u\n", value.u32);
+ break;
+ }
}
}
- TDM_SNPRINTF(reply, len, "\n");
}
+ TDM_SNPRINTF(reply, len, "\n");
- TDM_SNPRINTF(reply, len, "[Layer information]\n");
- for (i = 0; i < count; i++) {
- int j, cnt;
-
- output = tdm_display_get_output(dpy, i, &ret);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
-
- ret = tdm_output_get_layer_count(output, &cnt);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
-
- if (cnt > 0) {
- TDM_SNPRINTF(reply, len, "-----------------------------------------------------\n");
- TDM_SNPRINTF(reply, len, "idx output zpos buf info caps\n");
- TDM_SNPRINTF(reply, len, "-----------------------------------------------------\n");
- for (j = 0; j < cnt; j++) {
- tdm_layer *layer;
- tbm_surface_h buf;
- tdm_layer_capability layer_caps;
- int k, c, zpos;
+ /* layer information */
+ TDM_SNPRINTF(reply, len, "['%s' backend layer information]\n", module_data->name);
+ TDM_SNPRINTF(reply, len, "-----------------------------------------------------------------------\n");
+ TDM_SNPRINTF(reply, len, "idx output zpos buf format size crop geometry transform\n");
+ TDM_SNPRINTF(reply, len, "-----------------------------------------------------------------------\n");
+ LIST_FOR_EACH_ENTRY(private_output, &private_module->output_list, link) {
+ LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link) {
+ if (!private_layer->usable) {
tdm_info_layer info;
+ unsigned int format;
+ tdm_size size;
+ tbm_surface_info_s buf_info;
+ TDM_DBG_RETURN_VAL_IF_FAIL(func_layer->layer_get_info, reply);
memset(&info, 0, sizeof info);
+ ret = func_layer->layer_get_info(private_layer->layer_backend, &info);
+ TDM_DBG_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, reply);
- layer = tdm_output_get_layer(output, j, &ret);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_layer_get_capabilities(layer, &layer_caps);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_layer_get_zpos(layer, &zpos);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
+ if (!private_layer->showing_buffer)
+ continue;
- ret = tdm_layer_get_info(layer, &info);
- buf = tdm_layer_get_displaying_buffer(layer, &ret);
+ format = tbm_surface_get_format(private_layer->showing_buffer->buffer);
+ tbm_surface_get_info(private_layer->showing_buffer->buffer, &buf_info);
- if (info.src_config.format)
- TDM_SNPRINTF(reply, len, "%d %d %d %p %c%c%c%c %dx%d (%d,%d %dx%d) (%d,%d %dx%d) trans(%d) ",
- j, i, zpos, buf,
- FOURCC_STR(info.src_config.format), info.src_config.size.h, info.src_config.size.v,
- info.src_config.pos.x, info.src_config.pos.y, info.src_config.pos.w, info.src_config.pos.h,
- info.dst_pos.x, info.dst_pos.y, info.dst_pos.w, info.dst_pos.h,
- info.transform);
+ if (IS_RGB(format))
+ size.h = buf_info.planes[0].stride >> 2;
else
- TDM_SNPRINTF(reply, len, "%d %d %d %p %c%c%c%c %dx%d (%d,%d %dx%d) (%d,%d %dx%d) trans(%d) ",
- j, i, zpos, buf,
- 'N', 'O', 'N', 'E', info.src_config.size.h, info.src_config.size.v,
- info.src_config.pos.x, info.src_config.pos.y, info.src_config.pos.w, info.src_config.pos.h,
- info.dst_pos.x, info.dst_pos.y, info.dst_pos.w, info.dst_pos.h,
- info.transform);
- tdm_layer_caps_str(layer_caps, &reply, len);
+ size.h = buf_info.planes[0].stride;
+ size.v = tbm_surface_get_height(private_layer->showing_buffer->buffer);
+
+ if (info.src_config.format)
+ format = (info.src_config.format) ? : format;
+
+ TDM_SNPRINTF(reply, len, "%d %d %d %p %c%c%c%c %ux%u %ux%u+%u+%u %ux%u+%u+%u %s\n",
+ private_layer->index,
+ private_output->index,
+ private_layer->caps.zpos,
+ private_layer->showing_buffer->buffer, FOURCC_STR(format), size.h, size.v,
+ info.src_config.pos.w, info.src_config.pos.h, info.src_config.pos.x, info.src_config.pos.y,
+ info.dst_pos.w, info.dst_pos.h, info.dst_pos.x, info.dst_pos.y,
+ tdm_transform_str(info.transform));
+ } else {
+ TDM_SNPRINTF(reply, len, "%d %d %d -\n",
+ private_layer->index,
+ private_output->index,
+ private_layer->caps.zpos);
+ }
+
+ TDM_SNPRINTF(reply, len, "\tcaps\t: ");
+ tdm_layer_caps_str(private_layer->caps.capabilities, &reply, len);
+ TDM_SNPRINTF(reply, len, "\n");
+
+ TDM_SNPRINTF(reply, len, "\tformats\t: ");
+ if (private_layer->caps.format_count > 0) {
+ const char *sep = "";
+ for (i = 0; i < private_layer->caps.format_count; i++) {
+ if (private_layer->caps.formats[i] == 0)
+ continue;
+ TDM_SNPRINTF(reply, len, "%s%c%c%c%c", sep, FOURCC_STR(private_layer->caps.formats[i]));
+ sep = ",";
+ }
TDM_SNPRINTF(reply, len, "\n");
+ }
- ret = tdm_layer_get_available_properties(layer, &props, &c);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- TDM_SNPRINTF(reply, len, "\t%d properties:\n", c);
- if (c > 0) {
- TDM_SNPRINTF(reply, len, "\t\tname idx value\n");
- for (k = 0; k < c; k++) {
- tdm_value value;
- ret = tdm_layer_get_property(layer, props[k].id, &value);
- TDM_SNPRINTF(reply, len, "\t\t%s %d %d\n",
- props[k].name,
- props[k].id,
- value.u32);
- }
+ TDM_SNPRINTF(reply, len, "\t%u properties:\n", private_layer->caps.prop_count);
+ if (private_layer->caps.prop_count > 0) {
+ TDM_SNPRINTF(reply, len, "\t\tname\ttype\tidx\tvalue\n");
+ for (i = 0; i < private_layer->caps.prop_count; i++) {
+ tdm_value value;
+ TDM_DBG_RETURN_VAL_IF_FAIL(func_layer->layer_get_property, reply);
+ ret = func_layer->layer_get_property(private_layer->layer_backend,
+ private_layer->caps.props[i].id,
+ &value);
+ TDM_DBG_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, reply);
+ TDM_SNPRINTF(reply, len, "\t\t%s\t%s\t%u\t",
+ private_layer->caps.props[i].name,
+ tdm_value_type_str(private_output->caps.props[i].type),
+ private_layer->caps.props[i].id);
+ switch (private_layer->caps.props[i].type) {
+ case TDM_VALUE_TYPE_PTR:
+ TDM_SNPRINTF(reply, len, "%p\n", value.ptr);
+ break;
+ case TDM_VALUE_TYPE_INT32:
+ TDM_SNPRINTF(reply, len, "%d\n", value.s32);
+ break;
+ case TDM_VALUE_TYPE_INT64:
+ TDM_SNPRINTF(reply, len, "%"PRId64"\n", value.s64);
+ break;
+ case TDM_VALUE_TYPE_UINT64:
+ TDM_SNPRINTF(reply, len, "%"PRIu64"\n", value.u64);
+ break;
+ case TDM_VALUE_TYPE_UINT32:
+ default:
+ TDM_SNPRINTF(reply, len, "%u\n", value.u32);
+ break;
}
+ }
+ }
+ }
+ }
+ TDM_SNPRINTF(reply, len, "\n");
- ret = tdm_layer_get_available_formats(layer, &formats, &c);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- TDM_SNPRINTF(reply, len, "\tformats:");
- for (k = 0; k < c; k++)
- TDM_SNPRINTF(reply, len, " %c%c%c%c", FOURCC_STR(formats[k]));
- TDM_SNPRINTF(reply, len, "\n");
+ if (private_module->capabilities & TDM_DISPLAY_CAPABILITY_PP) {
+ const char *sep = "";
+ TDM_SNPRINTF(reply, len, "['%s' backend PP information]\n", module_data->name);
+ TDM_SNPRINTF(reply, len, "caps\t: ");
+ tdm_pp_caps_str(private_module->caps_pp.capabilities, &reply, len);
+ TDM_SNPRINTF(reply, len, "\n");
+ TDM_SNPRINTF(reply, len, "formats\t: ");
+ for (i = 0; i < private_module->caps_pp.format_count; i++) {
+ if (private_module->caps_pp.formats[i] == 0)
+ continue;
+ TDM_SNPRINTF(reply, len, "%s%c%c%c%c", sep, FOURCC_STR(private_module->caps_pp.formats[i]));
+ sep = ",";
+ }
+ TDM_SNPRINTF(reply, len, "\n");
+ TDM_SNPRINTF(reply, len, "size\t: min(%dx%d) max(%dx%d) align_w(%d)\n",
+ TDM_FRONT_VALUE(private_module->caps_pp.min_w),
+ TDM_FRONT_VALUE(private_module->caps_pp.min_h),
+ TDM_FRONT_VALUE(private_module->caps_pp.max_w),
+ TDM_FRONT_VALUE(private_module->caps_pp.max_h),
+ TDM_FRONT_VALUE(private_module->caps_pp.preferred_align));
+ if (!LIST_IS_EMPTY(&private_module->pp_list)) {
+ TDM_SNPRINTF(reply, len, "-------------------------------------------------------------\n");
+ TDM_SNPRINTF(reply, len, "src(format size crop) | dst(format size crop) | transform\n");
+ TDM_SNPRINTF(reply, len, "-------------------------------------------------------------\n");
+ LIST_FOR_EACH_ENTRY(private_pp, &private_module->pp_list, link) {
+ TDM_SNPRINTF(reply, len, "%c%c%c%c %ux%u %ux%u+%u+%u | %c%c%c%c %ux%u %ux%u+%u+%u | %s\n",
+ FOURCC_STR(private_pp->info.src_config.format),
+ private_pp->info.src_config.size.h,
+ private_pp->info.src_config.size.v,
+ private_pp->info.src_config.pos.x, private_pp->info.src_config.pos.y,
+ private_pp->info.src_config.pos.w, private_pp->info.src_config.pos.h,
+ FOURCC_STR(private_pp->info.dst_config.format),
+ private_pp->info.dst_config.size.h,
+ private_pp->info.dst_config.size.v,
+ private_pp->info.dst_config.pos.x, private_pp->info.dst_config.pos.y,
+ private_pp->info.dst_config.pos.w, private_pp->info.dst_config.pos.h,
+ tdm_transform_str(private_pp->info.transform));
}
}
+ } else {
+ TDM_SNPRINTF(reply, len, "['%s' backend No PP capability]\n", module_data->name);
}
+ TDM_SNPRINTF(reply, len, "\n");
+ if (private_module->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE) {
+ const char *sep = "";
+ TDM_SNPRINTF(reply, len, "['%s' backend capture information]\n", module_data->name);
+ TDM_SNPRINTF(reply, len, "caps\t: ");
+ tdm_capture_caps_str(private_module->caps_capture.capabilities, &reply, len);
+ TDM_SNPRINTF(reply, len, "\n");
+ TDM_SNPRINTF(reply, len, "formats\t: ");
+ for (i = 0; i < private_module->caps_capture.format_count; i++) {
+ if (private_module->caps_capture.formats[i] == 0)
+ continue;
+ TDM_SNPRINTF(reply, len, "%s%c%c%c%c", sep, FOURCC_STR(private_module->caps_capture.formats[i]));
+ sep = ",";
+ }
+ TDM_SNPRINTF(reply, len, "\n");
+ TDM_SNPRINTF(reply, len, "size\t: min(%dx%d) max(%dx%d) align_w(%d)\n",
+ TDM_FRONT_VALUE(private_module->caps_capture.min_w),
+ TDM_FRONT_VALUE(private_module->caps_capture.min_h),
+ TDM_FRONT_VALUE(private_module->caps_capture.max_w),
+ TDM_FRONT_VALUE(private_module->caps_capture.max_h),
+ TDM_FRONT_VALUE(private_module->caps_capture.preferred_align));
+ if (!LIST_IS_EMPTY(&private_module->capture_list)) {
+ TDM_SNPRINTF(reply, len, "-----------------------------------\n");
+ TDM_SNPRINTF(reply, len, "dst(format size crop) | transform\n");
+ TDM_SNPRINTF(reply, len, "-----------------------------------\n");
+ LIST_FOR_EACH_ENTRY(private_capture, &private_module->capture_list, link) {
+ TDM_SNPRINTF(reply, len, "%c%c%c%c %ux%u %ux%u+%u+%u | %s\n",
+ FOURCC_STR(private_capture->info.dst_config.format),
+ private_capture->info.dst_config.size.h,
+ private_capture->info.dst_config.size.v,
+ private_capture->info.dst_config.pos.x, private_capture->info.dst_config.pos.y,
+ private_capture->info.dst_config.pos.w, private_capture->info.dst_config.pos.h,
+ tdm_transform_str(private_capture->info.transform));
+ }
+ }
+ } else {
+ TDM_SNPRINTF(reply, len, "['%s' backend No Capture capability]\n", module_data->name);
+ }
TDM_SNPRINTF(reply, len, "\n");
+ return reply;
+}
- ret = tdm_display_get_capabilities(dpy, &display_caps);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
+EXTERN void
+tdm_helper_get_display_information(tdm_display *dpy, char *reply, int *len)
+{
+ tdm_private_display *private_display;
+ tdm_private_module *private_module = NULL;
- if (display_caps & TDM_DISPLAY_CAPABILITY_PP) {
- tdm_pp_capability pp_caps;
+ TDM_DBG_RETURN_IF_FAIL(dpy != NULL);
- ret = tdm_display_get_pp_capabilities(dpy, &pp_caps);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_display_get_pp_available_formats(dpy, &formats, &count);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_display_get_pp_available_size(dpy, &min_w, &min_h, &max_w, &max_h, &preferred_align);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
+ private_display = dpy;
- TDM_SNPRINTF(reply, len, "[PP information]\n");
- TDM_SNPRINTF(reply, len, "caps: ");
- tdm_pp_caps_str(pp_caps, &reply, len);
- TDM_SNPRINTF(reply, len, "\n");
- TDM_SNPRINTF(reply, len, "formats: ");
- for (i = 0; i < count; i++)
- TDM_SNPRINTF(reply, len, " %c%c%c%c", FOURCC_STR(formats[i]));
- TDM_SNPRINTF(reply, len, "\n");
- TDM_SNPRINTF(reply, len, "size: min(%dx%d) max(%dx%d) preferred(%d)\n",
- min_w, min_h, max_w, max_h, preferred_align);
+ _pthread_mutex_lock(&private_display->lock);
+
+ LIST_FOR_EACH_ENTRY(private_module, &private_display->module_list, link) {
+ reply = _tdm_helper_get_backend_information(private_module, reply, len);
}
- if (display_caps & TDM_DISPLAY_CAPABILITY_CAPTURE) {
- tdm_capture_capability capture_caps;
+ _pthread_mutex_unlock(&private_display->lock);
+}
+
+/* LCOV_EXCL_START */
+EXTERN int
+tdm_helper_commit_per_vblank_enabled(tdm_display *dpy)
+{
+ TDM_DEPRECATED("Use tdm_helper_output_commit_per_vblank_enabled");
+
+ return 0;
+}
+/* LCOV_EXCL_STOP */
- ret = tdm_display_get_capture_capabilities(dpy, &capture_caps);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
- ret = tdm_display_get_catpure_available_formats(dpy, &formats, &count);
- TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
+EXTERN int
+tdm_helper_output_commit_per_vblank_enabled(tdm_output *output)
+{
+ tdm_private_output *private_output = output;
- TDM_SNPRINTF(reply, len, "[Capture information]\n");
- TDM_SNPRINTF(reply, len, "caps: ");
- tdm_capture_caps_str(capture_caps, &reply, len);
- TDM_SNPRINTF(reply, len, "\n");
- TDM_SNPRINTF(reply, len, "formats: ");
- for (i = 0; i < count; i++)
- TDM_SNPRINTF(reply, len, " %c%c%c%c", FOURCC_STR(formats[i]));
- TDM_SNPRINTF(reply, len, "\n");
- }
+ TDM_RETURN_VAL_IF_FAIL(private_output != NULL, -1);
+
+ return !!private_output->commit_per_vblank;
+}
+
+EXTERN unsigned int
+tdm_helper_output_vblank_timer_expired(tdm_output *output)
+{
+ tdm_private_output *private_output = output;
+
+ TDM_RETURN_VAL_IF_FAIL(private_output != NULL, -1);
+
+ return private_output->vblank_timeout_timer_expired;
}