summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/amdgpu_bo_helper.c2
-rw-r--r--src/amdgpu_glamor.c15
-rw-r--r--src/amdgpu_kms.c7
-rw-r--r--src/drmmode_display.c10
4 files changed, 21 insertions, 13 deletions
diff --git a/src/amdgpu_bo_helper.c b/src/amdgpu_bo_helper.c
index 3f62214..df32f5d 100644
--- a/src/amdgpu_bo_helper.c
+++ b/src/amdgpu_bo_helper.c
@@ -79,7 +79,7 @@ struct amdgpu_buffer *amdgpu_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width,
}
pixmap_buffer->ref_count = 1;
- if ( bitsPerPixel == pScrn->bitsPerPixel)
+ if (usage_hint & AMDGPU_CREATE_PIXMAP_SCANOUT)
bo_use |= GBM_BO_USE_SCANOUT;
#ifdef HAVE_GBM_BO_USE_LINEAR
diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index 5b8d560..174bbdf 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -201,11 +201,12 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
unsigned usage)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ PixmapFormatPtr format = xf86GetPixFormat(scrn, depth);
AMDGPUInfoPtr info = AMDGPUPTR(scrn);
struct amdgpu_pixmap *priv;
PixmapPtr pixmap, new_pixmap = NULL;
- if (!xf86GetPixFormat(scrn, depth))
+ if (!format)
return NULL;
if (!AMDGPU_CREATE_PIXMAP_SHARED(usage)) {
@@ -216,9 +217,15 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
usage |= AMDGPU_CREATE_PIXMAP_LINEAR |
AMDGPU_CREATE_PIXMAP_GTT;
} else if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP) {
- pixmap = glamor_create_pixmap(screen, w, h, depth, usage);
- if (pixmap)
- return pixmap;
+ if (w < scrn->virtualX || w > scrn->displayWidth ||
+ h != scrn->virtualY ||
+ format->bitsPerPixel != scrn->bitsPerPixel) {
+ pixmap = glamor_create_pixmap(screen, w, h, depth, usage);
+ if (pixmap)
+ return pixmap;
+ } else {
+ usage |= AMDGPU_CREATE_PIXMAP_SCANOUT;
+ }
}
}
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index f0831d2..54238c4 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -2207,6 +2207,7 @@ Bool AMDGPUEnterVT_KMS(ScrnInfoPtr pScrn)
struct amdgpu_buffer *front_buffer =
amdgpu_alloc_pixmap_bo(pScrn, pScrn->virtualX,
pScrn->virtualY, pScrn->depth,
+ AMDGPU_CREATE_PIXMAP_SCANOUT |
AMDGPU_CREATE_PIXMAP_LINEAR,
pScrn->bitsPerPixel,
&pitch);
@@ -2413,12 +2414,12 @@ static Bool amdgpu_setup_kernel_mem(ScreenPtr pScreen)
if (!info->front_buffer) {
int pitch;
- int hint = 0;
+ int hint = AMDGPU_CREATE_PIXMAP_SCANOUT;
if (info->shadow_primary)
- hint = AMDGPU_CREATE_PIXMAP_LINEAR | AMDGPU_CREATE_PIXMAP_GTT;
+ hint |= AMDGPU_CREATE_PIXMAP_LINEAR | AMDGPU_CREATE_PIXMAP_GTT;
else if (!info->use_glamor)
- hint = AMDGPU_CREATE_PIXMAP_LINEAR;
+ hint |= AMDGPU_CREATE_PIXMAP_LINEAR;
info->front_buffer =
amdgpu_alloc_pixmap_bo(pScrn, pScrn->virtualX,
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2c0b96c..1fcc252 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -557,8 +557,8 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout,
drmmode_crtc_scanout_destroy(drmmode, scanout);
}
- scanout->bo = amdgpu_alloc_pixmap_bo(pScrn, width, height,
- pScrn->depth, 0,
+ scanout->bo = amdgpu_alloc_pixmap_bo(pScrn, width, height, pScrn->depth,
+ AMDGPU_CREATE_PIXMAP_SCANOUT,
pScrn->bitsPerPixel, &pitch);
if (!scanout->bo) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -2975,8 +2975,8 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
int i, pitch, old_width, old_height, old_pitch;
int cpp = info->pixel_bytes;
PixmapPtr ppix = screen->GetScreenPixmap(screen);
+ int hint = AMDGPU_CREATE_PIXMAP_SCANOUT;
void *fb_shadow;
- int hint = 0;
if (scrn->virtualX == width && scrn->virtualY == height)
return TRUE;
@@ -2990,9 +2990,9 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
}
if (info->shadow_primary)
- hint = AMDGPU_CREATE_PIXMAP_LINEAR | AMDGPU_CREATE_PIXMAP_GTT;
+ hint |= AMDGPU_CREATE_PIXMAP_LINEAR | AMDGPU_CREATE_PIXMAP_GTT;
else if (!info->use_glamor)
- hint = AMDGPU_CREATE_PIXMAP_LINEAR;
+ hint |= AMDGPU_CREATE_PIXMAP_LINEAR;
xf86DrvMsg(scrn->scrnIndex, X_INFO,
"Allocate new frame buffer %dx%d\n", width, height);