summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/amdgpu_kms.c44
-rw-r--r--src/drmmode_display.c24
2 files changed, 14 insertions, 54 deletions
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 506e5f7..4ce9b9f 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -2270,6 +2270,7 @@ void AMDGPUAdjustFrame_KMS(ScrnInfoPtr pScrn, int x, int y)
static Bool amdgpu_setup_kernel_mem(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int cpp = info->pixel_bytes;
@@ -2281,40 +2282,17 @@ static Bool amdgpu_setup_kernel_mem(ScreenPtr pScreen)
for (c = 0; c < xf86_config->num_crtc; c++) {
/* cursor objects */
if (!info->cursor_buffer[c]) {
- if (info->gbm) {
- info->cursor_buffer[c] = (struct amdgpu_buffer *)calloc(1, sizeof(struct amdgpu_buffer));
- if (!info->cursor_buffer[c]) {
- return FALSE;
- }
- info->cursor_buffer[c]->ref_count = 1;
- info->cursor_buffer[c]->flags = AMDGPU_BO_FLAGS_GBM;
-
- info->cursor_buffer[c]->bo.gbm = gbm_bo_create(info->gbm,
- info->cursor_w,
- info->cursor_h,
- GBM_FORMAT_ARGB8888,
- GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
- if (!info->cursor_buffer[c]->bo.gbm) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate cursor buffer memory\n");
- free(info->cursor_buffer[c]);
- return FALSE;
- }
- } else {
- AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
- info->cursor_buffer[c] = amdgpu_bo_open(pAMDGPUEnt->pDev,
- cursor_size,
- 0,
- AMDGPU_GEM_DOMAIN_VRAM);
- if (!(info->cursor_buffer[c])) {
- ErrorF("Failed to allocate cursor buffer memory\n");
- return FALSE;
- }
+ info->cursor_buffer[c] = amdgpu_bo_open(pAMDGPUEnt->pDev,
+ cursor_size, 0,
+ AMDGPU_GEM_DOMAIN_VRAM);
+ if (!(info->cursor_buffer[c])) {
+ ErrorF("Failed to allocate cursor buffer memory\n");
+ return FALSE;
+ }
- if (amdgpu_bo_cpu_map(info->cursor_buffer[c]->bo.amdgpu,
- &info->cursor_buffer[c]->cpu_ptr)) {
- ErrorF("Failed to map cursor buffer memory\n");
- }
+ if (amdgpu_bo_cpu_map(info->cursor_buffer[c]->bo.amdgpu,
+ &info->cursor_buffer[c]->cpu_ptr)) {
+ ErrorF("Failed to map cursor buffer memory\n");
}
drmmode_set_cursor(pScrn, &info->drmmode, c,
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2a22777..7435043 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1627,8 +1627,10 @@ drmmode_cursor_pixel(xf86CrtcPtr crtc, uint32_t *argb, Bool *premultiplied,
return TRUE;
}
-static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_t *ptr)
+static void drmmode_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
{
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ uint32_t *ptr = (uint32_t *) (drmmode_crtc->cursor_buffer->cpu_ptr);
ScrnInfoPtr pScrn = crtc->scrn;
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
Bool premultiplied = TRUE;
@@ -1678,26 +1680,6 @@ retry:
}
}
-static void drmmode_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
-{
- ScrnInfoPtr pScrn = crtc->scrn;
- AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- uint32_t cursor_size = info->cursor_w * info->cursor_h;
-
- if (info->gbm) {
- uint32_t ptr[cursor_size];
-
- drmmode_do_load_cursor_argb(crtc, image, ptr);
- gbm_bo_write(drmmode_crtc->cursor_buffer->bo.gbm, ptr, cursor_size * 4);
- } else {
- /* cursor should be mapped already */
- uint32_t *ptr = (uint32_t *) (drmmode_crtc->cursor_buffer->cpu_ptr);
-
- drmmode_do_load_cursor_argb(crtc, image, ptr);
- }
-}
-
#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,15,99,903,0)
static Bool drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 * image)