New: [r300g] KWin Lanczos filter problems - Black Windows using effects
https://bugs.freedesktop.org/show_bug.cgi?id=31499
Summary: [r300g] KWin Lanczos filter problems - Black Windows
using effects
Product: Mesa
Version: git
Platform: x86-64 (AMD64)
OS/Version: Linux (All)
Status: NEW
Severity: normal
Priority: medium
Component: Drivers/Gallium/r300
AssignedTo: [email protected]
ReportedBy: [email protected]
The issue was discussed in the following entries:
https://bugs.kde.org/show_bug.cgi?id=253483
http://forum.kde.org/viewtopic.php?f=111&t=91027
The problem is referred to certain screens or previews that look black or empty using effects like "Present Windows", with Gallium 3D (View screen shots in the second link)
The problem is present using Kubuntu 10.10 (Maverick) KDE SC 4.5.3 (4.5.2 too). Mesa and ATI drivers from xorg edgers PPA repository:
https://launchpad.net/~xorg-edgers/+archive/ppa
Tested with packages:
libgl1-mesa-dri 7.10.0+git20101104.e7f5d19a-0ubuntu0sarvatt~maverick libgl1-mesa-dri 7.10.0+git20101108.ef6967dd-0ubuntu0sarvatt~maverick
The problem is also present using Fedora 14 KDE LiveCD wich uses Gallium3D by default (KDE 4.5.2, Mesa 7.9, Gallium 0.4)
My video card is an integrated ATI x1250 (RS690)
=======
$ glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,
GLX_OML_swap_method, GLX_SGI_make_current_read, GLX_SGI_swap_control,
GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
GLX_SGIX_visual_select_group, GLX_INTEL_swap_event
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,
GLX_MESA_swap_control, 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_visual_select_group, GLX_EXT_texture_from_pixmap,
GLX_INTEL_swap_event
GLX version: 1.4
GLX extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,
GLX_MESA_swap_control, 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_visual_select_group, GLX_EXT_texture_from_pixmap,
GLX_INTEL_swap_event
OpenGL vendor string: X.Org R300 Project
OpenGL renderer string: Gallium 0.4 on RS690
OpenGL version string: 2.1 Mesa 7.10-devel
OpenGL shading language version string: 1.20
OpenGL extensions:
GL_ARB_copy_buffer, GL_ARB_depth_texture, GL_ARB_draw_buffers,
GL_ARB_draw_elements_base_vertex, GL_ARB_fragment_coord_conventions,
GL_ARB_fragment_program, GL_ARB_fragment_program_shadow,
GL_ARB_fragment_shader, GL_ARB_framebuffer_object,
GL_ARB_half_float_vertex, 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_provoking_vertex,
GL_ARB_shader_objects, GL_ARB_shading_language_100, GL_ARB_shadow,
GL_ARB_texture_border_clamp, GL_ARB_texture_compression,
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_mirrored_repeat,
GL_ARB_texture_non_power_of_two, GL_ARB_texture_rectangle,
GL_ARB_texture_rg, GL_ARB_texture_swizzle, GL_ARB_transpose_matrix,
GL_ARB_vertex_array_bgra, GL_ARB_vertex_array_object,
GL_ARB_vertex_buffer_object, GL_ARB_vertex_program, GL_ARB_vertex_shader,
GL_ARB_window_pos, GL_EXT_abgr, GL_EXT_bgra, GL_EXT_blend_color,
GL_EXT_blend_equation_separate, GL_EXT_blend_func_separate,
GL_EXT_blend_logic_op, GL_EXT_blend_minmax, GL_EXT_blend_subtract,
GL_EXT_compiled_vertex_array, GL_EXT_copy_texture,
GL_EXT_draw_range_elements, GL_EXT_framebuffer_blit,
GL_EXT_framebuffer_multisample, GL_EXT_framebuffer_object,
GL_EXT_fog_coord, GL_EXT_gpu_program_parameters, GL_EXT_multi_draw_arrays,
GL_EXT_packed_depth_stencil, GL_EXT_packed_pixels,
GL_EXT_pixel_buffer_object, GL_EXT_point_parameters,
GL_EXT_polygon_offset, GL_EXT_provoking_vertex, GL_EXT_rescale_normal,
GL_EXT_secondary_color, GL_EXT_separate_specular_color,
GL_EXT_shadow_funcs, GL_EXT_stencil_two_side, GL_EXT_stencil_wrap,
GL_EXT_subtexture, GL_EXT_texture, GL_EXT_texture3D,
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_lod_bias, GL_EXT_texture_mirror_clamp,
GL_EXT_texture_object, GL_EXT_texture_rectangle, GL_EXT_texture_sRGB,
GL_EXT_texture_swizzle, GL_EXT_vertex_array, GL_EXT_vertex_array_bgra,
GL_APPLE_packed_pixels, GL_APPLE_vertex_array_object,
GL_ATI_blend_equation_separate, GL_ATI_texture_env_combine3,
GL_ATI_texture_mirror_once, GL_ATI_separate_stencil,
GL_IBM_multimode_draw_arrays, GL_IBM_rasterpos_clip,
GL_IBM_texture_mirrored_repeat, GL_INGR_blend_func_separate,
GL_MESA_pack_invert, GL_MESA_ycbcr_texture, GL_MESA_window_pos,
GL_NV_blend_square, GL_NV_conditional_render, GL_NV_light_max_exponent,
GL_NV_packed_depth_stencil, GL_NV_texgen_reflection,
GL_NV_texture_env_combine4, GL_NV_texture_rectangle, GL_OES_read_format,
GL_SGIS_generate_mipmap, GL_SGIS_texture_border_clamp,
GL_SGIS_texture_edge_clamp, GL_SGIS_texture_lod, GL_SUN_multi_draw_arrays,
GL_OES_EGL_image, GL_OES_draw_textureSignature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.
[Bug 31499] [r300g] KWin Lanczos filter problems - Black Windows using effects
https://bugs.freedesktop.org/show_bug.cgi?id=31499
--- Comment #1 from YAFU <[email protected]> 2010-11-09 05:44:58 PST --- I'm sorry, screen shots are in the first link (Comment #8)
Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.
[Bug 31499] [r300g] KWin Lanczos filter problems - Black Windows using effects
In reply to [email protected]https://bugs.freedesktop.org/show_bug.cgi?id=31499
--- Comment #2 from Tom Stellard <[email protected]> 2010-11-18 23:45:16 PST --- It looks like some of the KDE devs have identified the failing shader as the Lanczos filter. It would be helpful if you could attach the Lanczos filter GLSL code along with the stderr output from running KWin with RADEON_DEBUG=fp
Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.
[Bug 31499] [r300g] KWin Lanczos filter problems - Black Windows using effects
In reply to [email protected]https://bugs.freedesktop.org/show_bug.cgi?id=31499
--- Comment #3 from Tom Stellard <[email protected]> 2010-11-19 17:46:59 PST --- The Lanczos filter fragment shader uses indirect addressing and support for this was recently added to git about a week ago, can you try again with a more up to date version of libgl1-mesa-dri?
Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.
[Bug 31499] [r300g] KWin Lanczos filter problems - Black Windows using effects
In reply to [email protected]https://bugs.freedesktop.org/show_bug.cgi?id=31499
--- Comment #4 from YAFU <[email protected]> 2010-11-19 22:43:00 PST --- Hi Tom.
I am currently using this version of libgl1-mesa-dri:
libgl1-mesa-dri 7.10.0+git20101118.3dcc3153-0ubuntu0sarvatt~maverick
I still have the problem.
KDE developer is helping me in the KDE forum so I can answer what you asked.
The GLSL code can be found here:
http://websvn.kde.org/*checkout*/trunk/KDE/kdebase/workspace/kwin/lanczos-vertex.glsl
http://websvn.kde.org/*checkout*/trunk/KDE/kdebase/workspace/kwin/lanczos-fragment.glsl
I attached the stderr output obtained with:
RADEON_DEBUG=fp kwin --replace &> ~/stderr.output
Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.
[Bug 31499] [r300g] KWin Lanczos filter problems - Black Windows using effects
In reply to [email protected]https://bugs.freedesktop.org/show_bug.cgi?id=31499
--- Comment #5 from YAFU <[email protected]> 2010-11-19 22:45:32 PST --- Created an attachment (id=40429)
--> (https://bugs.freedesktop.org/attachment.cgi?id=40429)
kwin stderr output
Obtained with:
RADEON_DEBUG=fp kwin --replace &> ~/stderr.output
Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.
[Bug 31499] [r300g] KWin Lanczos filter problems - Black Windows using effects
In reply to [email protected]https://bugs.freedesktop.org/show_bug.cgi?id=31499
--- Comment #6 from Tom Stellard <[email protected]> 2010-11-20 00:07:55 PST --- As the shader is currently written, it should use 50 constants, your hardware only supports 32. So unless the KDE devs can modify the shader to use less constants, it won't work with your hardware. It might be possible to rewrite it to use 32 or fewer constants. It looks like there are only two possibilities for values in the offset array (although I could be wrong about this), so rewriting it like this might work:
uniform sampler2D texUnit;
uniform vec4 offsetValues[6];
uniform vec4 kernel[25];
unifrom vec4 offsetsAandB;
void main(void)
{
vec2 offsetValueA = offsetsAandB.xy;
vec2 offsetValueB = offsetsAandB.zw;
vec4 sum = texture2D(texUnit, gl_TexCoord[0].st) * kernel[0];
for (int i = 1; i < 25; i++) {
vec2 offset;
int index = (i - 1) / 4;
vec4 offsetIndexValues = offsetValues[index];
switch((i - 1) % 4) {
case 0:
offset = (offsetIndexValues.x == 1.0 ? offsetValueA :
offsetValueB);
break;
case 1:
offset = (offsetIndexValues.y == 1.0 ? offsetValueA :
offsetValueB);
break;
case 2:
offset = (offsetIndexValues.z == 1.0 ? offsetValueA :
offsetValueB);
break;
case 3:
offset = (offsetIndexValues.w == 1.0 ? offsetValueA :
offsetValueB);
break;
}
sum += texture2D(texUnit, gl_TexCoord[0].st - offset) * kernel[i];
sum += texture2D(texUnit, gl_TexCoord[0].st + offset) * kernel[i];
}
gl_FragColor = sum;
}The basic idea is to store an array of boolean values (1.0 and 0.0) that tell you what offset value (offsetValueA or offsetValueB) to choose for each value of i. So for i = 1, check offsetValues[0].x and for i = 2, check offsetValues[0].y, i = 5, check offsetValues[1].x, etc. If the compiler is smart enough, the above shader will only have 32 constants.
The KDE developers might be able to spot some simpler ways to reduce the number of constants, since they have a better idea of what the code is doing. At the very least, the vec2 offset array could be packed into a vec4 array, that would reduce the number of constants by 12.
Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.
[Bug 31499] [r300g] KWin Lanczos filter problems - Black Windows using effects
In reply to [email protected]https://bugs.freedesktop.org/show_bug.cgi?id=31499
--- Comment #7 from Tom Stellard <[email protected]> 2010-11-20 11:35:49 PST --- Actually calculating the offset values inside the shader would be even better. So something like this:
uniform sampler2D texUnit;
uniform vec4 kernel[25];
uniform int direction;
uniform int count;
uniform float width;
void main(void)
{
vec4 sum = texture2D(texUnit, gl_TexCoord[0].st) * kernel[0];
for (int i = 1; i < 25; i++) {
vec2 offset = (direction == 0 ? vec2(i / width, 0.0) :
vec2(0.0, i / width);
offset = (i < count) ? offset : vec2(0.0, 0.0);
sum += texture2D(texUnit, gl_TexCoord[0].st - offset) * kernel[i];
sum += texture2D(texUnit, gl_TexCoord[0].st + offset) * kernel[i];
}
gl_FragColor = sum;
}Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.
[Bug 31499] [r300g] KWin Lanczos filter problems - Black Windows using effects
In reply to [email protected]https://bugs.freedesktop.org/show_bug.cgi?id=31499
Tom Stellard <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |NOTOURBUG--- Comment #8 from Tom Stellard <[email protected]> 2010-12-06 22:53:57 PST --- I'm closing this because it isn't a driver bug. This shader uses more constants than your hardware can handle. It is up to the KWin developers whether or not they want to rewrite this shader (if this is even possible) so that it works with your hardware.
Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.