summaryrefslogtreecommitdiff
path: root/src/drmmode_display.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drmmode_display.c')
-rw-r--r--src/drmmode_display.c55
1 files changed, 11 insertions, 44 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9c838a8..3cbf2bd 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -34,6 +34,7 @@
#include <time.h>
#include "cursorstr.h"
#include "damagestr.h"
+#include "list.h"
#include "micmap.h"
#include "xf86cmap.h"
#include "xf86Priv.h"
@@ -42,12 +43,9 @@
#include "drmmode_display.h"
#include "amdgpu_bo_helper.h"
#include "amdgpu_glamor.h"
-#include "amdgpu_list.h"
#include "amdgpu_pixmap.h"
-#ifdef AMDGPU_PIXMAP_SHARING
#include <dri.h>
-#endif
/* DPMS */
#ifdef HAVE_XEXTPROTO_71
@@ -575,7 +573,7 @@ drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
if (crtc->transformPresent)
return FALSE;
-#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7
+#if XF86_CRTC_VERSION < 7
/* Xorg doesn't correctly handle cursor position transform in the
* rotation case
*/
@@ -584,12 +582,10 @@ drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
return FALSE;
#endif
-#if defined(AMDGPU_PIXMAP_SHARING)
/* HW cursor not supported with RandR 1.4 multihead up to 1.18.99.901 */
if (xorgGetVersion() <= XORG_VERSION_NUMERIC(1,18,99,901,0) &&
!xorg_list_is_empty(&crtc->scrn->pScreen->pixmap_dirty_list))
return FALSE;
-#endif
return TRUE;
}
@@ -613,7 +609,7 @@ drmmode_crtc_update_tear_free(xf86CrtcPtr crtc)
if (drmmode_output->tear_free == 1 ||
(drmmode_output->tear_free == 2 &&
- (amdgpu_is_gpu_screen(crtc->scrn->pScreen) ||
+ (crtc->scrn->pScreen->isGPU ||
info->shadow_primary ||
crtc->transformPresent || crtc->rotation != RR_Rotate_0))) {
drmmode_crtc->tear_free = TRUE;
@@ -622,8 +618,6 @@ drmmode_crtc_update_tear_free(xf86CrtcPtr crtc)
}
}
-#if XF86_CRTC_VERSION >= 4
-
#if XF86_CRTC_VERSION < 7
#define XF86DriverTransformOutput TRUE
#define XF86DriverTransformNone FALSE
@@ -652,17 +646,6 @@ drmmode_handle_transform(xf86CrtcPtr crtc)
return ret;
}
-#else
-
-static Bool
-drmmode_handle_transform(xf86CrtcPtr crtc)
-{
- return xf86CrtcRotate(crtc);
-}
-
-#endif
-
-#ifdef AMDGPU_PIXMAP_SHARING
static void
drmmode_crtc_prime_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
@@ -721,7 +704,6 @@ drmmode_crtc_prime_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
drmmode_crtc->scanout_id = scanout_id;
}
-#endif /* AMDGPU_PIXMAP_SHARING */
static void
drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
@@ -878,21 +860,16 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
drmmode_crtc_gamma_do_set(crtc, crtc->gamma_red, crtc->gamma_green,
crtc->gamma_blue, crtc->gamma_size);
-#ifdef AMDGPU_PIXMAP_SHARING
if (drmmode_crtc->prime_scanout_pixmap) {
drmmode_crtc_prime_scanout_update(crtc, mode, scanout_id,
&fb, &x, &y);
- } else
-#endif
- if (drmmode_crtc->rotate.pixmap) {
+ } else if (drmmode_crtc->rotate.pixmap) {
fb = amdgpu_pixmap_get_fb(drmmode_crtc->rotate.pixmap);
x = y = 0;
- } else if (!amdgpu_is_gpu_screen(pScreen) &&
+ } else if (!pScreen->isGPU &&
(drmmode_crtc->tear_free ||
-#if XF86_CRTC_VERSION >= 4
crtc->driverIsPerformingTransform ||
-#endif
info->shadow_primary)) {
drmmode_crtc_scanout_update(crtc, mode, scanout_id,
&fb, &x, &y);
@@ -992,7 +969,7 @@ static void drmmode_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(crtc->scrn);
-#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7
+#if XF86_CRTC_VERSION < 7
if (crtc->driverIsPerformingTransform) {
x += crtc->x;
y += crtc->y;
@@ -1003,7 +980,7 @@ static void drmmode_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
drmModeMoveCursor(pAMDGPUEnt->fd, drmmode_crtc->mode_crtc->crtc_id, x, y);
}
-#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7
+#if XF86_CRTC_VERSION < 7
static int
drmmode_cursor_src_offset(Rotation rotation, int width, int height,
@@ -1068,7 +1045,7 @@ static void drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
ScrnInfoPtr pScrn = crtc->scrn;
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
-#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7
+#if XF86_CRTC_VERSION < 7
if (crtc->driverIsPerformingTransform) {
uint32_t cursor_w = info->cursor_w, cursor_h = info->cursor_h;
int dstx, dsty;
@@ -1269,7 +1246,6 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t * red, uint16_t * green,
#endif
}
-#ifdef AMDGPU_PIXMAP_SHARING
static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
@@ -1320,7 +1296,6 @@ static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
#endif
return TRUE;
}
-#endif
static xf86CrtcFuncsRec drmmode_crtc_funcs = {
.dpms = drmmode_crtc_dpms,
@@ -1339,9 +1314,7 @@ static xf86CrtcFuncsRec drmmode_crtc_funcs = {
.shadow_allocate = drmmode_crtc_shadow_allocate,
.shadow_destroy = drmmode_crtc_shadow_destroy,
.destroy = NULL, /* XXX */
-#ifdef AMDGPU_PIXMAP_SHARING
.set_scanout_pixmap = drmmode_set_scanout_pixmap,
-#endif
};
int drmmode_get_crtc_id(xf86CrtcPtr crtc)
@@ -1852,14 +1825,12 @@ drmmode_create_name(ScrnInfoPtr pScrn, drmModeConnectorPtr koutput, char *name,
if (output) {
snprintf(name, 32, "%s-%s", output->name, extra_path);
} else {
- if (koutput->connector_type >= NUM_OUTPUT_NAMES)
+ if (koutput->connector_type >= NUM_OUTPUT_NAMES) {
snprintf(name, 32, "Unknown%d-%d", koutput->connector_type, koutput->connector_type_id - 1);
-#ifdef AMDGPU_PIXMAP_SHARING
- else if (pScrn->is_gpu)
+ } else if (pScrn->is_gpu) {
snprintf(name, 32, "%s-%d-%d", output_names[koutput->connector_type],
pScrn->scrnIndex - GPU_SCREEN_OFFSET + 1, koutput->connector_type_id - 1);
-#endif
- else {
+ } else {
/* need to do smart conversion here for compat with non-kms ATI driver */
if (koutput->connector_type_id == 1) {
switch(koutput->connector_type) {
@@ -2355,9 +2326,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
int i, num_dvi = 0, num_hdmi = 0;
unsigned int crtcs_needed = 0;
drmModeResPtr mode_res;
-#ifdef AMDGPU_PIXMAP_SHARING
char *bus_id_string, *provider_name;
-#endif
xf86CrtcConfigInit(pScrn, &drmmode_xf86crtc_config_funcs);
@@ -2399,13 +2368,11 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
/* workout clones */
drmmode_clones_init(pScrn, drmmode, mode_res);
-#ifdef AMDGPU_PIXMAP_SHARING
bus_id_string = DRICreatePCIBusID(info->PciInfo);
XNFasprintf(&provider_name, "%s @ %s", pScrn->chipset, bus_id_string);
free(bus_id_string);
xf86ProviderSetup(pScrn, NULL, provider_name);
free(provider_name);
-#endif
xf86InitialConfiguration(pScrn, TRUE);