CrazyTB's blog

Nvidia bug when rendering windows smaller than 32x32

, , , , ,

This week I updated x11-drivers/nvidia-drivers from 270.41.19 to 275.09.07, and I found a bug. Any window that is smaller than 32x32 is not correctly rendered. Since "tooltips" sometimes are quite small, it's very easy to hit this bug.

Update: It seems that version 285.05.09 works correctly.

I've posted a video showing this bug


Basically, if the window size is smaller than 32x32, instead of the actual window contents, a glitched texture is rendered (probably from somewhere else in the video memory). Actually, I found this pattern:
if      height <= 16 and width <= 16: buggy
else if height <= 16 and width >= 17: ok
else if height <= 32 and width <= 32: buggy
else if height >= 33 or  width >= 33: ok

I've also seen that sometimes the window shadows (from Compiz) are glitched as well, while other times they get rendered correctly.

My system is Gentoo Linux 64-bit (amd64 arch), sys-kernel/gentoo-sources-2.6.38-r6, x11-drivers/nvidia-drivers-275.09.07, x11-base/xorg-server-1.10.4, x11-wm/compiz-0.8.6-r3, still using gcc-4.4.5 (x86_64-pc-linux-gnu-4.4.5). My hardware is Intel Core 2 Duo with Nvidia GeForce 9500M GS.

The previous 270.41.19 driver didn't have this bug.

This is the source-code of the win_size.py script (shown in the video):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4 sw=4 et

from __future__ import division
from __future__ import print_function

# Easy way of importing pygame:
# import pygame

# Hard way of importing pygame:
import pygame.display
import pygame.event
import pygame.key

from pygame.locals import *


def set_size(width, height):
    screen = pygame.display.set_mode((width, height), RESIZABLE)

    size_string = '{0}x{1}'.format(width, height)
    pygame.display.set_caption(size_string)
    print(size_string)

    yellow = (255, 255, 0)
    screen.fill(yellow)

    pygame.display.flip()

def change_size(delta_width, delta_height):
    #pygame.display.get_surface().get_size()
    info = pygame.display.Info()
    w = info.current_w + delta_width
    h = info.current_h + delta_height
    set_size(w, h)

def main():
    # pygame.init() will try to initialize all pygame modules, including
    # Cdrom and Audio. I'm not using such things, so let's initialize the
    # only really required module:
    pygame.display.init()
    set_size(15, 15)

    # This does not work... :-(
    pygame.key.set_repeat(500, 50)

    key_and_offsets = {
        # Key: (delta_width, delta_height)
        K_UP:    ( 0, -1),
        K_DOWN:  ( 0, +1),
        K_LEFT:  (-1,  0),
        K_RIGHT: (+1,  0),
    }

    while True:
        event = pygame.event.wait()

        if event.type == QUIT:
            break

        elif event.type == KEYDOWN:
            if event.key in [K_ESCAPE, K_q]:
                break
            elif key_and_offsets.has_key(event.key):
                delta_width, delta_height = key_and_offsets.get(event.key)
                change_size(delta_width, delta_height)

        elif event.type == VIDEORESIZE:
            w, h = event.size
            set_size(w, h)

    pygame.quit()

if __name__ == '__main__':
    main()


Also posted on Gentoo Forums and on nV News Forums.

Comparison between Microchip PIC and Atmel AVR microcontrollersNvidia crash, followed by glitched screen

Comments

gullfaraz Monday, November 26, 2012 1:57:49 PM

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies

May 2013
S M T W T F S
April 2013June 2013
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31