Port outstanding changes frm
cover Port outstanding changes frm
From: Michel Dänzer <[email protected]>
These are ports of the outstanding applicable changes from the amdgpu driver.
Emil Velikov (1):
Do not export the DriverRec RADEON
Jim Qu (1):
Wait for pending scanout update before calling
drmmode_crtc_scanout_free
Keith Packard (3):
modesetting: Record non-desktop kernel property at PreInit time
modesetting: Create CONNECTOR_ID properties for outputs [v2] Add RandR leases support
Michel Dänzer (16):
Ignore RADEON_DRM_QUEUE_ERROR (0) in radeon_drm_abort_entry Track DRM event queue sequence number in scanout_update_pending Abort scanout_update_pending event when possible
Update RandR CRTC state if set_mode_major fails in set_desired_modes Simplify drmmode_crtc_scanout_update
Don't call scanout_flip/update with a legacy RandR scanout buffer Simplify drmmode_handle_transform
Set drmmode_crtc->scanout_id = 0 when TearFree is disabled Refactor drmmode_output_set_tear_free helper
Wait for pending flips in drmmode_output_set_tear_free Replace 'foo == NULL' with '!foo'
Call drmmode_do_crtc_dpms from drmmode_crtc_dpms as well Use drmmode_crtc_dpms in drmmode_set_desired_modes
Check dimensions passed to drmmode_xf86crtc_resize
Remove #if 0'd code
Call drmmode_crtc_gamma_do_set from drmmode_setup_colormap
configure.ac | 4 +- src/ati.c | 4 +- src/drmmode_display.c | 344 ++++++++++++++++++++++++++++------- src/drmmode_display.h | 8 +- src/evergreen_exa.c | 10 +- src/r600_exa.c | 10 +- src/radeon.h | 2 +- src/radeon_dri2.c | 12 +- src/radeon_drm_queue.c | 3 + src/radeon_exa.c | 2 +- src/radeon_exa_funcs.c | 8 +- src/radeon_exa_render.c | 6 +- src/radeon_glamor.c | 2 +- src/radeon_glamor_wrappers.c | 4 +- src/radeon_kms.c | 45 ++--- src/radeon_probe.c | 2 +- src/radeon_textured_video.c | 10 +- src/radeon_video.c | 6 +- 18 files changed, 352 insertions(+), 130 deletions(-)
Signature · 6 lines
2.18.0 _______________________________________________ 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): 20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
PATCH 1/21 Wait for pending scanout update before calling drmmode_crtc_scanout_free
From: Jim Qu <[email protected]>
There is a case that when set screen from reverse to normal, the old scanout damage is freed in modesetting before scanout update handler, so it causes segment fault issue.
[ Michel Dänzer: Only call drmmode_crtc_wait_pending_event before
drmmode_crtc_scanout_free is actually called, slightly tweak commit message ]
(Ported from amdgpu commit 9f6a8905611b5b1d8fcd31bebbc9af7ca1355cc3)
--- src/drmmode_display.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
src/drmmode_display.c +4 -2
@@ -985,9 +985,11 @@ done:if (drmmode_crtc->scanout[scanout_id].pixmap && fb !=radeon_pixmap_get_fb (drmmode_crtc-> - scanout[scanout_id].pixmap)) + scanout[scanout_id].pixmap)) { +drmmode_crtc_wait_pending_event (drmmode_crtc, pRADEONEnt->fd, + drmmode_crtc->scanout_update_pending);drmmode_crtc_scanout_free (drmmode_crtc); -else if (!drmmode_crtc->tear_free) { + }else if (!drmmode_crtc->tear_free) {drmmode_crtc_scanout_destroy (drmmode, &drmmode_crtc->scanout[1 ]); }
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/21 Do not export the DriverRec RADEON
In reply to a message not in the archiveFrom: Emil Velikov <[email protected]>
Unused externally and should not be exported.
(Ported from amdgpu commit 7fb8b49895e225b3908c8bd186539de23afe91d1)
--- src/radeon_probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/radeon_probe.c +1 -1
@@ -278,7 +278,7 @@ radeon_platform_probe(DriverPtr pDriver, }#endif -_X_EXPORT DriverRec RADEON = +DriverRec RADEON = {RADEON_VERSION_CURRENT ,RADEON_DRIVER_NAME ,
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/21 Ignore RADEON_DRM_QUEUE_ERROR (0) in radeon_drm_abort_entry
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
This allows a following change to be slightly simpler. (Ported from amdgpu commit 8fcc3a9b43d3907052a83a96e5a2423afab5ad3f)
--- src/radeon_drm_queue.c | 3 +++ 1 file changed, 3 insertions(+)
src/radeon_drm_queue.c +3 -0
@@ -150,6 +150,9 @@ radeon_drm_abort_entry(uintptr_t seq) {struct radeon_drm_queue_entry *e, *tmp; +if (seq ==RADEON_DRM_QUEUE_ERROR ) +return ; +xorg_list_for_each_entry_safe (e, tmp, &radeon_drm_queue, list) {if (e->seq == seq) {radeon_drm_abort_one (e);
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/21 Track DRM event queue sequence number in scanout_update_pending
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Preparation for next change, no behaviour change intended. (Ported from amdgpu commit 04a5c5f7cfacad8d9ccffe81e388cc3da2036cb5)
--- src/drmmode_display.h | 2 +- src/radeon_kms.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)
src/drmmode_display.h +1 -1
@@ -88,7 +88,7 @@ typedef struct {Bool ignore_damage;RegionRec scanout_last_region;unsigned scanout_id; -Bool scanout_update_pending; +uintptr_t scanout_update_pending;Bool tear_free;PixmapPtr prime_scanout_pixmap;
src/radeon_kms.c +8 -8
@@ -526,7 +526,7 @@ radeon_scanout_flip_abort(xf86CrtcPtr crtc, void *event_data)RADEONEntPtr pRADEONEnt =RADEONEntPriv (crtc->scrn);drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - drmmode_crtc->scanout_update_pending = FALSE; + drmmode_crtc->scanout_update_pending =0 ;drmmode_fb_reference (pRADEONEnt->fd, &drmmode_crtc->flip_pending,NULL ); }
@@ -611,7 +611,7 @@ radeon_prime_scanout_update_abort(xf86CrtcPtr crtc, void *event_data) {drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - drmmode_crtc->scanout_update_pending = FALSE; + drmmode_crtc->scanout_update_pending =0 ; }void
@@ -752,7 +752,7 @@ radeon_prime_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t udrmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;radeon_prime_scanout_do_update (crtc,0 ); - drmmode_crtc->scanout_update_pending = FALSE; + drmmode_crtc->scanout_update_pending =0 ; } static void
@@ -793,7 +793,7 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)return ; } - drmmode_crtc->scanout_update_pending = TRUE; + drmmode_crtc->scanout_update_pending = drm_queue_seq; } static void
@@ -851,7 +851,7 @@ radeon_prime_scanout_flip(PixmapDirtyUpdatePtr ent) } drmmode_crtc->scanout_id = scanout_id; - drmmode_crtc->scanout_update_pending = TRUE; + drmmode_crtc->scanout_update_pending = drm_queue_seq; } static void
@@ -1000,7 +1000,7 @@ radeon_scanout_update_abort(xf86CrtcPtr crtc, void *event_data) {drmmode_crtc_private_ptr drmmode_crtc = event_data; - drmmode_crtc->scanout_update_pending = FALSE; + drmmode_crtc->scanout_update_pending =0 ; } static void
@@ -1077,7 +1077,7 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)return ; } - drmmode_crtc->scanout_update_pending = TRUE; + drmmode_crtc->scanout_update_pending = drm_queue_seq; } static void
@@ -1144,7 +1144,7 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info, } drmmode_crtc->scanout_id = scanout_id; - drmmode_crtc->scanout_update_pending = TRUE; + drmmode_crtc->scanout_update_pending = drm_queue_seq; }static void RADEONBlockHandler_KMS (BLOCKHANDLER_ARGS_DECL )
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/21 Abort scanout_update_pending event when possible
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
We don't need to wait for a non-TearFree scanout update before scanning out from the screen pixmap or before flipping, as the scanout update won't be visible anyway. Instead, just abort it.
(Ported from amdgpu commit 36d01989cd842588f12fdae5b2cba5fdcf9c91dd)
--- src/drmmode_display.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
src/drmmode_display.c +8 -4
@@ -986,8 +986,8 @@ done:if (drmmode_crtc->scanout[scanout_id].pixmap && fb !=radeon_pixmap_get_fb (drmmode_crtc-> scanout[scanout_id].pixmap)) { -drmmode_crtc_wait_pending_event (drmmode_crtc, pRADEONEnt->fd, - drmmode_crtc->scanout_update_pending); +radeon_drm_abort_entry (drmmode_crtc->scanout_update_pending); + drmmode_crtc->scanout_update_pending =0 ;drmmode_crtc_scanout_free (drmmode_crtc); }else if (!drmmode_crtc->tear_free) { drmmode_crtc_scanout_destroy(drmmode,
@@ -3190,8 +3190,12 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, extents);radeon_cs_flush_indirect (crtc->scrn); -drmmode_crtc_wait_pending_event (drmmode_crtc, pRADEONEnt->fd, - drmmode_crtc->scanout_update_pending); +if (drmmode_crtc->scanout_update_pending) { +drmmode_crtc_wait_pending_event (drmmode_crtc, pRADEONEnt->fd, + drmmode_crtc->flip_pending); +radeon_drm_abort_entry (drmmode_crtc->scanout_update_pending); + drmmode_crtc->scanout_update_pending =0 ; + } }if (crtc == ref_crtc) {
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/21 Update RandR CRTC state if set_mode_major fails in set_desired_modes
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Without this, RandR would report the CRTC and its outputs as enabled, even though they were actually off due to the failure.
(Cherry picked from amdgpu commit 4dcda0b48d62944c841cd9540f4ad4c7ac8dee47)
--- src/drmmode_display.c | 2 ++ 1 file changed, 2 insertions(+)
src/drmmode_display.c +2 -0
@@ -2833,6 +2833,8 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, }else {xf86DrvMsg (pScrn->scrnIndex,X_WARNING ,"Failed to set mode on CRTC %d\n" , c); +RRCrtcSet (crtc->randr_crtc,NULL , crtc->x, crtc->y, + crtc->rotation,0 ,NULL ); } }else { crtc->mode = crtc->desiredMode;
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/21 Simplify drmmode_crtc_scanout_update
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Use our own BoxRec for the extents, and RegionEmpty for clearing the scanout damage region.
(Ported from amdgpu commit 72c3e9c7308fbcdf85708b72f9be14a5f2f8e7b5)
--- src/drmmode_display.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
src/drmmode_display.c +4 -12
@@ -765,8 +765,8 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,if (drmmode_crtc->scanout[scanout_id].pixmap && (!drmmode_crtc->tear_free || drmmode_crtc->scanout[scanout_id ^1 ].pixmap)) { -RegionPtr region; -BoxPtr box; +BoxRec extents = { .x1 =0 , .y1 =0 , + .x2 = scrn->virtualX, .y2 = scrn->virtualY };if (!drmmode_crtc->scanout_damage) { drmmode_crtc->scanout_damage =
@@ -778,21 +778,13 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode, drmmode_crtc->scanout_damage); } - region =DamageRegion (drmmode_crtc->scanout_damage); -RegionUninit (region); - region->data =NULL ; - box =RegionExtents (region); - box->x1 =0 ; - box->y1 =0 ; - box->x2 =max (box->x2, scrn->virtualX); - box->y2 =max (box->y2, scrn->virtualY); - *fb =radeon_pixmap_get_fb (drmmode_crtc->scanout[scanout_id].pixmap); *x = *y =0 ;radeon_scanout_do_update (crtc, scanout_id, screen->GetWindowPixmap (screen->root), - *box); + extents); +RegionEmpty (DamageRegion (drmmode_crtc->scanout_damage));radeon_finish (scrn, drmmode_crtc->scanout[scanout_id].bo); } }
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/21 Don't call scanout_flip/update with a legacy RandR scanout buffer
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
It means we are not using our own scanout buffers.
Fixes crash when TearFree is supposed to be enabled, but drmmode_handle_transform doesn't set crtc->driverIsPerformingTransform.
Bugzilla: https://bugs.freedesktop.org/105736
(Ported from commit 463477661c88cab3a87746499e5838c5b9f9a13b)
--- src/radeon_kms.c | 3 +++ 1 file changed, 3 insertions(+)
src/radeon_kms.c +3 -0
@@ -1167,6 +1167,9 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)xf86CrtcPtr crtc = xf86_config->crtc[c];drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; +if (drmmode_crtc->rotate.pixmap) +continue ; +if (drmmode_crtc->tear_free)radeon_scanout_flip (pScreen, info, crtc);else if (drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/21 Simplify drmmode_handle_transform
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Set crtc->driverIsPerformingTransform for any case we can handle before calling xf86CrtcRotate. We already clear it afterwards when the latter clears crtc->transform_in_use.
This should allow our separate scanout buffer mechanism to be used in more cases.
(Cherry picked from amdgpu commit 8e544b4a0de6717feb4abf00052d57c5b726b5ce)
--- src/drmmode_display.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
src/drmmode_display.c +1 -5
@@ -669,13 +669,9 @@ drmmode_handle_transform(xf86CrtcPtr crtc)Bool ret;#if XORG_VERSION_CURRENT >=XORG_VERSION_NUMERIC (1 ,15 ,99 ,903 ,0 ) -if (crtc->transformPresent || crtc->rotation != RR_Rotate_0) - crtc->driverIsPerformingTransform = XF86DriverTransformOutput; -else - crtc->driverIsPerformingTransform = XF86DriverTransformNone; + crtc->driverIsPerformingTransform = XF86DriverTransformOutput;#else crtc->driverIsPerformingTransform = !crtc->transformPresent && - crtc->rotation != RR_Rotate_0 && (crtc->rotation &0xf ) == RR_Rotate_0;#endif
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/21 Set drmmode_crtc->scanout_id = 0 when TearFree is disabled
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
When disabling TearFree, drmmode_crtc->scanout_id could remain as 1, but drmmode_set_mode_major would destroy drmmode_crtc->scanout[1], so scanout_do_update() would keep bailing, and the scanout buffer would stop being updated.
Fixes freeze after disabling TearFree on a CRTC with active RandR rotation or other transform.
(Ported from amdgpu commit 7db0c8e9d7586cff4312d4b93684d35de3e6376f)
--- src/drmmode_display.c | 2 ++ 1 file changed, 2 insertions(+)
src/drmmode_display.c +2 -0
@@ -885,6 +885,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,drmmode_crtc_update_tear_free (crtc);if (drmmode_crtc->tear_free) scanout_id = drmmode_crtc->scanout_id; +else + drmmode_crtc->scanout_id =0 ;drmmode_crtc_gamma_do_set (crtc, crtc->gamma_red, crtc->gamma_green, crtc->gamma_blue, crtc->gamma_size);
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/21 Refactor drmmode_output_set_tear_free helper
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Preparation for the following fix, no functional change intended.
(Ported from amdgpu commit fa30f4601de7a44edfb4a95873bd648946fd4292)
--- src/drmmode_display.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
src/drmmode_display.c +18 -10
@@ -1743,6 +1743,22 @@ drmmode_output_create_resources(xf86OutputPtr output) } } +static void +drmmode_output_set_tear_free (RADEONEntPtr pRADEONEnt, +drmmode_output_private_ptr drmmode_output, +xf86CrtcPtr crtc,int tear_free) +{ +if (drmmode_output->tear_free == tear_free) +return ; + + drmmode_output->tear_free = tear_free; + +if (crtc) { +drmmode_set_mode_major (crtc, &crtc->mode, crtc->rotation, + crtc->x, crtc->y); + } +} +static Bool drmmode_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value)
@@ -1783,16 +1799,8 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,for (j =0 ; j < p->mode_prop->count_enums; j++) {if (!strcmp (p->mode_prop->enums[j].name, name)) {if (i == (drmmode_output->num_props -1 )) { -if (drmmode_output->tear_free != j) { -xf86CrtcPtr crtc = output->crtc; - - drmmode_output->tear_free = j; -if (crtc) { -drmmode_set_mode_major (crtc, &crtc->mode, - crtc->rotation, - crtc->x, crtc->y); - } - } +drmmode_output_set_tear_free (pRADEONEnt, drmmode_output, + output->crtc, j); }else { drmModeConnectorSetProperty(pRADEONEnt->fd, drmmode_output->output_id,
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/21 Wait for pending flips in drmmode_output_set_tear_free
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
This prevents a nested call to drmHandleEvent, which would hang.
Fixes hangs when disabling TearFree on a CRTC while a DRI3 client is page flipping.
(Ported from amdgpu commit 04947b83cce3a7782e59dece2c7797cc396c1e05)
--- src/drmmode_display.c | 8 ++++++++ 1 file changed, 8 insertions(+)
src/drmmode_display.c +8 -0
@@ -1754,6 +1754,14 @@ drmmode_output_set_tear_free(RADEONEntPtr pRADEONEnt, drmmode_output->tear_free = tear_free;if (crtc) { +drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; + +/* Wait for pending flips before drmmode_set_mode_major calls +* drmmode_crtc_update_tear_free, to prevent a nested +* drmHandleEvent call, which would hang +*/ +drmmode_crtc_wait_pending_event (drmmode_crtc, pRADEONEnt->fd, + drmmode_crtc->flip_pending);drmmode_set_mode_major (crtc, &crtc->mode, crtc->rotation, crtc->x, crtc->y); }
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/21 Replace 'foo == NULL' with '!foo'
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Shorter and sweeter. :)
(Ported from amdgpu commit e8e688f3852fb06b0c34ed5bce47c9493bcd1613)
--- src/ati.c | 4 ++-- src/drmmode_display.c | 8 ++++---- src/evergreen_exa.c | 10 +++++----- src/r600_exa.c | 10 +++++----- src/radeon.h | 2 +- src/radeon_dri2.c | 12 ++++++------ src/radeon_exa.c | 2 +- src/radeon_exa_funcs.c | 8 ++++---- src/radeon_exa_render.c | 6 +++--- src/radeon_glamor.c | 2 +- src/radeon_glamor_wrappers.c | 4 ++-- src/radeon_kms.c | 25 ++++++++++++------------- src/radeon_textured_video.c | 10 +++++----- src/radeon_video.c | 6 +++--- 14 files changed, 54 insertions(+), 55 deletions(-)
src/ati.c +2 -2
@@ -109,7 +109,7 @@ ati_device_get_primary(void) device_iter =pci_slot_match_iterator_create (NULL ); -while ((device =pci_device_next (device_iter)) !=NULL ) { +while ((device =pci_device_next (device_iter))) {if (xf86IsPrimaryPci (device))break ; }
@@ -128,7 +128,7 @@ ati_device_get_indexed(int index) device_iter =pci_slot_match_iterator_create (NULL ); -while ((device =pci_device_next (device_iter)) !=NULL ) { +while ((device =pci_device_next (device_iter))) {if (device->vendor_id ==PCI_VENDOR_ATI ) {if (count == index)return device;
src/drmmode_display.c +4 -4
@@ -386,7 +386,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,return pixmap; fbcon =drmModeGetFB (pRADEONEnt->fd, fbcon_id); -if (fbcon ==NULL ) +if (!fbcon)return NULL ; if (fbcon->depth != pScrn->depth ||
@@ -410,7 +410,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, bo->ref_count =1 ; bo->bo.radeon =radeon_bo_open (drmmode->bufmgr, flink.name,0 ,0 ,0 ,0 ); -if (bo ==NULL ) { +if (!bo) {xf86DrvMsg (pScrn->scrnIndex,X_ERROR ,"Couldn't open BO for fbcon handle\n" ); goto out_free_fb;
@@ -1365,7 +1365,7 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_resRADEONInfoPtr info =RADEONPTR (pScrn); crtc =xf86CrtcCreate (pScrn, &info->drmmode_crtc_funcs); -if (crtc ==NULL ) +if (!crtc)return 0 ; drmmode_crtc =xnfcalloc (sizeof (drmmode_crtc_private_rec),1 );
@@ -2317,7 +2317,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)if (radeon_bo_map (info->front_buffer->bo.radeon,1 )) goto fail; fb_shadow =calloc (1 , pitch * scrn->virtualY); -if (fb_shadow ==NULL ) +if (!fb_shadow) goto fail;free (info->fb_shadow); info->fb_shadow = fb_shadow;
src/evergreen_exa.c +5 -5
@@ -511,7 +511,7 @@ EVERGREENPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, accel_state->copy_area_bo =radeon_bo_open (info->bufmgr,0 , size,0 ,RADEON_GEM_DOMAIN_VRAM ,0 ); -if (accel_state->copy_area_bo ==NULL ) +if (!accel_state->copy_area_bo)RADEON_FALLBACK (("temp copy surface alloc failed\n" )); radeon_cs_space_add_persistent_bo(info->cs, accel_state->copy_area_bo,
@@ -1693,7 +1693,7 @@ EVERGREENUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, base_align =drmmode_get_base_align (pScrn, (bpp /8 ),0 ); size = scratch_pitch * height * (bpp /8 ); scratch =radeon_bo_open (info->bufmgr,0 , size, base_align,RADEON_GEM_DOMAIN_GTT ,0 ); -if (scratch ==NULL ) { +if (!scratch) { goto copy; }
@@ -1821,7 +1821,7 @@ EVERGREENDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, base_align =drmmode_get_base_align (pScrn, (bpp /8 ),0 ); size = scratch_pitch * height * (bpp /8 ); scratch =radeon_bo_open (info->bufmgr,0 , size, base_align,RADEON_GEM_DOMAIN_GTT ,0 ); -if (scratch ==NULL ) { +if (!scratch) { goto copy; }radeon_cs_space_reset_bos (info->cs);
@@ -1927,7 +1927,7 @@ EVERGREENAllocShaders(ScrnInfoPtr pScrn, ScreenPtr pScreen) accel_state->shaders_bo =radeon_bo_open (info->bufmgr,0 , size,0 ,RADEON_GEM_DOMAIN_VRAM ,0 ); -if (accel_state->shaders_bo ==NULL ) { +if (!accel_state->shaders_bo) {ErrorF ("Allocating shader failed\n" );return FALSE; }
@@ -2046,7 +2046,7 @@ EVERGREENDrawInit(ScreenPtr pScreen)ScrnInfoPtr pScrn =xf86ScreenToScrn (pScreen);RADEONInfoPtr info =RADEONPTR (pScrn); -if (info->accel_state->exa ==NULL ) { +if (!info->accel_state->exa) {xf86DrvMsg (pScreen->myNum,X_ERROR ,"Memory map not set up\n" );return FALSE; }
src/r600_exa.c +5 -5
@@ -575,7 +575,7 @@ R600PrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, accel_state->copy_area_bo =radeon_bo_open (info->bufmgr,0 , size, align,RADEON_GEM_DOMAIN_VRAM ,0 ); -if (accel_state->copy_area_bo ==NULL ) +if (!accel_state->copy_area_bo)RADEON_FALLBACK (("temp copy surface alloc failed\n" )); radeon_cs_space_add_persistent_bo(info->cs, accel_state->copy_area_bo,
@@ -1723,7 +1723,7 @@ R600UploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h, base_align =drmmode_get_base_align (pScrn, (bpp /8 ),0 ); size = scratch_pitch * height * (bpp /8 ); scratch =radeon_bo_open (info->bufmgr,0 , size, base_align,RADEON_GEM_DOMAIN_GTT ,0 ); -if (scratch ==NULL ) { +if (!scratch) { goto copy; }
@@ -1847,7 +1847,7 @@ R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, base_align =drmmode_get_base_align (pScrn, (bpp /8 ),0 ); size = scratch_pitch * height * (bpp /8 ); scratch =radeon_bo_open (info->bufmgr,0 , size, base_align,RADEON_GEM_DOMAIN_GTT ,0 ); -if (scratch ==NULL ) { +if (!scratch) { goto copy; }radeon_cs_space_reset_bos (info->cs);
@@ -1960,7 +1960,7 @@ R600AllocShaders(ScrnInfoPtr pScrn, ScreenPtr pScreen) accel_state->shaders_bo =radeon_bo_open (info->bufmgr,0 , size,0 ,RADEON_GEM_DOMAIN_VRAM ,0 ); -if (accel_state->shaders_bo ==NULL ) { +if (!accel_state->shaders_bo) {ErrorF ("Allocating shader failed\n" );return FALSE; }
@@ -2025,7 +2025,7 @@ R600DrawInit(ScreenPtr pScreen)ScrnInfoPtr pScrn =xf86ScreenToScrn (pScreen);RADEONInfoPtr info =RADEONPTR (pScrn); -if (info->accel_state->exa ==NULL ) { +if (!info->accel_state->exa) {xf86DrvMsg (pScreen->myNum,X_ERROR ,"Memory map not set up\n" );return FALSE; }
src/radeon.h +1 -1
@@ -726,7 +726,7 @@ static inline Bool radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_buffer *bostruct radeon_pixmap *priv; priv =radeon_get_pixmap_private (pPix); -if (priv ==NULL && bo ==NULL ) +if (!priv && !bo)return TRUE;if (priv) {
src/radeon_dri2.c +6 -6
@@ -238,14 +238,14 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,return NULL ; buffers =calloc (1 ,sizeof *buffers); -if (buffers ==NULL ) +if (!buffers) goto error;if (!info->use_glamor) { info->exa_force_create = TRUE;exaMoveInPixmap (pixmap); info->exa_force_create = FALSE; -if (exaGetPixmapDriverPrivate (pixmap) ==NULL ) { +if (!exaGetPixmapDriverPrivate (pixmap)) {/* this happen if pixmap is non accelerable */ goto error; }
@@ -258,7 +258,7 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen, goto error; privates =calloc (1 ,sizeof (struct dri2_buffer_priv )); -if (privates ==NULL ) +if (!privates) goto error; buffers->attachment = attachment;
@@ -923,7 +923,7 @@ static int radeon_dri2_get_msc(DrawablePtr draw, CARD64 *ust, CARD64 *msc)xf86CrtcPtr crtc =radeon_dri2_drawable_crtc (draw, TRUE);/* Drawable not displayed, make up a value */ -if (crtc ==NULL ) { +if (!crtc) { *ust =0 ; *msc =0 ;return TRUE;
@@ -1034,7 +1034,7 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw, remainder &=0xffffffff ;/* Drawable not visible, return immediately */ -if (crtc ==NULL ) +if (!crtc) goto out_complete; msc_delta =radeon_get_msc_delta (draw, crtc);
@@ -1193,7 +1193,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,radeon_dri2_ref_buffer (back);/* either off-screen or CRTC not usable... just complete the swap */ -if (crtc ==NULL ) +if (!crtc) goto blit_fallback; msc_delta =radeon_get_msc_delta (draw, crtc);
src/radeon_exa.c +1 -1
@@ -150,7 +150,7 @@ Bool RADEONGetPixmapOffsetPitch(PixmapPtr pPix, uint32_t *pitch_offset)*/ Bool radeon_transform_is_affine_or_scaled (PictTransformPtr t) { -if (t ==NULL ) +if (!t)return TRUE;/* the shaders don't handle scaling either */ return t->matrix[2 ][0 ] ==0 && t->matrix[2 ][1 ] ==0 && t->matrix[2 ][2 ] ==IntToxFixed (1 );
src/radeon_exa_funcs.c +4 -4
@@ -331,7 +331,7 @@ RADEONBlitChunk(ScrnInfoPtr pScrn, struct radeon_bo *src_bo,if (src_bo && dst_bo) {BEGIN_ACCEL_RELOC (6 ,2 ); - }else if (src_bo && dst_bo ==NULL ) { + }else if (src_bo && !dst_bo) {BEGIN_ACCEL_RELOC (6 ,1 ); }else {BEGIN_RING (2 *6 );
@@ -423,7 +423,7 @@ RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h, size = scratch_pitch * h; scratch =radeon_bo_open (info->bufmgr,0 , size,0 ,RADEON_GEM_DOMAIN_GTT ,0 ); -if (scratch ==NULL ) { +if (!scratch) { goto copy; }radeon_cs_space_reset_bos (info->cs);
@@ -531,7 +531,7 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, } size = scratch_pitch * h; scratch =radeon_bo_open (info->bufmgr,0 , size,0 ,RADEON_GEM_DOMAIN_GTT ,0 ); -if (scratch ==NULL ) { +if (!scratch) { goto copy; }radeon_cs_space_reset_bos (info->cs);
@@ -584,7 +584,7 @@ Bool RADEONDrawInit(ScreenPtr pScreen) {RINFO_FROM_SCREEN (pScreen); -if (info->accel_state->exa ==NULL ) { +if (!info->accel_state->exa) {xf86DrvMsg (pScreen->myNum,X_ERROR ,"Memory map not set up\n" );return FALSE; }
src/radeon_exa_render.c +3 -3
@@ -630,7 +630,7 @@ static Bool R100PrepareComposite(int op,return FALSE; pp_cntl =RADEON_TEX_0_ENABLE |RADEON_TEX_BLEND_0_ENABLE ; -if (pMask !=NULL ) { +if (pMask) {if (!R100TextureSetup (pMaskPicture, pMask,1 ))return FALSE; pp_cntl |=RADEON_TEX_1_ENABLE ;
@@ -992,7 +992,7 @@ static Bool R200PrepareComposite(int op, PicturePtr pSrcPicture,return FALSE; pp_cntl =RADEON_TEX_0_ENABLE |RADEON_TEX_BLEND_0_ENABLE ; -if (pMask !=NULL ) { +if (pMask) {if (!R200TextureSetup (pMaskPicture, pMask,1 ))return FALSE; pp_cntl |=RADEON_TEX_1_ENABLE ;
@@ -1484,7 +1484,7 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture,return FALSE; txenable =R300_TEX_0_ENABLE ; -if (pMask !=NULL ) { +if (pMask) {if (!R300TextureSetup (pMaskPicture, pMask,1 ))return FALSE; txenable |=R300_TEX_1_ENABLE ;
src/radeon_glamor.c +1 -1
@@ -261,7 +261,7 @@ radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,int stride; priv =calloc (1 ,sizeof (struct radeon_pixmap )); -if (priv ==NULL ) +if (!priv) goto fallback_pixmap; priv->bo = radeon_alloc_pixmap_bo(scrn, w, h, depth, usage,
src/radeon_glamor_wrappers.c +2 -2
@@ -132,7 +132,7 @@ radeon_glamor_finish_access_cpu(PixmapPtr pixmap)static Bool radeon_glamor_prepare_access_gpu (struct radeon_pixmap *priv) { -return priv !=NULL ; +return !!priv; } static void
@@ -201,7 +201,7 @@ radeon_glamor_picture_prepare_access_cpu_ro(ScrnInfoPtr scrn,PixmapPtr pixmap;struct radeon_pixmap *priv; -if (picture->pDrawable ==NULL ) +if (!picture->pDrawable)return TRUE; pixmap =get_drawable_pixmap (picture->pDrawable);
src/radeon_kms.c +12 -13
@@ -639,7 +639,7 @@ master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty) {ScreenPtr master_screen =radeon_dirty_master (dirty); -return master_screen->SyncSharedPixmap !=NULL ; +return !!master_screen->SyncSharedPixmap; } static Bool
@@ -647,7 +647,7 @@ slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty) {ScreenPtr slave_screen = dirty->slave_dst->drawable.pScreen; -return slave_screen->SyncSharedPixmap !=NULL ; +return !!slave_screen->SyncSharedPixmap; } static void
@@ -1769,7 +1769,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags) info->dri2.available = FALSE; info->dri2.enabled = FALSE; info->dri2.pKernelDRMVersion =drmGetVersion (pRADEONEnt->fd); -if (info->dri2.pKernelDRMVersion ==NULL ) { +if (!info->dri2.pKernelDRMVersion) {xf86DrvMsg (pScrn->scrnIndex,X_ERROR ,"RADEONDRIGetVersion failed to get the DRM version\n" );return FALSE;
@@ -1924,7 +1924,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)xf86OutputPtr output = xf86_config->output[i];/* XXX: double check crtc mode */ -if ((output->probed_modes !=NULL ) && (output->crtc ==NULL )) +if (output->probed_modes && !output->crtc) output->crtc = xf86_config->crtc[0 ]; } }
@@ -1987,7 +1987,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)if (!xf86LoadSubModule (pScrn,"ramdac" ))return FALSE; } - if (pScrn->modes == NULL + if (!pScrn->modes #ifdef XSERVER_PLATFORM_BUS && !pScrn->is_gpu #endif
@@ -2098,7 +2098,7 @@ static Bool RADEONSaveScreen_KMS(ScreenPtr pScreen, int mode) unblank =xf86IsUnblank (mode);if (unblank)SetTimeSinceLastInputEvent (); -if ((pScrn !=NULL ) && pScrn->vtSema) { +if (pScrn && pScrn->vtSema) {if (unblank)RADEONUnblank (pScrn);else
@@ -2287,7 +2287,7 @@ Bool RADEONScreenInit_KMS(ScreenPtr pScreen, int argc, char **argv) info->fb_shadow =calloc (1 , pScrn->displayWidth * pScrn->virtualY * ((pScrn->bitsPerPixel +7 ) >>3 )); -if (info->fb_shadow ==NULL ) { +if (!info->fb_shadow) {xf86DrvMsg (pScrn->scrnIndex,X_ERROR ,"Failed to allocate shadow framebuffer\n" );return FALSE;
@@ -2689,13 +2689,13 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)int pitch;uint32_t tiling_flags =0 ; -if (info->accel_state->exa !=NULL ) { +if (info->accel_state->exa) {xf86DrvMsg (pScreen->myNum,X_ERROR ,"Memory map already initialized\n" );return FALSE; }if (!info->use_glamor && info->r600_shadow_fb == FALSE) { info->accel_state->exa =exaDriverAlloc (); -if (info->accel_state->exa ==NULL ) { +if (!info->accel_state->exa) {xf86DrvMsg (pScreen->myNum,X_ERROR ,"exaDriverAlloc failed\n" );return FALSE; }
@@ -2709,7 +2709,7 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen) cursor_size =RADEON_ALIGN (cursor_size,RADEON_GPU_PAGE_SIZE );for (c =0 ; c < xf86_config->num_crtc; c++) {/* cursor objects */ -if (info->cursor_bo[c] ==NULL ) { +if (!info->cursor_bo[c]) { info->cursor_bo[c] =radeon_bo_open (info->bufmgr,0 , cursor_size,0 ,RADEON_GEM_DOMAIN_VRAM ,0 );
@@ -2727,7 +2727,7 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen) } } -if (info->front_buffer ==NULL ) { +if (!info->front_buffer) {int usage =CREATE_PIXMAP_USAGE_BACKING_PIXMAP ;if (info->allowColorTiling && !info->shadow_primary) {
@@ -2787,9 +2787,8 @@ void radeon_kms_update_vram_limit(ScrnInfoPtr pScrn, uint32_t new_fb_size)int c;for (c =0 ; c < xf86_config->num_crtc; c++) { -if (info->cursor_bo[c] !=NULL ) { +if (info->cursor_bo[c]) new_fb_size += (64 *4 *64 ); - } } remain_size_bytes = info->vram_size - new_fb_size;
src/radeon_textured_video.c +5 -5
@@ -153,7 +153,7 @@ radeon_allocate_video_bo(ScrnInfoPtr pScrn,static void RADEONFreeVideoMemory (ScrnInfoPtr pScrn,RADEONPortPrivPtr pPriv) { -if (pPriv->video_memory !=NULL ) { +if (pPriv->video_memory) {radeon_bo_unref (pPriv->video_memory); pPriv->video_memory =NULL ;
@@ -312,7 +312,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,RADEONFreeVideoMemory (pScrn, pPriv); } -if (pPriv->video_memory ==NULL ) { +if (!pPriv->video_memory) {Bool ret; ret = radeon_allocate_video_bo(pScrn, &pPriv->video_memory,
@@ -329,7 +329,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,/* Bicubic filter loading */ if (pPriv->bicubic_enabled) { -if (info->bicubic_bo ==NULL ) +if (!info->bicubic_bo) pPriv->bicubic_enabled = FALSE; }
@@ -725,7 +725,7 @@ static void radeon_unload_bicubic_texture(ScrnInfoPtr pScrn) {RADEONInfoPtr info =RADEONPTR (pScrn); -if (info->bicubic_memory !=NULL ) { +if (info->bicubic_memory) {radeon_bo_unref (info->bicubic_memory); info->bicubic_memory =NULL ; }
@@ -827,7 +827,7 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen) adapt =calloc (1 ,sizeof (XF86VideoAdaptorRec) + num_texture_ports * (sizeof (RADEONPortPrivRec) +sizeof (DevUnion))); -if (adapt ==NULL ) +if (!adapt)return NULL ; xvBicubic =MAKE_ATOM ("XV_BICUBIC" );
src/radeon_video.c +3 -3
@@ -144,7 +144,7 @@ void RADEONInitVideo(ScreenPtr pScreen) num_adaptors =xf86XVListGenericAdaptors (pScrn, &adaptors); newAdaptors =malloc ((num_adaptors +2 ) *sizeof (*newAdaptors)); -if (newAdaptors ==NULL ) +if (!newAdaptors)return ;memcpy (newAdaptors, adaptors, num_adaptors *sizeof (XF86VideoAdaptorPtr));
@@ -152,7 +152,7 @@ void RADEONInitVideo(ScreenPtr pScreen)if (info->use_glamor) { texturedAdaptor =radeon_glamor_xv_init (pScreen,16 ); -if (texturedAdaptor !=NULL ) { +if (texturedAdaptor) { adaptors[num_adaptors++] = texturedAdaptor;xf86DrvMsg (pScrn->scrnIndex,X_INFO ,"Set up textured video (glamor)\n" ); }else
@@ -161,7 +161,7 @@ void RADEONInitVideo(ScreenPtr pScreen) || (info->directRenderingEnabled) ) { texturedAdaptor =RADEONSetupImageTexturedVideo (pScreen); -if (texturedAdaptor !=NULL ) { +if (texturedAdaptor) { adaptors[num_adaptors++] = texturedAdaptor;xf86DrvMsg (pScrn->scrnIndex,X_INFO ,"Set up textured video\n" ); }else
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/21 Call drmmode_do_crtc_dpms from drmmode_crtc_dpms as well
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Leo pointed out that drmmode_do_crtc_dpms wasn't getting called when turning off an output with
xrandr --output <output> --off
This meant that the vblank sequence number and timestamp wouldn't be saved before turning off the CRTC in this case.
(Ported from amdgpu commit ceeacb455cd058492a493aac954deab8455804b5)
--- src/drmmode_display.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
src/drmmode_display.c +1 -2
@@ -361,8 +361,7 @@ drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)/* Disable unused CRTCs */ if (!crtc->enabled || mode != DPMSModeOn) { -drmmode_crtc_wait_pending_event (drmmode_crtc, pRADEONEnt->fd, - drmmode_crtc->flip_pending); +drmmode_do_crtc_dpms (crtc, DPMSModeOff);drmModeSetCrtc (pRADEONEnt->fd, drmmode_crtc->mode_crtc->crtc_id,0 ,0 ,0 ,NULL ,0 ,NULL );drmmode_fb_reference (pRADEONEnt->fd, &drmmode_crtc->fb,NULL );
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/21 Use drmmode_crtc_dpms in drmmode_set_desired_modes
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Simplifies the latter slightly.
(Ported from amdgpu commit 74124f2c17dbb4b752707bb7eee398ae099e8a2c)
--- src/drmmode_display.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
src/drmmode_display.c +1 -8
@@ -2763,7 +2763,6 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, Bool set_hw) {xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (pScrn); -RADEONEntPtr pRADEONEnt =RADEONEntPriv (pScrn);unsigned num_desired =0 , num_on =0 ;int c;
@@ -2771,18 +2770,12 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,if (set_hw) {for (c =0 ; c < config->num_crtc; c++) {xf86CrtcPtr crtc = config->crtc[c]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;/* Skip disabled CRTCs */ if (crtc->enabled)continue ; -drmmode_do_crtc_dpms (crtc, DPMSModeOff); -drmModeSetCrtc (pRADEONEnt->fd, - drmmode_crtc->mode_crtc->crtc_id, -0 ,0 ,0 ,NULL ,0 ,NULL ); -drmmode_fb_reference (pRADEONEnt->fd, - &drmmode_crtc->fb,NULL ); +drmmode_crtc_dpms (crtc, DPMSModeOff); } }
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 16/21 Check dimensions passed to drmmode_xf86crtc_resize
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
When enabling a secondary GPU output, Xorg can try resizing the screen beyond the limit advertised by the driver, leading to drmModeAddFB failing and primary GPU outputs turning off. Check for this and bail instead.
(Ported from amdgpu commit 940c8b39f79789d4d5ddb8ab8d25a8ae05932756)
--- src/drmmode_display.c | 8 ++++++++ 1 file changed, 8 insertions(+)
src/drmmode_display.c +8 -0
@@ -2260,6 +2260,14 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)if (scrn->virtualX == width && scrn->virtualY == height)return TRUE; +if (width > xf86_config->maxWidth || height > xf86_config->maxHeight) { +xf86DrvMsg (scrn->scrnIndex,X_WARNING , +"Xorg tried resizing screen to %dx%d, but maximum " +"supported is %dx%d\n" , width, height, + xf86_config->maxWidth, xf86_config->maxHeight); +return FALSE; + } +if (info->allowColorTiling && !info->shadow_primary) {if (info->ChipFamily <CHIP_FAMILY_R600 || info->allowColorTiling2D) usage |=RADEON_CREATE_PIXMAP_TILING_MACRO ;
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 17/21 Remove #if 0'd code
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
This has always been disabled, no need to keep it.
(Ported from amdgpu commit 19a40758be04e1d451a030f452efb49e8aaad541)
--- src/drmmode_display.c | 12 ------------ 1 file changed, 12 deletions(-)
src/drmmode_display.c +0 -12
@@ -1835,15 +1835,6 @@ static const xf86OutputFuncsRec drmmode_output_funcs = { .create_resources = drmmode_output_create_resources, .set_property = drmmode_output_set_property, .get_property = drmmode_output_get_property, -#if 0 - - .save = drmmode_crt_save, - .restore = drmmode_crt_restore, - .mode_fixup = drmmode_crt_mode_fixup, - .prepare = drmmode_output_prepare, - .mode_set = drmmode_crt_mode_set, - .commit = drmmode_output_commit, -#endif .detect = drmmode_output_detect, .mode_valid = drmmode_output_mode_valid,
@@ -2875,9 +2866,6 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn) !xf86HandleColormaps (pScreen,256 ,10 ,NULL ,NULL ,CMAP_PALETTED_TRUECOLOR -#if 0 /* This option messes up text mode! ([email protected]) */ - |CMAP_LOAD_EVEN_IF_OFFSCREEN -#endif | CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; }
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 18/21 Call drmmode_crtc_gamma_do_set from drmmode_setup_colormap
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Instead of from drmmode_set_mode_major. There's no need to re-set the gamma LUT on every modeset, the kernel should preserve it.
(Ported from amdgpu commit baea4fa492f635cdfe746a84be2e337d9aeae8a9)
--- src/drmmode_display.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
src/drmmode_display.c +17 -9
@@ -887,9 +887,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,else drmmode_crtc->scanout_id =0 ; -drmmode_crtc_gamma_do_set (crtc, crtc->gamma_red, crtc->gamma_green, - crtc->gamma_blue, crtc->gamma_size); -if (drmmode_crtc->prime_scanout_pixmap) {drmmode_crtc_prime_scanout_update (crtc, mode, scanout_id, &fb, &x, &y);
@@ -2854,6 +2851,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,Bool drmmode_setup_colormap (ScreenPtr pScreen,ScrnInfoPtr pScrn) {xf86CrtcConfigPtr xf86_config =XF86_CRTC_CONFIG_PTR (pScrn); +int i;if (xf86_config->num_crtc) { xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
@@ -2862,13 +2860,23 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)return FALSE;/* All radeons support 10 bit CLUTs. They get bypassed at depth 30. */ -if (pScrn->depth !=30 && - !xf86HandleColormaps (pScreen,256 ,10 , -NULL ,NULL , -CMAP_PALETTED_TRUECOLOR - |CMAP_RELOAD_ON_MODE_SWITCH )) -return FALSE; +if (pScrn->depth !=30 ) { +if (!xf86HandleColormaps (pScreen,256 ,10 ,NULL ,NULL , +CMAP_PALETTED_TRUECOLOR + |CMAP_RELOAD_ON_MODE_SWITCH )) +return FALSE; + +for (i =0 ; i < xf86_config->num_crtc; i++) { +xf86CrtcPtr crtc = xf86_config->crtc[i]; + +drmmode_crtc_gamma_do_set (crtc, crtc->gamma_red, + crtc->gamma_green, + crtc->gamma_blue, + crtc->gamma_size); + } + } } +return TRUE; }
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 19/21 modesetting: Record non-desktop kernel property at PreInit time
In reply to a message not in the archiveFrom: Keith Packard <[email protected]>
Save any value of the kernel non-desktop property in the xf86Output structure to avoid non-desktop outputs in the default configuration.
[Also bump randrproto requirement to a version that defines RR_PROPERTY_NON_DESKTOP - ajax]
(Ported from xserver commit b91c787c4cd2d20685db69426c539938c556128a)
(Ported from amdgpu commit 14db71a606128c4a207f43298809af279b77e2a8)
--- configure.ac | 2 +- src/drmmode_display.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-)
configure.ac +1 -1
@@ -64,7 +64,7 @@ AC_ARG_WITH(xorg-module-dir, [moduledir="$libdir/xorg/modules"]) # Store the list of server defined optional extensions in REQUIRED_MODULES -XORG_DRIVER_CHECK_EXT(RANDR, randrproto) +XORG_DRIVER_CHECK_EXT(RANDR, [randrproto >= 1.6.0]) XORG_DRIVER_CHECK_EXT(RENDER, renderproto) XORG_DRIVER_CHECK_EXT(XV, videoproto) XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
src/drmmode_display.c +16 -0
@@ -1975,6 +1975,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_rdrmModeEncoderPtr *kencoders =NULL ;drmmode_output_private_ptr drmmode_output;drmModePropertyBlobPtr path_blob =NULL ; +#if XF86_CRTC_VERSION >=8 +Bool nonDesktop = FALSE; +#endif char name[32 ];int i;const char *s;
@@ -1985,6 +1988,13 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r path_blob =koutput_get_prop_blob (pRADEONEnt->fd, koutput,"PATH" ); +#if XF86_CRTC_VERSION >=8 + i =koutput_get_prop_idx (pRADEONEnt->fd, koutput,DRM_MODE_PROP_RANGE , +RR_PROPERTY_NON_DESKTOP ); +if (i >=0 ) + nonDesktop = koutput->prop_values[i] !=0 ; +#endif + kencoders =calloc (sizeof (drmModeEncoderPtr), koutput->count_encoders);if (!kencoders) { goto out_free_encoders;
@@ -2014,6 +2024,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r drmmode_output = output->driver_private; drmmode_output->output_id = mode_res->connectors[num]; drmmode_output->mode_output = koutput; +#if XF86_CRTC_VERSION >=8 + output->non_desktop = nonDesktop; +#endif for (i =0 ; i < koutput->count_encoders; i++)drmModeFreeEncoder (kencoders[i]);free (kencoders);
@@ -2055,6 +2068,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r output->interlaceAllowed = TRUE; output->doubleScanAllowed = TRUE; output->driver_private = drmmode_output; +#if XF86_CRTC_VERSION >=8 + output->non_desktop = nonDesktop; +#endif output->possible_crtcs =0xffffffff ;for (i =0 ; i < koutput->count_encoders; i++) {
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 20/21 modesetting: Create CONNECTOR_ID properties for outputs [v2]
In reply to a message not in the archiveFrom: Keith Packard <[email protected]>
This lets a DRM client map between X outputs and kernel connectors.
v2:
Change CONNECTOR_ID to enum -- Adam Jackson <[email protected]>
(Ported from xserver commit 023d4aba8d45e9e3630b944ecfb650c081799b96)
(Ported from amdgpu commit ab7e39c5a03e24c3ce3ee2f22ada7572bc2d9aa7)
--- src/drmmode_display.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
src/drmmode_display.c +27 -0
@@ -1643,6 +1643,33 @@ drmmode_output_create_resources(xf86OutputPtr output)RADEONEntPtr pRADEONEnt =RADEONEntPriv (output->scrn);drmModePropertyPtr drmmode_prop, tearfree_prop;int i, j, err; +Atom name; + +/* Create CONNECTOR_ID property */ + name =MakeAtom ("CONNECTOR_ID" ,12 , TRUE); +if (name !=BAD_RESOURCE ) { +INT32 value = mode_output->connector_id; + + err =RRConfigureOutputProperty (output->randr_output, name, + FALSE, FALSE, TRUE,1 , &value); +if (err != Success) { +xf86DrvMsg (output->scrn->scrnIndex,X_ERROR , +"RRConfigureOutputProperty error, %d\n" , err); + } + + err =RRChangeOutputProperty (output->randr_output, name, +XA_INTEGER ,32 , PropModeReplace,1 , + &value, FALSE, FALSE); +if (err != Success) { +xf86DrvMsg (output->scrn->scrnIndex,X_ERROR , +"RRChangeOutputProperty error, %d\n" , err); + } + } + + drmmode_output->props = +calloc (mode_output->count_props +1 ,sizeof (drmmode_prop_rec)); +if (!drmmode_output->props) +return ; drmmode_output->props =calloc (mode_output->count_props +1 ,sizeof (drmmode_prop_rec));if (!drmmode_output->props)
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 21/21 Add RandR leases support
In reply to a message not in the archiveFrom: Keith Packard <[email protected]>
(Ported from xserver commit e4e3447603b5fd3a38a92c3f972396d1f81168ad)
(Ported from amdgpu commit 61040bdfa360975614fb47aa7ea1b3a1abac3427)
--- configure.ac | 2 +- src/drmmode_display.c | 159 +++++++++++++++++++++++++++++++++++++++++- src/drmmode_display.h | 6 ++ src/radeon_kms.c | 1 + 4 files changed, 166 insertions(+), 2 deletions(-)
configure.ac +1 -1
@@ -70,7 +70,7 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto) XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) # Checks for libraries. -PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.78]) +PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.89]) PKG_CHECK_MODULES(LIBDRM_RADEON, [libdrm_radeon]) # Obtain compiler/linker options for the driver dependencies
src/drmmode_display.c +158 -1
178 lines not on this page · raw message
src/drmmode_display.h +6 -0
@@ -139,6 +139,10 @@ typedef struct {int tear_free; } drmmode_output_private_rec, *drmmode_output_private_ptr; +typedef struct { +uint32_t lessee_id; +}drmmode_lease_private_rec , *drmmode_lease_private_ptr ; +enum drmmode_flip_sync {FLIP_VSYNC ,
@@ -223,6 +227,8 @@ PixmapPtr drmmode_crtc_scanout_create(xf86CrtcPtr crtc,extern void drmmode_uevent_init (ScrnInfoPtr scrn,drmmode_ptr drmmode);extern void drmmode_uevent_fini (ScrnInfoPtr scrn,drmmode_ptr drmmode); +extern void drmmode_terminate_leases (ScrnInfoPtr scrn); +Bool drmmode_set_mode (xf86CrtcPtr crtc,struct drmmode_fb *fb,DisplayModePtr mode,int x,int y);
src/radeon_kms.c +1 -0
@@ -2154,6 +2154,7 @@ static Bool RADEONCloseScreen_KMS(ScreenPtr pScreen)/* Clear mask of assigned crtc's in this generation */ pRADEONEnt->assigned_crtcs =0 ; +drmmode_terminate_leases (pScrn);drmmode_uevent_fini (pScrn, &info->drmmode);radeon_drm_queue_close (pScrn);radeon_cs_flush_indirect (pScrn);
Signature · 6 lines
2.18.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
Acked-byQuoted 4 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
These are ports of the outstanding applicable changes from the amdgpu driver.
Series is:
Quoted 51 lines
Emil Velikov (1):
Do not export the DriverRec RADEONJim Qu (1):
Wait for pending scanout update before calling
drmmode_crtc_scanout_freeKeith Packard (3):
modesetting: Record non-desktop kernel property at PreInit time
modesetting: CreateCONNECTOR_IDproperties for outputs [v2] Add RandR leases supportMichel Dänzer (16):
IgnoreRADEON_DRM_QUEUE_ERROR(0) inradeon_drm_abort_entryTrack DRM event queue sequence number inscanout_update_pendingAbortscanout_update_pendingevent when possible
Update RandR CRTC state ifset_mode_majorfails inset_desired_modesSimplifydrmmode_crtc_scanout_update
Don't call scanout_flip/update with a legacy RandR scanout buffer Simplifydrmmode_handle_transform
Setdrmmode_crtc->scanout_id= 0 when TearFree is disabled Refactordrmmode_output_set_tear_freehelper
Wait for pending flips indrmmode_output_set_tear_freeReplace 'foo == NULL' with '!foo'
Calldrmmode_do_crtc_dpmsfromdrmmode_crtc_dpmsas well Usedrmmode_crtc_dpmsindrmmode_set_desired_modes
Check dimensions passed todrmmode_xf86crtc_resize
Remove #if 0'd code
Calldrmmode_crtc_gamma_do_setfromdrmmode_setup_colormapconfigure.ac | 4 +- src/ati.c | 4 +- src/drmmode_display.c | 344 ++++++++++++++++++++++++++++------- src/drmmode_display.h | 8 +- src/evergreen_exa.c | 10 +- src/r600_exa.c | 10 +- src/radeon.h | 2 +- src/radeon_dri2.c | 12 +- src/radeon_drm_queue.c | 3 + src/radeon_exa.c | 2 +- src/radeon_exa_funcs.c | 8 +- src/radeon_exa_render.c | 6 +- src/radeon_glamor.c | 2 +- src/radeon_glamor_wrappers.c | 4 +- src/radeon_kms.c | 45 ++--- src/radeon_probe.c | 2 +- src/radeon_textured_video.c | 10 +- src/radeon_video.c | 6 +- 18 files changed, 352 insertions(+), 130 deletions(-)
Quoted 7 lines
--
2.18.0_______________________________________________
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