summaryrefslogtreecommitdiff
path: root/src/amdgpu_dri2.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-02-24 17:06:43 +0900
committerMichel Dänzer <michel@daenzer.net>2016-02-27 15:24:51 +0900
commitdf60c635e1e632233de9dd4b01d63c2b963003f8 (patch)
tree9eaa6cad5fbb594b108991719191fc8ff2f0e5ed /src/amdgpu_dri2.c
parente463b849f3e9d7b69e64a65619a22e00e78d297b (diff)
glamor: Avoid generating GEM flink names for BOs shared via DRI3 (v2)
We can't create our own struct amdgpu_buffer representation in this case because destroying that would make the GEM handle inaccessible to glamor as well. So just get the handle directly via dma-buf. (ported from radeon commit 391900a670addec39515f924265bfa9f8bfa9ec0, extended to cache BO handles in the private for non-DRI3 pixmaps as well) v2: Swap whole pixmap privates instead of just BOs in amdgpu_dri2_exchange_buffers to avoid invalidating cached BO handles Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/amdgpu_dri2.c')
-rw-r--r--src/amdgpu_dri2.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index d974cb8..18eb876 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -719,8 +719,8 @@ amdgpu_dri2_exchange_buffers(DrawablePtr draw, DRI2BufferPtr front,
{
struct dri2_buffer_priv *front_priv = front->driverPrivate;
struct dri2_buffer_priv *back_priv = back->driverPrivate;
- struct amdgpu_buffer *front_bo = NULL;
- struct amdgpu_buffer *back_bo = NULL;
+ struct amdgpu_pixmap *front_pix;
+ struct amdgpu_pixmap *back_pix;
ScreenPtr screen;
AMDGPUInfoPtr info;
RegionRec region;
@@ -737,20 +737,23 @@ amdgpu_dri2_exchange_buffers(DrawablePtr draw, DRI2BufferPtr front,
front->name = back->name;
back->name = tmp;
- /* Swap pixmap bos */
- front_bo = amdgpu_get_pixmap_bo(front_priv->pixmap);
- back_bo = amdgpu_get_pixmap_bo(back_priv->pixmap);
- amdgpu_set_pixmap_bo(front_priv->pixmap, back_bo);
- amdgpu_set_pixmap_bo(back_priv->pixmap, front_bo);
+ /* Swap pixmap privates */
+ front_pix = amdgpu_get_pixmap_private(front_priv->pixmap);
+ back_pix = amdgpu_get_pixmap_private(back_priv->pixmap);
+ amdgpu_set_pixmap_private(front_priv->pixmap, back_pix);
+ amdgpu_set_pixmap_private(back_priv->pixmap, front_pix);
/* Do we need to update the Screen? */
screen = draw->pScreen;
info = AMDGPUPTR(xf86ScreenToScrn(screen));
- if (front_bo == info->front_buffer) {
- amdgpu_bo_ref(back_bo);
+ if (front_pix->bo == info->front_buffer) {
+ struct amdgpu_pixmap *screen_priv =
+ amdgpu_get_pixmap_private(screen->GetScreenPixmap(screen));
+
+ amdgpu_bo_ref(back_pix->bo);
amdgpu_bo_unref(&info->front_buffer);
- info->front_buffer = back_bo;
- amdgpu_set_pixmap_bo(screen->GetScreenPixmap(screen), back_bo);
+ info->front_buffer = back_pix->bo;
+ *screen_priv = *back_pix;
}
amdgpu_glamor_exchange_buffers(front_priv->pixmap, back_priv->pixmap);