* [PATCH xf86-video-amdgpu] Don't apply gamma to HW cursor data if colour management is enabled
@ 2018-06-26 16:41 Michel Dänzer
[not found] ` <20180626164135.2844-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Michel Dänzer @ 2018-06-26 16:41 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
From: Michel Dänzer <michel.daenzer@amd.com>
In that case, the display hardware applies gamma to the HW cursor.
Bugzilla: https://bugs.freedesktop.org/106578
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
src/drmmode_display.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fa0c05b0c..fc8dd7a4d 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1515,6 +1515,12 @@ drmmode_cursor_src_offset(Rotation rotation, int width, int height,
#endif
+static uint32_t
+drmmode_cursor_gamma_passthrough(xf86CrtcPtr crtc, uint32_t argb)
+{
+ return argb;
+}
+
static uint32_t
drmmode_cursor_gamma(xf86CrtcPtr crtc, uint32_t argb)
{
@@ -1525,9 +1531,6 @@ drmmode_cursor_gamma(xf86CrtcPtr crtc, uint32_t argb)
if (!alpha)
return 0;
- if (crtc->scrn->depth != 24 && crtc->scrn->depth != 32)
- return argb;
-
/* Un-premultiply alpha */
for (i = 0; i < 3; i++)
rgb[i] = ((argb >> (i * 8)) & 0xff) * 0xff / alpha;
@@ -1544,6 +1547,12 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
{
ScrnInfoPtr pScrn = crtc->scrn;
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
+ uint32_t (*cursor_gamma)(xf86CrtcPtr crtc, uint32_t argb) =
+ drmmode_cursor_gamma;
+
+ if ((crtc->scrn->depth != 24 && crtc->scrn->depth != 32) ||
+ drmmode_cm_enabled(&info->drmmode))
+ cursor_gamma = drmmode_cursor_gamma_passthrough;
#if XF86_CRTC_VERSION < 7
if (crtc->driverIsPerformingTransform) {
@@ -1559,8 +1568,7 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
dstx, dsty);
ptr[dsty * info->cursor_w + dstx] =
- cpu_to_le32(drmmode_cursor_gamma(crtc,
- image[srcoffset]));
+ cpu_to_le32(cursor_gamma(crtc, image[srcoffset]));
}
}
} else
@@ -1570,7 +1578,7 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
int i;
for (i = 0; i < cursor_size; i++)
- ptr[i] = cpu_to_le32(drmmode_cursor_gamma(crtc, image[i]));
+ ptr[i] = cpu_to_le32(cursor_gamma(crtc, image[i]));
}
}
--
2.18.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 xf86-video-amdgpu] Don't apply gamma to HW cursor data if colour management is enabled
[not found] ` <20180626164135.2844-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-06-27 16:20 ` Michel Dänzer
[not found] ` <20180627162039.17540-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Michel Dänzer @ 2018-06-27 16:20 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
From: Michel Dänzer <michel.daenzer@amd.com>
In that case (with DC as of 4.17 kernels), the display hardware applies
gamma to the HW cursor.
v2:
* Also use all 0s when alpha == 0 in the gamma passthrough case.
Bugzilla: https://bugs.freedesktop.org/106578
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
src/drmmode_display.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fa0c05b0c..1563417a7 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1515,6 +1515,17 @@ drmmode_cursor_src_offset(Rotation rotation, int width, int height,
#endif
+static uint32_t
+drmmode_cursor_gamma_passthrough(xf86CrtcPtr crtc, uint32_t argb)
+{
+ uint32_t alpha = argb >> 24;
+
+ if (!alpha)
+ return 0;
+
+ return argb;
+}
+
static uint32_t
drmmode_cursor_gamma(xf86CrtcPtr crtc, uint32_t argb)
{
@@ -1525,9 +1536,6 @@ drmmode_cursor_gamma(xf86CrtcPtr crtc, uint32_t argb)
if (!alpha)
return 0;
- if (crtc->scrn->depth != 24 && crtc->scrn->depth != 32)
- return argb;
-
/* Un-premultiply alpha */
for (i = 0; i < 3; i++)
rgb[i] = ((argb >> (i * 8)) & 0xff) * 0xff / alpha;
@@ -1544,6 +1552,12 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
{
ScrnInfoPtr pScrn = crtc->scrn;
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
+ uint32_t (*cursor_gamma)(xf86CrtcPtr crtc, uint32_t argb) =
+ drmmode_cursor_gamma;
+
+ if ((crtc->scrn->depth != 24 && crtc->scrn->depth != 32) ||
+ drmmode_cm_enabled(&info->drmmode))
+ cursor_gamma = drmmode_cursor_gamma_passthrough;
#if XF86_CRTC_VERSION < 7
if (crtc->driverIsPerformingTransform) {
@@ -1559,8 +1573,7 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
dstx, dsty);
ptr[dsty * info->cursor_w + dstx] =
- cpu_to_le32(drmmode_cursor_gamma(crtc,
- image[srcoffset]));
+ cpu_to_le32(cursor_gamma(crtc, image[srcoffset]));
}
}
} else
@@ -1570,7 +1583,7 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
int i;
for (i = 0; i < cursor_size; i++)
- ptr[i] = cpu_to_le32(drmmode_cursor_gamma(crtc, image[i]));
+ ptr[i] = cpu_to_le32(cursor_gamma(crtc, image[i]));
}
}
--
2.18.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 xf86-video-amdgpu] Don't apply gamma to HW cursor data if colour management is enabled
[not found] ` <20180627162039.17540-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-06-27 18:40 ` Alex Deucher
0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2018-06-27 18:40 UTC (permalink / raw)
To: Michel Dänzer; +Cc: amd-gfx list
On Wed, Jun 27, 2018 at 12:20 PM, Michel Dänzer <michel@daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> In that case (with DC as of 4.17 kernels), the display hardware applies
> gamma to the HW cursor.
>
> v2:
> * Also use all 0s when alpha == 0 in the gamma passthrough case.
>
> Bugzilla: https://bugs.freedesktop.org/106578
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> src/drmmode_display.c | 25 +++++++++++++++++++------
> 1 file changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index fa0c05b0c..1563417a7 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -1515,6 +1515,17 @@ drmmode_cursor_src_offset(Rotation rotation, int width, int height,
>
> #endif
>
> +static uint32_t
> +drmmode_cursor_gamma_passthrough(xf86CrtcPtr crtc, uint32_t argb)
> +{
> + uint32_t alpha = argb >> 24;
> +
> + if (!alpha)
> + return 0;
> +
> + return argb;
> +}
> +
> static uint32_t
> drmmode_cursor_gamma(xf86CrtcPtr crtc, uint32_t argb)
> {
> @@ -1525,9 +1536,6 @@ drmmode_cursor_gamma(xf86CrtcPtr crtc, uint32_t argb)
> if (!alpha)
> return 0;
>
> - if (crtc->scrn->depth != 24 && crtc->scrn->depth != 32)
> - return argb;
> -
> /* Un-premultiply alpha */
> for (i = 0; i < 3; i++)
> rgb[i] = ((argb >> (i * 8)) & 0xff) * 0xff / alpha;
> @@ -1544,6 +1552,12 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
> {
> ScrnInfoPtr pScrn = crtc->scrn;
> AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
> + uint32_t (*cursor_gamma)(xf86CrtcPtr crtc, uint32_t argb) =
> + drmmode_cursor_gamma;
> +
> + if ((crtc->scrn->depth != 24 && crtc->scrn->depth != 32) ||
> + drmmode_cm_enabled(&info->drmmode))
> + cursor_gamma = drmmode_cursor_gamma_passthrough;
>
> #if XF86_CRTC_VERSION < 7
> if (crtc->driverIsPerformingTransform) {
> @@ -1559,8 +1573,7 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
> dstx, dsty);
>
> ptr[dsty * info->cursor_w + dstx] =
> - cpu_to_le32(drmmode_cursor_gamma(crtc,
> - image[srcoffset]));
> + cpu_to_le32(cursor_gamma(crtc, image[srcoffset]));
> }
> }
> } else
> @@ -1570,7 +1583,7 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
> int i;
>
> for (i = 0; i < cursor_size; i++)
> - ptr[i] = cpu_to_le32(drmmode_cursor_gamma(crtc, image[i]));
> + ptr[i] = cpu_to_le32(cursor_gamma(crtc, image[i]));
> }
> }
>
> --
> 2.18.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-27 18:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-26 16:41 [PATCH xf86-video-amdgpu] Don't apply gamma to HW cursor data if colour management is enabled Michel Dänzer
[not found] ` <20180626164135.2844-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-06-27 16:20 ` [PATCH v2 " Michel Dänzer
[not found] ` <20180627162039.17540-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-06-27 18:40 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.