Friday, March 27, 2009

How to Enable ATI Radeon 3200 card with fglrx on Fedora-10

I had till date installed my ATI - Radeon 3200 twice in 4 months.Currently I am applying my hands on Fedora 10 , OpenSuse 11 + Solaris.

For novices/myriads in flux here's a detailed how to & problem I faced & how I got rid with it.

Question:- After freshly installing Fedora-10 my PC works fine for few minutes and then freezes up badly that I need to reboot or shutdown and then once again same things are redundant

Ans : You need to install either fglrx or any Opensource driver for your card

Try these :-

** sudo yum install system-config-display ( The moment I installed these rpm package F10 stopped freezing to death but here it takes general Opensource drivers for your card instead we want to use fglrx which allows us to use 3d effects of ATI along with compiz-fusion,so all these below heck we are doing)

Question 2:- How to install & enable fglrx drivers & compiz-fusion ?

1)Check if your card is supported by these ATI driver

2)Update system & Kernel with :-

Code : su -c "yum update"

OR

Code : sudo yum update

3)install the F10 rpmfusion driver

Code:
su -
rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
yum install kmod-fglrx xorg-x11-drv-fglrx xorg-x11-drv-fglrx-libs.i386

4) Backup Old initrd
Code:
su
mv /boot/initrd-`uname -r`.img /boot/initrd-`uname -r`.img.backup

Remake initrd for the kernel (So the radeon module is not force loaded)

Code:
su -
mkinitrd -v /boot/initrd-`uname -r`.img `uname -r`

5) Edit grub.conf

Code:
su
gedit /boot/grub/grub.conf
and add this "nopat" to the kernel arguments.


Optional (in case libdrm change breaks things due to relationship with KMS):
add "nomodeset" to end of kernel arguments


6. Reboot

due to the akmod, it is *absolutely necessary* to reboot after the install, otherwise the kernel module won't be compiled.



7. Optional install compiz-fusion.


8.How to upgrade libdrm if previously downgraded .


Code:
su
rm -f /etc/yum.repos.d/rpmfusion-nonfree-updates-9.repo
rm -f /etc/yum.repos.d/fedora9.repo
sed -i -e 's|^exclude.*||' /etc/yum.repos.d/fedora*
yum clean all
yum update libdrm
Now finally when we are done with these steps from Fedoraforums by Leigh here I share my input

1)After reboot on CLE type :-

Code :
sudo aticonfig -v --initial -f (These will do initial /first time setup of fglrx on ATI card) // mindwell dont forget to be super user or else things wont work

2)Then verify if fglrx is enabled or not with :-

Code:-

fglrx-config-display enable

To Restart fglrx :- sudo service fglrx restart

3)For single head you may go for :- aticonfig --initial --input=/etc/X11/xorg.conf
4)For dual head you may go on for:- aticonfig --initial=dual-head --screen-layout=above
This command will generate a dual head configuration
file with the second screen located above the first
screen.
5) Setting up modes for primary display.
aticonfig --resolution=0,1600x1200,1280x1024,1024x768
6) Force primary CRT on and TV-out off.
aticonfig --force-monitor=crt1,notv
7) Change tv geometry
aticonfig --tv-geometry=85x90+10-10
This will set tv to 85% width (where 100% ==
overscan) 90% height and shift 10 pixels right of centre
and 10 pixels down of centre

**Troubleshooting :-

1)sudo aticonfig --initial=check
Identifies if the fglrx driver is present in configuration file.

Output should be :-
[binnishah@redhat ~]$ aticonfig --initial=check
Check: Found fglrx section.

