Use root window (pixmap) instead of screen pixmap for scanout updates
PATCH 1/3 Use root window (pixmap) instead of screen pixmap for scanout updates
From: Michel Dänzer <[email protected]>
Preparation for following changes, no functional change intended yet.
--- src/drmmode_display.c | 2 +- src/radeon_kms.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
src/drmmode_display.c +1 -1
@@ -795,7 +795,7 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,DamageCreate (radeon_screen_damage_report,NULL , DamageReportRawRegion, TRUE, screen,NULL ); -DamageRegister (&screen->GetScreenPixmap (screen)->drawable, +DamageRegister (&screen->root->drawable, drmmode_crtc->scanout_damage); }
src/radeon_kms.c +1 -1
@@ -981,7 +981,7 @@ radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)GCPtr gc =GetScratchGC (pDraw->depth, pScreen);ValidateGC (pDraw, gc); - (*gc->ops->CopyArea)(&pScreen->GetScreenPixmap(pScreen)->drawable, + (*gc->ops->CopyArea)(&pScreen->GetWindowPixmap(pScreen->root)->drawable, pDraw, gc, xf86_crtc->x + extents.x1, xf86_crtc->y + extents.y1, extents.x2 - extents.x1, extents.y2 - extents.y1,
Signature · 6 lines
2.13.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170731094808.2552-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
PATCH 2/3 Add drmmode_crtc_can_flip helper
From: Michel Dänzer <[email protected]>
To reduce code duplication between DRI2 and Present. No functional change intended yet.
--- src/drmmode_display.h | 11 +++++++++++ src/radeon_dri2.c | 5 +---- src/radeon_present.c | 8 +++----- 3 files changed, 15 insertions(+), 9 deletions(-)
src/drmmode_display.h +11 -0
@@ -139,6 +139,17 @@ enum drmmode_flip_sync { }; +/* Can the page flip ioctl be used for this CRTC? */ +static inline Bool +drmmode_crtc_can_flip (xf86CrtcPtr crtc) +{ +drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; + +return crtc->enabled && + drmmode_crtc->pending_dpms_mode == DPMSModeOn; +} + +static inline void drmmode_fb_reference_loc (int drm_fd,struct drmmode_fb **old,struct drmmode_fb *new,const char *caller,unsigned line)
src/radeon_dri2.c +1 -4
@@ -774,14 +774,11 @@ can_flip(ScrnInfoPtr pScrn, DrawablePtr draw,xf86CrtcPtr crtc = config->crtc[i];drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; -if (!crtc->enabled) -continue ; -if (!drmmode_crtc || drmmode_crtc->rotate.bo || drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo)return FALSE; -if (drmmode_crtc->pending_dpms_mode == DPMSModeOn) +if (drmmode_crtc_can_flip (crtc)) num_crtcs_on++; }
src/radeon_present.c +3 -5
@@ -243,16 +243,14 @@ radeon_present_check_unflip(ScrnInfoPtr scrn)return FALSE;for (i =0 , num_crtcs_on =0 ; i < config->num_crtc; i++) { -drmmode_crtc_private_ptr drmmode_crtc = config->crtc[i]->driver_private; - -if (!config->crtc[i]->enabled) -continue ; +xf86CrtcPtr crtc = config->crtc[i]; +drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;if (!drmmode_crtc || drmmode_crtc->rotate.bo || drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo)return FALSE; -if (drmmode_crtc->pending_dpms_mode == DPMSModeOn) +if (drmmode_crtc_can_flip (crtc)) num_crtcs_on++; }
Signature · 6 lines
2.13.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 Allow DRI page flipping when some CRTCs use separate scanout buffers
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
As long as the CRTC we're synchronizing to doesn't.
--- man/radeon.man | 2 +- src/drmmode_display.c | 2 +- src/drmmode_display.h | 4 +++- src/radeon_dri2.c | 18 +++++++----------- src/radeon_present.c | 12 ++++-------- 5 files changed, 16 insertions(+), 22 deletions(-)
man/radeon.man +1 -1
@@ -285,7 +285,7 @@ Set the default value of the per-output 'TearFree' property, which controls tearing prevention using the hardware page flipping mechanism. TearFree is on for any CRTC associated with one or more outputs with TearFree on. Two separate scanout buffers need to be allocated for each CRTC with TearFree -on. While TearFree is on for any CRTC, it currently prevents clients from using +on. While TearFree is on for any CRTC, it may prevent clients from using DRI page flipping. If this option is set, the default value of the property is 'on' or 'off' accordingly. If this option isn't set, the default value of the property is
src/drmmode_display.c +1 -1
@@ -3007,7 +3007,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,for (i =0 ; i < config->num_crtc; i++) { crtc = config->crtc[i]; -if (!crtc->enabled) +if (!drmmode_crtc_can_flip (crtc))continue ; flipdata->flip_count++;
src/drmmode_display.h +3 -1
@@ -146,7 +146,9 @@ drmmode_crtc_can_flip(xf86CrtcPtr crtc)drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;return crtc->enabled && - drmmode_crtc->pending_dpms_mode == DPMSModeOn; + drmmode_crtc->pending_dpms_mode == DPMSModeOn && + !drmmode_crtc->rotate.bo && + !drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo; }
src/radeon_dri2.c +7 -11
@@ -754,9 +754,10 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw, }static Bool -can_flip (ScrnInfoPtr pScrn,DrawablePtr draw, +can_flip (xf86CrtcPtr crtc,DrawablePtr draw,DRI2BufferPtr front,DRI2BufferPtr back) { +ScrnInfoPtr pScrn = crtc->scrn;RADEONInfoPtr info =RADEONPTR (pScrn);xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (pScrn);int num_crtcs_on;
@@ -771,15 +772,10 @@ can_flip(ScrnInfoPtr pScrn, DrawablePtr draw,return FALSE;for (i =0 , num_crtcs_on =0 ; i < config->num_crtc; i++) { -xf86CrtcPtr crtc = config->crtc[i]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - -if (!drmmode_crtc || drmmode_crtc->rotate.bo || - drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo) -return FALSE; - -if (drmmode_crtc_can_flip (crtc)) +if (drmmode_crtc_can_flip (config->crtc[i])) num_crtcs_on++; +else if (config->crtc[i] == crtc) +return FALSE; }return num_crtcs_on >0 &&can_exchange (pScrn, draw, front, back);
@@ -859,7 +855,7 @@ static void radeon_dri2_frame_event_handler(xf86CrtcPtr crtc, uint32_t seq, switch (event->type) { case DRI2_FLIP: - if (can_flip(scrn, drawable, event->front, event->back) && + if (can_flip(crtc, drawable, event->front, event->back) && radeon_dri2_schedule_flip(crtc, event->client, drawable,
@@ -1352,7 +1348,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, current_msc &=0xffffffff ;/* Flips need to be submitted one frame before */ -if (can_flip (scrn, draw, front, back)) { +if (can_flip (crtc, draw, front, back)) { swap_info->type =DRI2_FLIP ; flip =1 ; }
src/radeon_present.c +4 -8
@@ -243,14 +243,7 @@ radeon_present_check_unflip(ScrnInfoPtr scrn)return FALSE;for (i =0 , num_crtcs_on =0 ; i < config->num_crtc; i++) { -xf86CrtcPtr crtc = config->crtc[i]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - -if (!drmmode_crtc || drmmode_crtc->rotate.bo || - drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo) -return FALSE; - -if (drmmode_crtc_can_flip (crtc)) +if (drmmode_crtc_can_flip (config->crtc[i])) num_crtcs_on++; }
@@ -286,6 +279,9 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, radeon_present_get_pixmap_tiling_flags(info, screen_pixmap))return FALSE; +if (!drmmode_crtc_can_flip (crtc->devPrivate)) +return FALSE; +return radeon_present_check_unflip (scrn); }
Signature · 6 lines
2.13.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170731094808.2552-3-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Deucher, Alexander
Reviewed-by Alex DeucherRE: [PATCH xf86-video-ati 3/3] Allow DRI page flipping when some CRTCs use separate scanout buffers
Quoted 8 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Monday, July 31, 2017 5:48 AM
To: [email protected]
Subject: [PATCH xf86-video-ati 3/3] Allow DRI page flipping when some CRTCs use separate scanout buffers
Quoted 5 lines
From: Michel Dänzer <[email protected]>
As long as the CRTC we're synchronizing to doesn't.
Signed-off-by Michel Dänzer <[email protected]>
Series is:
Quoted 141 lines
--- man/radeon.man | 2 +- src/drmmode_display.c | 2 +- src/drmmode_display.h | 4 +++- src/radeon_dri2.c | 18 +++++++----------- src/radeon_present.c | 12 ++++-------- 5 files changed, 16 insertions(+), 22 deletions(-)man/radeon.man +0
-0@@ -285,7 +285,7 @@ Set the default value of the per-output 'TearFree'property, which controls
tearing prevention using the hardware page flipping mechanism. TearFree is on for any CRTC associated with one or more outputs with TearFree on. Two separate scanout buffers need to be allocated for each CRTC with TearFree
-on. While TearFree is on for any CRTC, it currently prevents clients from usingman/radeon.man +1
-0+on. While TearFree is on for any CRTC, it may prevent clients from using DRI page flipping. If this option is set, the default value of the property is 'on' or 'off' accordingly. If this option isn't set, the default value of the property issrc/drmmode_display.c +1
-1@@ -3007,7 +3007,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn,ClientPtr client, for (i = 0; i < config->num_crtc; i++) { crtc = config->crtc[i]; -if (!crtc->enabled) +if (!drmmode_crtc_can_flip (crtc))continue ;src/drmmode_display.c +0
-0flipdata->flip_count++;src/drmmode_display.h +3
-1@@ -146,7 +146,9 @@ drmmode_crtc_can_flip(xf86CrtcPtr crtc)drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;return crtc->enabled && - drmmode_crtc->pending_dpms_mode == DPMSModeOn; + drmmode_crtc->pending_dpms_mode == DPMSModeOn && + !drmmode_crtc->rotate.bo && + !drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo; }src/radeon_dri2.c +6
-10@@ -754,9 +754,10 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw, }static Bool -can_flip (ScrnInfoPtr pScrn,DrawablePtr draw, +can_flip (xf86CrtcPtr crtc,DrawablePtr draw,DRI2BufferPtr front,DRI2BufferPtr back) { +ScrnInfoPtr pScrn = crtc->scrn;RADEONInfoPtr info =RADEONPTR (pScrn);xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (pScrn);int num_crtcs_on;@@ -771,15 +772,10 @@ can_flip(ScrnInfoPtr pScrn, DrawablePtr draw,return FALSE;for (i =0 , num_crtcs_on =0 ; i < config->num_crtc; i++) { -xf86CrtcPtr crtc = config->crtc[i]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - -if (!drmmode_crtc || drmmode_crtc->rotate.bo || - drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo) -return FALSE; - -if (drmmode_crtc_can_flip (crtc)) +if (drmmode_crtc_can_flip (config->crtc[i])) num_crtcs_on++; +else if (config->crtc[i] == crtc) +return FALSE; }return num_crtcs_on >0 &&can_exchange (pScrn, draw, front, back);@@ -859,7 +855,7 @@ static void radeon_dri2_frame_event_handler(xf86CrtcPtr crtc, uint32_t seq, switch (event->type) { case DRI2_FLIP: - if (can_flip(scrn, drawable, event->front, event->back) && + if (can_flip(crtc, drawable, event->front, event->back) && radeon_dri2_schedule_flip(crtc, event->client,src/radeon_dri2.c +1
-1drawable,@@ -1352,7 +1348,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, current_msc &=0xffffffff ;/* Flips need to be submitted one frame before */ -if (can_flip (scrn, draw, front, back)) { +if (can_flip (crtc, draw, front, back)) { swap_info->type =DRI2_FLIP ; flip =1 ;}src/radeon_present.c +4
-9@@ -243,14 +243,7 @@ radeon_present_check_unflip(ScrnInfoPtr scrn)return FALSE;for (i =0 , num_crtcs_on =0 ; i < config->num_crtc; i++) { -xf86CrtcPtr crtc = config->crtc[i]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - -if (!drmmode_crtc || drmmode_crtc->rotate.bo || - drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo) -return FALSE; - -if (drmmode_crtc_can_flip (crtc)) +if (drmmode_crtc_can_flip (config->crtc[i])) num_crtcs_on++; }@@ -286,6 +279,9 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, radeon_present_get_pixmap_tiling_flags(info, screen_pixmap)) return FALSE; +if (!drmmode_crtc_can_flip (crtc->devPrivate)) +return FALSE; +return radeon_present_check_unflip (scrn); } --2.13.3
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v2 3/3 Allow DRI page flipping when some CRTCs use separate scanout buffers
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
As long as the CRTC we're synchronizing to doesn't.
---
v2: Remove redundant checks from can_exchange which still prevented DRI2
page flipping
man/radeon.man | 2 +- src/drmmode_display.c | 2 +- src/drmmode_display.h | 4 +++- src/radeon_dri2.c | 30 +++++++----------------------- src/radeon_present.c | 12 ++++-------- 5 files changed, 16 insertions(+), 34 deletions(-)
man/radeon.man +1 -1
@@ -285,7 +285,7 @@ Set the default value of the per-output 'TearFree' property, which controls tearing prevention using the hardware page flipping mechanism. TearFree is on for any CRTC associated with one or more outputs with TearFree on. Two separate scanout buffers need to be allocated for each CRTC with TearFree -on. While TearFree is on for any CRTC, it currently prevents clients from using +on. While TearFree is on for any CRTC, it may prevent clients from using DRI page flipping. If this option is set, the default value of the property is 'on' or 'off' accordingly. If this option isn't set, the default value of the property is
src/drmmode_display.c +1 -1
@@ -3007,7 +3007,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,for (i =0 ; i < config->num_crtc; i++) { crtc = config->crtc[i]; -if (!crtc->enabled) +if (!drmmode_crtc_can_flip (crtc))continue ; flipdata->flip_count++;
src/drmmode_display.h +3 -1
@@ -146,7 +146,9 @@ drmmode_crtc_can_flip(xf86CrtcPtr crtc)drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;return crtc->enabled && - drmmode_crtc->pending_dpms_mode == DPMSModeOn; + drmmode_crtc->pending_dpms_mode == DPMSModeOn && + !drmmode_crtc->rotate.bo && + !drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo; }
src/radeon_dri2.c +7 -23
@@ -720,18 +720,6 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw,struct dri2_buffer_priv *back_priv = back->driverPrivate;PixmapPtr front_pixmap;PixmapPtr back_pixmap = back_priv->pixmap; -xf86CrtcConfigPtr xf86_config =XF86_CRTC_CONFIG_PTR (pScrn); -int i; - -for (i =0 ; i < xf86_config->num_crtc; i++) { -xf86CrtcPtr crtc = xf86_config->crtc[i]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - -if (crtc->enabled && - (crtc->rotatedData || - drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo)) -return FALSE; - }if (!update_front (draw, front))return FALSE;
@@ -754,9 +742,10 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw, }static Bool -can_flip (ScrnInfoPtr pScrn,DrawablePtr draw, +can_flip (xf86CrtcPtr crtc,DrawablePtr draw,DRI2BufferPtr front,DRI2BufferPtr back) { +ScrnInfoPtr pScrn = crtc->scrn;RADEONInfoPtr info =RADEONPTR (pScrn);xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (pScrn);int num_crtcs_on;
@@ -771,15 +760,10 @@ can_flip(ScrnInfoPtr pScrn, DrawablePtr draw,return FALSE;for (i =0 , num_crtcs_on =0 ; i < config->num_crtc; i++) { -xf86CrtcPtr crtc = config->crtc[i]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - -if (!drmmode_crtc || drmmode_crtc->rotate.bo || - drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo) -return FALSE; - -if (drmmode_crtc_can_flip (crtc)) +if (drmmode_crtc_can_flip (config->crtc[i])) num_crtcs_on++; +else if (config->crtc[i] == crtc) +return FALSE; }return num_crtcs_on >0 &&can_exchange (pScrn, draw, front, back);
@@ -859,7 +843,7 @@ static void radeon_dri2_frame_event_handler(xf86CrtcPtr crtc, uint32_t seq, switch (event->type) { case DRI2_FLIP: - if (can_flip(scrn, drawable, event->front, event->back) && + if (can_flip(crtc, drawable, event->front, event->back) && radeon_dri2_schedule_flip(crtc, event->client, drawable,
@@ -1352,7 +1336,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, current_msc &=0xffffffff ;/* Flips need to be submitted one frame before */ -if (can_flip (scrn, draw, front, back)) { +if (can_flip (crtc, draw, front, back)) { swap_info->type =DRI2_FLIP ; flip =1 ; }
src/radeon_present.c +4 -8
@@ -243,14 +243,7 @@ radeon_present_check_unflip(ScrnInfoPtr scrn)return FALSE;for (i =0 , num_crtcs_on =0 ; i < config->num_crtc; i++) { -xf86CrtcPtr crtc = config->crtc[i]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - -if (!drmmode_crtc || drmmode_crtc->rotate.bo || - drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo) -return FALSE; - -if (drmmode_crtc_can_flip (crtc)) +if (drmmode_crtc_can_flip (config->crtc[i])) num_crtcs_on++; }
@@ -286,6 +279,9 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, radeon_present_get_pixmap_tiling_flags(info, screen_pixmap))return FALSE; +if (!drmmode_crtc_can_flip (crtc->devPrivate)) +return FALSE; +return radeon_present_check_unflip (scrn); }
Signature · 6 lines
2.13.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170801085737.25904-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Alex Deucher
Reviewed-byRe: [PATCH xf86-video-ati v2 3/3] Allow DRI page flipping when some CRTCs use separate scanout buffers
Quoted 10 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
As long as the CRTC we're synchronizing to doesn't.
Reviewed-by Alex Deucher <[email protected]>Signed-off-by Michel Dänzer <[email protected]>---
v2: Remove redundant checks from
can_exchangewhich still prevented DRI2
page flipping
Quoted 154 lines
man/radeon.man | 2 +- src/drmmode_display.c | 2 +- src/drmmode_display.h | 4 +++- src/radeon_dri2.c | 30 +++++++----------------------- src/radeon_present.c | 12 ++++-------- 5 files changed, 16 insertions(+), 34 deletions(-)man/radeon.man +1
-1@@ -285,7 +285,7 @@ Set the default value of the per-output 'TearFree' property, which controls tearing prevention using the hardware page flipping mechanism. TearFree is on for any CRTC associated with one or more outputs with TearFree on. Two separate scanout buffers need to be allocated for each CRTC with TearFree -on. While TearFree is on for any CRTC, it currently prevents clients from using +on. While TearFree is on for any CRTC, it may prevent clients from using DRI page flipping. If this option is set, the default value of the property is 'on' or 'off' accordingly. If this option isn't set, the default value of the property issrc/drmmode_display.c +1
-1@@ -3007,7 +3007,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,for (i =0 ; i < config->num_crtc; i++) { crtc = config->crtc[i]; -if (!crtc->enabled) +if (!drmmode_crtc_can_flip (crtc))continue ; flipdata->flip_count++;src/drmmode_display.h +3
-1@@ -146,7 +146,9 @@ drmmode_crtc_can_flip(xf86CrtcPtr crtc)drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;return crtc->enabled && - drmmode_crtc->pending_dpms_mode == DPMSModeOn; + drmmode_crtc->pending_dpms_mode == DPMSModeOn && + !drmmode_crtc->rotate.bo && + !drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo; }src/radeon_dri2.c +7
-23@@ -720,18 +720,6 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw,struct dri2_buffer_priv *back_priv = back->driverPrivate;PixmapPtr front_pixmap;PixmapPtr back_pixmap = back_priv->pixmap; -xf86CrtcConfigPtr xf86_config =XF86_CRTC_CONFIG_PTR (pScrn); -int i; - -for (i =0 ; i < xf86_config->num_crtc; i++) { -xf86CrtcPtr crtc = xf86_config->crtc[i]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - -if (crtc->enabled && - (crtc->rotatedData || - drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo)) -return FALSE; - }if (!update_front (draw, front))return FALSE;@@ -754,9 +742,10 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw, }static Bool -can_flip (ScrnInfoPtr pScrn,DrawablePtr draw, +can_flip (xf86CrtcPtr crtc,DrawablePtr draw,DRI2BufferPtr front,DRI2BufferPtr back) { +ScrnInfoPtr pScrn = crtc->scrn;RADEONInfoPtr info =RADEONPTR (pScrn);xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (pScrn);int num_crtcs_on;@@ -771,15 +760,10 @@ can_flip(ScrnInfoPtr pScrn, DrawablePtr draw,return FALSE;for (i =0 , num_crtcs_on =0 ; i < config->num_crtc; i++) { -xf86CrtcPtr crtc = config->crtc[i]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - -if (!drmmode_crtc || drmmode_crtc->rotate.bo || - drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo) -return FALSE; - -if (drmmode_crtc_can_flip (crtc)) +if (drmmode_crtc_can_flip (config->crtc[i])) num_crtcs_on++; +else if (config->crtc[i] == crtc) +return FALSE; }return num_crtcs_on >0 &&can_exchange (pScrn, draw, front, back);@@ -859,7 +843,7 @@ static void radeon_dri2_frame_event_handler(xf86CrtcPtr crtc, uint32_t seq, switch (event->type) { case DRI2_FLIP: - if (can_flip(scrn, drawable, event->front, event->back) && + if (can_flip(crtc, drawable, event->front, event->back) && radeon_dri2_schedule_flip(crtc, event->client, drawable,@@ -1352,7 +1336,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, current_msc &=0xffffffff ;/* Flips need to be submitted one frame before */ -if (can_flip (scrn, draw, front, back)) { +if (can_flip (crtc, draw, front, back)) { swap_info->type =DRI2_FLIP ; flip =1 ; }src/radeon_present.c +4
-9@@ -243,14 +243,7 @@ radeon_present_check_unflip(ScrnInfoPtr scrn)return FALSE;for (i =0 , num_crtcs_on =0 ; i < config->num_crtc; i++) { -xf86CrtcPtr crtc = config->crtc[i]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - -if (!drmmode_crtc || drmmode_crtc->rotate.bo || - drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo) -return FALSE; - -if (drmmode_crtc_can_flip (crtc)) +if (drmmode_crtc_can_flip (config->crtc[i])) num_crtcs_on++; }@@ -286,6 +279,9 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, radeon_present_get_pixmap_tiling_flags(info, screen_pixmap))return FALSE; +if (!drmmode_crtc_can_flip (crtc->devPrivate)) +return FALSE; +return radeon_present_check_unflip (scrn); } --2.13.3
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v2 1/3 Use root window (pixmap) instead of screen pixmap for scanout updates
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Preparation for following changes, no functional change intended yet.
---
v2: Add drmmode_screen_damage_destroy to prevent use-after-free on
server shutdown
src/drmmode_display.c | 21 ++++++++++++++------- src/radeon_kms.c | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-)
src/drmmode_display.c +14 -7
@@ -529,11 +529,8 @@ drmmode_crtc_scanout_free(drmmode_crtc_private_ptr drmmode_crtc) &drmmode_crtc->scanout[1]); } -if (drmmode_crtc->scanout_damage) { +if (drmmode_crtc->scanout_damage)DamageDestroy (drmmode_crtc->scanout_damage); - drmmode_crtc->scanout_damage =NULL ; -RegionUninit (&drmmode_crtc->scanout_last_region); - } }void
@@ -605,6 +602,15 @@ radeon_screen_damage_report(DamagePtr damage, RegionPtr region, void *closure) damage->damage.data =NULL ; } +static void +drmmode_screen_damage_destroy (DamagePtr damage,void *closure) +{ +drmmode_crtc_private_ptr drmmode_crtc = closure; + + drmmode_crtc->scanout_damage =NULL ; +RegionUninit (&drmmode_crtc->scanout_last_region); +} +static Bool drmmode_can_use_hw_cursor (xf86CrtcPtr crtc) {
@@ -793,9 +799,10 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,if (!drmmode_crtc->scanout_damage) { drmmode_crtc->scanout_damage =DamageCreate (radeon_screen_damage_report, -NULL , DamageReportRawRegion, - TRUE, screen,NULL ); -DamageRegister (&screen->GetScreenPixmap (screen)->drawable, + drmmode_screen_damage_destroy, + DamageReportRawRegion, + TRUE, screen, drmmode_crtc); +DamageRegister (&screen->root->drawable, drmmode_crtc->scanout_damage); }
src/radeon_kms.c +1 -1
@@ -981,7 +981,7 @@ radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)GCPtr gc =GetScratchGC (pDraw->depth, pScreen);ValidateGC (pDraw, gc); - (*gc->ops->CopyArea)(&pScreen->GetScreenPixmap(pScreen)->drawable, + (*gc->ops->CopyArea)(&pScreen->GetWindowPixmap(pScreen->root)->drawable, pDraw, gc, xf86_crtc->x + extents.x1, xf86_crtc->y + extents.y1, extents.x2 - extents.x1, extents.y2 - extents.y1,
Signature · 6 lines
2.13.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170801091959.28685-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Alex Deucher
Reviewed-byQuoted 10 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
Preparation for following changes, no functional change intended yet.
Reviewed-by Alex Deucher <[email protected]> # v1Signed-off-by Michel Dänzer <[email protected]>---
v2: Add
drmmode_screen_damage_destroyto prevent use-after-free on
server shutdown
Quoted 68 lines
src/drmmode_display.c | 21 ++++++++++++++------- src/radeon_kms.c | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-)src/drmmode_display.c +14
-7@@ -529,11 +529,8 @@ drmmode_crtc_scanout_free(drmmode_crtc_private_ptr drmmode_crtc) &drmmode_crtc->scanout[1]); } -if (drmmode_crtc->scanout_damage) { +if (drmmode_crtc->scanout_damage)DamageDestroy (drmmode_crtc->scanout_damage); - drmmode_crtc->scanout_damage =NULL ; -RegionUninit (&drmmode_crtc->scanout_last_region); - } }void @@ -605,6 +602,15 @@ radeon_screen_damage_report(DamagePtr damage, RegionPtr region, void *closure) damage->damage.data =NULL ; } +static void +drmmode_screen_damage_destroy (DamagePtr damage,void *closure) +{ +drmmode_crtc_private_ptr drmmode_crtc = closure; + + drmmode_crtc->scanout_damage =NULL ; +RegionUninit (&drmmode_crtc->scanout_last_region); +} +static Bool drmmode_can_use_hw_cursor (xf86CrtcPtr crtc) {@@ -793,9 +799,10 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,if (!drmmode_crtc->scanout_damage) { drmmode_crtc->scanout_damage =DamageCreate (radeon_screen_damage_report, -NULL , DamageReportRawRegion, - TRUE, screen,NULL ); -DamageRegister (&screen->GetScreenPixmap (screen)->drawable, + drmmode_screen_damage_destroy, + DamageReportRawRegion, + TRUE, screen, drmmode_crtc); +DamageRegister (&screen->root->drawable, drmmode_crtc->scanout_damage); }src/radeon_kms.c +1
-2@@ -981,7 +981,7 @@ radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)GCPtr gc =GetScratchGC (pDraw->depth, pScreen);ValidateGC (pDraw, gc); - (*gc->ops->CopyArea)(&pScreen->GetScreenPixmap(pScreen)->drawable, + (*gc->ops->CopyArea)(&pScreen->GetWindowPixmap(pScreen->root)->drawable, pDraw, gc, xf86_crtc->x + extents.x1, xf86_crtc->y + extents.y1, extents.x2 - extents.x1, extents.y2 - extents.y1, --2.13.3
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx