mirror of
https://github.com/X11Libre/xf86-video-ati.git
synced 2026-03-24 01:24:43 +00:00
dri3: Flush if necessary in dri3_fd_from_pixmap
To make sure the client can't use the shared pixmap storage for direct rendering first, which could produce garbage. Bugzilla: https://bugs.freedesktop.org/109235 (Ported from amdgpu commit d168532ee739f7e33a2798051e64ba445dd3859f)
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <gbm.h>
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
|
||||
@@ -218,8 +219,34 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen,
|
||||
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
||||
RADEONInfoPtr info = RADEONPTR(scrn);
|
||||
|
||||
if (info->use_glamor)
|
||||
return glamor_fd_from_pixmap(screen, pixmap, stride, size);
|
||||
if (info->use_glamor) {
|
||||
Bool need_flush = TRUE;
|
||||
int ret = -1;
|
||||
#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,19,99,904,0)
|
||||
struct gbm_bo *gbm_bo = glamor_gbm_bo_from_pixmap(screen, pixmap);
|
||||
|
||||
if (gbm_bo) {
|
||||
ret = gbm_bo_get_fd(gbm_bo);
|
||||
gbm_bo_destroy(gbm_bo);
|
||||
|
||||
if (ret >= 0)
|
||||
need_flush = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ret < 0)
|
||||
ret = glamor_fd_from_pixmap(screen, pixmap, stride, size);
|
||||
|
||||
/* glamor might have needed to reallocate the pixmap storage and
|
||||
* copy the pixmap contents to the new storage. The copy
|
||||
* operation needs to be flushed to the kernel driver before the
|
||||
* client starts using the pixmap storage for direct rendering.
|
||||
*/
|
||||
if (ret >= 0 && need_flush)
|
||||
radeon_cs_flush_indirect(scrn);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
bo = radeon_get_pixmap_bo(pixmap);
|
||||
|
||||
Reference in New Issue
Block a user