4.1 网络层概述 4.1.1 转发和路由选择:数据平面和控制平面 转发 (forwarding):将 从一个输入链路接口转移到适当的输出链路接口的路由器本地动作。转发发生的时间尺度很短 (通常为几纳秒),因此通常用硬件来实现。 路由 (routing):指确定分组从源到目的地所采取的端到端路径的网络范围处理过程。路由选择发生的时间尺度长得多 (通常为几秒),因此通常用软件来实现。 每台网络路由器中有一个关键元素是它的转发表 (forwarding table)。 路由器检査到达分组首部的一个或多个字段值,进而使用这些首部值在其转发表中索引,通过这种方法来转发分组。 控制平面有传统方法和 SDN(Software Defined Networking) 方法。 传统方法:每个路由器中的控制器使用一个独立算法来计算其转发表。 SDN 方法:路由选择设备仅执行转发,而远程控制器计算并分发转发表。 4.2 路由器工作原理

1 min

Ch1 摄影家的眼力 一幅好照片要有一个鲜明主题 一幅好照片要有一个吸引注意力的主体 一幅好照片必须画面简洁

1 min

Ch2 照相机和镜头 2.5 镜头 2.6 镜头速度 2.7 光圈 开大一档光圈,进入照相机的光量会加倍;缩小一档光圈,光量将减半。 f值的完整序列如下: f/1, f/1.4, f/2, f/2.8, f/4, f/5.6, f/8, f/11, f/16, f/22, f/32, f/44, f/64 如果镜头的最大光圈为f/2.8, 那么这个镜头称为f/2.8镜头。 2.8 焦距 2.9 焦距和影像大小的关系 2.10 标准镜头,广角镜头,远摄镜头 2.11 折反射镜头 2.12 变焦镜头 2.13 微距镜头 2.14 眩光 明亮的光线通过镜头时,一部分光线会被这些透镜反射回去,形成一种幻影。 清洁镜头要小心把镀膜层擦掉。 2.15 透视畸变 2.16 肖像镜头 85~135mm焦距的镜头,适合拍摄肖像。 2.17 线性畸变 2.18 鱼眼镜头

1 min

Ch3 如何使用照相机 3.1 取景系统 3.2 旁轴取景器和测距器 3.3 单镜头反光(SLR)取景器 3.4 双镜头反光(TLR)取景器 3.5 毛玻璃取景器 3.6 聚焦 被摄体离多远,就设置镜头筒聚焦标尺到那个数字。 3.8 景深 当某一物体聚焦清晰时,从该物体前面的某一段距离到其后面的某一段距离内的所有景物也是清晰的,这段距离称为景深。 光圈控制景深 光圈越小,景深越大。 光圈越大,景深越小。 焦距控制景深 焦点越远,景深越大。 景深标尺 // TODO: 插图 在景深标尺上找到当前设定光圈的值,这两个值对应的距离标尺上的两个值,就是景深范围。 3.11 快门速度 T门:按下快门开始曝光,再次按闭合。 B门:按下快门开始曝光,松开闭合。 手持拍摄时,最慢的快门速度要大于等于镜头焦距毫米数的倒数,50mm焦距的镜头,快门速度至少是1/50s。 为了留有余地,最好使用1/100s以上的快门速度。

1 min

安装 Zsh 安装 zsh: sudo apt install zsh 设置 zsh 为 default shell: chsh -s $(which zsh) echo $SHELL # 检查当前shell 安装 Oh My Zsh 及插件 安装 Oh My Zsh: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" Theme 主题安装到~/.oh-my-zsh/custom/theme目录下。 使用网上推荐的 powerlevel10k: git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k 在.zshrc 中配置主题: ZSH_THEME="powerlevel10k/powerlevel10k" Plugins 主题安装到~/.oh-my-zsh/custom/plugin目录下。 zsh-autosuggestions 智能补全命令的插件,按下右键可以快速采用建议。 git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions zsh-syntax-highlighting 智能检查输入命令语法的插件。 git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting z oh-my-zsh 自带的智能跳转文件夹的插件。 用法: 可以模糊补全,不用输入整个文件夹的名称。 配置 Download https://github.com/YC-Xiang/dotfiles 中的 ....

1 min

Data Structure struct thermal_zone_device { int id; char type[THERMAL_NAME_LENGTH]; struct device device; struct attribute_group trips_attribute_group; struct thermal_attr *trip_temp_attrs; struct thermal_attr *trip_type_attrs; struct thermal_attr *trip_hyst_attrs; enum thermal_device_mode mode; void *devdata; struct thermal_trip *trips; int num_trips; unsigned long trips_disabled; /* bitmap for disabled trips */ unsigned long passive_delay_jiffies; unsigned long polling_delay_jiffies; int temperature; int last_temperature; int emul_temperature; int passive; int prev_low_trip; int prev_high_trip; atomic_t need_update; struct thermal_zone_device_ops *ops; struct thermal_zone_params *tzp; struct thermal_governor *governor; void *governor_data; struct list_head thermal_instances; struct ida ida; struct mutex lock; struct list_head node; struct delayed_work poll_queue; enum thermal_notify_event notify_event; bool suspended; }; id: thermal zone unique id。...

