mirror of
https://github.com/X11Libre/xf86-video-amdgpu.git
synced 2026-03-24 01:24:31 +00:00
Use DRM_CAP_CURSOR_WIDTH/HEIGHT if possible
There's no need to hardcode the cursor size if the kernel can report the value it wants.
This commit is contained in:
@@ -1501,6 +1501,25 @@ static Bool AMDGPUCreateWindow_oneshot(WindowPtr pWin)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void amdgpu_determine_cursor_size(int fd, AMDGPUInfoPtr info)
|
||||
{
|
||||
uint64_t value;
|
||||
|
||||
if (drmGetCap(fd, DRM_CAP_CURSOR_WIDTH, &value) == 0)
|
||||
info->cursor_w = value;
|
||||
else if (info->family < AMDGPU_FAMILY_CI)
|
||||
info->cursor_w = CURSOR_WIDTH;
|
||||
else
|
||||
info->cursor_w = CURSOR_WIDTH_CIK;
|
||||
|
||||
if (drmGetCap(fd, DRM_CAP_CURSOR_HEIGHT, &value) == 0)
|
||||
info->cursor_h = value;
|
||||
else if (info->family < AMDGPU_FAMILY_CI)
|
||||
info->cursor_h = CURSOR_HEIGHT;
|
||||
else
|
||||
info->cursor_h = CURSOR_HEIGHT_CIK;
|
||||
}
|
||||
|
||||
/* When the root window is mapped, set the initial modes */
|
||||
void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
|
||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
|
||||
@@ -1684,13 +1703,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
|
||||
else
|
||||
pAMDGPUEnt->HasCRTC2 = TRUE;
|
||||
|
||||
if (info->family < AMDGPU_FAMILY_CI) {
|
||||
info->cursor_w = CURSOR_WIDTH;
|
||||
info->cursor_h = CURSOR_HEIGHT;
|
||||
} else {
|
||||
info->cursor_w = CURSOR_WIDTH_CIK;
|
||||
info->cursor_h = CURSOR_HEIGHT_CIK;
|
||||
}
|
||||
amdgpu_determine_cursor_size(pAMDGPUEnt->fd, info);
|
||||
|
||||
amdgpu_query_heap_size(pAMDGPUEnt->pDev, AMDGPU_GEM_DOMAIN_GTT,
|
||||
&heap_size, &max_allocation);
|
||||
|
||||
Reference in New Issue
Block a user