Bug 107482

Summary: Images gamma rendering issue
Product: DRI Reporter: Sebastian Luncan <esebaro>
Component: DRM/AMDgpuAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: medium CC: sunpeng.li
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
images gamma
none
xorg log
none
imagemagick original capture
none
Gamma amdgpu vs amdgpu-dc none

Description Sebastian Luncan 2018-08-04 08:36:36 UTC
Created attachment 140962 [details]
images gamma

I have a PC with:
MB: Asrock AM1B-ITX
CPU: AMD Kabini Athlon 5350 APU
iGPU: Radeon HD 8400 / R3 Series
Displays: DVI Asus, HDMI Samsung

kernel-4.15/4.16/4.17
xorg-server-1.19.5
xorg-drivers-1.19
xf86-video-amdgpu-18.0.1
xf86-video-ati-18.0.1
libdrm-2.4.92

When I increase the gamma to check the quality of images (xgamma -gamma 3), some pixels are darker/colorful, it seems like gamma is not applied uniformly for all pixels. This happens on all kernels with any video driver: radeon, amdgpu, amdgpu-dc.

I thought there's something wrong with the images so I've edited them on Gimp by  increasing brightness or change hue/saturation. This was fine until the kernel 4.17 and the amdgpu-dc driver upgrade, images have again the issue. They are fine with amdgpu.

Is there something I can do about this?
Thanks.
Comment 1 Michel Dänzer 2018-08-06 09:28:56 UTC
Please attach the corresponding Xorg log file.

How did you capture the attached image? Can you also attach a corresponding direct capture with a screenshot tool on that machine?
Comment 2 Sebastian Luncan 2018-08-06 10:08:55 UTC
Created attachment 140974 [details]
xorg log
Comment 3 Sebastian Luncan 2018-08-06 10:18:45 UTC
Created attachment 140975 [details]
imagemagick original capture

These are the capture commands (ImageMagick) used with FVWM:

import -window $[w.id] -silent "PNG24:$[infostore.mScreenshots]/screenshot-$(date +%F[%R]).png"
import -window root -silent "PNG24:$[infostore.mScreenshots]/screenshot-$(date +%F[%R]).png"

Attached the original capture (without gamma).
For the first attached imaged I've applied gamma with Gimp.
Comment 4 Michel Dänzer 2018-08-16 16:50:46 UTC
(In reply to Sebastian Luncan from comment #3)
> For the first attached imaged I've applied gamma with Gimp.

How exactly did you do that?

Anyway, I don't think there's a bug here. Gamma doesn't affect all colour values the same way (in particular, 0 and the maximum value are preserved for each colour component). The "colourful" pixels occur because the original pixels have 0 or a very small value in some components but larger values in others, which are affected differently by gamma.
Comment 5 Sebastian Luncan 2018-08-16 18:26:44 UTC
Created attachment 141147 [details]
Gamma amdgpu vs amdgpu-dc

I don't know how to capture the screen with gamma so I did a capture with imagemagick and applied gamma with gimp so the issues are visible.

I've also took a picture (attached). On the left is amdgpu-dc on the right amdgpu, gamma 3 (xgamma -gamma 3), kernel 4.17. See the trees and the grass on the left. Why do they look different on the same gamma values?

As I said, this happened before and I've fixed the issue with gimp by changing images brightness and hue/saturation, but now with amdgpu-dc from 4.17 the issues are back.
Comment 6 Michel Dänzer 2018-08-17 07:31:33 UTC
(In reply to Sebastian Luncan from comment #5)
> I've also took a picture (attached). On the left is amdgpu-dc on the right
> amdgpu, gamma 3 (xgamma -gamma 3), kernel 4.17. See the trees and the grass
> on the left. Why do they look different on the same gamma values?

Can you try if current upstream xf86-video-amdgpu Git master works better with DC?
Comment 7 Sebastian Luncan 2018-08-17 09:55:40 UTC
(In reply to Michel Dänzer from comment #6)
> Can you try if current upstream xf86-video-amdgpu Git master works better
> with DC?

It's the same.

I've also tried videos with gamma 3. All hardware decoded videos (h264) look fine, software decoded have this issue.
Comment 8 Michel Dänzer 2018-08-20 15:44:11 UTC
Leo, any ideas what's going on here?
Comment 9 Leo Li 2018-08-20 18:14:57 UTC
Michel's right about xgamma leaving 0 and max per-channel values unmodified, so the original issue is not-a-bug. Although I'm not sure why there's a difference between amdgpu and dc, I'll have to look into it.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.