diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2015-11-11 15:57:21 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2015-11-12 11:27:24 +0900 |
commit | 4e4f4d53da0539ef9feb8766230a6e9927ae005b (patch) | |
tree | 2b24cbaf7ecbb50ec349d2ba131dc4bf0c3c3eec | |
parent | 421a7e797bdd58d83e81af7a6512cc715a3df514 (diff) |
Eliminate redundant data parameter from drmmode_crtc_scanout_create
drmmode_crtc_scanout_create just needs to call
drmmode_crtc_scanout_allocate when scanout->bo is NULL.
This makes it clearer to the reader / compiler that
drmmode_crtc_scanout_create doesn't dereference scanout->bo when it's
NULL.
(ported from amdgpu commit 8da1d0c870e1081d77925807d6e3bbc61a23f54f)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/drmmode_display.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 4397c51c..22b84da3 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -565,7 +565,7 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc, static PixmapPtr drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout, - void *data, int width, int height) + int width, int height) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; @@ -579,8 +579,10 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout, drmmode_crtc_scanout_destroy(drmmode, scanout); } - if (!data) - data = drmmode_crtc_scanout_allocate(crtc, scanout, width, height); + if (!scanout->bo) { + if (!drmmode_crtc_scanout_allocate(crtc, scanout, width, height)) + return NULL; + } rotate_pitch = RADEON_ALIGN(width, drmmode_get_pitch_align(pScrn, drmmode->cpp, 0)) * drmmode->cpp; @@ -713,7 +715,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, for (i = 0; i < (info->tear_free ? 2 : 1); i++) { drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[i], - NULL, mode->HDisplay, + mode->HDisplay, mode->VDisplay); if (drmmode_crtc->scanout[i].pixmap) { @@ -887,8 +889,11 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - return drmmode_crtc_scanout_create(crtc, &drmmode_crtc->rotate, data, - width, height); + /* Xorg passes in the return value of drmmode_crtc_shadow_allocate + * for data, but that's redundant for drmmode_crtc_scanout_create. + */ + return drmmode_crtc_scanout_create(crtc, &drmmode_crtc->rotate, width, + height); } static void |