|
From: Antonino D. <ad...@po...> - 2003-02-06 21:55:46
|
On Thu, 2003-02-06 at 23:27, p.g...@li... wrote:
> Hi,
> I have a problem when I change the bpp value, here is the code:
>
> if( ioctl(fbd, FBIOGET_VSCREENINFO, &var_info) == -1){
> perror("\nError IOCTL 1");
> exit(0);
> }
> printf("\n bpp: %d", var_info.bits_per_pixel); // output is bpp: 16
> var_info.bits_per_pixel = 24;
> if( ioctl(fbd, FBIOPUT_VSCREENINFO, &var_info) == -1){
> perror("\nError IOCTL 2");
> exit(0);
> }
> The program exit with the following message error:
> Error IOCTL 2: Invalid argument
>
> How can I set the bpp value? Should I modify the file /etc/X11/XF86Config?
This will depend on the driver you are using. vesafb does not support
any change to fb_var_screeninfo. Other drivers, may not round off
invalid values: ie bpp == 24 is not supported. Also, increasing bpp
implies that more video memory will be required if var.xres_virtual and
var.yres_virtual remains the same. So try to check xres, yres,
xres_virtual and yres_virtual against fix.smem_len and
var.bits_per_pixel.
fix.smem_len >= (var.bits_per_pixel * var.xres_virtual)/8 *
var.yres_virtual.
/etc/X11/XF86Config has nothing to with fbdev.
>
> I have another problem, I try to write a simple program that reads frame from framebuffer and then creates a Divx file of a few seconds.
> I map the framebuffer to a buffer, but the program crash with a segmentation fault:
>
> screen_buffer = (char *)malloc(DIM_BUFFER * sizeof(char));
you don't need this step.
> screen_buffer = (void *)mmap(0, DIM_BUFFER, PROT_READ, MAP_SHARED, fbd, 0);
check if mmap failed, (returns -1).
>
> encFrame.image = (void *)screen_buffer; <--- causes seg fault
memcpy(encFrame.image, screen_bufer, DIM_BUFFER) is a more appropriate
step to get the contents.
Tony
|