2)Try glxinfo -->
Output should be :-
[binnishah@redhat ~]$ glxinfo
name of display: :4.0
display: :4 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.2
server glx extensions:
GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_OML_swap_method,
GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_visual_select_group
client glx vendor string: SGI
client glx version string: 1.4
client glx extensions:
GLX_ARB_create_context, GLX_ARB_get_proc_address, GLX_ARB_multisample,
GLX_EXT_import_context, GLX_EXT_visual_info, GLX_EXT_visual_rating,
GLX_MESA_allocate_memory, GLX_MESA_swap_control,
GLX_MESA_swap_frame_usage, GLX_NV_swap_group, GLX_OML_swap_method,
GLX_OML_sync_control, GLX_SGI_make_current_read, GLX_SGI_swap_control,
GLX_SGI_video_sync, GLX_SGIS_multisample, GLX_SGIX_fbconfig,
GLX_SGIX_pbuffer, GLX_SGIX_swap_barrier, GLX_SGIX_swap_group,
GLX_SGIX_visual_select_group, GLX_EXT_texture_from_pixmap
GLX version: 1.2
GLX extensions:
GLX_ARB_create_context, GLX_ARB_get_proc_address, GLX_ARB_multisample,
GLX_EXT_import_context, GLX_EXT_visual_info, GLX_EXT_visual_rating,
GLX_MESA_swap_control, GLX_NV_swap_group, GLX_OML_swap_method,
GLX_SGI_video_sync, GLX_SGIS_multisample, GLX_SGIX_fbconfig,
GLX_SGIX_swap_barrier, GLX_SGIX_swap_group, GLX_SGIX_visual_select_group
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Radeon HD 3200 Graphics
OpenGL version string: 2.1.8494 Release
OpenGL shading language version string: 1.20
OpenGL extensions:
GL_AMD_performance_monitor, GL_ARB_color_buffer_float,
GL_ARB_depth_buffer_float, GL_ARB_depth_texture, GL_ARB_draw_buffers,
GL_ARB_draw_instanced, GL_ARB_fragment_program,
GL_ARB_fragment_program_shadow, GL_ARB_fragment_shader,
GL_ARB_framebuffer_object, GL_ARB_framebuffer_sRGB,
GL_ARB_half_float_pixel, GL_ARB_half_float_vertex,
GL_ARB_instanced_arrays, GL_ARB_map_buffer_range, GL_ARB_multisample,
GL_ARB_multitexture, GL_ARB_occlusion_query, GL_ARB_pixel_buffer_object,
GL_ARB_point_parameters, GL_ARB_point_sprite, GL_ARB_shader_objects,
GL_ARB_shader_texture_lod, GL_ARB_shading_language_100, GL_ARB_shadow,
GL_ARB_shadow_ambient, GL_ARB_texture_border_clamp,
GL_ARB_texture_compression, GL_ARB_texture_compression_rgtc,
GL_ARB_texture_cube_map, GL_ARB_texture_env_add,
GL_ARB_texture_env_combine, GL_ARB_texture_env_crossbar,
GL_ARB_texture_env_dot3, GL_ARB_texture_float,
GL_ARB_texture_mirrored_repeat, GL_ARB_texture_non_power_of_two,
GL_ARB_texture_rectangle, GL_ARB_texture_rg, GL_ARB_transpose_matrix,
GL_ARB_vertex_array_object, GL_ARB_vertex_buffer_object,
GL_ARB_vertex_program, GL_ARB_vertex_shader, GL_ARB_window_pos,
GL_ATI_draw_buffers, GL_ATI_envmap_bumpmap, GL_ATI_fragment_shader,
GL_ATI_meminfo, GL_ATI_separate_stencil, GL_ATI_texture_compression_3dc,
GL_ATI_texture_env_combine3, GL_ATI_texture_float, GL_EXT_abgr,
GL_EXT_bgra, GL_EXT_bindable_uniform, GL_EXT_blend_color,
GL_EXT_blend_equation_separate, GL_EXT_blend_func_separate,
GL_EXT_blend_minmax, GL_EXT_blend_subtract, GL_EXT_compiled_vertex_array,
GL_EXT_copy_texture, GL_EXT_draw_buffers2, GL_EXT_draw_range_elements,
GL_EXT_fog_coord, GL_EXT_framebuffer_blit, GL_EXT_framebuffer_multisample,
GL_EXT_framebuffer_object, GL_EXT_framebuffer_sRGB,
GL_EXT_gpu_program_parameters, GL_EXT_gpu_shader4,
GL_EXT_multi_draw_arrays, GL_EXT_packed_depth_stencil,
GL_EXT_packed_float, GL_EXT_packed_pixels, GL_EXT_point_parameters,
GL_EXT_rescale_normal, GL_EXT_secondary_color,
GL_EXT_separate_specular_color, GL_EXT_shadow_funcs, GL_EXT_stencil_wrap,
GL_EXT_subtexture, GL_EXT_texgen_reflection, GL_EXT_texture3D,
GL_EXT_texture_array, GL_EXT_texture_compression_latc,
GL_EXT_texture_compression_rgtc, GL_EXT_texture_compression_s3tc,
GL_EXT_texture_cube_map, GL_EXT_texture_edge_clamp,
GL_EXT_texture_env_add, GL_EXT_texture_env_combine,
GL_EXT_texture_env_dot3, GL_EXT_texture_filter_anisotropic,
GL_EXT_texture_integer, GL_EXT_texture_lod_bias,
GL_EXT_texture_mirror_clamp, GL_EXT_texture_object,
GL_EXT_texture_rectangle, GL_EXT_texture_sRGB,
GL_EXT_texture_shared_exponent, GL_EXT_transform_feedback,
GL_EXT_vertex_array, GL_KTX_buffer_region, GL_NV_blend_square,
GL_NV_conditional_render, GL_NV_copy_depth_to_color,
GL_NV_texgen_reflection, GL_SGIS_generate_mipmap,
GL_SGIS_texture_edge_clamp, GL_SGIS_texture_lod, GL_WIN_swap_hint,
WGL_EXT_swap_control

65 GLX Visuals
---- !!!

3)Try glxgears
Output should be:- (some RGB wheels moving in contact with edges)

306 frames in 5.0 seconds = 61.035 FPS
301 frames in 5.0 seconds = 60.186 FPS
302 frames in 5.0 seconds = 60.207 FPS
301 frames in 5.0 seconds = 60.200 FPS
301 frames in 5.0 seconds = 60.178 FPS
301 frames in 5.0 seconds = 60.188 FPS

