Propagate failure from radeon_set_pixmap_bo
PATCH 1/15 Propagate failure from radeon_set_pixmap_bo
From: Michel Dänzer <[email protected]>
(Ported from amdgpu commits c315c00e44afc91a7c8e2eab5af836d9643ebb88
and 0d42082108c264568e2aadd15ace70e72388bc65)
--- src/drmmode_display.c | 30 ++++++++++++++++++------------ src/radeon.h | 14 +++++++++----- src/radeon_bo_helper.c | 16 +++++++++++----- src/radeon_kms.c | 3 ++- 4 files changed, 40 insertions(+), 23 deletions(-)
src/drmmode_display.c +18 -12
@@ -126,12 +126,11 @@ static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,if (!(*pScreen->ModifyPixmapHeader)(pixmap, width, height, depth, bpp, pitch,NULL )) { -return NULL ; + goto fail; }if (!info->use_glamor)exaMoveInPixmap (pixmap); -radeon_set_pixmap_bo (pixmap, bo);if (info->ChipFamily >=CHIP_FAMILY_R600 ) { surface =radeon_get_pixmap_surface (pixmap);if (surface && psurf)
@@ -163,22 +162,25 @@ static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn, surface->flags |=RADEON_SURF_SET (RADEON_SURF_MODE_2D ,MODE ); }if (radeon_surface_best (info->surf_man, surface)) { -return NULL ; + goto fail; }if (radeon_surface_init (info->surf_man, surface)) { -return NULL ; + goto fail; } } } -if (info->use_glamor && - !radeon_glamor_create_textured_pixmap (pixmap, -radeon_get_pixmap_private (pixmap))) { - pScreen->DestroyPixmap (pixmap); -return NULL ; - } +if (!radeon_set_pixmap_bo (pixmap, bo)) + goto fail; -return pixmap; +if (!info->use_glamor || +radeon_glamor_create_textured_pixmap (pixmap, +radeon_get_pixmap_private (pixmap))) +return pixmap; + +fail: + pScreen->DestroyPixmap (pixmap); +return NULL ; }static void drmmode_destroy_bo_pixmap (PixmapPtr pixmap)
@@ -2121,7 +2123,6 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) goto fail;if (!info->r600_shadow_fb) { -radeon_set_pixmap_bo (ppix, info->front_bo); psurface =radeon_get_pixmap_surface (ppix); *psurface = info->front_surface; screen->ModifyPixmapHeader(ppix,
@@ -2145,6 +2146,11 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)if (info->use_glamor)radeon_glamor_create_screen_resources (scrn->pScreen); +if (!info->r600_shadow_fb) { +if (!radeon_set_pixmap_bo (ppix, info->front_bo)) + goto fail; + } +/* Clear new buffer */ gc =GetScratchGC (ppix->drawable.depth, scrn->pScreen); force = info->accel_state->force;
src/radeon.h +9 -5
@@ -678,7 +678,7 @@ static inline struct radeon_surface *radeon_get_pixmap_surface(PixmapPtr pPix)uint32_t radeon_get_pixmap_tiling (PixmapPtr pPix); -static inline void radeon_set_pixmap_bo (PixmapPtr pPix,struct radeon_bo *bo) +static inline Bool radeon_set_pixmap_bo (PixmapPtr pPix,struct radeon_bo *bo) {#ifdef USE_GLAMOR RADEONInfoPtr info =RADEONPTR (xf86ScreenToScrn (pPix->drawable.pScreen));
@@ -688,11 +688,11 @@ static inline void radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo) priv =radeon_get_pixmap_private (pPix);if (priv ==NULL && bo ==NULL ) -return ; +return TRUE;if (priv) {if (priv->bo == bo) -return ; +return TRUE;if (priv->bo)radeon_bo_unref (priv->bo);
@@ -709,7 +709,7 @@ static inline void radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo)if (!priv) { priv =calloc (1 ,sizeof (struct radeon_pixmap ));if (!priv) - goto out; +return FALSE; }radeon_bo_ref (bo);
@@ -717,8 +717,9 @@ static inline void radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo) radeon_bo_get_tiling(bo, &priv->tiling_flags, &pitch); } -out: +radeon_set_pixmap_private (pPix, priv); +return TRUE; } else#endif /* USE_GLAMOR */ {
@@ -735,7 +736,10 @@ out: driver_priv->bo = bo;radeon_bo_get_tiling (bo, &driver_priv->tiling_flags, &pitch); +return TRUE; } + +return FALSE; } }
src/radeon_bo_helper.c +11 -5
@@ -312,14 +312,17 @@ Bool radeon_set_shared_pixmap_backing(PixmapPtr ppix, void *fd_handle,struct radeon_bo *bo;int ihandle = (int )(long )fd_handle;uint32_t size = ppix->devKind * ppix->drawable.height; +Bool ret = FALSE; bo =radeon_gem_bo_open_prime (info->bufmgr, ihandle, size);if (!bo) -return FALSE; + goto error;memset (surface,0 ,sizeof (struct radeon_surface )); -radeon_set_pixmap_bo (ppix, bo); + ret =radeon_set_pixmap_bo (ppix, bo); +if (!ret) + goto error;if (info->ChipFamily >=CHIP_FAMILY_R600 && info->surf_man) {uint32_t tiling_flags;
@@ -360,10 +363,12 @@ Bool radeon_set_shared_pixmap_backing(PixmapPtr ppix, void *fd_handle, surface->stencil_tile_split = (tiling_flags >>RADEON_TILING_EG_STENCIL_TILE_SPLIT_SHIFT ) &RADEON_TILING_EG_STENCIL_TILE_SPLIT_MASK ; surface->mtilea = (tiling_flags >>RADEON_TILING_EG_MACRO_TILE_ASPECT_SHIFT ) &RADEON_TILING_EG_MACRO_TILE_ASPECT_MASK ;if (radeon_surface_best (info->surf_man, surface)) { -return FALSE; + ret = FALSE; + goto error; }if (radeon_surface_init (info->surf_man, surface)) { -return FALSE; + ret = FALSE; + goto error; }/* we have to post hack the surface to reflect the actual size of the shared pixmap */
@@ -371,11 +376,12 @@ Bool radeon_set_shared_pixmap_backing(PixmapPtr ppix, void *fd_handle, surface->level[0].nblk_x = ppix->devKind / surface->bpe; } + error:close (ihandle);/* we have a reference from the alloc and one from set pixmap bo, drop one */ radeon_bo_unref (bo); -return TRUE; +return ret; }#endif /* RADEON_PIXMAP_SHARING */
src/radeon_kms.c +2 -1
@@ -347,7 +347,8 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)if (info->dri2.enabled || info->use_glamor) {if (info->front_bo) {PixmapPtr pPix = pScreen->GetScreenPixmap (pScreen); -radeon_set_pixmap_bo (pPix, info->front_bo); +if (!radeon_set_pixmap_bo (pPix, info->front_bo)) +return FALSE; surface =radeon_get_pixmap_surface (pPix);if (surface) { *surface = info->front_surface;
Signature · 6 lines
2.9.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): 20160921095054.28302-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
PATCH 2/15 glamor: Fix leak of pixmap private when replacing BO
From: Michel Dänzer <[email protected]>
(Ported from amdgpu commit 397aedafee437c125b8ac1feafb1c3b466842aeb)
--- src/radeon_glamor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
src/radeon_glamor.c +1 -2
@@ -314,10 +314,9 @@ radeon_glamor_set_pixmap_bo(DrawablePtr drawable, PixmapPtr pixmap)FreeScratchGC (gc); } -radeon_set_pixmap_private (pixmap,NULL ); -/* And redirect the pixmap to the new bo (for 3D). */ glamor_egl_exchange_buffers (old, pixmap); +radeon_set_pixmap_private (pixmap,radeon_get_pixmap_private (old));radeon_set_pixmap_private (old, priv); screen->ModifyPixmapHeader(old,
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/15 Free priv in amdgpu_set_pixmap_bo also if priv->bo == NULL
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Fixes memory leak when destroying pixmaps with priv->bo == NULL.
(Ported from amdgpu commit 7f7f9825caf3983902491da27c16d14cd8bf9b7d)
--- src/radeon.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
src/radeon.h +4 -3
@@ -691,11 +691,12 @@ static inline Bool radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo)return TRUE;if (priv) { -if (priv->bo == bo) -return TRUE; +if (priv->bo) { +if (priv->bo == bo) +return TRUE; -if (priv->bo)radeon_bo_unref (priv->bo); + }if (!bo) {free (priv);
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/15 Remove unnecessary fb addition from drmmode_xf86crtc_resize
In reply to a message not in the archiveFrom: Hans de Goede <[email protected]>
drmmode_set_mode_major() is the only user of drmmode->fb_id and will create it if necessary.
(Ported from xserver commit 877453212166fdc912e0d687cdecee11aba563b5) (Ported from amdgpu commit 9ca1c24235ff5ab2e028333fc326e2eff008c574)
--- src/drmmode_display.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
src/drmmode_display.c +1 -8
@@ -1982,7 +1982,6 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)drmmode_ptr drmmode = drmmode_crtc->drmmode;RADEONInfoPtr info =RADEONPTR (scrn);struct radeon_bo *old_front =NULL ; -Bool ret;ScreenPtr screen =xf86ScrnToScreen (scrn);uint32_t old_fb_id;int i, pitch, old_width, old_height, old_pitch;
@@ -2085,6 +2084,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) old_height = scrn->virtualY; old_pitch = scrn->displayWidth; old_fb_id = drmmode->fb_id; + drmmode->fb_id =0 ; old_front = info->front_bo; scrn->virtualX = width;
@@ -2115,13 +2115,6 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)if (tiling_flags)radeon_bo_set_tiling (info->front_bo, tiling_flags, pitch); - ret =drmModeAddFB (drmmode->fd, width, height, scrn->depth, - scrn->bitsPerPixel, pitch, - info->front_bo->handle, - &drmmode->fb_id); -if (ret) - goto fail; -if (!info->r600_shadow_fb) { psurface =radeon_get_pixmap_surface (ppix); *psurface = info->front_surface;
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/15 Only add main fb if necessary
In reply to a message not in the archiveFrom: Hans de Goede <[email protected]>
If we're doing reverse-prime; or doing rotation the main fb is not used, and there is no reason to add it in this case.
(Ported from xserver commit 4313122dea0df9affc280ee698e929489061ccc6) (Ported from amdgpu commit a3ca1500703837cbb8d49c554199a25dea7d5e1e)
--- src/drmmode_display.c | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-)
src/drmmode_display.c +16 -28
@@ -734,34 +734,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,int i;int fb_id;drmModeModeInfo kmode; -int pitch; -uint32_t tiling_flags =0 ; - -if (info->allowColorTiling) { -if (info->ChipFamily >=CHIP_FAMILY_R600 ) - tiling_flags |=RADEON_TILING_MICRO ; -else - tiling_flags |=RADEON_TILING_MACRO ; - } - - pitch =RADEON_ALIGN (pScrn->displayWidth,drmmode_get_pitch_align (pScrn, info->pixel_bytes, tiling_flags)) * - info->pixel_bytes; -if (info->ChipFamily >=CHIP_FAMILY_R600 ) { - pitch = info->front_surface.level[0 ].pitch_bytes; - } - -if (drmmode->fb_id ==0 ) { - ret =drmModeAddFB (drmmode->fd, - pScrn->virtualX, pScrn->virtualY, - pScrn->depth, pScrn->bitsPerPixel, - pitch, - info->front_bo->handle, - &drmmode->fb_id); -if (ret <0 ) { -ErrorF ("failed to add fb\n" ); -return FALSE; - } - } saved_mode = crtc->mode; saved_x = crtc->x;
@@ -869,6 +841,22 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, } } +if (fb_id ==0 ) { +if (drmModeAddFB (drmmode->fd, + pScrn->virtualX, + pScrn->virtualY, + pScrn->depth, pScrn->bitsPerPixel, + pScrn->displayWidth * info->pixel_bytes, + info->front_bo->handle, + &drmmode->fb_id) <0 ) { +ErrorF ("failed to add fb\n" ); + ret = FALSE; + goto done; + } + + fb_id = drmmode->fb_id; + } +/* Wait for any pending flip to finish */ do {}while (drmmode_crtc->flip_pending && drmHandleEvent(drmmode->fd,
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/15 Simplify drmmode_set_mode_major error handling
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Initialize ret = FALSE and only set it to TRUE when we've succeeded.
(Ported from amdgpu commit 3bce0519a4008cf87c0e31a7a579e10f5dcdd2f3)
--- src/drmmode_display.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
src/drmmode_display.c +3 -7
@@ -730,7 +730,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,DisplayModeRec saved_mode;uint32_t *output_ids =NULL ;int output_count =0 ; -Bool ret = TRUE; +Bool ret = FALSE;int i;int fb_id;drmModeModeInfo kmode;
@@ -747,10 +747,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, crtc->rotation = rotation; output_ids =calloc (sizeof (uint32_t ), xf86_config->num_output); -if (!output_ids) { - ret = FALSE; +if (!output_ids) goto done; - }for (i =0 ; i < xf86_config->num_output; i++) {xf86OutputPtr output = xf86_config->output[i];
@@ -850,7 +848,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, info->front_bo->handle, &drmmode->fb_id) < 0) {ErrorF ("failed to add fb\n" ); - ret = FALSE; goto done; }
@@ -867,8 +864,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, fb_id, x, y, output_ids, output_count, &kmode) != 0) {xf86DrvMsg (crtc->scrn->scrnIndex,X_ERROR , -"failed to set mode: %s" ,strerror (errno)); - ret = FALSE; +"failed to set mode: %s\n" ,strerror (errno)); goto done; } else ret = TRUE;
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/15 Make sure drmmode_crtc->scanout[] are destroyed when not needed
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
We failed to do this when going back to scanning out directly from the screen pixmap.
As a bonus, since we now destroy drmmode_crtc->scanout[] after setting the new scanout buffer, we may avoid the CRTC turning off intermittently in this case.
(Ported from amdgpu commit 9c3324715fd395fd486ea341654d78f4f298b97f)
--- src/drmmode_display.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
src/drmmode_display.c +5 -2
@@ -781,7 +781,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, fb_id = drmmode_crtc->rotate.fb_id; x = y =0 ; -drmmode_crtc_scanout_free (drmmode_crtc); } else if (#ifdef RADEON_PIXMAP_SHARING !pScreen->isGPU &&
@@ -909,9 +908,13 @@ done: crtc->y = saved_y; crtc->rotation = saved_rotation; crtc->mode = saved_mode; - }else + }else { crtc->active = TRUE; +if (fb_id != drmmode_crtc->scanout[0 ].fb_id) +drmmode_crtc_scanout_free (drmmode_crtc); + } +free (output_ids);return ret;
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/15 present: Don't allow flipping when using a dedicated scanout buffer
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Fixes issues when mixing rotation and page flipping with current xserver Git master.
(Ported from amdgpu commit 3ed28ce7cd26f89969617ba901ff253091d0d469)
--- src/radeon_present.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
src/radeon_present.c +2 -1
@@ -265,7 +265,8 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,if (!config->crtc[i]->enabled)continue ; -if (!drmmode_crtc || drmmode_crtc->rotate.bo !=NULL ) +if (!drmmode_crtc || drmmode_crtc->rotate.bo || + drmmode_crtc->scanout[0 ].bo)return FALSE;if (drmmode_crtc->pending_dpms_mode == DPMSModeOn)
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/15 dri2: Don't allow flipping when using a dedicated scanout buffer
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Fixes issues when mixing rotation and page flipping with current xserver Git master.
(Ported from amdgpu commit decabd574f90d3df397c80ec931b3fde8a4afb49)
--- src/radeon_dri2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
src/radeon_dri2.c +4 -1
@@ -723,7 +723,10 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw,for (i =0 ; i < xf86_config->num_crtc; i++) {xf86CrtcPtr crtc = xf86_config->crtc[i]; -if (crtc->enabled && crtc->rotatedData) +drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; + +if (crtc->enabled && + (crtc->rotatedData || drmmode_crtc->scanout[0 ].bo))return FALSE; }
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/15 present: Separate checks for flips vs unflips
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
All unflip checks apply to flips as well, but not vice versa.
(Ported from amdgpu commit 4d506c23c9a628204fa23607931557b07ada3e31)
--- src/radeon_present.c | 58 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 23 deletions(-)
src/radeon_present.c +35 -23
@@ -225,16 +225,13 @@ radeon_present_get_pixmap_tiling_flags(RADEONInfoPtr info, PixmapPtr pixmap) }/* -* Test to see if page flipping is possible on the target crtc +* Test to see if unflipping is possible +* +* These tests have to pass for flips as well */ static Bool -radeon_present_check_flip (RRCrtcPtr crtc,WindowPtr window,PixmapPtr pixmap, -Bool sync_flip) +radeon_present_check_unflip (ScrnInfoPtr scrn) { -ScreenPtr screen = window->drawable.pScreen; -ScrnInfoPtr scrn =xf86ScreenToScrn (screen); -RADEONInfoPtr info =RADEONPTR (scrn); -PixmapPtr screen_pixmap;xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (scrn);int num_crtcs_on;int i;
@@ -242,6 +239,35 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,if (!scrn->vtSema)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 ; + +if (!drmmode_crtc || drmmode_crtc->rotate.bo || + drmmode_crtc->scanout[0 ].bo) +return FALSE; + +if (drmmode_crtc->pending_dpms_mode == DPMSModeOn) + num_crtcs_on++; + } + +return num_crtcs_on >0 ; +} + +/* +* Test to see if page flipping is possible on the target crtc +*/ +static Bool +radeon_present_check_flip (RRCrtcPtr crtc,WindowPtr window,PixmapPtr pixmap, +Bool sync_flip) +{ +ScreenPtr screen = window->drawable.pScreen; +ScrnInfoPtr scrn =xf86ScreenToScrn (screen); +RADEONInfoPtr info =RADEONPTR (scrn); +PixmapPtr screen_pixmap; +if (!info->allowPageFlip)return FALSE;
@@ -259,21 +285,7 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, radeon_present_get_pixmap_tiling_flags(info, screen_pixmap))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 ; - -if (!drmmode_crtc || drmmode_crtc->rotate.bo || - drmmode_crtc->scanout[0 ].bo) -return FALSE; - -if (drmmode_crtc->pending_dpms_mode == DPMSModeOn) - num_crtcs_on++; - } - -return num_crtcs_on >0 ; +return radeon_present_check_unflip (scrn); }/*
@@ -360,7 +372,7 @@ radeon_present_unflip(ScreenPtr screen, uint64_t event_id)uint32_t handle;int i; -if (!radeon_present_check_flip (NULL , screen->root, pixmap, TRUE)) +if (!radeon_present_check_unflip (scrn)) goto modeset;if (!radeon_get_pixmap_handle (pixmap, &handle)) {
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/15 Remove drmmode_load_palette
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Not used by any supported version of xserver.
(Ported from amdgpu commits 1091f28e1fa239ee1a973d84a8376fa4a95d7247
and 5a4d3267ac3823fe58b51b0b9075b82375d7180c)
--- src/drmmode_display.c | 65 +-------------------------------------------------- src/drmmode_display.h | 1 - 2 files changed, 1 insertion(+), 65 deletions(-)
src/drmmode_display.c +1 -64
@@ -2498,69 +2498,6 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,return TRUE; } -static void drmmode_load_palette (ScrnInfoPtr pScrn,int numColors, -int *indices,LOCO *colors,VisualPtr pVisual) -{ -xf86CrtcConfigPtr xf86_config =XF86_CRTC_CONFIG_PTR (pScrn); -uint16_t lut_r[256 ], lut_g[256 ], lut_b[256 ]; -int index, j, i; -int c; - -for (c =0 ; c < xf86_config->num_crtc; c++) { -xf86CrtcPtr crtc = xf86_config->crtc[c]; -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - -for (i =0 ; i <256 ; i++) { - lut_r[i] = drmmode_crtc->lut_r[i] <<6 ; - lut_g[i] = drmmode_crtc->lut_g[i] <<6 ; - lut_b[i] = drmmode_crtc->lut_b[i] <<6 ; - } - -switch (pScrn->depth) { -case 15 : -for (i =0 ; i < numColors; i++) { - index = indices[i]; -for (j =0 ; j <8 ; j++) { - lut_r[index *8 + j] = colors[index].red <<6 ; - lut_g[index *8 + j] = colors[index].green <<6 ; - lut_b[index *8 + j] = colors[index].blue <<6 ; - } - } -break ; -case 16 : -for (i =0 ; i < numColors; i++) { - index = indices[i]; - -if (i <=31 ) { -for (j =0 ; j <8 ; j++) { - lut_r[index *8 + j] = colors[index].red <<6 ; - lut_b[index *8 + j] = colors[index].blue <<6 ; - } - } - -for (j =0 ; j <4 ; j++) { - lut_g[index *4 + j] = colors[index].green <<6 ; - } - } -break ; -default : -for (i =0 ; i < numColors; i++) { - index = indices[i]; - lut_r[index] = colors[index].red <<6 ; - lut_g[index] = colors[index].green <<6 ; - lut_b[index] = colors[index].blue <<6 ; - } -break ; - } - -/* Make the change through RandR */ -if (crtc->randr_crtc) -RRCrtcGammaSet (crtc->randr_crtc, lut_r, lut_g, lut_b); -else - crtc->funcs->gamma_set (crtc, lut_r, lut_g, lut_b,256 ); - } -} -Bool drmmode_setup_colormap (ScreenPtr pScreen,ScrnInfoPtr pScrn) {xf86CrtcConfigPtr xf86_config =XF86_CRTC_CONFIG_PTR (pScrn);
@@ -2572,7 +2509,7 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)return FALSE;/* all radeons support 10 bit CLUTs */ if (!xf86HandleColormaps(pScreen, 256, 10, - drmmode_load_palette, NULL, + NULL, NULL, CMAP_PALETTED_TRUECOLOR #if 0 /* This option messes up text mode! ([email protected]) */ | CMAP_LOAD_EVEN_IF_OFFSCREEN
src/drmmode_display.h +0 -1
@@ -96,7 +96,6 @@ typedef struct {uint32_t dpms_last_seq;int dpms_last_fps;uint32_t interpolated_vblanks; -uint16_t lut_r[256 ], lut_g[256 ], lut_b[256 ];/* Modeset needed (for DPMS on or after a page flip crossing with a * modeset)
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/15 Make the dedicated scanout mechanism work with arbitrary transforms
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
This makes TearFree work with arbitrary transforms, and makes transforms work better even without TearFree, with xserver >= 1.12.
(Ported from amdgpu commit bf000ea7ef91f5ecb59fc3c1ab8ed9eddcc0841d)
--- src/drmmode_display.c | 23 +++++++---------------- src/radeon_kms.c | 29 ++++++++++------------------- 2 files changed, 17 insertions(+), 35 deletions(-)
src/drmmode_display.c +7 -16
@@ -687,15 +687,15 @@ drmmode_handle_transform(xf86CrtcPtr crtc)Bool ret;#if XF86_CRTC_VERSION >=7 -if (!crtc->transformPresent && crtc->rotation != RR_Rotate_0) +if (crtc->transformPresent || crtc->rotation != RR_Rotate_0) crtc->driverIsPerformingTransform = XF86DriverTransformOutput;else crtc->driverIsPerformingTransform = XF86DriverTransformNone;#else RADEONInfoPtr info =RADEONPTR (crtc->scrn); - crtc->driverIsPerformingTransform = info->tear_free && - !crtc->transformPresent && crtc->rotation != RR_Rotate_0; + crtc->driverIsPerformingTransform = crtc->transformPresent || + (info->tear_free && crtc->rotation != RR_Rotate_0);#endif ret =xf86CrtcRotate (crtc);
@@ -815,19 +815,10 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,RegionUninit (pRegion); pRegion->data =NULL ; pBox =RegionExtents (pRegion); - pBox->x1 =min (pBox->x1, x); - pBox->y1 =min (pBox->y1, y); - -switch (crtc->rotation &0xf ) { -case RR_Rotate_90: -case RR_Rotate_270: - pBox->x2 =max (pBox->x2, x + mode->VDisplay); - pBox->y2 =max (pBox->y2, y + mode->HDisplay); -break ; -default : - pBox->x2 =max (pBox->x2, x + mode->HDisplay); - pBox->y2 =max (pBox->y2, y + mode->VDisplay); - } + pBox->x1 =0 ; + pBox->y1 =0 ; + pBox->x2 =max (pBox->x2, pScrn->virtualX); + pBox->y2 =max (pBox->y2, pScrn->virtualY); drmmode_crtc->scanout_id =0 ; fb_id = drmmode_crtc->scanout[0 ].fb_id;
src/radeon_kms.c +10 -19
@@ -386,19 +386,16 @@ static Bool radeon_scanout_extents_intersect(xf86CrtcPtr xf86_crtc, BoxPtr extents, int w, int h) { - extents->x1 = max(extents->x1 - xf86_crtc->x, 0); - extents->y1 =max (extents->y1 - xf86_crtc->y,0 ); - -switch (xf86_crtc->rotation &0xf ) { -case RR_Rotate_90: -case RR_Rotate_270: - extents->x2 =min (extents->x2 - xf86_crtc->x, h); - extents->y2 =min (extents->y2 - xf86_crtc->y, w); -break ; -default : - extents->x2 =min (extents->x2 - xf86_crtc->x, w); - extents->y2 =min (extents->y2 - xf86_crtc->y, h); - } + extents->x1 -= xf86_crtc->filter_width >> 1; + extents->x2 += xf86_crtc->filter_width >>1 ; + extents->y1 -= xf86_crtc->filter_height >>1 ; + extents->y2 += xf86_crtc->filter_height >>1 ; +pixman_f_transform_bounds (&xf86_crtc->f_framebuffer_to_crtc, extents); + + extents->x1 =max (extents->x1,0 ); + extents->y1 =max (extents->y1,0 ); + extents->x2 =min (extents->x2, w); + extents->y2 =min (extents->y2, h);return (extents->x1 < extents->x2 && extents->y1 < extents->y2); }
@@ -928,12 +925,6 @@ radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)SetPicturePictFilter (src, xf86_crtc->filter, xf86_crtc->params, xf86_crtc->nparams); - extents.x1 += xf86_crtc->x - (xf86_crtc->filter_width >>1 ); - extents.x2 += xf86_crtc->x + (xf86_crtc->filter_width >>1 ); - extents.y1 += xf86_crtc->y - (xf86_crtc->filter_height >>1 ); - extents.y2 += xf86_crtc->y + (xf86_crtc->filter_height >>1 ); -pixman_f_transform_bounds (&xf86_crtc->f_framebuffer_to_crtc, &extents); - pScreen->SourceValidate =NULL ; CompositePicture(PictOpSrc, src, NULL, dst,
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/15 Remove w/h parameters from radeon_scanout_extents_intersect
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
We can use the dimensions of the CRTC's mode instead.
(Ported from amdgpu commit ede7f2bcae63be65e05e3029bfe7c742e5978932)
--- src/radeon_kms.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
src/radeon_kms.c +6 -12
@@ -383,8 +383,7 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen) }static Bool -radeon_scanout_extents_intersect (xf86CrtcPtr xf86_crtc,BoxPtr extents,int w, -int h) +radeon_scanout_extents_intersect (xf86CrtcPtr xf86_crtc,BoxPtr extents) { extents->x1 -= xf86_crtc->filter_width >>1 ; extents->x2 += xf86_crtc->filter_width >>1 ;
@@ -394,8 +393,8 @@ radeon_scanout_extents_intersect(xf86CrtcPtr xf86_crtc, BoxPtr extents, int w, extents->x1 =max (extents->x1,0 ); extents->y1 =max (extents->y1,0 ); - extents->x2 =min (extents->x2, w); - extents->y2 =min (extents->y2, h); + extents->x2 =min (extents->x2, xf86_crtc->mode.HDisplay); + extents->y2 =min (extents->y2, xf86_crtc->mode.VDisplay);return (extents->x1 < extents->x2 && extents->y1 < extents->y2); }
@@ -468,8 +467,7 @@ radeon_sync_scanout_pixmaps(xf86CrtcPtr xf86_crtc, RegionPtr new_region, goto uninit; extents = *RegionExtents (&remaining); -if (!radeon_scanout_extents_intersect (xf86_crtc, &extents, dst->width, - dst->height)) +if (!radeon_scanout_extents_intersect (xf86_crtc, &extents)) goto uninit;#if XF86_CRTC_VERSION >=4
@@ -875,8 +873,7 @@ radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id) pDraw = &drmmode_crtc->scanout[scanout_id].pixmap->drawable; extents = *RegionExtents (pRegion); -if (!radeon_scanout_extents_intersect (xf86_crtc, &extents, pDraw->width, - pDraw->height)) +if (!radeon_scanout_extents_intersect (xf86_crtc, &extents))return FALSE;if (info->tear_free) {
@@ -985,7 +982,6 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)drmVBlank vbl;DamagePtr pDamage;RegionPtr pRegion; -DrawablePtr pDraw;BoxRec extents; if (!xf86_crtc->enabled ||
@@ -1002,10 +998,8 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)if (!RegionNotEmpty (pRegion))return ; - pDraw = &drmmode_crtc->scanout[0 ].pixmap->drawable; extents = *RegionExtents (pRegion); -if (!radeon_scanout_extents_intersect (xf86_crtc, &extents, pDraw->width, - pDraw->height)) +if (!radeon_scanout_extents_intersect (xf86_crtc, &extents))return ; scrn = xf86_crtc->scrn;
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/15 Clear damage in radeon_scanout_update if it doesn't intersect the CRTC
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
There's no need to test that same damage again.
(Ported from amdgpu commit a576430526cbc404de64b30e1377a356644e8024)
--- src/radeon_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
src/radeon_kms.c +3 -1
@@ -999,8 +999,10 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)return ; extents = *RegionExtents (pRegion); -if (!radeon_scanout_extents_intersect (xf86_crtc, &extents)) +if (!radeon_scanout_extents_intersect (xf86_crtc, &extents)) { +RegionEmpty (pRegion);return ; + } scrn = xf86_crtc->scrn; drm_queue_seq = radeon_drm_queue_alloc(xf86_crtc,
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/15 Only list each unique chipset family once in the log file
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
(Ported from amdgpu commit 6a1ba044c2b71081e6060d0c096917d6238f2145)
--- src/pcidb/parse_pci_ids.pl | 7 + src/radeon_chipset_gen.h | 339 +++++++++++++++++++++++++++++++++++++++++++++ src/radeon_probe.c | 4 +- 3 files changed, 348 insertions(+), 2 deletions(-)
src/pcidb/parse_pci_ids.pl +7 -0
@@ -16,6 +16,8 @@ my $radeonpcidevicematchfile = 'radeon_pci_device_match_gen.h'; my $radeonchipsetfile = 'radeon_chipset_gen.h'; my $radeonchipinfofile = 'radeon_chipinfo_gen.h'; +my %uniquechipsets; + my $csv = Text::CSV_XS->new(); open (CSV, "<", $file) or die $!;
@@ -48,6 +50,7 @@ while (<CSV>) { print PCIDEVICEMATCH " ATI_DEVICE_MATCH( PCI_CHIP_$columns[1], 0 ),\n"; print RADEONCHIPSET " { PCI_CHIP_$columns[1], \"$columns[8]\" },\n"; + $uniquechipsets{$columns[8]} = 1; print RADEONCHIPINFO " { $columns[0], CHIP_FAMILY_$columns[2], ";
@@ -91,6 +94,10 @@ while (<CSV>) { } print RADEONCHIPINFO "};\n"; +print RADEONCHIPSET " { -1, NULL }\n};\n\nSymTabRec RADEONUniqueChipsets[] = {\n"; +foreach (sort keys %uniquechipsets) { + print RADEONCHIPSET " { 0, \"$_\" },\n"; +} print RADEONCHIPSET " { -1, NULL }\n};\n"; print PCICHIPSET " { -1, -1, RES_UNDEFINED }\n};\n"; print PCIDEVICEMATCH " { 0, 0, 0 }\n};\n";
src/radeon_chipset_gen.h +339 -0
342 lines not on this page · raw message
src/radeon_probe.c +2 -2
@@ -78,8 +78,8 @@ static void RADEONIdentify(int flags) {xf86PrintChipsets (RADEON_NAME , -"Driver for ATI Radeon chipsets" , - RADEONChipsets); +"Driver for ATI/AMD Radeon chipsets" , + RADEONUniqueChipsets); }
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx