/*
* Copyright 2012 Red Hat Inc.
* Parts based on xf86-video-ast
* Copyright (c) 2005 ASPEED Technology Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
*/
/*
* Authors: Dave Airlie <airlied@redhat.com>
*/
#include <linux/export.h>
#include <linux/pci.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_gem_vram_helper.h>
#include <drm/drm_plane_helper.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>
#include "ast_drv.h"
#include "ast_tables.h"
#include "ast_hdmitx.h"
static struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev);
static void ast_i2c_destroy(struct ast_i2c_chan *i2c);
static inline void ast_load_palette_index(struct ast_private *ast,
u8 index, u8 red, u8 green,
u8 blue)
{
ast_io_write8(ast, AST_IO_DAC_INDEX_WRITE, index);
ast_io_read8(ast, AST_IO_SEQ_PORT);
ast_io_write8(ast, AST_IO_DAC_DATA, red);
ast_io_read8(ast, AST_IO_SEQ_PORT);
ast_io_write8(ast, AST_IO_DAC_DATA, green);
ast_io_read8(ast, AST_IO_SEQ_PORT);
ast_io_write8(ast, AST_IO_DAC_DATA, blue);
ast_io_read8(ast, AST_IO_SEQ_PORT);
}
static void ast_crtc_load_lut(struct ast_private *ast, struct drm_crtc *crtc)
{
u16 *r, *g, *b;
int i;
if (!crtc->enabled)
return;
r = crtc->gamma_store;
g = r + crtc->gamma_size;
b = g + crtc->gamma_size;
for (i = 0; i < MAX_COLOR_LUT_ENTRIES; i++)
ast_load_palette_index(ast, i, *r++ >> 8, *g++ >> 8, *b++ >> 8);
}
static bool ast_get_vbios_mode_info(const struct drm_format_info *format,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode,
struct ast_vbios_mode_info *vbios_mode)
{
u32 refresh_rate_index = 0, refresh_rate;
const struct ast_vbios_enhtable *best = NULL;
u32 hborder, vborder;
bool check_sync;
switch (format->cpp[0] * 8) {
case 8:
vbios_mode->std_table = &vbios_stdtable[VGAModeIndex];
break;
case 16:
vbios_mode->std_table = &vbios_stdtable[HiCModeIndex];
break;
case 24:
case 32:
vbios_mode->std_table = &vbios_stdtable[TrueCModeIndex];
break;
default:
return false;
}
switch (mode->crtc_hdisplay) {
case 640:
vbios_mode->enh_table = &res_640x480[refresh_rate_index];
break;
case 800:
vbios_mode->enh_table = &res_800x600[refresh_rate_index];
break;
case 1024:
vbios_mode->enh_table = &res_1024x768[refresh_rate_index];
break;
case 1152:
vbios_mode->enh_table = &res_1152x864[refresh_rate_index];
break;
case 1280:
if (mode->crtc_vdisplay == 800)
vbios_mode->enh_table = &res_1280x800[refresh_rate_index];
else
vbios_mode->enh_table = &res_1280x1024[refresh_rate_index];
break;
case 1360:
vbios_mode->enh_table = &res_1360x768[refresh_rate_index];
break;
case 1440:
vbios_mode->enh_table = &res_1440x900[refresh_rate_index];
break;
case 1600:
if (mode->crtc_vdisplay == 900)
vbios_mode->enh_table = &res_1600x900[refresh_rate_index];
else
vbios_mode->enh_table = &res_1600x1200[refresh_rate_index];
break;
case 1680:
vbios_mode->enh_table = &res_1680x1050[refresh_rate_index];
break;
case 1920:
if (mode->crtc_vdisplay == 1080)
vbios_mode->enh_table = &res_1920x1080[refresh_rate_index];
else
vbios_mode->enh_table = &res_1920x1200[refresh_rate_index];
break;
default:
return false;
}
refresh_rate = drm_mode_vrefresh(mode);
check_sync = vbios_mode->enh_table->flags & WideScreenMode;
while (1) {
const struct ast_vbios_enhtable *loop = vbios_mode->enh_table;
while (loop->refresh_rate != 0xff) {
if ((check_sync) &&
(((mode->flags & DRM_MODE_FLAG_NVSYNC) &&
(loop->flags & PVSync)) ||
((mode->flags & DRM_MODE_FLAG_PVSYNC) &&
(loop->flags & NVSync)) ||
((mode->flags & DRM_MODE_FLAG_NHSYNC) &&
(loop->flags & PHSync)) ||
((mode->flags & DRM_MODE_FLAG_PHSYNC) &&
(loop->flags & NHSync)))) {
loop++;
continue;
}
if (loop->refresh_rate <= refresh_rate
&& (!best || loop->refresh_rate > best->refresh_rate))
best = loop;
loop++;
}
if (best || !check_sync)
break;
check_sync = 0;
}
if (best)
vbios_mode->enh_table = best;
hborder = (vbios_mode->enh_table->flags & HBorder) ? 8 : 0;
vborder = (vbios_mode->enh_table->flags & VBorder) ? 8 : 0;
adjusted_mode->crtc_htotal = vbios_mode->enh_table->ht;
adjusted_mode->crtc_hblank_start = vbios_mode->enh_table->hde + hborder;
adjusted_mode->crtc_hblank_end = vbios_mode->enh_table->ht - hborder;
adjusted_mode->crtc_hsync_start = vbios_mode->enh_table->hde + hborder +
vbios_mode->enh_table->hfp;
adjusted_mode->crtc_hsync_end = (vbios_mode->enh_table->hde + hborder +
vbios_mode->enh_table->hfp +
vbios_mode->enh_table->hsync);
adjusted_mode->crtc_vtotal = vbios_mode->enh_table->vt;
adjusted_mode->crtc_vblank_start = vbios_mode->enh_table->vde + vborder;
adjusted_mode->crtc_vblank_end = vbios_mode->enh_table->vt - vborder;
adjusted_mode->crtc_vsync_start = vbios_mode->enh_table->vde + vborder +
vbios_mode->enh_table->vfp;
adjusted_mode->crtc_vsync_end = (vbios_mode->enh_table->vde + vborder +
vbios_mode->enh_table->vfp +
vbios_mode->enh_table->vsync);
return true;
}
static void ast_set_vbios_color_reg(struct ast_private *ast,
const struct drm_format_info *format,
const struct ast_vbios_mode_info *vbios_mode)
{
u32 color_index;
switch (format->cpp[0]) {
case 1:
color_index = VGAModeIndex - 1;
break;
case 2:
color_index = HiCModeIndex;
break;
case 3:
case 4:
color_index = TrueCModeIndex;
break;
default:
return;
}
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8c, (u8)((color_index & 0x0f) << 4));
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0x00);
if (vbios_mode->enh_table->flags & NewModeInfo) {
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0xa8);
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x92, format->cpp[0] * 8);
}
}
static void ast_set_vbios_mode_reg(struct ast_private *ast,
const struct drm_display_mode *adjusted_mode,
const struct ast_vbios_mode_info *vbios_mode)
{
u32 refresh_rate_index, mode_id;
refresh_rate_index = vbios_mode->enh_table->refresh_rate_index;
mode_id = vbios_mode->enh_table->mode_id;
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8d, refresh_rate_index & 0xff);
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8e, mode_id & 0xff);
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0x00);
if (vbios_mode->enh_table->flags & NewModeInfo) {
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0xa8);
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x93, adjusted_mode->clock / 1000);
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x94, adjusted_mode->crtc_hdisplay);
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x95, adjusted_mode->crtc_hdis
CentOS 8.5 Ast2600 花屏驱动
需积分: 0 102 浏览量
更新于2024-01-08
收藏 52KB ZIP 举报
在IT领域,尤其是在Linux操作系统中,驱动程序是连接硬件设备与操作系统的重要桥梁。"CentOS 8.5 Ast2600 花屏驱动"这个主题涉及到的是一个特定的问题,即在使用CentOS 8.5操作系统时,搭载AST2600图形处理器(GPU)的设备出现了屏幕显示异常,通常表现为图像扭曲、闪烁或者颜色失真,这种现象被称为“花屏”。
CentOS 8.5是一个基于Red Hat Enterprise Linux的开源操作系统,它为服务器和工作站环境提供了稳定且安全的基础。然而,由于开源社区对硬件的支持程度可能与商业操作系统有所差异,特别是对于一些较新的或不常见的硬件,比如AST2600 GPU,可能会存在驱动兼容性问题。
AST2600 GPU是由Amlogic(晶晨半导体)制造的一款高性能图形处理单元,常见于嵌入式系统、智能电视盒和其他低功耗设备中。由于其硬件特性,它需要特定的驱动程序来确保在Linux环境下正常工作。在CentOS 8.5上出现花屏问题,可能是由于默认的开源驱动程序与AST2600 GPU不完全兼容,或者是驱动版本过旧,无法有效支持GPU的高级功能。
解决这个问题的方法通常有以下几种:
1. **查找官方驱动**:应当去Amlogic官方网站或相关的开发者社区寻找是否有官方发布的适用于CentOS 8.5的最新驱动程序。如果有,按照官方提供的安装指南进行安装。
2. **第三方驱动**:如果官方没有提供,可以尝试寻找社区开发的第三方驱动。这些驱动可能由热心的开发者维护,他们通过逆向工程来使硬件与Linux系统兼容。需要谨慎操作,因为这些驱动可能存在不稳定的风险。
3. **更新内核**:有时,问题可能出在操作系统内核与硬件驱动的兼容性上。升级到最新版本的Linux内核可能有助于解决驱动问题,因为新内核往往包含了更多硬件的驱动支持。
4. **回退驱动**:如果新的驱动导致问题,可以尝试回退到已知稳定的旧版驱动,看看是否能改善花屏现象。
5. **配置调整**:检查Xorg或Wayland的相关配置文件,确保GPU设置正确。例如,分辨率、刷新率等参数设置不当也可能引起花屏。
6. **硬件问题**:在排除软件因素后,也要考虑是否是硬件本身的问题。例如,GPU的散热不良或接口接触不良都可能导致显示异常。
在提供的压缩包文件"src"中,可能包含了解决这个问题的源代码或者编译好的驱动程序。如果是一个源代码包,你需要先阅读README文件或其他文档,了解如何编译和安装驱动。通常会涉及`make`和`sudo make install`这样的命令来编译和安装驱动。
解决CentOS 8.5上的AST2600 GPU花屏问题需要对Linux内核、驱动程序以及硬件有深入的理解。通过更新、替换或调整驱动,以及检查系统配置,大多数情况下都能找到解决方案。对于初学者来说,这可能是一项挑战,但这也是Linux系统学习过程中的宝贵经验。
从入门到入土0715
- 粉丝: 19
- 资源: 1
最新资源
- 基于Java的大学生就业网站的设计与实现【附源码】
- 适合学校使用的一款抽奖程序
- 易语言任务计划模块,以管理员模式开机自启,应用所有用户等
- 基于S7-200-PLC-十字路口交通灯的控制系统设计.doc
- 深度学习+使用pytorch实现CNN代码+算法原理代码部分的补充
- 机械设计NGW两级行星齿轮减速机sw18可编辑非常好的设计图纸100%好用.zip
- python pytorch- TextCNN TextRNN FastText Transfermer文本情感分类-数据集
- Pytorch实现基于LSTM的情感分析的代码和数据集
- 计算机组成原理课程设计2024.doc
- 机械设计FPC双面视觉检测设备-带自动上下料step非常好的设计图纸100%好用.zip
- 动物世界GUI包Unity Animal World GUI Pack
- GBase 8s 数据库备份&还原
- 机械设计EOT起重机sw20可编辑非常好的设计图纸100%好用.zip
- openmmlab下的mmpose框架工程
- BMS仿真,电池管理系统,整个BMS的matlab仿真模型 包含限位,EKF-SOC,均衡,充点电控制,冷却风机,充电控制,开机自检功能 SOC:State of charge,电池剩余电量百分比
- 调试小助手SocketTool