4)Try fgl _glxgears

Output should be :-

Using GLX_SGIX_pbuffer
262 frames in 5.0 seconds = 52.400 FPS
298 frames in 5.0 seconds = 59.600 FPS
299 frames in 5.0 seconds = 59.800 FPS
286 frames in 5.0 seconds = 57.200 FPS

5)Try fglrxinfo

Output should be :-
[binnishah@redhat ~]$ fglrxinfo
display: :4.0 screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Radeon HD 3200 Graphics
OpenGL version string: 2.1.8494 Release

*More ways to troubleshoot, is to analyse following:-

1)cat /var/log/Xorg.0.log | grep EE --> EE = error
2)cat /var/log/Xorg.0.log | grep EE --> WW = warning
3)dmesg | grep error
4)ccsm ( compiz config setting manager)
5)amdcccle
6)If you can't get xorg.conf (or dont find it in fresh fedora installation esp in Cambridge)

a)sudo yum install system-config-display
b)Menu - System - Administration - Display .Simply press ok ,so it will create in /etc/X11/xorg.conf later you can carry it from step 1 above

7)Open /etc/X11/xorg.conf and add in Section "Files"

ModulePath "/usr/lib/xorg/modules/extensions/fglrx"
ModulePath "/usr/lib/xorg/modules"

These is necessary to tell the server where to pick up the new driver. This is done by adding above lines in Files section

It’s important that this be the first ModulePath entry in the Files section. You can have more than one ModulePath in this section and they are all appended in order. This order is also the order searched for driver (and other) modules. So having this path first tells the server to look in our new driver directory first for the amd/ati driver.

Finally how my current xorg.conf looks like :-

# Xorg configuration created by system-config-display

Section "ServerLayout"
Identifier "single head configuration"
Screen 0 "aticonfig-Screen[0]-0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
ModulePath "/usr/lib/xorg/modules/extensions/fglrx"
ModulePath "/usr/lib/xorg/modules"
EndSection

Section "ServerFlags"
Option "AIGLX" "on"
EndSection

Section "InputDevice"

# keyboard added by rhpxl
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105+inet"
Option "XkbLayout" "us"
EndSection

Section "Monitor"
Identifier "aticonfig-Monitor[0]-0"
Option "VendorName" "ATI Proprietary Driver"
Option "ModelName" "Generic Autodetecting Monitor"
Option "DPMS" "true"
EndSection

Section "Device"
Identifier "aticonfig-Device[0]-0"
Driver "fglrx"
BusID "PCI:1:5:0"
EndSection

Section "Screen"
Identifier "aticonfig-Screen[0]-0"
Device "aticonfig-Device[0]-0"
Monitor "aticonfig-Monitor[0]-0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection

Section "Extensions"
Option "Composite" "Enable"
EndSection



If you have any issues with ATI graphics card in linux,feel free to contact



What is formal & Actual parameter along with examples

Often in Interviews we are prompted with question what is formal & actual parameter & explain difference in btw:-

Ok here we go ,

What are Formal Parameters ?

Ans:-

*Formal Parameter*
1)Consider y = f(x) // where x is independent & value of y is dependent on value returned by f.Here f(x) is formal parameter or argument to f

2)Formal parameters are place holders for values of "Actual parameter"

3)Formal parameters are declared/defined during function definition.

4)Examples :-

A)int f ( int x) --> x is formal paremter
B)int miles ( int km ,int mileage) --> km & mileage are formal parameter

5)In short in laymen language any fun. parameter that comes outside parenthesis is Formal parameter


*Actual parameter

1)In C prg. values that appears inside the parentheses are called "Actual Parameter"

2)Formal parameters must match in position,number & type

3)When a function call is made,a memory location is allocated for each formal parameter & a copy of corresponding actual parameter is kept in that memory location. All calculations involving the formal parameter use this memory location.

4)Actual parameters are always "Passed" & variables that are declared & passed as arguments to procedure by caller

5)Examples :-

A)#define MILEAGE 25 // Here MILEAGE is actual parameter
B)int miles(int gallons, int mileage) is Formal parameter

Consider following example:-
Problem:- Accepts a number of gallons as input from end user and calculates & displays the number of miles that can be traveled

#include
#define MILEAGE 25
int miles(int gallons,int mileage); // -->Both gallons & mileage are formal parameters

int main(void)
{
int f ; // --> f is actual parameter & f stores value in Gallons
printf("Enter number of Gallons of Gas : ");
scanf("%d",&f);
printf("\nYou will be able to travel %d miles from %d Gallons of Gasoline",miles(f,MILEAGE),f);/* here f & MILEAGE are actual parameters whose values are stored into gallons & mileage respectively which are formal parameters*/
return 0;
}

int miles(int gallons,int mileage)
{
return ( gallons * mileage); //Here both are formal parameters ie: gallons & mileage
}

*** Above example and some logic was taken from C by discovery by Foster & Foster