summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@armlinux.org.uk>2018-06-28 00:23:44 +0100
committerRussell King <rmk@armlinux.org.uk>2018-07-13 18:14:06 +0100
commit009a95fcd9b4b6c1a4fdf57b3b60a0c3682501ac (patch)
tree70108ef4c48d4e934b7f8212de67baa9b3650bc6
parent54ab37c4d91a9c4cd848ae2f62dcb24376c9314d (diff)
src: store crtc id instead of entire drmModeCrtc structure
We only make use of the crtc ID from the drmModeCrtc structure, which is the same ID we got from the drmModeRes mode resources. Rather than fetching the drmModeCrtc structure, just store and use the crtc ID directly. Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r--src/armada_drm.c5
-rw-r--r--src/armada_drm_xv.c4
-rw-r--r--src/common_drm.c21
-rw-r--r--src/common_drm.h2
4 files changed, 14 insertions, 18 deletions
diff --git a/src/armada_drm.c b/src/armada_drm.c
index 7a4bc85..0f6357f 100644
--- a/src/armada_drm.c
+++ b/src/armada_drm.c
@@ -255,12 +255,9 @@ static void armada_drm_crtc_destroy(xf86CrtcPtr crtc)
struct common_crtc_info *drmc = common_crtc(crtc);
if (drmc->cursor_data) {
- drmModeSetCursor(drmc->drm_fd, drmc->mode_crtc->crtc_id,
- 0, 0, 0);
+ drmModeSetCursor(drmc->drm_fd, drmc->drm_id, 0, 0, 0);
drm_armada_bo_put(drmc->cursor_data);
}
- drmModeFreeCrtc(drmc->mode_crtc);
-
free(drmc);
}
diff --git a/src/armada_drm_xv.c b/src/armada_drm_xv.c
index ad28a56..c08a2e0 100644
--- a/src/armada_drm_xv.c
+++ b/src/armada_drm_xv.c
@@ -801,7 +801,7 @@ static void armada_drm_primary_plane_restore(xf86CrtcPtr crtc)
int ret;
ret = drmModeSetPlane(drm->fd, drmc->primary_plane_id,
- drmc->mode_crtc->crtc_id, drm->fb_id, 0,
+ drmc->drm_id, drm->fb_id, 0,
crtc->x, crtc->y,
crtc->mode.HDisplay, crtc->mode.VDisplay,
0, 0,
@@ -945,7 +945,7 @@ armada_drm_plane_Put(ScrnInfoPtr pScrn, struct drm_xv *drmxv, uint32_t fb_id,
crtc_y = dst->y1 - crtc->y;
drmModeSetPlane(drmxv->fd, drmxv->overlay_plane->plane_id,
- common_crtc(crtc)->mode_crtc->crtc_id, fb_id, 0,
+ common_crtc(crtc)->drm_id, fb_id, 0,
crtc_x, crtc_y, dst->x2 - dst->x1, dst->y2 - dst->y1,
x1, y1, x2 - x1, y2 - y1);
diff --git a/src/common_drm.c b/src/common_drm.c
index 1ae7c8d..d9a66b8 100644
--- a/src/common_drm.c
+++ b/src/common_drm.c
@@ -630,12 +630,12 @@ static Bool common_drm_crtc_apply(xf86CrtcPtr crtc, uint32_t front_fb_id)
drmmode_ConvertToKMode(&kmode, &crtc->mode);
- ret = drmModeSetCrtc(drmc->drm_fd, drmc->mode_crtc->crtc_id, fb_id,
+ ret = drmModeSetCrtc(drmc->drm_fd, drmc->drm_id, fb_id,
x, y, output_ids, output_num, &kmode);
if (ret) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[drm] failed to set mode on crtc %u: %s\n",
- drmc->mode_crtc->crtc_id, strerror(errno));
+ drmc->drm_id, strerror(errno));
ret = FALSE;
} else {
ret = TRUE;
@@ -723,7 +723,7 @@ void common_drm_crtc_gamma_set(xf86CrtcPtr crtc,
{
struct common_crtc_info *drmc = common_crtc(crtc);
- drmModeCrtcSetGamma(drmc->drm_fd, drmc->mode_crtc->crtc_id,
+ drmModeCrtcSetGamma(drmc->drm_fd, drmc->drm_id,
size, red, green, blue);
}
@@ -731,14 +731,14 @@ void common_drm_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
{
struct common_crtc_info *drmc = common_crtc(crtc);
- drmModeMoveCursor(drmc->drm_fd, drmc->mode_crtc->crtc_id, x, y);
+ drmModeMoveCursor(drmc->drm_fd, drmc->drm_id, x, y);
}
void common_drm_crtc_show_cursor(xf86CrtcPtr crtc)
{
struct common_drm_info *drm = GET_DRM_INFO(crtc->scrn);
struct common_crtc_info *drmc = common_crtc(crtc);
- uint32_t crtc_id = drmc->mode_crtc->crtc_id;
+ uint32_t crtc_id = drmc->drm_id;
uint32_t handle = drmc->cursor_handle;
uint32_t width = drm->cursor_max_width;
uint32_t height = drm->cursor_max_height;
@@ -758,7 +758,7 @@ void common_drm_crtc_hide_cursor(xf86CrtcPtr crtc)
{
struct common_crtc_info *drmc = common_crtc(crtc);
- drmModeSetCursor(drmc->drm_fd, drmc->mode_crtc->crtc_id, 0, 0, 0);
+ drmModeSetCursor(drmc->drm_fd, drmc->drm_id, 0, 0, 0);
}
Bool common_drm_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height,
@@ -808,8 +808,8 @@ static Bool common_drm_crtc_init(ScrnInfoPtr pScrn, unsigned num,
drmc = xnfcalloc(1, sizeof *drmc);
drmc->drm_fd = drm->fd;
+ drmc->drm_id = id;
drmc->num = num;
- drmc->mode_crtc = drmModeGetCrtc(drmc->drm_fd, id);
crtc->driver_private = drmc;
/* Test whether hardware cursor is supported */
@@ -953,9 +953,8 @@ Bool common_drm_flip(ScrnInfoPtr pScrn, PixmapPtr pixmap,
event->handler = common_drm_flip_handler;
drmc = common_crtc(crtc);
- if (drmModePageFlip(drm->fd, drmc->mode_crtc->crtc_id,
- drm->fb_id, DRM_MODE_PAGE_FLIP_EVENT,
- event)) {
+ if (drmModePageFlip(drm->fd, drmc->drm_id, drm->fb_id,
+ DRM_MODE_PAGE_FLIP_EVENT, event)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"page flip: queue failed: %s\n", strerror(errno));
free(event);
@@ -1440,7 +1439,7 @@ Bool common_drm_EnterVT(VT_FUNC_ARGS_DECL)
struct common_crtc_info *drmc = common_crtc(crtc);
if (!crtc->enabled)
- drmModeSetCrtc(drmc->drm_fd, drmc->mode_crtc->crtc_id,
+ drmModeSetCrtc(drmc->drm_fd, drmc->drm_id,
0, 0, 0, NULL, 0, NULL);
}
diff --git a/src/common_drm.h b/src/common_drm.h
index 14e12c7..2267190 100644
--- a/src/common_drm.h
+++ b/src/common_drm.h
@@ -15,8 +15,8 @@ struct common_drm_device {
struct common_crtc_info {
int drm_fd;
+ uint32_t drm_id;
unsigned num;
- drmModeCrtcPtr mode_crtc;
uint32_t primary_plane_id;
void *cursor_data;
uint32_t cursor_handle;