[PATCH 6/8] Eliminate redundant data parameter from drmmode_crtc_scanout_create
Michel Dänzer
michel at daenzer.net
Tue Nov 10 23:16:04 PST 2015
From: Michel Dänzer <michel.daenzer at amd.com>
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)
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/drmmode_display.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 4397c51..22b84da 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
--
2.6.2
More information about the xorg-driver-ati
mailing list