3 min

基于 linux 6.6 drm api 注释掉的 api 表示暂时不关心 drm_atomic_helper.ch drm_atomic_helper_check_modeset(); // drm_atomic_helper_check_wb_encoder_state(); drm_atomic_helper_check_plane_state(); drm_atomic_helper_check_planes(); drm_atomic_helper_check_crtc_primary_plane(); drm_atomic_helper_check(); drm_atomic_helper_commit_tail(); drm_atomic_helper_commit_tail_rpm(); drm_atomic_helper_commit(); drm_atomic_helper_async_check(); drm_atomic_helper_async_commit(); drm_atomic_helper_wait_for_fences(); drm_atomic_helper_wait_for_vblanks(); drm_atomic_helper_wait_for_flip_done(); drm_atomic_helper_update_legacy_modeset_state(); drm_atomic_helper_calc_timestamping_constants(); drm_atomic_helper_commit_modeset_disables(); drm_atomic_helper_commit_modeset_enables(); drm_atomic_helper_prepare_planes(); drm_atomic_helper_unprepare_planes(); drm_atomic_helper_commit_planes(); drm_atomic_helper_cleanup_planes(); drm_atomic_helper_commit_planes_on_crtc(); drm_atomic_helper_disable_planes_on_crtc(); drm_atomic_helper_swap_state(); /* nonblocking commit helpers */ drm_atomic_helper_setup_commit(); drm_atomic_helper_wait_for_dependencies(); drm_atomic_helper_fake_vblank(); drm_atomic_helper_commit_hw_done(); drm_atomic_helper_commit_cleanup_done(); /* implementations for legacy interfaces */ drm_atomic_helper_update_plane(); drm_atomic_helper_disable_plane(); drm_atomic_helper_set_config(); drm_atomic_helper_disable_all(); drm_atomic_helper_shutdown(); drm_atomic_helper_duplicate_state(); drm_atomic_helper_suspend(); drm_atomic_helper_commit_duplicated_state(); drm_atomic_helper_resume(); drm_atomic_helper_page_flip(); drm_atomic_helper_page_flip_target(); #define drm_atomic_crtc_for_each_plane(); #define drm_atomic_crtc_state_for_each_plane(); #define drm_atomic_crtc_state_for_each_plane_state(); inline drm_atomic_plane_enabling(); inline drm_atomic_plane_disabling(); drm_atomic_helper_bridge_propagate_bus_fmt(); drm_atomic_state_helper....

1 min

0 min

Color Management drm_color_mgmt.c, drm_color_mgmt.h color management or color space 通过 drm_crtc 和 drm_plane 的相关 properties 来实现控制。 drm_crtc_enable_color_mgmt() 用来 create crtc 相关的 degamma lut, ctx, gamma lut 这些 properties,在 crtc 初始化过程中调用。 还有一个初始化函数 drm_mode_crtc_set_gamma_size() 可以用来 support legacy gamma 相关接口。 drm_plane_create_color_properties() create plane 相关的 yuv color coding, color range properties,在 plane 初始化过程中调用。 Properties 具体看 drm_crtc_state 和 drm_plane_state 中对应的 fields. crtc: DEGAMMA_LUT, DEGAMMA_LUT_SIZE, CTM, GAMMA_LUT, GAMMA_LUT_SIZE plane: COLOR_ENCODING, COLOR_RANGE Userspace 之后 userspace 可以通过设置这些 properties 修改到 struct drm_crtc_state 和 struct drm_plane_state 中相关的 fields....

1 min

DRM_IOCTL_MODE_ATOMIC struct drm_mode_atomic { __u32 flags; __u32 count_objs; __u64 objs_ptr; __u64 count_props_ptr; __u64 props_ptr; __u64 prop_values_ptr; __u64 reserved; __u64 user_data; }; app: flags: 可传入的 flags 参考 DRM_MODE_ATOMIC_FLAGS 宏,有 DRM_MODE_PAGE_FLIP_EVENT/DRM_MODE_PAGE_FLIP_ASYNC/DRM_MODE_ATOMIC_TEST_ONLY/DRM_MODE_ATOMIC_NONBLOCK/DRM_MODE_ATOMIC_ALLOW_MODESET. count_objs: 要设置的 drm object 数量。 objs_ptr: 要设置的 object id 数组指针。 count_props_ptr: 每个 object 要设置多少个 property 的数组指针。 props_ptr: 要设置的 property id 数组指针。 prop_values_ptr: 要设置的 property value 数组指针。 user_data: 用户传入的一个 data 指针值。 kernel:

1 min