int bcm_accel_init(void) { fb_fd = open("/dev/fb/0", O_RDWR); if (fb_fd < 0) { perror("/dev/fb/0"); return 1; } if (exec_list()) { fprintf(stderr, "BCM accel interface not available - %m\n"); close(fb_fd); return 1; } /* now test for blending flags support */ P(0x80, 0); if (exec_list()) { supportblendingflags = false; } #ifdef FORCE_NO_BLENDING_ACCELERATION /* hardware doesn't allow us to detect whether the opcode is working */ supportblendingflags = false; #endif return 0; }
void bcm_accel_blit( int src_addr, int src_width, int src_height, int src_stride, int src_format, int dst_addr, int dst_width, int dst_height, int dst_stride, int src_x, int src_y, int width, int height, int dst_x, int dst_y, int dwidth, int dheight, int pal_addr, int flags) { C(0x43); // reset source C(0x53); // reset dest C(0x5b); // reset pattern C(0x67); // reset blend C(0x75); // reset output P(0x0, src_addr); // set source addr P(0x1, src_stride); // set source pitch P(0x2, src_width); // source width P(0x3, src_height); // height switch (src_format) { case 0: P(0x4, 0x7e48888); // format: ARGB 8888 break; case 1: P(0x4, 0x12e40008); // indexed 8bit P(0x78, 256); P(0x79, pal_addr); P(0x7a, 0x7e48888); break; } C(0x5); // set source surface (based on last parameters) P(0x2e, src_x); // define rect P(0x2f, src_y); P(0x30, width); P(0x31, height); C(0x32); // set this rect as source rect P(0x0, dst_addr); // prepare output surface P(0x1, dst_stride); P(0x2, dst_width); P(0x3, dst_height); P(0x4, 0x7e48888); C(0x69); // set output surface P(0x2e, dst_x); // prepare output rect P(0x2f, dst_y); P(0x30, dwidth); P(0x31, dheight); C(0x6e); // set this rect as output rect if (supportblendingflags && flags) P(0x80, flags); /* blend flags... We'd really like some blending support in the drivers, to avoid punching holes in the osd */ C(0x77); // do it exec_list(); }
void bcm_accel_fill( int dst_addr, int dst_width, int dst_height, int dst_stride, int x, int y, int width, int height, unsigned long color) { C(0x43); // reset source C(0x53); // reset dest C(0x5b); // reset pattern C(0x67); // reset blend C(0x75); // reset output // clear dest surface P(0x0, 0); P(0x1, 0); P(0x2, 0); P(0x3, 0); P(0x4, 0); C(0x45); // clear src surface P(0x0, 0); P(0x1, 0); P(0x2, 0); P(0x3, 0); P(0x4, 0); C(0x5); P(0x2d, color); P(0x2e, x); // prepare output rect P(0x2f, y); P(0x30, width); P(0x31, height); C(0x6e); // set this rect as output rect P(0x0, dst_addr); // prepare output surface P(0x1, dst_stride); P(0x2, dst_width); P(0x3, dst_height); P(0x4, 0x7e48888); C(0x69); // set output surface P(0x6f, 0); P(0x70, 0); P(0x71, 2); P(0x72, 2); C(0x73); // select color keying C(0x77); // do it exec_list(); }
void get_pkg_dbdir(void) { char **exec_cmd; if ((exec_cmd = exec_list(PKGTOOLS"/pkg_admin config-var PKG_DBDIR", NULL)) == NULL) strcpy(pkg_dbdir, PKG_DBDIR); else { XSTRCPY(pkg_dbdir, exec_cmd[0]); free_list(exec_cmd); } }
static void exec_cmd(Pcs pcs, struct params *params) { switch (params->action) { case ACTION_QUOTA: break; case ACTION_META: /*获取元数据*/ exec_meta(pcs, params); break; case ACTION_LIST: /* 列出目录 */ exec_list(pcs, params); break; case ACTION_RENAME: /* 重命名文件或目录 */ exec_rename(pcs, params); break; case ACTION_MOVE: /* 移动文件或目录 */ exec_move(pcs, params); break; case ACTION_COPY: /* 复制文件或目录 */ exec_copy(pcs, params); break; case ACTION_MKDIR: /* 创建目录 */ exec_mkdir(pcs, params); break; case ACTION_DELETE: /* 删除文件或目录 */ exec_delete(pcs, params); break; case ACTION_CAT: /* 直接显示网盘中文本文件的内容 */ exec_cat(pcs, params); break; case ACTION_ECHO: /* 直接把文本保存到网盘文件中 */ exec_echo(pcs, params); break; case ACTION_SEARCH: /* 搜索网盘文件 */ exec_search(pcs, params); break; case ACTION_DOWNLOAD: /* 下载网盘文件或目录 */ exec_download(pcs, params); break; case ACTION_UPLOAD: /* 上传文件或目录到网盘中 */ exec_upload(pcs, params); break; default: printf("Unknown command, use `--help` to view help.\n"); break; } }