xf86-video-amdgpu: Branch 'master' - 6 commits
Michel Dänzer
daenzer at kemper.freedesktop.org
Wed Feb 14 16:13:02 UTC 2018
man/amdgpu.man | 2 +-
src/amdgpu_bo_helper.c | 2 ++
src/amdgpu_dri2.c | 1 +
src/amdgpu_drv.h | 1 +
src/amdgpu_kms.c | 32 ++++++++++++++++++--------------
src/amdgpu_pixmap.h | 13 ++++++-------
src/drmmode_display.c | 37 ++++++++++++++++++++++++++-----------
7 files changed, 55 insertions(+), 33 deletions(-)
New commits:
commit 103b7285845b786929fb509083c57e074c48f9be
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Tue Feb 13 19:11:00 2018 +0100
Don't call AMDGPUFreeRec from AMDGPUPreInit_KMS
If the latter fails, Xorg will call AMDGPUFreeScreen_KMS, which calls
the former.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 43c18d4..f5874d3 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1352,7 +1352,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
&& info->pEnt->location.type != BUS_PLATFORM
#endif
)
- goto fail;
+ return FALSE;
pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
getAMDGPUEntityIndex());
@@ -1375,23 +1375,23 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
pScrn->monitor = pScrn->confScreen->monitor;
if (!AMDGPUPreInitVisual(pScrn))
- goto fail;
+ return FALSE;
xf86CollectOptions(pScrn, NULL);
if (!(info->Options = malloc(sizeof(AMDGPUOptions_KMS))))
- goto fail;
+ return FALSE;
memcpy(info->Options, AMDGPUOptions_KMS, sizeof(AMDGPUOptions_KMS));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, info->Options);
if (!AMDGPUPreInitWeight(pScrn))
- goto fail;
+ return FALSE;
memset(&gpu_info, 0, sizeof(gpu_info));
amdgpu_query_gpu_info(pAMDGPUEnt->pDev, &gpu_info);
if (!AMDGPUPreInitChipType_KMS(pScrn, &gpu_info))
- goto fail;
+ return FALSE;
info->dri2.available = FALSE;
info->dri2.enabled = FALSE;
@@ -1399,7 +1399,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
if (info->dri2.pKernelDRMVersion == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"AMDGPUDRIGetVersion failed to get the DRM version\n");
- goto fail;
+ return FALSE;
}
/* Get ScreenInit function */
@@ -1407,7 +1407,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
return FALSE;
if (!AMDGPUPreInitAccel_KMS(pScrn))
- goto fail;
+ return FALSE;
amdgpu_drm_queue_init();
@@ -1466,7 +1466,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
FALSE) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Kernel modesetting setup failed\n");
- goto fail;
+ return FALSE;
}
AMDGPUSetupCapabilities(pScrn);
@@ -1518,14 +1518,10 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
#endif
) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
- goto fail;
+ return FALSE;
}
return TRUE;
-fail:
- AMDGPUFreeRec(pScrn);
- return FALSE;
-
}
static Bool AMDGPUCursorInit_KMS(ScreenPtr pScreen)
commit a23d1ff700d486138c624c2023d8d251c73709af
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Tue Feb 13 18:57:48 2018 +0100
Guard against pAMDGPUEnt == NULL in AMDGPUFreeRec
This can happen if PreInit fails early.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 7dc9e22..43c18d4 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -137,7 +137,7 @@ static void AMDGPUFreeRec(ScrnInfoPtr pScrn)
pPriv = xf86GetEntityPrivate(pEnt->index, gAMDGPUEntityIndex);
pAMDGPUEnt = pPriv->ptr;
- if (pAMDGPUEnt->fd > 0) {
+ if (pAMDGPUEnt && pAMDGPUEnt->fd > 0) {
DevUnion *pPriv;
AMDGPUEntPtr pAMDGPUEnt;
pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
commit b3095710b7c240ddefce794033a77033806f639d
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Tue Feb 13 18:26:06 2018 +0100
Always use screen depth/bpp for KMS framebuffers
DRI clients can use depth 32 pixmaps while the screen is depth 24, in
which case page flipping would fail.
Reported-by: Mario Kleiner <mario.kleiner.de at gmail.com>
(Ported from radeon commit 733f606dd6ca8350e6e7f0858bfff5454ddc98ed)
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/amdgpu_pixmap.h b/src/amdgpu_pixmap.h
index eded170..d744ca5 100644
--- a/src/amdgpu_pixmap.h
+++ b/src/amdgpu_pixmap.h
@@ -104,8 +104,8 @@ static inline struct amdgpu_buffer *amdgpu_get_pixmap_bo(PixmapPtr pPix)
}
static inline struct drmmode_fb*
-amdgpu_fb_create(int drm_fd, uint32_t width, uint32_t height, uint8_t depth,
- uint8_t bpp, uint32_t pitch, uint32_t handle)
+amdgpu_fb_create(ScrnInfoPtr scrn, int drm_fd, uint32_t width, uint32_t height,
+ uint32_t pitch, uint32_t handle)
{
struct drmmode_fb *fb = malloc(sizeof(*fb));
@@ -113,8 +113,8 @@ amdgpu_fb_create(int drm_fd, uint32_t width, uint32_t height, uint8_t depth,
return NULL;
fb->refcnt = 1;
- if (drmModeAddFB(drm_fd, width, height, depth, bpp, pitch, handle,
- &fb->handle) == 0)
+ if (drmModeAddFB(drm_fd, width, height, scrn->depth, scrn->bitsPerPixel,
+ pitch, handle, &fb->handle) == 0)
return fb;
free(fb);
@@ -154,9 +154,8 @@ amdgpu_pixmap_get_fb(PixmapPtr pix)
ScrnInfoPtr scrn = xf86ScreenToScrn(pix->drawable.pScreen);
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
- *fb_ptr = amdgpu_fb_create(pAMDGPUEnt->fd, pix->drawable.width,
- pix->drawable.height, pix->drawable.depth,
- pix->drawable.bitsPerPixel, pix->devKind,
+ *fb_ptr = amdgpu_fb_create(scrn, pAMDGPUEnt->fd, pix->drawable.width,
+ pix->drawable.height, pix->devKind,
handle);
}
}
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e52b7a3..8ccbf73 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -885,9 +885,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
union gbm_bo_handle bo_handle;
bo_handle = gbm_bo_get_handle(info->front_buffer->bo.gbm);
- fb = amdgpu_fb_create(pAMDGPUEnt->fd, pScrn->virtualX,
- pScrn->virtualY, pScrn->depth,
- pScrn->bitsPerPixel,
+ fb = amdgpu_fb_create(pScrn, pAMDGPUEnt->fd,
+ pScrn->virtualX, pScrn->virtualY,
pScrn->displayWidth * info->pixel_bytes,
bo_handle.u32);
/* Prevent refcnt of ad-hoc FBs from reaching 2 */
commit 6aee5770fb913713bb1b9a1af8f0d0892a66f21a
Author: Hawking Zhang <Hawking.Zhang at amd.com>
Date: Sat Jul 16 00:09:21 2016 +0800
Add 30bit RGB color format support
Signed-off-by: Hawking Zhang <Hawking.Zhang at amd.com>
[ Michel Dänzer:
* Require Xorg >= 1.19.99.1 for depth 30, otherwise it can't work with glamor
* Update manpage, per radeon commit
574bfab4bf1fcd95163a8f33cea2889189429d30 ]
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/man/amdgpu.man b/man/amdgpu.man
index 0d9dd93..390f483 100644
--- a/man/amdgpu.man
+++ b/man/amdgpu.man
@@ -18,7 +18,7 @@ following features:
.PD 0
.TP 2
\(bu
-Support for 24-bit pixel depth;
+Support for 24- and 30-bit pixel depths;
.TP
\(bu
RandR support up to version 1.4;
diff --git a/src/amdgpu_bo_helper.c b/src/amdgpu_bo_helper.c
index ba22122..34880ff 100644
--- a/src/amdgpu_bo_helper.c
+++ b/src/amdgpu_bo_helper.c
@@ -42,6 +42,8 @@ amdgpu_get_gbm_format(int depth, int bitsPerPixel)
return GBM_FORMAT_RGB565;
case 32:
return GBM_FORMAT_ARGB8888;
+ case 30:
+ return GBM_FORMAT_XRGB2101010;
case 24:
if (bitsPerPixel == 32)
return GBM_FORMAT_XRGB8888;
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 4ffa346..4a0f8bf 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -120,6 +120,7 @@ amdgpu_dri2_create_buffer2(ScreenPtr pScreen,
cpp = 2;
break;
case 24:
+ case 30:
cpp = 4;
break;
default:
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 49044f5..7dc9e22 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1085,6 +1085,14 @@ static Bool AMDGPUPreInitVisual(ScrnInfoPtr pScrn)
case 24:
break;
+ case 30:
+ if (xorgGetVersion() < XORG_VERSION_NUMERIC(1,19,99,1,0)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Depth 30 requires Xorg >= 1.19.99.1\n");
+ return FALSE;
+ }
+ break;
+
default:
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Given depth (%d) is not supported by %s driver\n",
commit ec397f7d3bfc89a5d8b8429c96e1b9572f6ee47d
Author: Qiang Yu <Qiang.Yu at amd.com>
Date: Thu Nov 2 14:00:23 2017 +0800
Disable gamma set when deep color
gamma set is disabled in kernel driver when deep color.
Enable it will confuse the user.
Signed-off-by: Qiang Yu <Qiang.Yu at amd.com>
[ Michel Dänzer: Align drmmode_pre_init change with radeon commit
1f1d4b1fa7d4b22dd8553f7e71251bf17ca7a7b1 ]
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index be3deef..e52b7a3 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -858,8 +858,11 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
if (drmmode_crtc->tear_free)
scanout_id = drmmode_crtc->scanout_id;
- drmmode_crtc_gamma_do_set(crtc, crtc->gamma_red, crtc->gamma_green,
- crtc->gamma_blue, crtc->gamma_size);
+ /* gamma is disabled in kernel driver for deep color */
+ if (pScrn->depth != 30)
+ drmmode_crtc_gamma_do_set(
+ crtc, crtc->gamma_red, crtc->gamma_green,
+ crtc->gamma_blue, crtc->gamma_size);
if (drmmode_crtc->prime_scanout_pixmap) {
drmmode_crtc_prime_scanout_update(crtc, mode, scanout_id,
@@ -2361,6 +2364,12 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
info->drmmode_crtc_funcs.shadow_destroy = NULL;
}
+ /* Hw gamma lut's are currently bypassed by the hw at color depth 30,
+ * so spare the server the effort to compute and update the cluts.
+ */
+ if (pScrn->depth == 30)
+ info->drmmode_crtc_funcs.gamma_set = NULL;
+
for (i = 0; i < mode_res->count_crtcs; i++)
if (!xf86IsEntityShared(pScrn->entityList[0]) ||
(crtcs_needed && !(pAMDGPUEnt->assigned_crtcs & (1 << i))))
@@ -2591,8 +2600,9 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
"Initializing kms color map\n");
if (!miCreateDefColormap(pScreen))
return FALSE;
- /* all amdgpus support 10 bit CLUTs */
- if (!xf86HandleColormaps(pScreen, 256, 10,
+ /* All radeons support 10 bit CLUTs. They get bypassed at depth 30. */
+ if (pScrn->depth != 30 &&
+ !xf86HandleColormaps(pScreen, 256, 10,
NULL, NULL,
CMAP_PALETTED_TRUECOLOR
#if 0 /* This option messes up text mode! (eich at suse.de) */
commit c849081e24377a81afc1a05f2a5634b1e60c67db
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date: Mon Feb 12 18:18:46 2018 +0100
Define per x-screen individual drmmode_crtc_funcs
This allows to en-/disable some functions depending on individual screen
settings.
Prep work for more efficient depth 30 support.
Suggested-by: Michel Dänzer <michel.daenzer at amd.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
(Ported from radeon commit 21f6753462464acfd3c452393328c977a375ce26)
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index f60b192..4015726 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -340,6 +340,7 @@ typedef struct {
SetSharedPixmapBackingProcPtr SavedSetSharedPixmapBacking;
} glamor;
+ xf86CrtcFuncsRec drmmode_crtc_funcs;
} AMDGPUInfoRec, *AMDGPUInfoPtr;
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 0471794..be3deef 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1344,8 +1344,9 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res
xf86CrtcPtr crtc;
drmmode_crtc_private_ptr drmmode_crtc;
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
+ AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
- crtc = xf86CrtcCreate(pScrn, &drmmode_crtc_funcs);
+ crtc = xf86CrtcCreate(pScrn, &info->drmmode_crtc_funcs);
if (crtc == NULL)
return 0;
@@ -2348,11 +2349,16 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, AMDGPU_LOGLEVEL_DEBUG,
"%d crtcs needed for screen.\n", crtcs_needed);
+ /* Need per-screen drmmode_crtc_funcs, based on our global template,
+ * so we can disable some functions, depending on screen settings.
+ */
+ info->drmmode_crtc_funcs = drmmode_crtc_funcs;
+
if (!info->use_glamor) {
/* Rotation requires hardware acceleration */
- drmmode_crtc_funcs.shadow_allocate = NULL;
- drmmode_crtc_funcs.shadow_create = NULL;
- drmmode_crtc_funcs.shadow_destroy = NULL;
+ info->drmmode_crtc_funcs.shadow_allocate = NULL;
+ info->drmmode_crtc_funcs.shadow_create = NULL;
+ info->drmmode_crtc_funcs.shadow_destroy = NULL;
}
for (i = 0; i < mode_res->count_crtcs; i++)
More information about the xorg-commit
mailing list