tdm_helper_dump_buffer(tbm_surface_h buffer, const char *file);
/**
+ * @brief fill a buffer with 0 for given pos.
+ * @details
+ * This function supports only if a buffer has below formats.
+ * - TBM_FORMAT_ARGB8888
+ * - TBM_FORMAT_XRGB8888
+ * - TBM_FORMAT_YVU420
+ * - TBM_FORMAT_YUV420
+ * - TBM_FORMAT_NV12
+ * - TBM_FORMAT_NV21
+ * - TBM_FORMAT_YUYV
+ * - TBM_FORMAT_UYVY
+ * @param[in] buffer A TDM buffer
+ */
+void
+tdm_helper_clear_buffer_pos(tbm_surface_h buffer, tdm_pos *pos);
+
+/**
* @brief fill a buffer with 0.
* @details
* This function supports only if a buffer has below formats.
TDM_INFO("dump %s", file);
}
-EXTERN void
-tdm_helper_clear_buffer(tbm_surface_h buffer)
+void
+tdm_helper_clear_buffer_pos(tbm_surface_h buffer, tdm_pos *pos)
{
tbm_surface_info_s info;
int ret;
switch (info.format) {
case TBM_FORMAT_ARGB8888:
case TBM_FORMAT_XRGB8888:
- memset(info.planes[0].ptr, 0, info.planes[0].stride * info.height);
+ 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++) {
+ int *ibuf = (int*)p;
+ ibuf[x] = 0x00000000;
+ }
+ }
+ }
break;
case TBM_FORMAT_YVU420:
case TBM_FORMAT_YUV420:
tbm_surface_unmap(buffer);
}
+EXTERN void
+tdm_helper_clear_buffer(tbm_surface_h buffer)
+{
+ TDM_RETURN_IF_FAIL(buffer != NULL);
+
+ tdm_helper_clear_buffer_pos(buffer, NULL);
+}
+
EXTERN int
tdm_helper_get_fd(const char *env)
{
tdm_display_enable_dump(dpy, (const char*)argv[2], reply, len);
}
+static void
+_tdm_monitor_server_punch(unsigned int pid, char *cwd, int argc, char *argv[], char *reply, int *len, tdm_display *dpy)
+{
+ char *arg, *end;
+ unsigned int output_id, layer_id;
+ tdm_output *output;
+ tdm_layer *layer;
+ tbm_surface_h buffer;
+
+ arg = argv[2];
+
+ output_id = strtol(arg, &end, 10);
+ output = tdm_display_get_output(dpy, output_id, NULL);
+ if (!output) {
+ TDM_SNPRINTF(reply, len, "not found output\n");
+ return;
+ }
+ if (*end != ',') {
+ TDM_SNPRINTF(reply, len, "not found ',<layer_idx>'\n");
+ return;
+ }
+
+ arg = end + 1;
+ layer_id = strtol(arg, &end, 10);
+ layer = tdm_output_get_layer(output, layer_id, NULL);
+ if (!layer) {
+ TDM_SNPRINTF(reply, len, "not found layer\n");
+ return;
+ }
+
+ buffer = tdm_layer_get_displaying_buffer(layer, NULL);
+ if (!buffer) {
+ TDM_SNPRINTF(reply, len, "not found buffer\n");
+ return;
+ }
+
+ if (*end == ':') {
+ tdm_pos pos = {0,};
+
+ arg = end + 1;
+ pos.w = strtol(arg, &end, 10);
+ TDM_EXIT_IF_FAIL(*end == 'x');
+ arg = end + 1;
+ pos.h = strtol(arg, &end, 10);
+ if (*end == '+') {
+ arg = end + 1;
+ pos.x = strtol(arg, &end, 10);
+ TDM_EXIT_IF_FAIL(*end == '+');
+ arg = end + 1;
+ pos.y = strtol(arg, &end, 10);
+ }
+
+ tdm_helper_clear_buffer_pos(buffer, &pos);
+ }
+ else
+ tdm_helper_clear_buffer(buffer);
+}
+
static struct {
const char *opt;
void (*func)(unsigned int pid, char *cwd, int argc, char *argv[], char *reply, int *len, tdm_display *dpy);
"<object_type1>[,<object_type2>[,...]][@<directory_path>]",
NULL
},
+ {
+ "punch", _tdm_monitor_server_punch,
+ "punch a layer",
+ "<output_idx>,<layer_idx>[:<w>x<h>[+<x>+<y>]]",
+ NULL
+ },
};
static void