[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][xorg-team/driver/xserver-xorg-video-ati][debian-unstable] 12 commits: dri3: Flush if necessary in dri3_fd_from_pixmap



Title: GitLab

Timo Aaltonen pushed to branch debian-unstable at X Strike Force / driver / xserver-xorg-video-ati

Commits:

9 changed files:

Changes:

  • configure.ac
    ... ... @@ -23,7 +23,7 @@
    23 23
     # Initialize Autoconf
    
    24 24
     AC_PREREQ([2.60])
    
    25 25
     AC_INIT([xf86-video-ati],
    
    26
    -        [18.1.99],
    
    26
    +        [19.0.0],
    
    27 27
             [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/Radeon],
    
    28 28
             [xf86-video-ati])
    
    29 29
     
    

  • debian/changelog
    1
    +xserver-xorg-video-ati (1:19.0.0-1) UNRELEASED; urgency=medium
    
    2
    +
    
    3
    +  * New upstream release.
    
    4
    +
    
    5
    + -- Timo Aaltonen <tjaalton@debian.org>  Thu, 07 Mar 2019 10:43:13 +0200
    
    6
    +
    
    1 7
     xserver-xorg-video-ati (1:18.1.99+git20190207-1) unstable; urgency=medium
    
    2 8
     
    
    3 9
       * New upstream snapshot.
    

  • src/drmmode_display.c
    ... ... @@ -2651,12 +2651,14 @@ drmmode_flip_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec, void *even
    2651 2651
     		flipdata->fe_usec = usec;
    
    2652 2652
     	}
    
    2653 2653
     
    
    2654
    -	if (drmmode_crtc->flip_pending == *fb) {
    
    2655
    -		drmmode_fb_reference(pRADEONEnt->fd,
    
    2656
    -				     &drmmode_crtc->flip_pending, NULL);
    
    2654
    +	if (*fb) {
    
    2655
    +		if (drmmode_crtc->flip_pending == *fb) {
    
    2656
    +			drmmode_fb_reference(pRADEONEnt->fd,
    
    2657
    +					     &drmmode_crtc->flip_pending, NULL);
    
    2658
    +		}
    
    2659
    +		drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->fb, *fb);
    
    2660
    +		drmmode_fb_reference(pRADEONEnt->fd, fb, NULL);
    
    2657 2661
     	}
    
    2658
    -	drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->fb, *fb);
    
    2659
    -	drmmode_fb_reference(pRADEONEnt->fd, fb, NULL);
    
    2660 2662
     
    
    2661 2663
     	if (--flipdata->flip_count == 0) {
    
    2662 2664
     		/* Deliver MSC & UST from reference/current CRTC to flip event
    
    ... ... @@ -3492,9 +3494,10 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
    3492 3494
     			drmmode_crtc->ignore_damage = TRUE;
    
    3493 3495
     		}
    
    3494 3496
     
    
    3495
    -	next:
    
    3496 3497
     		drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending,
    
    3497 3498
     				     flipdata->fb[crtc_id]);
    
    3499
    +
    
    3500
    +	next:
    
    3498 3501
     		drm_queue_seq = 0;
    
    3499 3502
     	}
    
    3500 3503
     
    

  • src/radeon_dri2.c
    ... ... @@ -252,6 +252,12 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
    252 252
         } else if (is_glamor_pixmap) {
    
    253 253
     	pixmap = radeon_glamor_set_pixmap_bo(drawable, pixmap);
    
    254 254
     	pixmap->refcnt++;
    
    255
    +
    
    256
    +	/* The copy operation from radeon_glamor_set_pixmap_bo needs to
    
    257
    +	 * be flushed to the kernel driver before the client starts
    
    258
    +	 * using the pixmap storage for direct rendering.
    
    259
    +	 */
    
    260
    +	radeon_cs_flush_indirect(pScrn);
    
    255 261
         }
    
    256 262
     
    
    257 263
         if (!radeon_get_flink_name(pRADEONEnt, pixmap, &buffers->name))
    
    ... ... @@ -973,12 +979,18 @@ CARD32 radeon_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data)
    973 979
         if (ret) {
    
    974 980
     	xf86DrvMsg(scrn->scrnIndex, X_ERROR,
    
    975 981
     		   "%s cannot get current time\n", __func__);
    
    976
    -	if (event_info->drm_queue_seq)
    
    982
    +
    
    983
    +	if (event_info->drm_queue_seq) {
    
    977 984
     	    drmmode_crtc->drmmode->event_context.
    
    978 985
     		vblank_handler(pRADEONEnt->fd, 0, 0, 0,
    
    979 986
     			       (void*)event_info->drm_queue_seq);
    
    980
    -	else
    
    987
    +	    drmmode_crtc->wait_flip_nesting_level++;
    
    988
    +	    radeon_drm_queue_handle_deferred(crtc);
    
    989
    +
    
    990
    +	} else {
    
    981 991
     	    radeon_dri2_frame_event_handler(crtc, 0, 0, data);
    
    992
    +	}
    
    993
    +
    
    982 994
     	return 0;
    
    983 995
         }
    
    984 996
         /*
    
    ... ... @@ -989,13 +1001,18 @@ CARD32 radeon_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data)
    989 1001
         delta_seq = delta_t * drmmode_crtc->dpms_last_fps;
    
    990 1002
         delta_seq /= 1000000;
    
    991 1003
         frame = (CARD64)drmmode_crtc->dpms_last_seq + delta_seq;
    
    992
    -    if (event_info->drm_queue_seq)
    
    1004
    +
    
    1005
    +    if (event_info->drm_queue_seq) {
    
    993 1006
     	drmmode_crtc->drmmode->event_context.
    
    994 1007
     	    vblank_handler(pRADEONEnt->fd, frame, drm_now / 1000000,
    
    995 1008
     			   drm_now % 1000000,
    
    996 1009
     			   (void*)event_info->drm_queue_seq);
    
    997
    -    else
    
    1010
    +	drmmode_crtc->wait_flip_nesting_level++;
    
    1011
    +	radeon_drm_queue_handle_deferred(crtc);
    
    1012
    +    } else {
    
    998 1013
     	radeon_dri2_frame_event_handler(crtc, frame, drm_now, data);
    
    1014
    +    }
    
    1015
    +
    
    999 1016
         return 0;
    
    1000 1017
     }
    
    1001 1018
     
    

  • src/radeon_dri3.c
    ... ... @@ -37,6 +37,7 @@
    37 37
     #include <sys/types.h>
    
    38 38
     #include <sys/stat.h>
    
    39 39
     #include <fcntl.h>
    
    40
    +#include <gbm.h>
    
    40 41
     #include <errno.h>
    
    41 42
     #include <libgen.h>
    
    42 43
     
    
    ... ... @@ -218,8 +219,34 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen,
    218 219
     	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
    
    219 220
     	RADEONInfoPtr info = RADEONPTR(scrn);
    
    220 221
     
    
    221
    -	if (info->use_glamor)
    
    222
    -		return glamor_fd_from_pixmap(screen, pixmap, stride, size);
    
    222
    +	if (info->use_glamor) {
    
    223
    +		Bool need_flush = TRUE;
    
    224
    +		int ret = -1;
    
    225
    +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,19,99,904,0)
    
    226
    +		struct gbm_bo *gbm_bo = glamor_gbm_bo_from_pixmap(screen, pixmap);
    
    227
    +
    
    228
    +		if (gbm_bo) {
    
    229
    +			ret = gbm_bo_get_fd(gbm_bo);
    
    230
    +			gbm_bo_destroy(gbm_bo);
    
    231
    +
    
    232
    +			if (ret >= 0)
    
    233
    +				need_flush = FALSE;
    
    234
    +		}
    
    235
    +#endif
    
    236
    +
    
    237
    +		if (ret < 0)
    
    238
    +			ret = glamor_fd_from_pixmap(screen, pixmap, stride, size);
    
    239
    +
    
    240
    +		/* glamor might have needed to reallocate the pixmap storage and
    
    241
    +		 * copy the pixmap contents to the new storage. The copy
    
    242
    +		 * operation needs to be flushed to the kernel driver before the
    
    243
    +		 * client starts using the pixmap storage for direct rendering.
    
    244
    +		 */
    
    245
    +		if (ret >= 0 && need_flush)
    
    246
    +			radeon_cs_flush_indirect(scrn);
    
    247
    +
    
    248
    +		return ret;
    
    249
    +	}
    
    223 250
     #endif
    
    224 251
     
    
    225 252
     	bo = radeon_get_pixmap_bo(pixmap);
    

  • src/radeon_drm_queue.c
    ... ... @@ -30,6 +30,8 @@
    30 30
     #include "config.h"
    
    31 31
     #endif
    
    32 32
     
    
    33
    +#include <errno.h>
    
    34
    +
    
    33 35
     #include <xorg-server.h>
    
    34 36
     #include <X11/Xdefs.h>
    
    35 37
     #include <list.h>
    
    ... ... @@ -277,7 +279,20 @@ radeon_drm_handle_event(int fd, drmEventContext *event_context)
    277 279
         struct radeon_drm_queue_entry *e;
    
    278 280
         int r;
    
    279 281
     
    
    280
    -    r = drmHandleEvent(fd, event_context);
    
    282
    +    /* Retry drmHandleEvent if it was interrupted by a signal in read() */
    
    283
    +    do {
    
    284
    +	r = drmHandleEvent(fd, event_context);
    
    285
    +    } while (r < 0 && (errno == EINTR || errno == EAGAIN));
    
    286
    +
    
    287
    +    if (r < 0) {
    
    288
    +	static Bool printed;
    
    289
    +
    
    290
    +	if (!printed) {
    
    291
    +	    ErrorF("%s: drmHandleEvent returned %d, errno=%d (%s)\n",
    
    292
    +		   __func__, r, errno, strerror(errno));
    
    293
    +	    printed = TRUE;
    
    294
    +	}
    
    295
    +    }
    
    281 296
     
    
    282 297
         while (!xorg_list_is_empty(&radeon_drm_flip_signalled)) {
    
    283 298
     	e = xorg_list_first_entry(&radeon_drm_flip_signalled,
    
    ... ... @@ -310,7 +325,7 @@ void radeon_drm_wait_pending_flip(xf86CrtcPtr crtc)
    310 325
     
    
    311 326
         while (drmmode_crtc->flip_pending
    
    312 327
     	   && radeon_drm_handle_event(pRADEONEnt->fd,
    
    313
    -					  &drmmode_crtc->drmmode->event_context) > 0);
    
    328
    +				      &drmmode_crtc->drmmode->event_context) >= 0);
    
    314 329
     }
    
    315 330
     
    
    316 331
     /*
    

  • src/radeon_glamor.c
    ... ... @@ -238,7 +238,7 @@ radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
    238 238
     		if (info->shadow_primary) {
    
    239 239
     			if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP)
    
    240 240
     				return fbCreatePixmap(screen, w, h, depth, usage);
    
    241
    -		} else {
    
    241
    +		} else if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP) {
    
    242 242
     			pixmap = glamor_create_pixmap(screen, w, h, depth, usage);
    
    243 243
     			if (pixmap)
    
    244 244
     			    return pixmap;
    

  • src/radeon_kms.c
    ... ... @@ -526,10 +526,14 @@ radeon_scanout_flip_abort(xf86CrtcPtr crtc, void *event_data)
    526 526
     {
    
    527 527
         RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
    
    528 528
         drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
    
    529
    +    struct drmmode_fb *fb = event_data;
    
    529 530
     
    
    530 531
         drmmode_crtc->scanout_update_pending = 0;
    
    531
    -    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending,
    
    532
    -			 NULL);
    
    532
    +
    
    533
    +    if (drmmode_crtc->flip_pending == fb) {
    
    534
    +	drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending,
    
    535
    +			     NULL);
    
    536
    +    }
    
    533 537
     }
    
    534 538
     
    
    535 539
     static void
    
    ... ... @@ -538,9 +542,9 @@ radeon_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t msc, uint64_t usec,
    538 542
     {
    
    539 543
         RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
    
    540 544
         drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
    
    545
    +    struct drmmode_fb *fb = event_data;
    
    541 546
     
    
    542
    -    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->fb,
    
    543
    -			 drmmode_crtc->flip_pending);
    
    547
    +    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->fb, fb);
    
    544 548
         radeon_scanout_flip_abort(crtc, event_data);
    
    545 549
     }
    
    546 550
     
    
    ... ... @@ -821,24 +825,31 @@ radeon_prime_scanout_flip(PixmapDirtyUpdatePtr ent)
    821 825
         drmmode_crtc_private_ptr drmmode_crtc;
    
    822 826
         uintptr_t drm_queue_seq;
    
    823 827
         unsigned scanout_id;
    
    828
    +    struct drmmode_fb *fb;
    
    824 829
     
    
    825 830
         if (!crtc || !crtc->enabled)
    
    826 831
     	return;
    
    827 832
     
    
    828 833
         drmmode_crtc = crtc->driver_private;
    
    834
    +    scanout_id = drmmode_crtc->scanout_id ^ 1;
    
    829 835
         if (drmmode_crtc->scanout_update_pending ||
    
    830
    -	!drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap ||
    
    836
    +	!drmmode_crtc->scanout[scanout_id].pixmap ||
    
    831 837
     	drmmode_crtc->dpms_mode != DPMSModeOn)
    
    832 838
     	return;
    
    833 839
     
    
    834
    -    scanout_id = drmmode_crtc->scanout_id ^ 1;
    
    835 840
         if (!radeon_prime_scanout_do_update(crtc, scanout_id))
    
    836 841
     	return;
    
    837 842
     
    
    843
    +    fb = radeon_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap);
    
    844
    +    if (!fb) {
    
    845
    +	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
    
    846
    +		   "Failed to get FB for PRIME flip.\n");
    
    847
    +	return;
    
    848
    +    }
    
    849
    +	
    
    838 850
         drm_queue_seq = radeon_drm_queue_alloc(crtc,
    
    839 851
     					   RADEON_DRM_QUEUE_CLIENT_DEFAULT,
    
    840
    -					   RADEON_DRM_QUEUE_ID_DEFAULT,
    
    841
    -					   NULL,
    
    852
    +					   RADEON_DRM_QUEUE_ID_DEFAULT, fb,
    
    842 853
     					   radeon_scanout_flip_handler,
    
    843 854
     					   radeon_scanout_flip_abort, TRUE);
    
    844 855
         if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
    
    ... ... @@ -847,18 +858,9 @@ radeon_prime_scanout_flip(PixmapDirtyUpdatePtr ent)
    847 858
     	return;
    
    848 859
         }
    
    849 860
     
    
    850
    -    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending,
    
    851
    -			  radeon_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap));
    
    852
    -    if (!drmmode_crtc->flip_pending) {
    
    853
    -	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
    
    854
    -		   "Failed to get FB for PRIME flip.\n");
    
    855
    -	radeon_drm_abort_entry(drm_queue_seq);
    
    856
    -	return;
    
    857
    -    }
    
    858
    -
    
    859 861
         if (drmmode_page_flip_target_relative(pRADEONEnt, drmmode_crtc,
    
    860
    -					  drmmode_crtc->flip_pending->handle,
    
    861
    -					  0, drm_queue_seq, 0) != 0) {
    
    862
    +					  fb->handle, 0, drm_queue_seq, 1)
    
    863
    +	!= 0) {
    
    862 864
     	if (!(drmmode_crtc->scanout_status & DRMMODE_SCANOUT_FLIP_FAILED)) {
    
    863 865
     	    xf86DrvMsg(scrn->scrnIndex, X_WARNING,
    
    864 866
     		       "flip queue failed in %s: %s, TearFree inactive\n",
    
    ... ... @@ -877,6 +879,7 @@ radeon_prime_scanout_flip(PixmapDirtyUpdatePtr ent)
    877 879
     
    
    878 880
         drmmode_crtc->scanout_id = scanout_id;
    
    879 881
         drmmode_crtc->scanout_update_pending = drm_queue_seq;
    
    882
    +    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending, fb);
    
    880 883
     }
    
    881 884
     
    
    882 885
     static void
    
    ... ... @@ -1137,6 +1140,7 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
    1137 1140
         RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
    
    1138 1141
         uintptr_t drm_queue_seq;
    
    1139 1142
         unsigned scanout_id;
    
    1143
    +    struct drmmode_fb *fb;
    
    1140 1144
     
    
    1141 1145
         if (drmmode_crtc->scanout_update_pending ||
    
    1142 1146
     	drmmode_crtc->flip_pending ||
    
    ... ... @@ -1152,10 +1156,16 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
    1152 1156
         radeon_cs_flush_indirect(scrn);
    
    1153 1157
         RegionEmpty(region);
    
    1154 1158
     
    
    1159
    +    fb = radeon_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap);
    
    1160
    +    if (!fb) {
    
    1161
    +	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
    
    1162
    +	       "Failed to get FB for scanout flip.\n");
    
    1163
    +	return;
    
    1164
    +    }
    
    1165
    +
    
    1155 1166
         drm_queue_seq = radeon_drm_queue_alloc(xf86_crtc,
    
    1156 1167
     					   RADEON_DRM_QUEUE_CLIENT_DEFAULT,
    
    1157
    -					   RADEON_DRM_QUEUE_ID_DEFAULT,
    
    1158
    -					   NULL,
    
    1168
    +					   RADEON_DRM_QUEUE_ID_DEFAULT, fb,
    
    1159 1169
     					   radeon_scanout_flip_handler,
    
    1160 1170
     					   radeon_scanout_flip_abort, TRUE);
    
    1161 1171
         if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
    
    ... ... @@ -1164,18 +1174,9 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
    1164 1174
     	return;
    
    1165 1175
         }
    
    1166 1176
     
    
    1167
    -    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending,
    
    1168
    -			  radeon_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap));
    
    1169
    -    if (!drmmode_crtc->flip_pending) {
    
    1170
    -	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
    
    1171
    -		   "Failed to get FB for scanout flip.\n");
    
    1172
    -	radeon_drm_abort_entry(drm_queue_seq);
    
    1173
    -	return;
    
    1174
    -    }
    
    1175
    -
    
    1176 1177
         if (drmmode_page_flip_target_relative(pRADEONEnt, drmmode_crtc,
    
    1177
    -					  drmmode_crtc->flip_pending->handle,
    
    1178
    -					  0, drm_queue_seq, 0) != 0) {
    
    1178
    +					  fb->handle, 0, drm_queue_seq, 1)
    
    1179
    +	!= 0) {
    
    1179 1180
     	if (!(drmmode_crtc->scanout_status & DRMMODE_SCANOUT_FLIP_FAILED)) {
    
    1180 1181
     	    xf86DrvMsg(scrn->scrnIndex, X_WARNING,
    
    1181 1182
     		       "flip queue failed in %s: %s, TearFree inactive\n",
    
    ... ... @@ -1201,6 +1202,7 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
    1201 1202
     
    
    1202 1203
         drmmode_crtc->scanout_id = scanout_id;
    
    1203 1204
         drmmode_crtc->scanout_update_pending = drm_queue_seq;
    
    1205
    +    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending, fb);
    
    1204 1206
     }
    
    1205 1207
     
    
    1206 1208
     static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
    

  • src/radeon_present.c
    ... ... @@ -256,7 +256,7 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
    256 256
         ScrnInfoPtr scrn = xf86_crtc->scrn;
    
    257 257
         xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
    
    258 258
         RADEONInfoPtr info = RADEONPTR(scrn);
    
    259
    -    PixmapPtr screen_pixmap;
    
    259
    +    PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
    
    260 260
         int num_crtcs_on;
    
    261 261
         int i;
    
    262 262
     
    
    ... ... @@ -272,10 +272,14 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
    272 272
         if (info->drmmode.dri2_flipping)
    
    273 273
     	return FALSE;
    
    274 274
     
    
    275
    +#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1, 20, 99, 1, 0)
    
    276
    +    if (pixmap->devKind != screen_pixmap->devKind)
    
    277
    +	return FALSE;
    
    278
    +#endif
    
    279
    +
    
    275 280
         /* The kernel driver doesn't handle flipping between BOs with different
    
    276 281
          * tiling parameters correctly yet
    
    277 282
          */
    
    278
    -    screen_pixmap = screen->GetScreenPixmap(screen);
    
    279 283
         if (radeon_present_get_pixmap_tiling_flags(info, pixmap) !=
    
    280 284
     	radeon_present_get_pixmap_tiling_flags(info, screen_pixmap))
    
    281 285
     	return FALSE;
    


  • Reply to: