summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Barnish <dave.barnish@arm.com>2013-06-11 16:31:10 +0100
committerDave Barnish <dave.barnish@arm.com>2013-06-11 16:31:10 +0100
commit2e9989563ba6860ed10298fa2ea0c58875265086 (patch)
tree165959f11ff0db7c50129190d19bd72e4f009639
parent0bdb7382f3cb42bd4852397bb7723a5c607b7733 (diff)
Source conforms to linux kernel coding style
Change-Id: I8d155efa4b9e1997e07c11bd453208f79b6a7f25
-rw-r--r--src/armsoc_dri2.c195
-rw-r--r--src/armsoc_driver.c264
-rw-r--r--src/armsoc_driver.h74
-rw-r--r--src/armsoc_dumb.c133
-rw-r--r--src/armsoc_dumb.h16
-rw-r--r--src/armsoc_exa.c120
-rw-r--r--src/armsoc_exa.h43
-rw-r--r--src/armsoc_exa_null.c44
-rw-r--r--src/compat-api.h6
-rw-r--r--src/drmmode_display.c469
-rw-r--r--src/drmmode_driver.h33
-rw-r--r--src/drmmode_exynos/drmmode_exynos.c15
-rw-r--r--src/drmmode_pl111/drmmode_pl111.c63
-rw-r--r--src/drmmode_template/drmmode_template.c11
14 files changed, 799 insertions, 687 deletions
diff --git a/src/armsoc_dri2.c b/src/armsoc_dri2.c
index 2c53090..3993c4d 100644
--- a/src/armsoc_dri2.c
+++ b/src/armsoc_dri2.c
@@ -42,7 +42,7 @@
#include "drmmode_driver.h"
-typedef struct {
+struct ARMSOCDRI2BufferRec {
DRI2BufferRec base;
/**
@@ -76,20 +76,19 @@ typedef struct {
*/
int previous_canflip;
-} ARMSOCDRI2BufferRec, *ARMSOCDRI2BufferPtr;
+};
-#define ARMSOCBUF(p) ((ARMSOCDRI2BufferPtr)(p))
+#define ARMSOCBUF(p) ((struct ARMSOCDRI2BufferRec *)(p))
#define DRIBUF(p) ((DRI2BufferPtr)(&(p)->base))
static inline DrawablePtr
dri2draw(DrawablePtr pDraw, DRI2BufferPtr buf)
{
- if (buf->attachment == DRI2BufferFrontLeft) {
+ if (buf->attachment == DRI2BufferFrontLeft)
return pDraw;
- } else {
+ else
return &(ARMSOCBUF(buf)->pPixmap->drawable);
- }
}
static Bool
@@ -97,12 +96,12 @@ canflip(DrawablePtr pDraw)
{
ScreenPtr pScreen = pDraw->pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
- if( pARMSOC->NoFlip ) {
+ if (pARMSOC->NoFlip) {
/* flipping is disabled by user option */
return FALSE;
- } else {
+ } else {
return (pDraw->type == DRAWABLE_WINDOW) &&
DRI2CanFlip(pDraw);
}
@@ -114,7 +113,7 @@ exchangebufs(DrawablePtr pDraw, DRI2BufferPtr a, DRI2BufferPtr b)
PixmapPtr aPix = draw2pix(dri2draw(pDraw, a));
PixmapPtr bPix = draw2pix(dri2draw(pDraw, b));
- ARMSOCPixmapExchange(aPix,bPix);
+ ARMSOCPixmapExchange(aPix, bPix);
exchange(a->name, b->name);
return TRUE;
}
@@ -144,7 +143,7 @@ ARMSOCDRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment,
{
ScreenPtr pScreen = pDraw->pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCDRI2BufferPtr buf = calloc(1, sizeof(*buf));
+ struct ARMSOCDRI2BufferRec *buf = calloc(1, sizeof(*buf));
PixmapPtr pPixmap = NULL;
struct armsoc_bo *bo;
int ret;
@@ -164,17 +163,16 @@ ARMSOCDRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment,
pPixmap = createpix(pDraw);
}
- if (!pPixmap)
- {
+ if (!pPixmap) {
assert(attachment != DRI2BufferFrontLeft);
ERROR_MSG("Failed to create back buffer for window");
goto fail;
}
bo = ARMSOCPixmapBo(pPixmap);
- if (!bo)
- {
- ERROR_MSG("Attempting to DRI2 wrap a pixmap with no DRM buffer object backing");
+ if (!bo) {
+ ERROR_MSG(
+ "Attempting to DRI2 wrap a pixmap with no DRM buffer object backing");
goto fail;
}
@@ -193,8 +191,8 @@ ARMSOCDRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment,
goto fail;
}
- /* Q: how to know across ARMSOC generations what formats that the display
- * can support directly?
+ /* Q: how to know across ARMSOC generations what formats the display
+ * can support directly?
* A: attempt to create a drm_framebuffer, and if that fails then the
* hw must not support.. then fall back to blitting
*/
@@ -213,16 +211,11 @@ ARMSOCDRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment,
return DRIBUF(buf);
fail:
- if (pPixmap != NULL)
- {
+ if (pPixmap != NULL) {
if (attachment != DRI2BufferFrontLeft)
- {
pScreen->DestroyPixmap(pPixmap);
- }
else
- {
pPixmap->refcnt--;
- }
}
free(buf);
@@ -235,7 +228,7 @@ fail:
static void
ARMSOCDRI2DestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
{
- ARMSOCDRI2BufferPtr buf = ARMSOCBUF(buffer);
+ struct ARMSOCDRI2BufferRec *buf = ARMSOCBUF(buffer);
/* Note: pDraw may already be deleted, so use the pPixmap here
* instead (since it is at least refcntd)
*/
@@ -257,7 +250,7 @@ ARMSOCDRI2DestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
static void
ARMSOCDRI2ReferenceBuffer(DRI2BufferPtr buffer)
{
- ARMSOCDRI2BufferPtr buf = ARMSOCBUF(buffer);
+ struct ARMSOCDRI2BufferRec *buf = ARMSOCBUF(buffer);
buf->refcnt++;
}
@@ -279,9 +272,8 @@ ARMSOCDRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
pDraw, pDstBuffer, pSrcDraw, pSrcBuffer, pDstDraw);
pGC = GetScratchGC(pDstDraw->depth, pScreen);
- if (!pGC) {
+ if (!pGC)
return;
- }
pCopyClip = REGION_CREATE(pScreen, NULL, 0);
RegionCopy(pCopyClip, pRegion);
@@ -311,7 +303,7 @@ ARMSOCDRI2GetMSC(DrawablePtr pDraw, CARD64 *ust, CARD64 *msc)
{
ScreenPtr pScreen = pDraw->pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
drmVBlank vbl = { .request = {
.type = DRM_VBLANK_RELATIVE,
.sequence = 0,
@@ -322,18 +314,19 @@ ARMSOCDRI2GetMSC(DrawablePtr pDraw, CARD64 *ust, CARD64 *msc)
if (ret) {
static int limit = 5;
if (limit) {
- ERROR_MSG("get vblank counter failed: %s", strerror(errno));
+ ERROR_MSG("get vblank counter failed: %s",
+ strerror(errno));
limit--;
}
return FALSE;
}
- if (ust) {
- *ust = ((CARD64)vbl.reply.tval_sec * 1000000) + vbl.reply.tval_usec;
- }
- if (msc) {
+ if (ust)
+ *ust = ((CARD64)vbl.reply.tval_sec * 1000000)
+ + vbl.reply.tval_usec;
+
+ if (msc)
*msc = vbl.reply.sequence;
- }
return TRUE;
}
@@ -341,7 +334,7 @@ ARMSOCDRI2GetMSC(DrawablePtr pDraw, CARD64 *ust, CARD64 *msc)
#define ARMSOC_SWAP_FAKE_FLIP (1 << 0)
#define ARMSOC_SWAP_FAIL (1 << 1)
-struct _ARMSOCDRISwapCmd {
+struct ARMSOCDRISwapCmd {
int type;
ClientPtr client;
ScreenPtr pScreen;
@@ -357,50 +350,57 @@ struct _ARMSOCDRISwapCmd {
void *data;
};
-static const char *swap_names[] = {
+static const char * const swap_names[] = {
[DRI2_EXCHANGE_COMPLETE] = "exchange",
[DRI2_BLIT_COMPLETE] = "blit",
[DRI2_FLIP_COMPLETE] = "flip,"
};
void
-ARMSOCDRI2SwapComplete(ARMSOCDRISwapCmd *cmd)
+ARMSOCDRI2SwapComplete(struct ARMSOCDRISwapCmd *cmd)
{
ScreenPtr pScreen = cmd->pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
DrawablePtr pDraw = NULL;
int status;
- ARMSOCPixmapPrivPtr src_priv, dst_priv;
+ struct ARMSOCPixmapPrivRec *src_priv, *dst_priv;
struct armsoc_bo *old_src_bo, *old_dst_bo;
if (--cmd->swapCount > 0)
return;
/* Save the old source bo for unreference below */
- src_priv = exaGetPixmapDriverPrivate(ARMSOCBUF(cmd->pSrcBuffer)->pPixmap);
- dst_priv = exaGetPixmapDriverPrivate(ARMSOCBUF(cmd->pDstBuffer)->pPixmap);
+ src_priv = exaGetPixmapDriverPrivate(
+ ARMSOCBUF(cmd->pSrcBuffer)->pPixmap);
+ dst_priv = exaGetPixmapDriverPrivate(
+ ARMSOCBUF(cmd->pDstBuffer)->pPixmap);
old_src_bo = src_priv->bo;
old_dst_bo = dst_priv->bo;
if ((cmd->flags & ARMSOC_SWAP_FAIL) == 0) {
DEBUG_MSG("%s complete: %d -> %d", swap_names[cmd->type],
- cmd->pSrcBuffer->attachment, cmd->pDstBuffer->attachment);
+ cmd->pSrcBuffer->attachment,
+ cmd->pDstBuffer->attachment);
status = dixLookupDrawable(&pDraw, cmd->draw_id, serverClient,
M_ANY, DixWriteAccess);
if (status == Success) {
- if (cmd->type != DRI2_BLIT_COMPLETE && (cmd->flags & ARMSOC_SWAP_FAKE_FLIP) == 0) {
+ if (cmd->type != DRI2_BLIT_COMPLETE &&
+ (cmd->flags & ARMSOC_SWAP_FAKE_FLIP) == 0) {
assert(cmd->type == DRI2_FLIP_COMPLETE);
- exchangebufs(pDraw, cmd->pSrcBuffer, cmd->pDstBuffer);
+ exchangebufs(pDraw, cmd->pSrcBuffer,
+ cmd->pDstBuffer);
}
DRI2SwapComplete(cmd->client, pDraw, 0, 0, 0, cmd->type,
cmd->func, cmd->data);
- if (cmd->type != DRI2_BLIT_COMPLETE && (cmd->flags & ARMSOC_SWAP_FAKE_FLIP) == 0) {
- dst_priv = exaGetPixmapDriverPrivate(draw2pix(dri2draw(pDraw, cmd->pDstBuffer)));
+ if (cmd->type != DRI2_BLIT_COMPLETE &&
+ (cmd->flags & ARMSOC_SWAP_FAKE_FLIP) == 0) {
+ dst_priv = exaGetPixmapDriverPrivate(draw2pix(
+ dri2draw(pDraw, cmd->pDstBuffer)));
assert(cmd->type == DRI2_FLIP_COMPLETE);
set_scanout_bo(pScrn, dst_priv->bo);
}
@@ -438,18 +438,16 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
{
ScreenPtr pScreen = pDraw->pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
- ARMSOCDRI2BufferPtr src = ARMSOCBUF(pSrcBuffer);
- ARMSOCDRI2BufferPtr dst = ARMSOCBUF(pDstBuffer);
- ARMSOCDRISwapCmd *cmd = calloc(1, sizeof(*cmd));
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCDRI2BufferRec *src = ARMSOCBUF(pSrcBuffer);
+ struct ARMSOCDRI2BufferRec *dst = ARMSOCBUF(pDstBuffer);
+ struct ARMSOCDRISwapCmd *cmd = calloc(1, sizeof(*cmd));
int src_fb_id, dst_fb_id;
- ARMSOCPixmapPrivPtr src_priv, dst_priv;
+ struct ARMSOCPixmapPrivRec *src_priv, *dst_priv;
int new_canflip, ret;
- if(!cmd)
- {
+ if (!cmd)
return FALSE;
- }
cmd->client = client;
cmd->pScreen = pScreen;
@@ -477,19 +475,23 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
dst_fb_id = armsoc_bo_get_fb(dst_priv->bo);
new_canflip = canflip(pDraw);
- if ((src->previous_canflip != -1 && src->previous_canflip != new_canflip) ||
- (dst->previous_canflip != -1 && dst->previous_canflip != new_canflip) ||
- (pARMSOC->has_resized))
- {
- /* The drawable has transitioned between being flippable and non-flippable
- * or vice versa. Bump the serial number to force the DRI2 buffers to be
- * re-allocated during the next frame so that:
- * - It is able to be scanned out (if drawable is now flippable), or
- * - It is not taking up possibly scarce scanout-able memory (if drawable
- * is now not flippable)
+ if ((src->previous_canflip != -1 &&
+ src->previous_canflip != new_canflip) ||
+ (dst->previous_canflip != -1 &&
+ dst->previous_canflip != new_canflip) ||
+ (pARMSOC->has_resized)) {
+ /* The drawable has transitioned between being flippable and
+ * non-flippable or vice versa. Bump the serial number to force
+ * the DRI2 buffers to be re-allocated during the next frame so
+ * that:
+ * - It is able to be scanned out
+ * (if drawable is now flippable), or
+ * - It is not taking up possibly scarce scanout-able memory
+ * (if drawable is now not flippable)
*
- * has_resized: On hotplugging back buffer needs to be invalidates as well
- * as Xsever invalidates only the front buffer.
+ * has_resized: On hotplugging back buffer needs to be
+ * invalidated as well, as Xserver invalidates only the
+ * front buffer.
*/
PixmapPtr pPix = pScreen->GetWindowPixmap((WindowPtr)pDraw);
@@ -501,20 +503,23 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
armsoc_bo_reference(src_priv->bo);
armsoc_bo_reference(dst_priv->bo);
- if (src_fb_id && dst_fb_id && canflip(pDraw) && !(pARMSOC->has_resized)) {
- /* has_resized: On hotplug the fb size and crtc sizes arent updated
- * hence on this event we do a copyb but flip from the next frame
- * when the sizes are updated.
- */
+ if (src_fb_id && dst_fb_id && canflip(pDraw) &&
+ !(pARMSOC->has_resized)) {
+ /* has_resized: On hotplug the fb size and crtc sizes aren't
+ * updated hence on this event we do a copyb but flip from the
+ * next frame when the sizes are updated.
+ */
DEBUG_MSG("can flip: %d -> %d", src_fb_id, dst_fb_id);
cmd->type = DRI2_FLIP_COMPLETE;
- /* TODO: MIDEGL-1461: Handle rollback if multiple CRTC flip is only partially successful
+ /* TODO: MIDEGL-1461: Handle rollback if multiple CRTC flip is
+ * only partially successful
*/
ret = drmmode_page_flip(pDraw, src_fb_id, cmd);
- /* If using page flip events, we'll trigger an immediate completion in
- * the case that no CRTCs were enabled to be flipped. If not using page
- * flip events, trigger immediate completion unconditionally.
+ /* If using page flip events, we'll trigger an immediate
+ * completion in the case that no CRTCs were enabled to be
+ * flipped. If not using page flip events, trigger immediate
+ * completion unconditionally.
*/
if (ret < 0) {
/*
@@ -528,9 +533,8 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
cmd->swapCount = 0;
if (cmd->swapCount == 0)
- {
ARMSOCDRI2SwapComplete(cmd);
- }
+
return FALSE;
} else {
if (ret == 0)
@@ -542,9 +546,7 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
cmd->swapCount = 0;
if (cmd->swapCount == 0)
- {
ARMSOCDRI2SwapComplete(cmd);
- }
}
} else {
/* fallback to blit: */
@@ -572,8 +574,8 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
* we receive it.
*/
static int
-ARMSOCDRI2ScheduleWaitMSC(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
- CARD64 divisor, CARD64 remainder)
+ARMSOCDRI2ScheduleWaitMSC(ClientPtr client, DrawablePtr pDraw,
+ CARD64 target_msc, CARD64 divisor, CARD64 remainder)
{
ScreenPtr pScreen = pDraw->pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -589,25 +591,24 @@ Bool
ARMSOCDRI2ScreenInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
DRI2InfoRec info = {
- .version = 5,
- .fd = pARMSOC->drmFD,
- .driverName = "armsoc",
- .deviceName = pARMSOC->deviceName,
- .CreateBuffer = ARMSOCDRI2CreateBuffer,
- .DestroyBuffer = ARMSOCDRI2DestroyBuffer,
- .CopyRegion = ARMSOCDRI2CopyRegion,
- .ScheduleSwap = ARMSOCDRI2ScheduleSwap,
- .ScheduleWaitMSC = ARMSOCDRI2ScheduleWaitMSC,
- .GetMSC = ARMSOCDRI2GetMSC,
- .AuthMagic = drmAuthMagic,
+ .version = 5,
+ .fd = pARMSOC->drmFD,
+ .driverName = "armsoc",
+ .deviceName = pARMSOC->deviceName,
+ .CreateBuffer = ARMSOCDRI2CreateBuffer,
+ .DestroyBuffer = ARMSOCDRI2DestroyBuffer,
+ .CopyRegion = ARMSOCDRI2CopyRegion,
+ .ScheduleSwap = ARMSOCDRI2ScheduleSwap,
+ .ScheduleWaitMSC = ARMSOCDRI2ScheduleWaitMSC,
+ .GetMSC = ARMSOCDRI2GetMSC,
+ .AuthMagic = drmAuthMagic,
};
int minor = 1, major = 0;
- if (xf86LoaderCheckSymbol("DRI2Version")) {
+ if (xf86LoaderCheckSymbol("DRI2Version"))
DRI2Version(&major, &minor);
- }
if (minor < 1) {
WARNING_MSG("DRI2 requires DRI2 module version 1.1.0 or later");
@@ -624,7 +625,7 @@ void
ARMSOCDRI2CloseScreen(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
while (pARMSOC->pending_flips > 0) {
DEBUG_MSG("waiting..");
drmmode_wait_for_event(pScrn);
diff --git a/src/armsoc_driver.c b/src/armsoc_driver.c
index 949646d..63bfc8e 100644
--- a/src/armsoc_driver.c
+++ b/src/armsoc_driver.c
@@ -48,7 +48,7 @@
#define DRM_DEVICE "/dev/dri/card0"
-Bool armsocDebug = 0;
+Bool armsocDebug;
/*
* Forward declarations:
@@ -59,7 +59,7 @@ static Bool ARMSOCProbe(DriverPtr drv, int flags);
static Bool ARMSOCPreInit(ScrnInfoPtr pScrn, int flags);
static Bool ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL);
static void ARMSOCLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
- LOCO * colors, VisualPtr pVisual);
+ LOCO *colors, VisualPtr pVisual);
static Bool ARMSOCCloseScreen(CLOSE_SCREEN_ARGS_DECL);
static Bool ARMSOCCreateScreenResources(ScreenPtr pScreen);
static void ARMSOCBlockHandler(BLOCKHANDLER_ARGS_DECL);
@@ -103,17 +103,19 @@ static SymTabRec ARMSOCChipsets[] = {
};
/** Supported options, as enum values. */
-typedef enum {
+enum {
OPTION_DEBUG,
OPTION_NO_FLIP,
- /* TODO: MIDEGL-1453: probably need to add an option to let user specify bus-id */
-} ARMSOCOpts;
+ /* TODO: MIDEGL-1453: probably need to add an option
+ * to let user specify bus-id
+ */
+};
/** Supported options. */
static const OptionInfoRec ARMSOCOptions[] = {
- { OPTION_DEBUG, "Debug", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_NO_FLIP, "NoFlip", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE }
+ { OPTION_DEBUG, "Debug", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_NO_FLIP, "NoFlip", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
};
/**
@@ -128,16 +130,16 @@ static struct ARMSOCConnection {
static int
ARMSOCSetDRMMaster(void)
{
- int ret=0;
+ int ret = 0;
- assert( connection.fd >=0 );
+ assert(connection.fd >= 0);
- if(!connection.master_count) {
+ if (!connection.master_count)
ret = drmSetMaster(connection.fd);
- }
- if(!ret) {
+
+ if (!ret)
connection.master_count++;
- }
+
return ret;
}
@@ -146,27 +148,26 @@ ARMSOCDropDRMMaster(void)
{
int ret = 0;
- assert( connection.fd >=0 );
- assert( connection.master_count > 0 );
+ assert(connection.fd >= 0);
+ assert(connection.master_count > 0);
- if(1 == connection.master_count) {
+ if (1 == connection.master_count)
ret = drmDropMaster(connection.fd);
- }
- if(!ret) {
+
+ if (!ret)
connection.master_count--;
- }
+
return ret;
}
static Bool
ARMSOCOpenDRM(ScrnInfoPtr pScrn)
{
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
drmSetVersion sv;
int err;
- if(-1 == connection.fd)
- {
+ if (-1 == connection.fd) {
assert(!connection.open_count);
assert(!connection.master_count);
pARMSOC->drmFD = open(DRM_DEVICE, O_RDWR, 0);
@@ -174,8 +175,9 @@ ARMSOCOpenDRM(ScrnInfoPtr pScrn)
ERROR_MSG("Cannot open a connection with the DRM.");
return FALSE;
}
- /* Check that what we are or can become drm master by attempting
- * a drmSetInterfaceVersion(). If successful this leaves us as master.
+ /* Check that what we are or can become drm master by
+ * attempting a drmSetInterfaceVersion(). If successful
+ * this leaves us as master.
* (see DRIOpenDRMMaster() in DRI1)
*/
sv.drm_di_major = 1;
@@ -192,9 +194,7 @@ ARMSOCOpenDRM(ScrnInfoPtr pScrn)
connection.fd = pARMSOC->drmFD;
connection.open_count = 1;
connection.master_count = 1;
- }
- else
- {
+ } else {
assert(connection.open_count);
connection.open_count++;
connection.master_count++;
@@ -211,13 +211,12 @@ ARMSOCOpenDRM(ScrnInfoPtr pScrn)
static void
ARMSOCCloseDRM(ScrnInfoPtr pScrn)
{
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
if (pARMSOC && (pARMSOC->drmFD >= 0)) {
drmFree(pARMSOC->deviceName);
connection.open_count--;
- if( !connection.open_count )
- {
+ if (!connection.open_count) {
assert(!connection.master_count);
drmClose(pARMSOC->drmFD);
connection.fd = -1;
@@ -230,14 +229,15 @@ ARMSOCCloseDRM(ScrnInfoPtr pScrn)
static MODULESETUPPROTO(ARMSOCSetup);
/** Provide basic version information to the XFree86 code. */
-static XF86ModuleVersionInfo ARMSOCVersRec =
-{
+static XF86ModuleVersionInfo ARMSOCVersRec = {
ARMSOC_DRIVER_NAME,
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
- PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL,
+ PACKAGE_VERSION_MAJOR,
+ PACKAGE_VERSION_MINOR,
+ PACKAGE_VERSION_PATCHLEVEL,
ABI_CLASS_VIDEODRV,
ABI_VIDEODRV_VERSION,
MOD_CLASS_VIDEODRV,
@@ -261,8 +261,8 @@ ARMSOCSetup(pointer module, pointer opts, int *errmaj, int *errmin)
setupDone = TRUE;
xf86AddDriver(&ARMSOC, module, 0);
- /* The return value must be non-NULL on success even though there is no
- * TearDownProc.
+ /* The return value must be non-NULL on success even
+ * though there is no TearDownProc.
*/
return (pointer) 1;
} else {
@@ -310,7 +310,7 @@ ARMSOCProbe(DriverPtr drv, int flags)
{
int i;
ScrnInfoPtr pScrn;
- GDevPtr *devSections=NULL;
+ GDevPtr *devSections = NULL;
int numDevSections;
Bool foundScreen = FALSE;
@@ -319,8 +319,8 @@ ARMSOCProbe(DriverPtr drv, int flags)
*/
numDevSections = xf86MatchDevice(ARMSOC_DRIVER_NAME, &devSections);
if (numDevSections <= 0) {
- EARLY_ERROR_MSG("Did not find any matching device section in "
- "configuration file");
+ EARLY_ERROR_MSG(
+ "Did not find any matching device section in configuration file");
if (flags & PROBE_DETECT) {
/* if we are probing, assume one and lets see if we can
* open the device to confirm it is there:
@@ -334,26 +334,32 @@ ARMSOCProbe(DriverPtr drv, int flags)
for (i = 0; i < numDevSections; i++) {
int fd = open(DRM_DEVICE, O_RDWR, 0);
if (fd != -1) {
- ARMSOCPtr pARMSOC;
+ struct ARMSOCRec *pARMSOC;
/* Allocate the ScrnInfoRec */
pScrn = xf86AllocateScreen(drv, 0);
if (!pScrn) {
- EARLY_ERROR_MSG("Cannot allocate a ScrnInfoPtr");
+ EARLY_ERROR_MSG(
+ "Cannot allocate a ScrnInfoPtr");
return FALSE;
}
- /* Allocate the driver's Screen-specific, "private" data structure
- * and hook it into the ScrnInfoRec's driverPrivate field. */
- pScrn->driverPrivate = calloc(1, sizeof(ARMSOCRec));
+ /* Allocate the driver's Screen-specific, "private"
+ * data structure and hook it into the ScrnInfoRec's
+ * driverPrivate field.
+ */
+ pScrn->driverPrivate =
+ calloc(1, sizeof(struct ARMSOCRec));
if (!pScrn->driverPrivate)
return FALSE;
pARMSOC = ARMSOCPTR(pScrn);
- pARMSOC->crtcNum = -1; /* intially mark to use all DRM crtc */
+ /* intially mark to use all DRM crtcs */
+ pARMSOC->crtcNum = -1;
if (flags & PROBE_DETECT) {
- /* just add the device.. we aren't a PCI device, so
- * call xf86AddBusDeviceToConfigure() directly
+ /* just add the device.. we aren't a PCI device,
+ * so call xf86AddBusDeviceToConfigure()
+ * directly
*/
xf86AddBusDeviceToConfigure(ARMSOC_DRIVER_NAME,
BUS_NONE, NULL, i);
@@ -363,16 +369,20 @@ ARMSOCProbe(DriverPtr drv, int flags)
}
if (devSections) {
- int entity = xf86ClaimNoSlot(drv, 0, devSections[i], TRUE);
+ int entity = xf86ClaimNoSlot(drv, 0,
+ devSections[i], TRUE);
xf86AddEntityToScreen(pScrn, entity);
}
- /* if there are multiple screens, use a separate crtc for each one */
- if(numDevSections > 1) {
+ /* if there are multiple screens, use a separate
+ * crtc for each one
+ */
+ if (numDevSections > 1)
pARMSOC->crtcNum = i;
- }
- xf86Msg(X_INFO,"Screen:%d, CRTC:%d\n", pScrn->scrnIndex, pARMSOC->crtcNum);
+ xf86Msg(X_INFO, "Screen:%d, CRTC:%d\n",
+ pScrn->scrnIndex,
+ pARMSOC->crtcNum);
foundScreen = TRUE;
@@ -403,7 +413,7 @@ ARMSOCProbe(DriverPtr drv, int flags)
static Bool
ARMSOCPreInit(ScrnInfoPtr pScrn, int flags)
{
- ARMSOCPtr pARMSOC;
+ struct ARMSOCRec *pARMSOC;
int default_depth, fbbpp;
rgb defaultWeight = { 0, 0, 0 };
rgb defaultMask = { 0, 0, 0 };
@@ -413,14 +423,16 @@ ARMSOCPreInit(ScrnInfoPtr pScrn, int flags)
TRACE_ENTER();
if (flags & PROBE_DETECT) {
- ERROR_MSG("The %s driver does not support the \"-configure\" or "
- "\"-probe\" command line arguments.", ARMSOC_NAME);
+ ERROR_MSG(
+ "The %s driver does not support the \"-configure\" or \"-probe\" command line arguments.",
+ ARMSOC_NAME);
return FALSE;
}
/* Check the number of entities, and fail if it isn't one. */
if (pScrn->numEntities != 1) {
- ERROR_MSG("Driver expected 1 entity, but found %d for screen %d",
+ ERROR_MSG(
+ "Driver expected 1 entity, but found %d for screen %d",
pScrn->numEntities, pScrn->scrnIndex);
return FALSE;
}
@@ -460,21 +472,24 @@ ARMSOCPreInit(ScrnInfoPtr pScrn, int flags)
/* We don't support 8-bit depths: */
if (pScrn->depth < 16) {
- ERROR_MSG("The requested default visual (%s) has an unsupported "
- "depth (%d).",
- xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
+ ERROR_MSG(
+ "The requested default visual (%s) has an unsupported depth (%d).",
+ xf86GetVisualName(pScrn->defaultVisual),
+ pScrn->depth);
goto fail;
}
/* Using a programmable clock: */
pScrn->progClock = TRUE;
- /* Open a connection to the DRM, so we can communicate with the KMS code: */
- if (!ARMSOCOpenDRM(pScrn)) {
+ /* Open a connection to the DRM, so we can communicate
+ * with the KMS code:
+ */
+ if (!ARMSOCOpenDRM(pScrn))
goto fail;
- }
- pARMSOC->drmmode_interface = drmmode_interface_get_implementation(pARMSOC->drmFD);
+ pARMSOC->drmmode_interface =
+ drmmode_interface_get_implementation(pARMSOC->drmFD);
if (!pARMSOC->drmmode_interface)
goto fail2;
@@ -497,19 +512,24 @@ ARMSOCPreInit(ScrnInfoPtr pScrn, int flags)
* Process the "xorg.conf" file options:
*/
xf86CollectOptions(pScrn, NULL);
- if (!(pARMSOC->pOptionInfo = calloc(1, sizeof(ARMSOCOptions))))
+ pARMSOC->pOptionInfo = calloc(1, sizeof(ARMSOCOptions));
+ if (!pARMSOC->pOptionInfo)
goto fail2;
+
memcpy(pARMSOC->pOptionInfo, ARMSOCOptions, sizeof(ARMSOCOptions));
- xf86ProcessOptions(pScrn->scrnIndex, pARMSOC->pEntityInfo->device->options,
+ xf86ProcessOptions(pScrn->scrnIndex,
+ pARMSOC->pEntityInfo->device->options,
pARMSOC->pOptionInfo);
/* Determine if the user wants debug messages turned on: */
- armsocDebug = xf86ReturnOptValBool(pARMSOC->pOptionInfo, OPTION_DEBUG, FALSE);
+ armsocDebug = xf86ReturnOptValBool(pARMSOC->pOptionInfo,
+ OPTION_DEBUG, FALSE);
/* Determine if user wants to disable buffer flipping: */
pARMSOC->NoFlip = xf86ReturnOptValBool(pARMSOC->pOptionInfo,
OPTION_NO_FLIP, FALSE);
- INFO_MSG("Buffer Flipping is %s", pARMSOC->NoFlip ? "Disabled" : "Enabled");
+ INFO_MSG("Buffer Flipping is %s",
+ pARMSOC->NoFlip ? "Disabled" : "Enabled");
/*
* Select the video modes:
@@ -521,7 +541,8 @@ ARMSOCPreInit(ScrnInfoPtr pScrn, int flags)
*/
/* Do initial KMS setup: */
- if (!drmmode_pre_init(pScrn, pARMSOC->drmFD, (pScrn->bitsPerPixel >> 3))) {
+ if (!drmmode_pre_init(pScrn, pARMSOC->drmFD,
+ (pScrn->bitsPerPixel >> 3))) {
ERROR_MSG("Cannot get KMS resources");
goto fail2;
} else {
@@ -540,7 +561,8 @@ ARMSOCPreInit(ScrnInfoPtr pScrn, int flags)
case 32:
break;
default:
- ERROR_MSG("The requested number of bits per pixel (%d) is unsupported.",
+ ERROR_MSG(
+ "The requested number of bits per pixel (%d) is unsupported.",
pScrn->bitsPerPixel);
goto fail2;
}
@@ -575,29 +597,28 @@ static void
ARMSOCAccelInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
- if (!pARMSOC->pARMSOCEXA) {
- pARMSOC->pARMSOCEXA = InitNullEXA(pScreen, pScrn, pARMSOC->drmFD);
- }
+ if (!pARMSOC->pARMSOCEXA)
+ pARMSOC->pARMSOCEXA = InitNullEXA(pScreen, pScrn,
+ pARMSOC->drmFD);
- if (pARMSOC->pARMSOCEXA) {
+ if (pARMSOC->pARMSOCEXA)
pARMSOC->dri = ARMSOCDRI2ScreenInit(pScreen);
- } else {
+ else
pARMSOC->dri = FALSE;
- }
}
/**
* The driver's ScreenInit() function, called at the start of each server
- * generation. Fill in pScreen, map the frame buffer, save state,
+ * generation. Fill in pScreen, map the frame buffer, save state,
* initialize the mode, etc.
*/
static Bool
ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
VisualPtr visual;
xf86CrtcConfigPtr xf86_config;
int j;
@@ -605,7 +626,7 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
TRACE_ENTER();
/* set drm master before allocating scanout buffer */
- if(ARMSOCSetDRMMaster()) {
+ if (ARMSOCSetDRMMaster()) {
ERROR_MSG("Cannot get DRM master: %s", strerror(errno));
goto fail;
}
@@ -615,12 +636,13 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
assert(!pARMSOC->scanout);
pARMSOC->scanout = armsoc_bo_new_with_dim(pARMSOC->dev, pScrn->virtualX,
pScrn->virtualY, pScrn->depth, pScrn->bitsPerPixel,
- ARMSOC_BO_SCANOUT );
+ ARMSOC_BO_SCANOUT);
if (!pARMSOC->scanout) {
ERROR_MSG("Cannot allocate scanout buffer\n");
goto fail1;
}
- pScrn->displayWidth = armsoc_bo_pitch(pARMSOC->scanout) / ((pScrn->bitsPerPixel+7) / 8);
+ pScrn->displayWidth = armsoc_bo_pitch(pARMSOC->scanout) /
+ ((pScrn->bitsPerPixel+7) / 8);
xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
/* need to point to new screen on server regeneration */
@@ -643,19 +665,22 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
/* Reset the visual list. */
miClearVisualTypes();
- if (!miSetVisualTypes(pScrn->bitsPerPixel, miGetDefaultVisualMask(pScrn->depth),
+ if (!miSetVisualTypes(pScrn->bitsPerPixel,
+ miGetDefaultVisualMask(pScrn->depth),
pScrn->rgbBits, pScrn->defaultVisual)) {
- ERROR_MSG("Cannot initialize the visual type for %d bits per pixel!",
+ ERROR_MSG(
+ "Cannot initialize the visual type for %d bits per pixel!",
pScrn->bitsPerPixel);
goto fail2;
}
- if(pScrn->bitsPerPixel == 32 && pScrn->depth == 24) {
+ if (pScrn->bitsPerPixel == 32 && pScrn->depth == 24) {
/* Also add a 24 bit depth visual */
if (!miSetVisualTypes(24, miGetDefaultVisualMask(pScrn->depth),
pScrn->rgbBits, pScrn->defaultVisual)) {
- WARNING_MSG("Cannot initialize a 24 depth visual for 32bpp");
- }else{
+ WARNING_MSG(
+ "Cannot initialize a 24 depth visual for 32bpp");
+ } else {
INFO_MSG("Initialized a 24 depth visual for 32bpp");
}
}
@@ -689,8 +714,8 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
}
}
- /* Continue initializing the generic 2D drawing functions after fixing the
- * RGB ordering:
+ /* Continue initializing the generic 2D drawing functions after
+ * fixing the RGB ordering:
*/
if (!fbPictureInit(pScreen, NULL, 0)) {
ERROR_MSG("fbPictureInit() failed!");
@@ -709,11 +734,11 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
/* Initialize backing store: */
xf86SetBackingStore(pScreen);
- /* Cause the cursor position to be updated by the mouse signal handler: */
+ /* Enable cursor position updates by mouse signal handler: */
xf86SetSilkenMouse(pScreen);
/* Initialize the cursor: */
- if(!miDCInitialize(pScreen, xf86GetPointerScreenFuncs())) {
+ if (!miDCInitialize(pScreen, xf86GetPointerScreenFuncs())) {
ERROR_MSG("miDCInitialize() failed!");
goto fail5;
}
@@ -727,8 +752,8 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
*/
pScrn->vtSema = TRUE;
- /* Take over the virtual terminal from the console, set the desired mode,
- * etc.:
+ /* Take over the virtual terminal from the console, set the
+ * desired mode, etc.:
*/
if (!ARMSOCEnterVT(VT_FUNC_ARGS(0))) {
ERROR_MSG("ARMSOCEnterVT() failed!");
@@ -756,7 +781,8 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
/* Wrap some screen functions: */
wrap(pARMSOC, pScreen, CloseScreen, ARMSOCCloseScreen);
- wrap(pARMSOC, pScreen, CreateScreenResources, ARMSOCCreateScreenResources);
+ wrap(pARMSOC, pScreen, CreateScreenResources,
+ ARMSOCCreateScreenResources);
wrap(pARMSOC, pScreen, BlockHandler, ARMSOCBlockHandler);
drmmode_screen_init(pScrn);
@@ -776,17 +802,17 @@ fail6:
drmmode_cursor_fini(pScreen);
fail5:
- if (pARMSOC->dri) {
+ if (pARMSOC->dri)
ARMSOCDRI2CloseScreen(pScreen);
- }
- if (pARMSOC->pARMSOCEXA) {
- if (pARMSOC->pARMSOCEXA->CloseScreen) {
- pARMSOC->pARMSOCEXA->CloseScreen(pScrn->scrnIndex, pScreen);
- }
- }
+
+ if (pARMSOC->pARMSOCEXA)
+ if (pARMSOC->pARMSOCEXA->CloseScreen)
+ pARMSOC->pARMSOCEXA->CloseScreen(pScrn->scrnIndex,
+ pScreen);
fail4:
/* Call the CloseScreen functions for fbInitScreen, miDCInitialize,
- * exaDriverInit & xf86CrtcScreenInit as appropriate via their wrapped pointers.
+ * exaDriverInit & xf86CrtcScreenInit as appropriate via their
+ * wrapped pointers.
* exaDDXCloseScreen uses the XF86SCRNINFO macro so we must
* set up the key for this before it gets called.
*/
@@ -815,7 +841,7 @@ fail:
static void
ARMSOCLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
- LOCO * colors, VisualPtr pVisual)
+ LOCO *colors, VisualPtr pVisual)
{
TRACE_ENTER();
TRACE_EXIT();
@@ -832,29 +858,27 @@ static Bool
ARMSOCCloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
TRACE_ENTER();
drmmode_screen_fini(pScrn);
- if (pARMSOC->dri) {
+ if (pARMSOC->dri)
ARMSOCDRI2CloseScreen(pScreen);
- }
- if (pARMSOC->pARMSOCEXA) {
- if (pARMSOC->pARMSOCEXA->CloseScreen) {
+
+ if (pARMSOC->pARMSOCEXA)
+ if (pARMSOC->pARMSOCEXA->CloseScreen)
pARMSOC->pARMSOCEXA->CloseScreen(CLOSE_SCREEN_ARGS);
- }
- }
/* release the scanout buffer */
armsoc_bo_unreference(pARMSOC->scanout);
pARMSOC->scanout = NULL;
pScrn->displayWidth = 0;
- if (pScrn->vtSema == TRUE) {
+ if (pScrn->vtSema == TRUE)
ARMSOCLeaveVT(VT_FUNC_ARGS(0));
- }
+
pScrn->vtSema = FALSE;
unwrap(pARMSOC, pScreen, CloseScreen);
@@ -878,7 +902,7 @@ static Bool
ARMSOCCreateScreenResources(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
swap(pARMSOC, pScreen, CreateScreenResources);
if (!(*pScreen->CreateScreenResources) (pScreen))
@@ -894,7 +918,7 @@ ARMSOCBlockHandler(BLOCKHANDLER_ARGS_DECL)
{
SCREEN_PTR(arg);
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
swap(pARMSOC, pScreen, BlockHandler);
(*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
@@ -985,23 +1009,23 @@ ARMSOCLeaveVT(VT_FUNC_ARGS_DECL)
}
ret = ARMSOCDropDRMMaster();
- if (ret) {
+ if (ret)
WARNING_MSG("drmDropMaster failed: %s", strerror(errno));
- }
TRACE_EXIT();
}
/**
* The driver's FreeScreen() function.
- * Frees the ScrnInfoRec driverPrivate field when a screen is deleted by the common layer.
+ * Frees the ScrnInfoRec driverPrivate field when a screen is
+ * deleted by the common layer.
* This function is not used in normal (error free) operation.
*/
static void
ARMSOCFreeScreen(FREE_SCREEN_ARGS_DECL)
{
SCRN_INFO_PTR(arg);
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
TRACE_ENTER();
@@ -1011,9 +1035,9 @@ ARMSOCFreeScreen(FREE_SCREEN_ARGS_DECL)
}
if (pARMSOC->pARMSOCEXA) {
- if (pARMSOC->pARMSOCEXA->FreeScreen) {
- pARMSOC->pARMSOCEXA->FreeScreen(FREE_SCREEN_ARGS(pScrn));
- }
+ if (pARMSOC->pARMSOCEXA->FreeScreen)
+ pARMSOC->pARMSOCEXA->FreeScreen(
+ FREE_SCREEN_ARGS(pScrn));
}
armsoc_device_del(pARMSOC->dev);
diff --git a/src/armsoc_driver.h b/src/armsoc_driver.h
index 6c9c29b..2ced536 100644
--- a/src/armsoc_driver.h
+++ b/src/armsoc_driver.h
@@ -39,9 +39,12 @@
#include <errno.h>
#include "armsoc_exa.h"
-#define ARMSOC_VERSION 1000 /* Apparently not used by X server */
-#define ARMSOC_NAME "ARMSOC" /* Name used to prefix messages */
-#define ARMSOC_DRIVER_NAME "armsoc" /* Driver name as used in config file */
+/* Apparently not used by X server */
+#define ARMSOC_VERSION 1000
+/* Name used to prefix messages */
+#define ARMSOC_NAME "ARMSOC"
+/* Driver name as used in config file */
+#define ARMSOC_DRIVER_NAME "armsoc"
#define ARMSOC_SUPPORT_GAMMA 0
@@ -56,14 +59,23 @@ extern _X_EXPORT Bool armsocDebug;
* sub-modules:
*/
#define TRACE_ENTER() \
- do { if (armsocDebug) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:%d: Entering\n",\
- __FUNCTION__, __LINE__); } while (0)
+ do { if (armsocDebug) \
+ xf86DrvMsg(pScrn->scrnIndex, \
+ X_INFO, "%s:%d: Entering\n",\
+ __func__, __LINE__);\
+ } while (0)
#define TRACE_EXIT() \
- do { if (armsocDebug) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:%d: Exiting\n",\
- __FUNCTION__, __LINE__); } while (0)
+ do { if (armsocDebug) \
+ xf86DrvMsg(pScrn->scrnIndex, \
+ X_INFO, "%s:%d: Exiting\n",\
+ __func__, __LINE__); \
+ } while (0)
#define DEBUG_MSG(fmt, ...) \
- do { if (armsocDebug) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:%d " fmt "\n",\
- __FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0)
+ do { if (armsocDebug) \
+ xf86DrvMsg(pScrn->scrnIndex, \
+ X_INFO, "%s:%d " fmt "\n",\
+ __func__, __LINE__, ##__VA_ARGS__); \
+ } while (0)
#define INFO_MSG(fmt, ...) \
do { xf86DrvMsg(pScrn->scrnIndex, X_INFO, fmt "\n",\
##__VA_ARGS__); } while (0)
@@ -71,23 +83,27 @@ extern _X_EXPORT Bool armsocDebug;
do { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, fmt "\n",\
##__VA_ARGS__); } while (0)
#define WARNING_MSG(fmt, ...) \
- do { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "WARNING: " fmt "\n",\
- ##__VA_ARGS__); } while (0)
+ do { xf86DrvMsg(pScrn->scrnIndex, \
+ X_WARNING, "WARNING: " fmt "\n",\
+ ##__VA_ARGS__); \
+ } while (0)
#define ERROR_MSG(fmt, ...) \
- do { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ERROR: " fmt "\n",\
- ##__VA_ARGS__); } while (0)
+ do { xf86DrvMsg(pScrn->scrnIndex, \
+ X_ERROR, "ERROR: " fmt "\n",\
+ ##__VA_ARGS__); \
+ } while (0)
#define EARLY_ERROR_MSG(fmt, ...) \
do { xf86Msg(X_ERROR, "ERROR: " fmt "\n",\
- ##__VA_ARGS__); } while (0)
+ ##__VA_ARGS__); \
+ } while (0)
/** The driver's Screen-specific, "private" data structure. */
-typedef struct _ARMSOCRec
-{
+struct ARMSOCRec {
/**
* Pointer to a structure used to communicate and coordinate with an
* external EXA library (if loaded).
*/
- ARMSOCEXAPtr pARMSOCEXA;
+ struct ARMSOCEXARec *pARMSOCEXA;
/** record if ARMSOCDRI2ScreenInit() was successful */
Bool dri;
@@ -98,7 +114,7 @@ typedef struct _ARMSOCRec
/** File descriptor of the connection with the DRM. */
int drmFD;
- char *deviceName;
+ char *deviceName;
/** interface to hardware specific functionality */
struct drmmode_interface *drmmode_interface;
@@ -128,30 +144,30 @@ typedef struct _ARMSOCRec
/* Identify which CRTC to use. -1 uses all CRTCs */
int crtcNum;
-} ARMSOCRec, *ARMSOCPtr;
+};
/*
* Misc utility macros:
*/
/** Return a pointer to the driver's private structure. */
-#define ARMSOCPTR(p) ((ARMSOCPtr)((p)->driverPrivate))
+#define ARMSOCPTR(p) ((struct ARMSOCRec *)((p)->driverPrivate))
#define ARMSOCPTR_FROM_SCREEN(pScreen) \
- ((ARMSOCPtr)(xf86Screens[(pScreen)->myNum])->driverPrivate);
+ ((struct ARMSOCRec *)(xf86Screens[(pScreen)->myNum])->driverPrivate);
#define wrap(priv, real, mem, func) {\
- priv->Saved##mem = real->mem; \
- real->mem = func; \
+ priv->Saved##mem = real->mem; \
+ real->mem = func; \
}
#define unwrap(priv, real, mem) {\
- real->mem = priv->Saved##mem; \
+ real->mem = priv->Saved##mem; \
}
#define swap(priv, real, mem) {\
- void *tmp = priv->Saved##mem; \
- priv->Saved##mem = real->mem; \
- real->mem = tmp; \
+ void *tmp = priv->Saved##mem; \
+ priv->Saved##mem = real->mem; \
+ real->mem = tmp; \
}
#define exchange(a, b) {\
@@ -180,10 +196,10 @@ void drmmode_cursor_fini(ScreenPtr pScreen);
/**
* DRI2 functions..
*/
-typedef struct _ARMSOCDRISwapCmd ARMSOCDRISwapCmd;
+struct ARMSOCDRISwapCmd;
Bool ARMSOCDRI2ScreenInit(ScreenPtr pScreen);
void ARMSOCDRI2CloseScreen(ScreenPtr pScreen);
-void ARMSOCDRI2SwapComplete(ARMSOCDRISwapCmd *cmd);
+void ARMSOCDRI2SwapComplete(struct ARMSOCDRISwapCmd *cmd);
/**
* DRI2 util functions..
diff --git a/src/armsoc_dumb.c b/src/armsoc_dumb.c
index ab065c9..b067fcd 100644
--- a/src/armsoc_dumb.c
+++ b/src/armsoc_dumb.c
@@ -55,14 +55,17 @@ struct armsoc_bo {
uint32_t pitch;
int refcnt;
int dmabuf;
- /* initial size of backing memory. Used on resize to check if the new size will fit */
+ /* initial size of backing memory. Used on resize to
+ * check if the new size will fit
+ */
uint32_t original_size;
};
/* device related functions:
*/
-struct armsoc_device *armsoc_device_new(int fd, uint32_t dumb_scanout_flags, uint32_t dumb_no_scanout_flags)
+struct armsoc_device *armsoc_device_new(int fd, uint32_t dumb_scanout_flags,
+ uint32_t dumb_no_scanout_flags)
{
struct armsoc_device *new_dev = malloc(sizeof(*new_dev));
if (!new_dev)
@@ -93,15 +96,13 @@ int armsoc_bo_set_dmabuf(struct armsoc_bo *bo)
/* Try to get dma_buf fd */
prime_handle.handle = bo->handle;
prime_handle.flags = 0;
- res = drmIoctl(bo->dev->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &prime_handle);
+ res = drmIoctl(bo->dev->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD,
+ &prime_handle);
if (res)
- {
res = errno;
- }
else
- {
bo->dmabuf = prime_handle.fd;
- }
+
return res;
}
@@ -135,23 +136,19 @@ struct armsoc_bo *armsoc_bo_new_with_dim(struct armsoc_device *dev,
create_dumb.height = height;
create_dumb.width = width;
create_dumb.bpp = bpp;
- assert((ARMSOC_BO_SCANOUT == buf_type) || (ARMSOC_BO_NON_SCANOUT == buf_type));
+ assert((ARMSOC_BO_SCANOUT == buf_type) ||
+ (ARMSOC_BO_NON_SCANOUT == buf_type));
if (ARMSOC_BO_SCANOUT == buf_type)
- {
create_dumb.flags = dev->dumb_scanout_flags;
- }
else
- {
create_dumb.flags = dev->dumb_no_scanout_flags;
- }
res = drmIoctl(dev->fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_dumb);
- if (res)
- {
+ if (res) {
free(new_buf);
- xf86DrvMsg(-1, X_ERROR, "_CREATE_DUMB("
- "{height: 0x%X, width: 0x%X, bpp: 0x%X, flags: 0x%X}) "
- "failed. errno:0x%X\n",height,width,bpp,create_dumb.flags,errno);
+ xf86DrvMsg(-1, X_ERROR,
+ "_CREATE_DUMB({height: 0x%X, width: 0x%X, bpp: 0x%X, flags: 0x%X}) failed. errno:0x%X\n",
+ height, width, bpp, create_dumb.flags, errno);
return NULL;
}
@@ -179,27 +176,27 @@ static void armsoc_bo_del(struct armsoc_bo *bo)
if (!bo)
return;
+
assert(bo->refcnt == 0);
assert(bo->dmabuf < 0);
- if (bo->map_addr)
- {
+ if (bo->map_addr) {
/* always map/unmap the full buffer for consistency */
munmap(bo->map_addr, bo->original_size);
}
- if (bo->fb_id)
- {
+ if (bo->fb_id) {
res = drmModeRmFB(bo->dev->fd, bo->fb_id);
- if(res) {
- xf86DrvMsg(-1, X_ERROR, "drmModeRmFb failed %d : %s\n", res, strerror(errno));
- }
+ if (res)
+ xf86DrvMsg(-1, X_ERROR, "drmModeRmFb failed %d : %s\n",
+ res, strerror(errno));
}
destroy_dumb.handle = bo->handle;
res = drmIoctl(bo->dev->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
- if(res) {
- xf86DrvMsg(-1, X_ERROR, "destroy dumb failed %d : %s\n", res, strerror(errno));
- }
+ if (res)
+ xf86DrvMsg(-1, X_ERROR, "destroy dumb failed %d : %s\n",
+ res, strerror(errno));
+
free(bo);
}
@@ -274,8 +271,7 @@ uint32_t armsoc_bo_pitch(struct armsoc_bo *bo)
void *armsoc_bo_map(struct armsoc_bo *bo)
{
assert(bo->refcnt > 0);
- if (!bo->map_addr)
- {
+ if (!bo->map_addr) {
struct drm_mode_map_dumb map_dumb;
int res;
@@ -286,12 +282,12 @@ void *armsoc_bo_map(struct armsoc_bo *bo)
return NULL;
/* always map/unmap the full buffer for consistency */
- bo->map_addr = mmap(NULL, bo->original_size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->dev->fd, map_dumb.offset);
+ bo->map_addr = mmap(NULL, bo->original_size,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ bo->dev->fd, map_dumb.offset);
if (bo->map_addr == MAP_FAILED)
- {
bo->map_addr = NULL;
- }
}
return bo->map_addr;
@@ -302,23 +298,22 @@ int armsoc_bo_cpu_prep(struct armsoc_bo *bo, enum armsoc_gem_op op)
int ret = 0;
assert(bo->refcnt > 0);
- if(armsoc_bo_has_dmabuf(bo))
- {
+ if (armsoc_bo_has_dmabuf(bo)) {
fd_set fds;
- const struct timeval timeout = {10,0}; /* 10s before printing a msg */
+ /* 10s before printing a msg */
+ const struct timeval timeout = {10, 0};
struct timeval t;
+
FD_ZERO(&fds);
FD_SET(bo->dmabuf, &fds);
- do
- {
+ do {
t = timeout;
ret = select(bo->dmabuf+1, &fds, NULL, NULL, &t);
if (ret == 0)
- {
- xf86DrvMsg(-1, X_ERROR, "select() on dma_buf fd has timed-out\n");
- }
- }while ( (ret == -1 && errno == EINTR) || ret == 0 );
+ xf86DrvMsg(-1, X_ERROR,
+ "select() on dma_buf fd has timed-out\n");
+ } while ((ret == -1 && errno == EINTR) || ret == 0);
if (ret > 0)
ret = 0;
@@ -355,9 +350,10 @@ int armsoc_bo_rm_fb(struct armsoc_bo *bo)
assert(bo->refcnt > 0);
assert(bo->fb_id != 0);
- ret = drmModeRmFB( bo->dev->fd, bo->fb_id );
- if( ret < 0 ) {
- xf86DrvMsg(-1, X_ERROR, "Could not remove fb from bo %d\n", ret);
+ ret = drmModeRmFB(bo->dev->fd, bo->fb_id);
+ if (ret < 0) {
+ xf86DrvMsg(-1, X_ERROR,
+ "Could not remove fb from bo %d\n", ret);
return ret;
}
bo->fb_id = 0;
@@ -375,14 +371,16 @@ int armsoc_bo_clear(struct armsoc_bo *bo)
unsigned char *dst;
assert(bo->refcnt > 0);
- if (!(dst = armsoc_bo_map(bo))) {
+ dst = armsoc_bo_map(bo);
+ if (!dst) {
xf86DrvMsg(-1, X_ERROR,
"Couldn't map scanout bo\n");
return -1;
}
- if( armsoc_bo_cpu_prep(bo, ARMSOC_GEM_WRITE)) {
- xf86DrvMsg(-1, X_ERROR," %s: armsoc_bo_cpu_prep failed - "
- "unable to synchronise access.\n", __FUNCTION__);
+ if (armsoc_bo_cpu_prep(bo, ARMSOC_GEM_WRITE)) {
+ xf86DrvMsg(-1, X_ERROR,
+ " %s: armsoc_bo_cpu_prep failed - unable to synchronise access.\n",
+ __func__);
return -1;
}
memset(dst, 0x0, bo->size);
@@ -390,33 +388,40 @@ int armsoc_bo_clear(struct armsoc_bo *bo)
return 0;
}
-int armsoc_bo_resize(struct armsoc_bo *bo, uint32_t new_width, uint32_t new_height)
+int armsoc_bo_resize(struct armsoc_bo *bo, uint32_t new_width,
+ uint32_t new_height)
{
uint32_t new_size;
uint32_t new_pitch;
- assert( bo != NULL );
- assert( new_width > 0 );
- assert( new_height > 0 );
- assert( bo->fb_id == 0 ); /* The caller must remove the fb object before attempting to resize. */
+ assert(bo != NULL);
+ assert(new_width > 0);
+ assert(new_height > 0);
+ /* The caller must remove the fb object before
+ * attempting to resize.
+ */
+ assert(bo->fb_id == 0);
assert(bo->refcnt > 0);
xf86DrvMsg(-1, X_INFO, "Resizing bo from %dx%d to %dx%d\n",
- bo->width, bo->height, new_width, new_height);
+ bo->width, bo->height, new_width, new_height);
- /* TODO: MIDEGL-1563: Get pitch from DRM as only DRM knows the ideal pitch and alignment requirements */
+ /* TODO: MIDEGL-1563: Get pitch from DRM as
+ * only DRM knows the ideal pitch and alignment
+ * requirements
+ * */
new_pitch = new_width * ((armsoc_bo_bpp(bo)+7)/8);
/* Align pitch to 64 byte */
new_pitch = ALIGN(new_pitch, 64);
- new_size = (((new_height-1) * new_pitch) + (new_width * ((armsoc_bo_bpp(bo)+7)/8)));
-
- if( new_size <= bo->original_size )
- {
- bo->width = new_width;
- bo->height = new_height;
- bo->pitch = new_pitch;
- bo->size = new_size;
- return 0;
+ new_size = (((new_height-1) * new_pitch) +
+ (new_width * ((armsoc_bo_bpp(bo)+7)/8)));
+
+ if (new_size <= bo->original_size) {
+ bo->width = new_width;
+ bo->height = new_height;
+ bo->pitch = new_pitch;
+ bo->size = new_size;
+ return 0;
}
xf86DrvMsg(-1, X_ERROR, "Failed to resize buffer\n");
return -1;
diff --git a/src/armsoc_dumb.h b/src/armsoc_dumb.h
index 8f1286e..660c455 100644
--- a/src/armsoc_dumb.h
+++ b/src/armsoc_dumb.h
@@ -40,19 +40,22 @@ enum armsoc_buf_type {
ARMSOC_BO_NON_SCANOUT
};
-struct armsoc_device *armsoc_device_new(int fd, uint32_t dumb_scanout_flags, uint32_t dumb_no_scanout_flags);
+struct armsoc_device *armsoc_device_new(int fd, uint32_t dumb_scanout_flags,
+ uint32_t dumb_no_scanout_flags);
void armsoc_device_del(struct armsoc_device *dev);
int armsoc_bo_get_name(struct armsoc_bo *bo, uint32_t *name);
uint32_t armsoc_bo_handle(struct armsoc_bo *bo);
void *armsoc_bo_map(struct armsoc_bo *bo);
-int armsoc_get_param(struct armsoc_device *dev, uint64_t param, uint64_t *value);
+int armsoc_get_param(struct armsoc_device *dev, uint64_t param,
+ uint64_t *value);
int armsoc_bo_add_fb(struct armsoc_bo *bo);
uint32_t armsoc_bo_get_fb(struct armsoc_bo *bo);
int armsoc_bo_cpu_prep(struct armsoc_bo *bo, enum armsoc_gem_op op);
int armsoc_bo_cpu_fini(struct armsoc_bo *bo, enum armsoc_gem_op op);
uint32_t armsoc_bo_size(struct armsoc_bo *bo);
-struct armsoc_bo *armsoc_bo_new_with_dim(struct armsoc_device *dev, uint32_t width,
+struct armsoc_bo *armsoc_bo_new_with_dim(struct armsoc_device *dev,
+ uint32_t width,
uint32_t height, uint8_t depth, uint8_t bpp,
enum armsoc_buf_type buf_type);
uint32_t armsoc_bo_width(struct armsoc_bo *bo);
@@ -63,13 +66,16 @@ uint32_t armsoc_bo_pitch(struct armsoc_bo *bo);
void armsoc_bo_reference(struct armsoc_bo *bo);
void armsoc_bo_unreference(struct armsoc_bo *bo);
-/* When dmabuf is set on a bo, armsoc_bo_cpu_prep() waits for KDS shared access */
+/* When dmabuf is set on a bo, armsoc_bo_cpu_prep()
+ * waits for KDS shared access
+ */
int armsoc_bo_set_dmabuf(struct armsoc_bo *bo);
void armsoc_bo_clear_dmabuf(struct armsoc_bo *bo);
int armsoc_bo_has_dmabuf(struct armsoc_bo *bo);
int armsoc_bo_clear(struct armsoc_bo *bo);
int armsoc_bo_rm_fb(struct armsoc_bo *bo);
-int armsoc_bo_resize(struct armsoc_bo *bo, uint32_t new_width, uint32_t new_height);
+int armsoc_bo_resize(struct armsoc_bo *bo, uint32_t new_width,
+ uint32_t new_height);
#endif /* ARMSOC_DUMB_H_ */
diff --git a/src/armsoc_exa.c b/src/armsoc_exa.c
index 6a276e7..8aaa297 100644
--- a/src/armsoc_exa.c
+++ b/src/armsoc_exa.c
@@ -34,12 +34,12 @@
#include "armsoc_driver.h"
/* keep this here, instead of static-inline so submodule doesn't
- * need to know layout of ARMSOCPtr..
+ * need to know layout of ARMSOCRec.
*/
-_X_EXPORT ARMSOCEXAPtr
+_X_EXPORT struct ARMSOCEXARec *
ARMSOCEXAPTR(ScrnInfoPtr pScrn)
{
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
return pARMSOC->pARMSOCEXA;
}
@@ -53,23 +53,20 @@ ARMSOCEXAPTR(ScrnInfoPtr pScrn)
void
ARMSOCPixmapExchange(PixmapPtr a, PixmapPtr b)
{
- ARMSOCPixmapPrivPtr apriv = exaGetPixmapDriverPrivate(a);
- ARMSOCPixmapPrivPtr bpriv = exaGetPixmapDriverPrivate(b);
+ struct ARMSOCPixmapPrivRec *apriv = exaGetPixmapDriverPrivate(a);
+ struct ARMSOCPixmapPrivRec *bpriv = exaGetPixmapDriverPrivate(b);
exchange(apriv->priv, bpriv->priv);
exchange(apriv->bo, bpriv->bo);
/* Ensure neither pixmap has a dmabuf fd attached to the bo if the
* ext_access_cnt refcount is 0, as it will never be cleared. */
- if (armsoc_bo_has_dmabuf(apriv->bo) && !apriv->ext_access_cnt)
- {
+ if (armsoc_bo_has_dmabuf(apriv->bo) && !apriv->ext_access_cnt) {
armsoc_bo_clear_dmabuf(apriv->bo);
/* Should only have to clear one dmabuf fd, otherwise the
* refcount is wrong */
assert(!armsoc_bo_has_dmabuf(bpriv->bo));
- }
- else if (armsoc_bo_has_dmabuf(bpriv->bo) && !bpriv->ext_access_cnt)
- {
+ } else if (armsoc_bo_has_dmabuf(bpriv->bo) && !bpriv->ext_access_cnt) {
armsoc_bo_clear_dmabuf(bpriv->bo);
assert(!armsoc_bo_has_dmabuf(apriv->bo));
@@ -77,34 +74,29 @@ ARMSOCPixmapExchange(PixmapPtr a, PixmapPtr b)
}
_X_EXPORT void *
-ARMSOCCreatePixmap2 (ScreenPtr pScreen, int width, int height,
+ARMSOCCreatePixmap2(ScreenPtr pScreen, int width, int height,
int depth, int usage_hint, int bitsPerPixel,
int *new_fb_pitch)
{
- ARMSOCPixmapPrivPtr priv = calloc(sizeof(ARMSOCPixmapPrivRec), 1);
+ struct ARMSOCPixmapPrivRec *priv =
+ calloc(sizeof(struct ARMSOCPixmapPrivRec), 1);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
enum armsoc_buf_type buf_type = ARMSOC_BO_NON_SCANOUT;
- if(!priv)
- {
+ if (!priv)
return NULL;
- }
if (usage_hint & ARMSOC_CREATE_PIXMAP_SCANOUT)
- {
buf_type = ARMSOC_BO_SCANOUT;
- }
- if (width > 0 && height > 0 && depth > 0 && bitsPerPixel > 0)
- {
+ if (width > 0 && height > 0 && depth > 0 && bitsPerPixel > 0) {
priv->bo = armsoc_bo_new_with_dim(pARMSOC->dev,
width,
height,
depth,
bitsPerPixel, buf_type);
- if (!priv->bo)
- {
+ if (!priv->bo) {
ERROR_MSG("failed to allocate %dx%d bo, buf_type = %d",
width, height, buf_type);
free(priv);
@@ -113,11 +105,11 @@ ARMSOCCreatePixmap2 (ScreenPtr pScreen, int width, int height,
*new_fb_pitch = armsoc_bo_pitch(priv->bo);
}
- /* The usage_hint field of the Pixmap passed to ModifyPixmapHeader is not
- * set to the usage_hint parameter passed to CreatePixmap.
- * It does appear to be set here so we stash it in the private structure.
- * However as we do not fully understand the uses of this parameter
- * beware of any unexpected values!
+ /* The usage_hint field of the Pixmap passed to ModifyPixmapHeader is
+ * not set to the usage_hint parameter passed to CreatePixmap.
+ * It does appear to be set here so we stash it in the private
+ * structure. However as we do not fully understand the uses of this
+ * parameter, beware of any unexpected values!
*/
priv->usage_hint = usage_hint;
@@ -127,14 +119,13 @@ ARMSOCCreatePixmap2 (ScreenPtr pScreen, int width, int height,
_X_EXPORT void
ARMSOCDestroyPixmap(ScreenPtr pScreen, void *driverPriv)
{
- ARMSOCPixmapPrivPtr priv = driverPriv;
+ struct ARMSOCPixmapPrivRec *priv = driverPriv;
assert(!priv->ext_access_cnt);
/* If ModifyPixmapHeader failed, it's possible we don't have a bo
* backing this pixmap. */
- if (priv->bo)
- {
+ if (priv->bo) {
assert(!armsoc_bo_has_dmabuf(priv->bo));
armsoc_bo_unreference(priv->bo);
}
@@ -147,9 +138,9 @@ ARMSOCModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
int depth, int bitsPerPixel, int devKind,
pointer pPixData)
{
- ARMSOCPixmapPrivPtr priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct ARMSOCPixmapPrivRec *priv = exaGetPixmapDriverPrivate(pPixmap);
ScrnInfoPtr pScrn = pix2scrn(pPixmap);
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
enum armsoc_buf_type buf_type = ARMSOC_BO_NON_SCANOUT;
/* Only modify specified fields, keeping all others intact. */
@@ -178,9 +169,7 @@ ARMSOCModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
priv->bo = pARMSOC->scanout;
if (priv->usage_hint & ARMSOC_CREATE_PIXMAP_SCANOUT)
- {
buf_type = ARMSOC_BO_SCANOUT;
- }
if (depth > 0)
pPixmap->drawable.depth = depth;
@@ -289,27 +278,30 @@ static inline enum armsoc_gem_op idx2op(int index)
_X_EXPORT Bool
ARMSOCPrepareAccess(PixmapPtr pPixmap, int index)
{
- ARMSOCPixmapPrivPtr priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct ARMSOCPixmapPrivRec *priv = exaGetPixmapDriverPrivate(pPixmap);
pPixmap->devPrivate.ptr = armsoc_bo_map(priv->bo);
if (!pPixmap->devPrivate.ptr) {
- xf86DrvMsg(-1, X_ERROR, "%s: Failed to map buffer\n", __FUNCTION__);
+ xf86DrvMsg(-1, X_ERROR, "%s: Failed to map buffer\n", __func__);
return FALSE;
}
- /* Attach dmabuf fd to bo to synchronise access if pixmap wrapped by DRI2 */
- if (priv->ext_access_cnt && !armsoc_bo_has_dmabuf(priv->bo))
- {
- if(armsoc_bo_set_dmabuf(priv->bo)) {
- xf86DrvMsg(-1, X_ERROR, "%s: Unable to get dma_buf fd for bo, "
- "to enable synchronised CPU access.\n", __FUNCTION__);
+ /* Attach dmabuf fd to bo to synchronise access if
+ * pixmap wrapped by DRI2
+ */
+ if (priv->ext_access_cnt && !armsoc_bo_has_dmabuf(priv->bo)) {
+ if (armsoc_bo_set_dmabuf(priv->bo)) {
+ xf86DrvMsg(-1, X_ERROR,
+ "%s: Unable to get dma_buf fd for bo, to enable synchronised CPU access.\n",
+ __func__);
return FALSE;
}
}
if (armsoc_bo_cpu_prep(priv->bo, idx2op(index))) {
- xf86DrvMsg(-1, X_ERROR, "%s: armsoc_bo_cpu_prep failed - "
- "unable to synchronise access.\n", __FUNCTION__);
+ xf86DrvMsg(-1, X_ERROR,
+ "%s: armsoc_bo_cpu_prep failed - unable to synchronise access.\n",
+ __func__);
return FALSE;
}
@@ -329,7 +321,7 @@ ARMSOCPrepareAccess(PixmapPtr pPixmap, int index)
_X_EXPORT void
ARMSOCFinishAccess(PixmapPtr pPixmap, int index)
{
- ARMSOCPixmapPrivPtr priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct ARMSOCPixmapPrivRec *priv = exaGetPixmapDriverPrivate(pPixmap);
pPixmap->devPrivate.ptr = NULL;
@@ -348,46 +340,44 @@ ARMSOCFinishAccess(PixmapPtr pPixmap, int index)
* @param pPix the pixmap
* @return TRUE if the given drawable is in framebuffer memory.
*
- * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen
- * memory, meaning that acceleration could probably be done to it, and that it
- * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
- * with the CPU.
+ * exaPixmapHasGpuCopy() is used to determine if a pixmap is in
+ * offscreen memory, meaning that acceleration could probably be done
+ * to it, and that it will need to be wrapped by PrepareAccess()/
+ * FinishAccess() when accessing it from the CPU.
*/
_X_EXPORT Bool
ARMSOCPixmapIsOffscreen(PixmapPtr pPixmap)
{
- /* offscreen means in 'gpu accessible memory', not that it's off the
- * visible screen. We currently have no special constraints, since
- * compatible ARM CPUS have a flat memory model
- * (no separate GPU memory). Ifindividual EXA implementation has
- * additional constraints, like buffer size or mapping in GPU MMU, it
- * should wrap this function.
+ /* offscreen means in 'gpu accessible memory', not that it's off
+ * the visible screen. We currently have no special constraints,
+ * since compatible ARM CPUS have a flat memory model (no separate
+ * GPU memory). If an individual EXA implementation has additional
+ * constraints, like buffer size or mapping in GPU MMU, it should
+ * wrap this function.
*/
- ARMSOCPixmapPrivPtr priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct ARMSOCPixmapPrivRec *priv = exaGetPixmapDriverPrivate(pPixmap);
return priv && priv->bo;
}
void ARMSOCRegisterExternalAccess(PixmapPtr pPixmap)
{
- ARMSOCPixmapPrivPtr priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct ARMSOCPixmapPrivRec *priv = exaGetPixmapDriverPrivate(pPixmap);
priv->ext_access_cnt++;
}
void ARMSOCDeregisterExternalAccess(PixmapPtr pPixmap)
{
- ARMSOCPixmapPrivPtr priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct ARMSOCPixmapPrivRec *priv = exaGetPixmapDriverPrivate(pPixmap);
assert(priv->ext_access_cnt > 0);
priv->ext_access_cnt--;
- if (priv->ext_access_cnt == 0)
- {
- /* No DRI2 buffers wrapping the pixmap, so no need for synchronisation
- * with dma_buf */
- if(armsoc_bo_has_dmabuf(priv->bo))
- {
+ if (priv->ext_access_cnt == 0) {
+ /* No DRI2 buffers wrapping the pixmap, so no
+ * need for synchronisation with dma_buf
+ */
+ if (armsoc_bo_has_dmabuf(priv->bo))
armsoc_bo_clear_dmabuf(priv->bo);
- }
}
}
diff --git a/src/armsoc_exa.h b/src/armsoc_exa.h
index f4b9877..ec22108 100644
--- a/src/armsoc_exa.h
+++ b/src/armsoc_exa.h
@@ -43,8 +43,7 @@
* A per-Screen structure used to communicate and coordinate between the
* ARMSOC X driver and an external EXA sub-module (if loaded).
*/
-typedef struct _ARMSOCEXARec
-{
+struct ARMSOCEXARec {
/**
* Called by X driver's CloseScreen() function at the end of each server
* generation to free per-Screen data structures (except those held by
@@ -53,24 +52,23 @@ typedef struct _ARMSOCEXARec
Bool (*CloseScreen)(CLOSE_SCREEN_ARGS_DECL);
/**
- * Called by X driver's FreeScreen() function at the end of each server
- * lifetime to free per-ScrnInfoRec data structures, to close any external
- * connections (e.g. with PVR2D, DRM), etc.
+ * Called by X driver's FreeScreen() function at the end of each
+ * server lifetime to free per-ScrnInfoRec data structures, to close
+ * any external connections (e.g. with PVR2D, DRM), etc.
*/
void (*FreeScreen)(FREE_SCREEN_ARGS_DECL);
/* add new fields here at end, to preserve ABI */
-} ARMSOCEXARec, *ARMSOCEXAPtr;
-
+};
/**
* Fallback EXA implementation
*/
-ARMSOCEXAPtr InitNullEXA(ScreenPtr pScreen, ScrnInfoPtr pScrn, int fd);
+struct ARMSOCEXARec *InitNullEXA(ScreenPtr pScreen, ScrnInfoPtr pScrn, int fd);
-ARMSOCEXAPtr ARMSOCEXAPTR(ScrnInfoPtr pScrn);
+struct ARMSOCEXARec *ARMSOCEXAPTR(ScrnInfoPtr pScrn);
static inline ScrnInfoPtr
pix2scrn(PixmapPtr pPixmap)
@@ -81,13 +79,12 @@ pix2scrn(PixmapPtr pPixmap)
static inline PixmapPtr
draw2pix(DrawablePtr pDraw)
{
- if (!pDraw) {
+ if (!pDraw)
return NULL;
- } else if (pDraw->type == DRAWABLE_WINDOW) {
+ else if (pDraw->type == DRAWABLE_WINDOW)
return pDraw->pScreen->GetWindowPixmap((WindowPtr)pDraw);
- } else {
+ else
return (PixmapPtr)pDraw;
- }
}
/* Common ARMSOC EXA functions, mostly related to pixmap/buffer allocation.
@@ -96,19 +93,23 @@ draw2pix(DrawablePtr pDraw)
* can use ARMSOCPrixmapPrivPtr#priv for their own private data.
*/
-typedef struct {
- void *priv; /* EXA submodule private data */
- int ext_access_cnt; /* Ref-count of DRI2Buffers that wrap the Pixmap,
- that allow external access to the underlying
- buffer. When >0 CPU access must be synchronised. */
+struct ARMSOCPixmapPrivRec {
+ /* EXA submodule private data */
+ void *priv;
+ /* Ref-count of DRI2Buffers that wrap the Pixmap,
+ * that allow external access to the underlying
+ * buffer. When >0 CPU access must be synchronised.
+ */
+ int ext_access_cnt;
struct armsoc_bo *bo;
int usage_hint;
-} ARMSOCPixmapPrivRec, *ARMSOCPixmapPrivPtr;
+};
+
#define ARMSOC_CREATE_PIXMAP_SCANOUT 0x80000000
-void * ARMSOCCreatePixmap2 (ScreenPtr pScreen, int width, int height,
+void *ARMSOCCreatePixmap2(ScreenPtr pScreen, int width, int height,
int depth, int usage_hint, int bitsPerPixel,
int *new_fb_pitch);
void ARMSOCDestroyPixmap(ScreenPtr pScreen, void *driverPriv);
@@ -123,7 +124,7 @@ Bool ARMSOCPixmapIsOffscreen(PixmapPtr pPixmap);
static inline struct armsoc_bo *
ARMSOCPixmapBo(PixmapPtr pPixmap)
{
- ARMSOCPixmapPrivPtr priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct ARMSOCPixmapPrivRec *priv = exaGetPixmapDriverPrivate(pPixmap);
return priv->bo;
}
diff --git a/src/armsoc_exa_null.c b/src/armsoc_exa_null.c
index 9a00113..782694a 100644
--- a/src/armsoc_exa_null.c
+++ b/src/armsoc_exa_null.c
@@ -42,12 +42,11 @@
* not installed.
*/
-typedef struct {
- ARMSOCEXARec base;
+struct ARMSOCNullEXARec {
+ struct ARMSOCEXARec base;
ExaDriverPtr exa;
/* add any other driver private data here.. */
-} ARMSOCNullEXARec, *ARMSOCNullEXAPtr;
-
+};
static Bool
PrepareSolidFail(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fill_colour)
@@ -71,7 +70,8 @@ CheckCompositeFail(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
static Bool
PrepareCompositeFail(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
- PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
+ PicturePtr pDstPicture, PixmapPtr pSrc,
+ PixmapPtr pMask, PixmapPtr pDst)
{
return FALSE;
}
@@ -84,17 +84,17 @@ static Bool
CloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
exaDriverFini(pScreen);
- free( ((ARMSOCNullEXAPtr)pARMSOC->pARMSOCEXA)->exa);
+ free(((struct ARMSOCNullEXARec *)pARMSOC->pARMSOCEXA)->exa);
free(pARMSOC->pARMSOCEXA);
pARMSOC->pARMSOCEXA = NULL;
return TRUE;
}
-/* FreeScreen() is called on an error during PreInit and
+/* FreeScreen() is called on an error during PreInit and
* should clean up anything initialised before InitNullEXA()
* (which currently is nothing)
*
@@ -104,25 +104,23 @@ FreeScreen(FREE_SCREEN_ARGS_DECL)
{
}
-
-ARMSOCEXAPtr
+struct ARMSOCEXARec *
InitNullEXA(ScreenPtr pScreen, ScrnInfoPtr pScrn, int fd)
{
- ARMSOCNullEXAPtr null_exa = calloc(sizeof (*null_exa), 1);
- ARMSOCEXAPtr armsoc_exa;
+ struct ARMSOCNullEXARec *null_exa = calloc(sizeof(*null_exa), 1);
+ struct ARMSOCEXARec *armsoc_exa;
ExaDriverPtr exa;
INFO_MSG("Soft EXA mode");
- if(!null_exa) {
+ if (!null_exa)
return NULL;
- }
- armsoc_exa = (ARMSOCEXAPtr)null_exa;
+
+ armsoc_exa = (struct ARMSOCEXARec *)null_exa;
exa = exaDriverAlloc();
- if (!exa) {
+ if (!exa)
goto fail;
- }
null_exa->exa = exa;
@@ -146,13 +144,13 @@ InitNullEXA(ScreenPtr pScreen, ScrnInfoPtr pScrn, int fd)
exa->FinishAccess = ARMSOCFinishAccess;
exa->PixmapIsOffscreen = ARMSOCPixmapIsOffscreen;
- // Always fallback for software operations
+ /* Always fallback for software operations */
exa->PrepareCopy = PrepareCopyFail;
exa->PrepareSolid = PrepareSolidFail;
exa->CheckComposite = CheckCompositeFail;
exa->PrepareComposite = PrepareCompositeFail;
- if (! exaDriverInit(pScreen, exa)) {
+ if (!exaDriverInit(pScreen, exa)) {
ERROR_MSG("exaDriverInit failed");
goto fail;
}
@@ -163,12 +161,12 @@ InitNullEXA(ScreenPtr pScreen, ScrnInfoPtr pScrn, int fd)
return armsoc_exa;
fail:
- if(exa) {
+ if (exa)
free(exa);
- }
- if (null_exa) {
+
+ if (null_exa)
free(null_exa);
- }
+
return NULL;
}
diff --git a/src/compat-api.h b/src/compat-api.h
index b74a582..fefbc59 100644
--- a/src/compat-api.h
+++ b/src/compat-api.h
@@ -48,7 +48,8 @@
#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
-#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
+#define BLOCKHANDLER_ARGS_DECL \
+ int arg, pointer blockData, pointer pTimeout, pointer pReadmask
#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
@@ -76,7 +77,8 @@
#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
-#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
+#define BLOCKHANDLER_ARGS_DECL \
+ ScreenPtr arg, pointer pTimeout, pointer pReadmask
#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 720b363..9087a59 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -50,55 +50,57 @@
#include <libudev.h>
#include "drmmode_driver.h"
-typedef struct {
+struct drmmode_cursor_rec {
/* hardware cursor: */
drmModePlane *ovr;
struct armsoc_bo *bo;
uint32_t fb_id;
int x, y;
-} drmmode_cursor_rec, *drmmode_cursor_ptr;
+};
-typedef struct {
+struct drmmode_rec {
int fd;
drmModeResPtr mode_res;
int cpp;
struct udev_monitor *uevent_monitor;
InputHandlerProc uevent_handler;
- drmmode_cursor_ptr cursor;
-} drmmode_rec, *drmmode_ptr;
+ struct drmmode_cursor_rec *cursor;
+};
-typedef struct {
- drmmode_ptr drmmode;
+struct drmmode_crtc_private_rec {
+ struct drmmode_rec *drmmode;
drmModeCrtcPtr mode_crtc;
int cursor_visible;
-} drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
+};
-typedef struct {
+struct drmmode_prop_rec {
drmModePropertyPtr mode_prop;
- int index; /* Index within the kernel-side property arrays for
- * this connector. */
- int num_atoms; /* if range prop, num_atoms == 1; if enum prop,
- * num_atoms == num_enums + 1 */
+ /* Index within the kernel-side property arrays for this connector. */
+ int index;
+ /* if range prop, num_atoms == 1;
+ * if enum prop, num_atoms == num_enums + 1
+ */
+ int num_atoms;
Atom *atoms;
-} drmmode_prop_rec, *drmmode_prop_ptr;
+};
-typedef struct {
- drmmode_ptr drmmode;
+struct drmmode_output_priv {
+ struct drmmode_rec *drmmode;
int output_id;
drmModeConnectorPtr mode_output;
drmModeEncoderPtr mode_encoder;
drmModePropertyBlobPtr edid_blob;
int num_props;
- drmmode_prop_ptr props;
-} drmmode_output_private_rec, *drmmode_output_private_ptr;
+ struct drmmode_prop_rec *props;
+};
static void drmmode_output_dpms(xf86OutputPtr output, int mode);
-static drmmode_ptr
+static struct drmmode_rec *
drmmode_from_scrn(ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- drmmode_crtc_private_ptr drmmode_crtc;
+ struct drmmode_crtc_private_rec *drmmode_crtc;
drmmode_crtc = xf86_config->crtc[0]->driver_private;
return drmmode_crtc->drmmode;
@@ -132,10 +134,11 @@ drmmode_ConvertFromKMode(ScrnInfoPtr pScrn, drmModeModeInfo *kmode,
if (kmode->type & DRM_MODE_TYPE_DRIVER)
mode->type = M_T_DRIVER;
+
if (kmode->type & DRM_MODE_TYPE_PREFERRED)
mode->type |= M_T_PREFERRED;
- xf86SetModeCrtc (mode, pScrn->adjustFlags);
+ xf86SetModeCrtc(mode, pScrn->adjustFlags);
}
static void
@@ -166,7 +169,7 @@ drmmode_ConvertToKMode(ScrnInfoPtr pScrn, drmModeModeInfo *kmode,
static void
drmmode_crtc_dpms(xf86CrtcPtr drmmode_crtc, int mode)
{
- // TODO: MIDEGL-1431: Implement this function
+ /* TODO: MIDEGL-1431: Implement this function */
}
static Bool
@@ -174,10 +177,10 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
Rotation rotation, int x, int y)
{
ScrnInfoPtr pScrn = crtc->scrn;
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ struct drmmode_crtc_private_rec *drmmode_crtc = crtc->driver_private;
+ struct drmmode_rec *drmmode = drmmode_crtc->drmmode;
int saved_x, saved_y;
Rotation saved_rotation;
DisplayModeRec saved_mode;
@@ -193,7 +196,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
fb_id = armsoc_bo_get_fb(pARMSOC->scanout);
if (fb_id == 0) {
-
DEBUG_MSG("create framebuffer: %dx%d",
pScrn->virtualX, pScrn->virtualY);
@@ -228,7 +230,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
- drmmode_output_private_ptr drmmode_output;
+ struct drmmode_output_priv *drmmode_output;
if (output->crtc != crtc)
continue;
@@ -239,7 +241,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
output_count++;
}
- if (!xf86CrtcRotate(crtc)){
+ if (!xf86CrtcRotate(crtc)) {
xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
"failed to assign rotation in drmmode_set_mode_major()\n");
ret = FALSE;
@@ -274,14 +276,13 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
}
/* if hw cursor is initialized, reload it */
- if(drmmode->cursor) {
+ if (drmmode->cursor)
xf86_reload_cursors(pScrn->pScreen);
- }
done:
- if (output_ids) {
+ if (output_ids)
free(output_ids);
- }
+
if (!ret) {
/* If there was a problem, restore the old mode: */
crtc->x = saved_x;
@@ -297,9 +298,9 @@ done:
static void
drmmode_hide_cursor(xf86CrtcPtr crtc)
{
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
- drmmode_cursor_ptr cursor = drmmode->cursor;
+ struct drmmode_crtc_private_rec *drmmode_crtc = crtc->driver_private;
+ struct drmmode_rec *drmmode = drmmode_crtc->drmmode;
+ struct drmmode_cursor_rec *cursor = drmmode->cursor;
if (!cursor)
return;
@@ -315,13 +316,13 @@ drmmode_hide_cursor(xf86CrtcPtr crtc)
static void
drmmode_show_cursor(xf86CrtcPtr crtc)
{
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
- drmmode_cursor_ptr cursor = drmmode->cursor;
+ struct drmmode_crtc_private_rec *drmmode_crtc = crtc->driver_private;
+ struct drmmode_rec *drmmode = drmmode_crtc->drmmode;
+ struct drmmode_cursor_rec *cursor = drmmode->cursor;
int crtc_x, crtc_y, src_x, src_y;
int w, h, pad;
ScrnInfoPtr pScrn = crtc->scrn;
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
if (!cursor)
return;
@@ -332,8 +333,10 @@ drmmode_show_cursor(xf86CrtcPtr crtc)
h = pARMSOC->drmmode_interface->cursor_height;
pad = pARMSOC->drmmode_interface->cursor_padding;
- w = w + 2 * pad; /* get padded width */
- crtc_x = cursor->x - pad; /* get x of padded cursor */
+ /* get padded width */
+ w = w + 2 * pad;
+ /* get x of padded cursor */
+ crtc_x = cursor->x - pad;
crtc_y = cursor->y;
src_x = 0;
src_y = 0;
@@ -351,26 +354,25 @@ drmmode_show_cursor(xf86CrtcPtr crtc)
crtc_y = 0;
}
- if ((crtc_x + w) > crtc->mode.HDisplay) {
+ if ((crtc_x + w) > crtc->mode.HDisplay)
w = crtc->mode.HDisplay - crtc_x;
- }
- if ((crtc_y + h) > crtc->mode.VDisplay) {
+ if ((crtc_y + h) > crtc->mode.VDisplay)
h = crtc->mode.VDisplay - crtc_y;
- }
/* note src coords (last 4 args) are in Q16 format */
drmModeSetPlane(drmmode->fd, cursor->ovr->plane_id,
drmmode_crtc->mode_crtc->crtc_id, cursor->fb_id, 0,
- crtc_x, crtc_y, w, h, src_x<<16, src_y<<16, w<<16, h<<16);
+ crtc_x, crtc_y, w, h, src_x<<16, src_y<<16,
+ w<<16, h<<16);
}
static void
drmmode_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
{
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
- drmmode_cursor_ptr cursor = drmmode->cursor;
+ struct drmmode_crtc_private_rec *drmmode_crtc = crtc->driver_private;
+ struct drmmode_rec *drmmode = drmmode_crtc->drmmode;
+ struct drmmode_cursor_rec *cursor = drmmode->cursor;
if (!cursor)
return;
@@ -385,13 +387,13 @@ drmmode_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
static void
drmmode_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
{
- uint32_t * d;
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
- drmmode_cursor_ptr cursor = drmmode->cursor;
+ uint32_t *d;
+ struct drmmode_crtc_private_rec *drmmode_crtc = crtc->driver_private;
+ struct drmmode_rec *drmmode = drmmode_crtc->drmmode;
+ struct drmmode_cursor_rec *cursor = drmmode->cursor;
int visible;
ScrnInfoPtr pScrn = crtc->scrn;
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
if (!cursor)
return;
@@ -402,7 +404,7 @@ drmmode_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
drmmode_hide_cursor(crtc);
d = armsoc_bo_map(cursor->bo);
- if(!d) {
+ if (!d) {
xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
"load_cursor_argb map failure\n");
if (visible)
@@ -411,7 +413,7 @@ drmmode_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
}
/* set_cursor_image is a mandatory function */
- assert( pARMSOC->drmmode_interface->set_cursor_image );
+ assert(pARMSOC->drmmode_interface->set_cursor_image);
pARMSOC->drmmode_interface->set_cursor_image(crtc, d, image);
if (visible)
@@ -422,9 +424,9 @@ Bool
drmmode_cursor_init(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
- drmmode_ptr drmmode = drmmode_from_scrn(pScrn);
- drmmode_cursor_ptr cursor;
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
+ struct drmmode_rec *drmmode = drmmode_from_scrn(pScrn);
+ struct drmmode_cursor_rec *cursor;
drmModePlaneRes *plane_resources;
drmModePlane *ovr;
int w, h, pad;
@@ -435,8 +437,9 @@ drmmode_cursor_init(ScreenPtr pScreen)
return TRUE;
}
- if(!xf86LoaderCheckSymbol("drmModeGetPlaneResources")) {
- ERROR_MSG("HW cursor not supported (needs libdrm 2.4.30 or higher)");
+ if (!xf86LoaderCheckSymbol("drmModeGetPlaneResources")) {
+ ERROR_MSG(
+ "HW cursor not supported (needs libdrm 2.4.30 or higher)");
return FALSE;
}
@@ -446,7 +449,8 @@ drmmode_cursor_init(ScreenPtr pScreen)
*/
plane_resources = drmModeGetPlaneResources(drmmode->fd);
if (!plane_resources) {
- ERROR_MSG("HW cursor: drmModeGetPlaneResources failed: %s", strerror(errno));
+ ERROR_MSG("HW cursor: drmModeGetPlaneResources failed: %s",
+ strerror(errno));
return FALSE;
}
@@ -458,19 +462,21 @@ drmmode_cursor_init(ScreenPtr pScreen)
ovr = drmModeGetPlane(drmmode->fd, plane_resources->planes[0]);
if (!ovr) {
- ERROR_MSG("HW cursor: drmModeGetPlane failed: %s", strerror(errno));
+ ERROR_MSG("HW cursor: drmModeGetPlane failed: %s",
+ strerror(errno));
drmModeFreePlaneResources(plane_resources);
return FALSE;
}
if (pARMSOC->drmmode_interface->init_plane_for_cursor &&
- pARMSOC->drmmode_interface->init_plane_for_cursor(drmmode->fd, ovr->plane_id)) {
+ pARMSOC->drmmode_interface->init_plane_for_cursor(
+ drmmode->fd, ovr->plane_id)) {
ERROR_MSG("Failed driver-specific cursor initialization");
drmModeFreePlaneResources(plane_resources);
return FALSE;
}
- cursor = calloc(1, sizeof(drmmode_cursor_rec));
+ cursor = calloc(1, sizeof(struct drmmode_cursor_rec));
if (!cursor) {
ERROR_MSG("HW cursor: calloc failed");
drmModeFreePlane(ovr);
@@ -485,7 +491,9 @@ drmmode_cursor_init(ScreenPtr pScreen)
pad = pARMSOC->drmmode_interface->cursor_padding;
/* allow for cursor padding in the bo */
- cursor->bo = armsoc_bo_new_with_dim(pARMSOC->dev, w + 2 * pad, h, 0, 32, ARMSOC_BO_SCANOUT );
+ cursor->bo = armsoc_bo_new_with_dim(pARMSOC->dev,
+ w + 2 * pad, h,
+ 0, 32, ARMSOC_BO_SCANOUT);
if (!cursor->bo) {
ERROR_MSG("HW cursor: buffer allocation failed");
@@ -502,7 +510,8 @@ drmmode_cursor_init(ScreenPtr pScreen)
/* allow for cursor padding in the fb */
if (drmModeAddFB2(drmmode->fd, w + 2 * pad, h, DRM_FORMAT_ARGB8888,
handles, pitches, offsets, &cursor->fb_id, 0)) {
- ERROR_MSG("HW cursor: drmModeAddFB2 failed: %s", strerror(errno));
+ ERROR_MSG("HW cursor: drmModeAddFB2 failed: %s",
+ strerror(errno));
armsoc_bo_unreference(cursor->bo);
free(cursor);
drmModeFreePlane(ovr);
@@ -512,9 +521,9 @@ drmmode_cursor_init(ScreenPtr pScreen)
if (!xf86_cursors_init(pScreen, w, h, HARDWARE_CURSOR_ARGB)) {
ERROR_MSG("xf86_cursors_init() failed");
- if(drmModeRmFB(drmmode->fd, cursor->fb_id)) {
+ if (drmModeRmFB(drmmode->fd, cursor->fb_id))
ERROR_MSG("drmModeRmFB() failed");
- }
+
armsoc_bo_unreference(cursor->bo);
free(cursor);
drmModeFreePlane(ovr);
@@ -531,12 +540,12 @@ drmmode_cursor_init(ScreenPtr pScreen)
void drmmode_cursor_fini(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- drmmode_ptr drmmode = drmmode_from_scrn(pScrn);
- drmmode_cursor_ptr cursor = drmmode->cursor;
+ struct drmmode_rec *drmmode = drmmode_from_scrn(pScrn);
+ struct drmmode_cursor_rec *cursor = drmmode->cursor;
- if(!cursor ) {
+ if (!cursor)
return;
- }
+
drmmode->cursor = NULL;
xf86_cursors_fini(pScreen);
drmModeRmFB(drmmode->fd, cursor->fb_id);
@@ -546,13 +555,13 @@ void drmmode_cursor_fini(ScreenPtr pScreen)
}
-#if 1==ARMSOC_SUPPORT_GAMMA
+#if 1 == ARMSOC_SUPPORT_GAMMA
static void
drmmode_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
int size)
{
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ struct drmmode_crtc_private_rec *drmmode_crtc = crtc->driver_private;
+ struct drmmode_rec *drmmode = drmmode_crtc->drmmode;
int ret;
ret = drmModeCrtcSetGamma(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
@@ -571,17 +580,17 @@ static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
.show_cursor = drmmode_show_cursor,
.hide_cursor = drmmode_hide_cursor,
.load_cursor_argb = drmmode_load_cursor_argb,
-#if 1==ARMSOC_SUPPORT_GAMMA
+#if 1 == ARMSOC_SUPPORT_GAMMA
.gamma_set = drmmode_gamma_set,
#endif
};
static void
-drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
+drmmode_crtc_init(ScrnInfoPtr pScrn, struct drmmode_rec *drmmode, int num)
{
xf86CrtcPtr crtc;
- drmmode_crtc_private_ptr drmmode_crtc;
+ struct drmmode_crtc_private_rec *drmmode_crtc;
TRACE_ENTER();
@@ -589,11 +598,11 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
if (crtc == NULL)
return;
- drmmode_crtc = xnfcalloc(sizeof(drmmode_crtc_private_rec), 1);
+ drmmode_crtc = xnfcalloc(sizeof(struct drmmode_crtc_private_rec), 1);
drmmode_crtc->mode_crtc = drmModeGetCrtc(drmmode->fd,
drmmode->mode_res->crtcs[num]);
drmmode_crtc->drmmode = drmmode;
- INFO_MSG("Got CRTC: %d",num);
+ INFO_MSG("Got CRTC: %d", num);
crtc->driver_private = drmmode_crtc;
@@ -605,13 +614,14 @@ static xf86OutputStatus
drmmode_output_detect(xf86OutputPtr output)
{
/* go to the hw and retrieve a new output struct */
- drmmode_output_private_ptr drmmode_output = output->driver_private;
- drmmode_ptr drmmode = drmmode_output->drmmode;
+ struct drmmode_output_priv *drmmode_output = output->driver_private;
+ struct drmmode_rec *drmmode = drmmode_output->drmmode;
xf86OutputStatus status;
drmModeFreeConnector(drmmode_output->mode_output);
drmmode_output->mode_output =
- drmModeGetConnector(drmmode->fd, drmmode_output->output_id);
+ drmModeGetConnector(drmmode->fd,
+ drmmode_output->output_id);
switch (drmmode_output->mode_output->connection) {
case DRM_MODE_CONNECTED:
@@ -642,9 +652,9 @@ static DisplayModePtr
drmmode_output_get_modes(xf86OutputPtr output)
{
ScrnInfoPtr pScrn = output->scrn;
- drmmode_output_private_ptr drmmode_output = output->driver_private;
+ struct drmmode_output_priv *drmmode_output = output->driver_private;
drmModeConnectorPtr koutput = drmmode_output->mode_output;
- drmmode_ptr drmmode = drmmode_output->drmmode;
+ struct drmmode_rec *drmmode = drmmode_output->drmmode;
DisplayModePtr modes = NULL;
drmModePropertyPtr prop;
xf86MonPtr ddc_mon = NULL;
@@ -659,10 +669,11 @@ drmmode_output_get_modes(xf86OutputPtr output)
if ((prop->flags & DRM_MODE_PROP_BLOB) &&
!strcmp(prop->name, "EDID")) {
if (drmmode_output->edid_blob)
- drmModeFreePropertyBlob(drmmode_output->edid_blob);
+ drmModeFreePropertyBlob(
+ drmmode_output->edid_blob);
drmmode_output->edid_blob =
drmModeGetPropertyBlob(drmmode->fd,
- koutput->prop_values[i]);
+ koutput->prop_values[i]);
}
drmModeFreeProperty(prop);
}
@@ -691,7 +702,7 @@ drmmode_output_get_modes(xf86OutputPtr output)
static void
drmmode_output_destroy(xf86OutputPtr output)
{
- drmmode_output_private_ptr drmmode_output = output->driver_private;
+ struct drmmode_output_priv *drmmode_output = output->driver_private;
int i;
if (drmmode_output->edid_blob)
@@ -709,10 +720,10 @@ drmmode_output_destroy(xf86OutputPtr output)
static void
drmmode_output_dpms(xf86OutputPtr output, int mode)
{
- drmmode_output_private_ptr drmmode_output = output->driver_private;
+ struct drmmode_output_priv *drmmode_output = output->driver_private;
drmModeConnectorPtr koutput = drmmode_output->mode_output;
drmModePropertyPtr prop;
- drmmode_ptr drmmode = drmmode_output->drmmode;
+ struct drmmode_rec *drmmode = drmmode_output->drmmode;
int mode_id = -1, i;
for (i = 0; i < koutput->count_props; i++) {
@@ -754,31 +765,35 @@ drmmode_property_ignore(drmModePropertyPtr prop)
static void
drmmode_output_create_resources(xf86OutputPtr output)
{
- drmmode_output_private_ptr drmmode_output = output->driver_private;
+ struct drmmode_output_priv *drmmode_output = output->driver_private;
drmModeConnectorPtr mode_output = drmmode_output->mode_output;
- drmmode_ptr drmmode = drmmode_output->drmmode;
+ struct drmmode_rec *drmmode = drmmode_output->drmmode;
drmModePropertyPtr drmmode_prop;
uint32_t value;
int i, j, err;
- drmmode_output->props = calloc(mode_output->count_props, sizeof(drmmode_prop_rec));
+ drmmode_output->props =
+ calloc(mode_output->count_props,
+ sizeof(struct drmmode_prop_rec));
if (!drmmode_output->props)
return;
drmmode_output->num_props = 0;
for (i = 0; i < mode_output->count_props; i++) {
- drmmode_prop = drmModeGetProperty(drmmode->fd, mode_output->props[i]);
+ drmmode_prop = drmModeGetProperty(drmmode->fd,
+ mode_output->props[i]);
if (drmmode_property_ignore(drmmode_prop)) {
drmModeFreeProperty(drmmode_prop);
continue;
}
- drmmode_output->props[drmmode_output->num_props].mode_prop = drmmode_prop;
+ drmmode_output->props[drmmode_output->num_props].mode_prop =
+ drmmode_prop;
drmmode_output->props[drmmode_output->num_props].index = i;
drmmode_output->num_props++;
}
for (i = 0; i < drmmode_output->num_props; i++) {
- drmmode_prop_ptr p = &drmmode_output->props[i];
+ struct drmmode_prop_rec *p = &drmmode_output->props[i];
drmmode_prop = p->mode_prop;
value = drmmode_output->mode_output->prop_values[p->index];
@@ -790,52 +805,73 @@ drmmode_output_create_resources(xf86OutputPtr output)
p->atoms = calloc(p->num_atoms, sizeof(Atom));
if (!p->atoms)
continue;
- p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE);
+ p->atoms[0] = MakeAtom(drmmode_prop->name,
+ strlen(drmmode_prop->name),
+ TRUE);
range[0] = drmmode_prop->values[0];
range[1] = drmmode_prop->values[1];
- err = RRConfigureOutputProperty(output->randr_output, p->atoms[0],
+ err = RRConfigureOutputProperty(output->randr_output,
+ p->atoms[0],
FALSE, TRUE,
- drmmode_prop->flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE,
- 2, range);
- if (err != 0) {
+ drmmode_prop->flags &
+ DRM_MODE_PROP_IMMUTABLE ?
+ TRUE : FALSE,
+ 2, range);
+
+ if (err != 0)
xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
- "RRConfigureOutputProperty error, %d\n", err);
- }
- err = RRChangeOutputProperty(output->randr_output, p->atoms[0],
+ "RRConfigureOutputProperty error, %d\n",
+ err);
+
+ err = RRChangeOutputProperty(output->randr_output,
+ p->atoms[0],
XA_INTEGER, 32, PropModeReplace, 1,
&value, FALSE, FALSE);
- if (err != 0) {
+ if (err != 0)
xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
- "RRChangeOutputProperty error, %d\n", err);
- }
+ "RRChangeOutputProperty error, %d\n",
+ err);
+
} else if (drmmode_prop->flags & DRM_MODE_PROP_ENUM) {
p->num_atoms = drmmode_prop->count_enums + 1;
p->atoms = calloc(p->num_atoms, sizeof(Atom));
if (!p->atoms)
continue;
- p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE);
+ p->atoms[0] = MakeAtom(drmmode_prop->name,
+ strlen(drmmode_prop->name),
+ TRUE);
for (j = 1; j <= drmmode_prop->count_enums; j++) {
- struct drm_mode_property_enum *e = &drmmode_prop->enums[j-1];
- p->atoms[j] = MakeAtom(e->name, strlen(e->name), TRUE);
+ struct drm_mode_property_enum *e =
+ &drmmode_prop->enums[j-1];
+ p->atoms[j] = MakeAtom(e->name,
+ strlen(e->name), TRUE);
}
- err = RRConfigureOutputProperty(output->randr_output, p->atoms[0],
+ err = RRConfigureOutputProperty(output->randr_output,
+ p->atoms[0],
FALSE, FALSE,
- drmmode_prop->flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE,
- p->num_atoms - 1, (INT32 *)&p->atoms[1]);
- if (err != 0) {
+ drmmode_prop->flags &
+ DRM_MODE_PROP_IMMUTABLE ?
+ TRUE : FALSE,
+ p->num_atoms - 1,
+ (INT32 *)&p->atoms[1]);
+
+ if (err != 0)
xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
- "RRConfigureOutputProperty error, %d\n", err);
- }
+ "RRConfigureOutputProperty error, %d\n",
+ err);
+
for (j = 0; j < drmmode_prop->count_enums; j++)
if (drmmode_prop->enums[j].value == value)
break;
/* there's always a matching value */
- err = RRChangeOutputProperty(output->randr_output, p->atoms[0],
- XA_ATOM, 32, PropModeReplace, 1, &p->atoms[j+1], FALSE, FALSE);
- if (err != 0) {
+ err = RRChangeOutputProperty(output->randr_output,
+ p->atoms[0],
+ XA_ATOM, 32, PropModeReplace, 1,
+ &p->atoms[j+1], FALSE, FALSE);
+ if (err != 0)
xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
- "RRChangeOutputProperty error, %d\n", err);
- }
+ "RRChangeOutputProperty error, %d\n",
+ err);
}
}
}
@@ -844,12 +880,12 @@ static Bool
drmmode_output_set_property(xf86OutputPtr output, Atom property,
RRPropertyValuePtr value)
{
- drmmode_output_private_ptr drmmode_output = output->driver_private;
- drmmode_ptr drmmode = drmmode_output->drmmode;
+ struct drmmode_output_priv *drmmode_output = output->driver_private;
+ struct drmmode_rec *drmmode = drmmode_output->drmmode;
int i, ret;
for (i = 0; i < drmmode_output->num_props; i++) {
- drmmode_prop_ptr p = &drmmode_output->props[i];
+ struct drmmode_prop_rec *p = &drmmode_output->props[i];
if (p->atoms[0] != property)
continue;
@@ -862,7 +898,8 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
return FALSE;
val = *(uint32_t *)value->data;
- ret = drmModeConnectorSetProperty(drmmode->fd, drmmode_output->output_id,
+ ret = drmModeConnectorSetProperty(drmmode->fd,
+ drmmode_output->output_id,
p->mode_prop->prop_id, (uint64_t)val);
if (ret)
@@ -875,18 +912,25 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
const char *name;
int j;
- if (value->type != XA_ATOM || value->format != 32 || value->size != 1)
+ if (value->type != XA_ATOM ||
+ value->format != 32 ||
+ value->size != 1)
return FALSE;
+
memcpy(&atom, value->data, 4);
name = NameForAtom(atom);
- /* search for matching name string, then set its value down */
+ /* search for matching name string, then
+ * set its value down
+ */
for (j = 0; j < p->mode_prop->count_enums; j++) {
- if (!strcmp(p->mode_prop->enums[j].name, name)) {
- ret = drmModeConnectorSetProperty(drmmode->fd,
- drmmode_output->output_id,
- p->mode_prop->prop_id,
- p->mode_prop->enums[j].value);
+ if (!strcmp(p->mode_prop->enums[j].name,
+ name)) {
+ ret = drmModeConnectorSetProperty(
+ drmmode->fd,
+ drmmode_output->output_id,
+ p->mode_prop->prop_id,
+ p->mode_prop->enums[j].value);
if (ret)
return FALSE;
@@ -894,11 +938,9 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
return TRUE;
}
}
-
return FALSE;
}
}
-
return TRUE;
}
@@ -906,19 +948,20 @@ static Bool
drmmode_output_get_property(xf86OutputPtr output, Atom property)
{
- drmmode_output_private_ptr drmmode_output = output->driver_private;
- drmmode_ptr drmmode = drmmode_output->drmmode;
+ struct drmmode_output_priv *drmmode_output = output->driver_private;
+ struct drmmode_rec *drmmode = drmmode_output->drmmode;
uint32_t value;
int err, i;
if (output->scrn->vtSema) {
drmModeFreeConnector(drmmode_output->mode_output);
drmmode_output->mode_output =
- drmModeGetConnector(drmmode->fd, drmmode_output->output_id);
+ drmModeGetConnector(drmmode->fd,
+ drmmode_output->output_id);
}
for (i = 0; i < drmmode_output->num_props; i++) {
- drmmode_prop_ptr p = &drmmode_output->props[i];
+ struct drmmode_prop_rec *p = &drmmode_output->props[i];
if (p->atoms[0] != property)
continue;
@@ -934,15 +977,18 @@ drmmode_output_get_property(xf86OutputPtr output, Atom property)
} else if (p->mode_prop->flags & DRM_MODE_PROP_ENUM) {
int j;
- /* search for matching name string, then set its value down */
+ /* search for matching name string, then set
+ * its value down
+ */
for (j = 0; j < p->mode_prop->count_enums; j++) {
if (p->mode_prop->enums[j].value == value)
break;
}
- err = RRChangeOutputProperty(output->randr_output, property,
- XA_ATOM, 32, PropModeReplace, 1,
- &p->atoms[j+1], FALSE, FALSE);
+ err = RRChangeOutputProperty(output->randr_output,
+ property,
+ XA_ATOM, 32, PropModeReplace, 1,
+ &p->atoms[j+1], FALSE, FALSE);
return !err;
}
@@ -981,12 +1027,12 @@ const char *output_names[] = { "None",
#define NUM_OUTPUT_NAMES (sizeof(output_names) / sizeof(output_names[0]))
static void
-drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
+drmmode_output_init(ScrnInfoPtr pScrn, struct drmmode_rec *drmmode, int num)
{
xf86OutputPtr output;
drmModeConnectorPtr koutput;
drmModeEncoderPtr kencoder;
- drmmode_output_private_ptr drmmode_output;
+ struct drmmode_output_priv *drmmode_output;
char name[32];
TRACE_ENTER();
@@ -1017,7 +1063,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
return;
}
- drmmode_output = calloc(sizeof(drmmode_output_private_rec), 1);
+ drmmode_output = calloc(sizeof(struct drmmode_output_priv), 1);
if (!drmmode_output) {
xf86OutputDestroy(output);
drmModeFreeConnector(koutput);
@@ -1037,10 +1083,11 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
if (ARMSOCPTR(pScrn)->crtcNum >= 0) {
/* Only single crtc per screen - see if this output can use it*/
output->possible_crtcs =
- (kencoder->possible_crtcs>>(ARMSOCPTR(pScrn)->crtcNum))&1;
- } else {
+ (kencoder->possible_crtcs >>
+ (ARMSOCPTR(pScrn)->crtcNum)
+ )&1;
+ } else
output->possible_crtcs = kencoder->possible_crtcs;
- }
output->possible_clones = kencoder->possible_clones;
output->interlaceAllowed = TRUE;
@@ -1051,7 +1098,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
void set_scanout_bo(ScrnInfoPtr pScrn, struct armsoc_bo *bo)
{
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
/* It had better have a framebuffer if we're scanning it out */
assert(armsoc_bo_get_fb(bo));
@@ -1062,7 +1109,7 @@ void set_scanout_bo(ScrnInfoPtr pScrn, struct armsoc_bo *bo)
static Bool
drmmode_xf86crtc_resize(ScrnInfoPtr pScrn, int width, int height)
{
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
ScreenPtr pScreen = pScrn->pScreen;
uint32_t pitch;
int i;
@@ -1074,55 +1121,57 @@ drmmode_xf86crtc_resize(ScrnInfoPtr pScrn, int width, int height)
pScrn->virtualX = width;
pScrn->virtualY = height;
- if ( (width != armsoc_bo_width(pARMSOC->scanout))
+ if ((width != armsoc_bo_width(pARMSOC->scanout))
|| (height != armsoc_bo_height(pARMSOC->scanout))
- || (pScrn->bitsPerPixel != armsoc_bo_bpp(pARMSOC->scanout)) ) {
+ || (pScrn->bitsPerPixel != armsoc_bo_bpp(pARMSOC->scanout))) {
struct armsoc_bo *new_scanout;
/* allocate new scanout buffer */
- new_scanout = armsoc_bo_new_with_dim(pARMSOC->dev, width, height, pScrn->depth, pScrn->bitsPerPixel, ARMSOC_BO_SCANOUT );
- if (!new_scanout)
- {
- /* Try to use the previous buffer if the new resolution is smaller than the one on buffer creation */
- DEBUG_MSG("allocate new scanout buffer failed - resizing existing bo");
+ new_scanout = armsoc_bo_new_with_dim(pARMSOC->dev,
+ width, height,
+ pScrn->depth, pScrn->bitsPerPixel,
+ ARMSOC_BO_SCANOUT);
+ if (!new_scanout) {
+ /* Try to use the previous buffer if the new resolution
+ * is smaller than the one on buffer creation
+ */
+ DEBUG_MSG(
+ "allocate new scanout buffer failed - resizing existing bo");
/* Remove the old fb from the bo */
- if( armsoc_bo_rm_fb( pARMSOC->scanout ) )
- {
+ if (armsoc_bo_rm_fb(pARMSOC->scanout))
return FALSE;
- }
+
/* Resize the bo */
- if ( armsoc_bo_resize(pARMSOC->scanout, width, height) )
- {
+ if (armsoc_bo_resize(pARMSOC->scanout, width, height)) {
armsoc_bo_clear(pARMSOC->scanout);
armsoc_bo_add_fb(pARMSOC->scanout);
return FALSE;
}
/* Add new fb to the bo */
- if( armsoc_bo_clear(pARMSOC->scanout) || armsoc_bo_add_fb(pARMSOC->scanout) )
- {
+ if (armsoc_bo_clear(pARMSOC->scanout) ||
+ armsoc_bo_add_fb(pARMSOC->scanout))
return FALSE;
- }
+
pitch = armsoc_bo_pitch(pARMSOC->scanout);
- }
- else
- {
+ } else {
DEBUG_MSG("allocated new scanout buffer okay");
pitch = armsoc_bo_pitch(new_scanout);
/* clear new BO and add FB */
- if (armsoc_bo_clear(new_scanout) || armsoc_bo_add_fb(new_scanout))
- {
+ if (armsoc_bo_clear(new_scanout) ||
+ armsoc_bo_add_fb(new_scanout)) {
armsoc_bo_unreference(new_scanout);
return FALSE;
}
/* Handle dma_buf fd that may be attached to old bo */
- if(armsoc_bo_has_dmabuf(pARMSOC->scanout))
- {
+ if (armsoc_bo_has_dmabuf(pARMSOC->scanout)) {
int res;
armsoc_bo_clear_dmabuf(pARMSOC->scanout);
res = armsoc_bo_set_dmabuf(new_scanout);
- if(res) {
- ERROR_MSG("Unable to attach dma_buf fd to new scanout buffer - %d (%s)\n", res, strerror(res));
+ if (res) {
+ ERROR_MSG(
+ "Unable to attach dma_buf fd to new scanout buffer - %d (%s)\n",
+ res, strerror(res));
armsoc_bo_unreference(new_scanout);
return FALSE;
}
@@ -1134,11 +1183,8 @@ drmmode_xf86crtc_resize(ScrnInfoPtr pScrn, int width, int height)
}
pARMSOC->has_resized = TRUE;
pScrn->displayWidth = pitch / ((pScrn->bitsPerPixel + 7) / 8);
- }
- else
- {
+ } else
pitch = armsoc_bo_pitch(pARMSOC->scanout);
- }
if (pScreen && pScreen->ModifyPixmapHeader) {
PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen);
@@ -1173,15 +1219,14 @@ static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {
Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
{
- drmmode_ptr drmmode;
+ struct drmmode_rec *drmmode;
int i;
TRACE_ENTER();
drmmode = calloc(1, sizeof *drmmode);
- if(!drmmode) {
+ if (!drmmode)
return FALSE;
- }
drmmode->fd = fd;
@@ -1199,29 +1244,35 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
drmmode->mode_res->count_connectors,
drmmode->mode_res->count_encoders);
DEBUG_MSG(" %d crtcs, %d fbs",
- drmmode->mode_res->count_crtcs, drmmode->mode_res->count_fbs);
+ drmmode->mode_res->count_crtcs,
+ drmmode->mode_res->count_fbs);
DEBUG_MSG(" %dx%d minimum resolution",
- drmmode->mode_res->min_width, drmmode->mode_res->min_height);
+ drmmode->mode_res->min_width,
+ drmmode->mode_res->min_height);
DEBUG_MSG(" %dx%d maximum resolution",
- drmmode->mode_res->max_width, drmmode->mode_res->max_height);
+ drmmode->mode_res->max_width,
+ drmmode->mode_res->max_height);
}
xf86CrtcSetSizeRange(pScrn, 320, 200, drmmode->mode_res->max_width,
drmmode->mode_res->max_height);
- if(ARMSOCPTR(pScrn)->crtcNum == -1) {
+ if (ARMSOCPTR(pScrn)->crtcNum == -1) {
INFO_MSG("Adding all CRTCs");
for (i = 0; i < drmmode->mode_res->count_crtcs; i++)
drmmode_crtc_init(pScrn, drmmode, i);
- }else if(ARMSOCPTR(pScrn)->crtcNum < drmmode->mode_res->count_crtcs) {
+ } else if (ARMSOCPTR(pScrn)->crtcNum < drmmode->mode_res->count_crtcs) {
drmmode_crtc_init(pScrn, drmmode, ARMSOCPTR(pScrn)->crtcNum);
} else {
- ERROR_MSG("Specified more Screens in xorg.conf than there are DRM CRTCs");
+ ERROR_MSG(
+ "Specified more Screens in xorg.conf than there are DRM CRTCs");
return FALSE;
}
- if(ARMSOCPTR(pScrn)->crtcNum != -1) {
- if (ARMSOCPTR(pScrn)->crtcNum < drmmode->mode_res->count_connectors)
- drmmode_output_init(pScrn, drmmode, ARMSOCPTR(pScrn)->crtcNum);
+ if (ARMSOCPTR(pScrn)->crtcNum != -1) {
+ if (ARMSOCPTR(pScrn)->crtcNum <
+ drmmode->mode_res->count_connectors)
+ drmmode_output_init(pScrn,
+ drmmode, ARMSOCPTR(pScrn)->crtcNum);
else
return FALSE;
} else {
@@ -1269,10 +1320,10 @@ int
drmmode_page_flip(DrawablePtr draw, uint32_t fb_id, void *priv)
{
ScrnInfoPtr pScrn = xf86Screens[draw->pScreen->myNum];
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- drmmode_crtc_private_ptr crtc = config->crtc[0]->driver_private;
- drmmode_ptr mode = crtc->drmmode;
+ struct drmmode_crtc_private_rec *crtc = config->crtc[0]->driver_private;
+ struct drmmode_rec *mode = crtc->drmmode;
int ret, i, failed = 0, num_flipped = 0;
unsigned int flags = 0;
@@ -1290,12 +1341,11 @@ drmmode_page_flip(DrawablePtr draw, uint32_t fb_id, void *priv)
fb_id, flags, priv);
if (ret) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "flip queue failed: %s\n", strerror(errno));
+ "flip queue failed: %s\n",
+ strerror(errno));
failed = 1;
- }
- else {
+ } else
num_flipped += 1;
- }
}
if (failed)
@@ -1312,8 +1362,8 @@ static void
drmmode_handle_uevents(int fd, void *closure)
{
ScrnInfoPtr pScrn = closure;
- ARMSOCPtr pARMSOC = ARMSOCPTR(pScrn);
- drmmode_ptr drmmode = drmmode_from_scrn(pScrn);
+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
+ struct drmmode_rec *drmmode = drmmode_from_scrn(pScrn);
struct udev_device *dev;
const char *hotplug;
struct stat s;
@@ -1323,8 +1373,9 @@ drmmode_handle_uevents(int fd, void *closure)
if (!dev)
return;
- // TODO: MIDEGL-1441: Do we need to keep this code, which Rob originally wrote
- // (i.e. up thru the "if" statement)?:
+ /* TODO: MIDEGL-1441: Do we need to keep this code, which
+ * Rob originally wrote? (i.e. up thru the "if" statement)?
+ */
/*
* Check to make sure this event is directed at our
@@ -1337,9 +1388,9 @@ drmmode_handle_uevents(int fd, void *closure)
hotplug = udev_device_get_property_value(dev, "HOTPLUG");
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "hotplug=%s, match=%d\n", hotplug,
- !memcmp(&s.st_rdev, &udev_devnum, sizeof (dev_t)));
+ !memcmp(&s.st_rdev, &udev_devnum, sizeof(dev_t)));
- if (memcmp(&s.st_rdev, &udev_devnum, sizeof (dev_t)) == 0 &&
+ if (memcmp(&s.st_rdev, &udev_devnum, sizeof(dev_t)) == 0 &&
hotplug && atoi(hotplug) == 1) {
RRGetInfo(screenInfo.screens[pScrn->scrnIndex], TRUE);
}
@@ -1349,7 +1400,7 @@ drmmode_handle_uevents(int fd, void *closure)
static void
drmmode_uevent_init(ScrnInfoPtr pScrn)
{
- drmmode_ptr drmmode = drmmode_from_scrn(pScrn);
+ struct drmmode_rec *drmmode = drmmode_from_scrn(pScrn);
struct udev *u;
struct udev_monitor *mon;
@@ -1385,7 +1436,7 @@ drmmode_uevent_init(ScrnInfoPtr pScrn)
static void
drmmode_uevent_fini(ScrnInfoPtr pScrn)
{
- drmmode_ptr drmmode = drmmode_from_scrn(pScrn);
+ struct drmmode_rec *drmmode = drmmode_from_scrn(pScrn);
TRACE_ENTER();
@@ -1404,7 +1455,7 @@ static void
drmmode_wakeup_handler(pointer data, int err, pointer p)
{
ScrnInfoPtr pScrn = data;
- drmmode_ptr drmmode;
+ struct drmmode_rec *drmmode;
fd_set *read_mask = p;
if (pScrn == NULL || err < 0)
@@ -1419,14 +1470,14 @@ drmmode_wakeup_handler(pointer data, int err, pointer p)
void
drmmode_wait_for_event(ScrnInfoPtr pScrn)
{
- drmmode_ptr drmmode = drmmode_from_scrn(pScrn);
+ struct drmmode_rec *drmmode = drmmode_from_scrn(pScrn);
drmHandleEvent(drmmode->fd, &event_context);
}
void
drmmode_screen_init(ScrnInfoPtr pScrn)
{
- drmmode_ptr drmmode = drmmode_from_scrn(pScrn);
+ struct drmmode_rec *drmmode = drmmode_from_scrn(pScrn);
drmmode_uevent_init(pScrn);
diff --git a/src/drmmode_driver.h b/src/drmmode_driver.h
index e6c2761..f6b996b 100644
--- a/src/drmmode_driver.h
+++ b/src/drmmode_driver.h
@@ -32,21 +32,23 @@
struct drmmode_interface {
- /* Flags value to pass to DRM_IOCTL_MODE_CREATE_DUMB to allocate a scanout-capable
- * buffer. A buffer allocated with these flags must be able to be wrapped in a
- * DRM framebuffer (via DRM_IOCTL_MODE_ADDFB or DRM_IOCTL_MODE_ADDFB2).
+ /* Flags value to pass to DRM_IOCTL_MODE_CREATE_DUMB to allocate
+ * a scanout-capable buffer. A buffer allocated with these flags
+ * must be able to be wrapped in a DRM framebuffer (via
+ * DRM_IOCTL_MODE_ADDFB or DRM_IOCTL_MODE_ADDFB2).
*/
uint32_t dumb_scanout_flags;
/* Flags value to pass to DRM_IOCTL_MODE_CREATE_DUMB to allocate a
- * non-scanout-capable buffer. It is acceptable for the driver to create a
- * scanout-capable buffer when given this flag, this flag is used to give the
- * option of preserving scarce scanout-capable memory if applicable.
+ * non-scanout-capable buffer. It is acceptable for the driver to
+ * create a scanout-capable buffer when given this flag, this flag
+ * is used to give the option of preserving scarce scanout-capable
+ * memory if applicable.
*/
uint32_t dumb_no_scanout_flags;
- /* Boolean value indicating whether DRM page flip events should be requested and
- * waited for during DRM_IOCTL_MODE_PAGE_FLIP.
+ /* Boolean value indicating whether DRM page flip events should
+ * be requested and waited for during DRM_IOCTL_MODE_PAGE_FLIP.
*/
int use_page_flip_events;
@@ -56,13 +58,15 @@ struct drmmode_interface {
/* The cursor height */
int cursor_height;
- /* A padding column of pixels of this width is added to either side of the image */
+ /* A padding column of pixels of this width is added to either
+ * side of the image
+ */
int cursor_padding;
/* (Optional) Initialize the given plane for use as a hardware cursor.
*
- * This function should do any initialization necessary, for example setting the
- * z-order on the plane to appear above all other layers.
+ * This function should do any initialization necessary, for example
+ * setting the z-order on the plane to appear above all other layers.
*
* @param drm_fd The DRM device file
* @param plane_id The plane to initialize
@@ -72,14 +76,15 @@ struct drmmode_interface {
/* (Mandatory) Set the cursor image from an ARGB image
*
- * If the cursor image is ARGB this is a straight copy, otherwise it must perform
- * any necessary conversion from ARGB to the cursor format.
+ * If the cursor image is ARGB this is a straight copy, otherwise
+ * it must perform any necessary conversion from ARGB to the
+ * cursor format.
*
* @param crtc The CRTC in use
* @param [out] d Pointer to the destination cursor image
* @param [in] s Pointer to the source for the cursor image
*/
- void (*set_cursor_image)( xf86CrtcPtr crtc, uint32_t * d, CARD32 *s );
+ void (*set_cursor_image)(xf86CrtcPtr crtc, uint32_t *d, CARD32 *s);
};
diff --git a/src/drmmode_exynos/drmmode_exynos.c b/src/drmmode_exynos/drmmode_exynos.c
index a81d8f9..9c9de7c 100644
--- a/src/drmmode_exynos/drmmode_exynos.c
+++ b/src/drmmode_exynos/drmmode_exynos.c
@@ -61,25 +61,26 @@ static int init_plane_for_cursor(int drm_fd, uint32_t plane_id)
* of the destination image. This is a workaround for a bug causing
* corruption when the cursor reaches the screen edges.
*/
-static void set_cursor_image( xf86CrtcPtr crtc, uint32_t * d, CARD32 *s )
+static void set_cursor_image(xf86CrtcPtr crtc, uint32_t *d, CARD32 *s)
{
int row;
- void* dst;
- const char* src_row;
- char* dst_row;
+ void *dst;
+ const char *src_row;
+ char *dst_row;
dst = d;
for (row = 0; row < CURSORH; row += 1) {
/* we're operating with ARGB data (4 bytes per pixel) */
- src_row = (const char*)s + row * 4 * CURSORW;
- dst_row = (char*)dst + row * 4 * (CURSORW + 2 * CURSORPAD);
+ src_row = (const char *)s + row * 4 * CURSORW;
+ dst_row = (char *)dst + row * 4 * (CURSORW + 2 * CURSORPAD);
/* set first CURSORPAD pixels in row to 0 */
memset(dst_row, 0, (4 * CURSORPAD));
/* copy cursor image pixel row across */
memcpy(dst_row + (4 * CURSORPAD), src_row, 4 * CURSORW);
/* set last CURSORPAD pixels in row to 0 */
- memset(dst_row + 4 * (CURSORPAD + CURSORW ), 0, (4 * CURSORPAD));
+ memset(dst_row + 4 * (CURSORPAD + CURSORW),
+ 0, (4 * CURSORPAD));
}
}
diff --git a/src/drmmode_pl111/drmmode_pl111.c b/src/drmmode_pl111/drmmode_pl111.c
index 424eb16..d8a16a5 100644
--- a/src/drmmode_pl111/drmmode_pl111.c
+++ b/src/drmmode_pl111/drmmode_pl111.c
@@ -33,9 +33,11 @@
*/
#define CURSORW (64)
#define CURSORH (64)
-#define CURSORPAD (0) /* Padding added down each side of cursor image */
+/* Padding added down each side of cursor image */
+#define CURSORPAD (0)
-/*#define ARGB_LBBP_CONVERSION_DEBUG un-comment to enable cursor format conversion debugging.*/
+/* un-comment to enable cursor format conversion debugging.*/
+/* #define ARGB_LBBP_CONVERSION_DEBUG */
#define LBBP_BACKGROUND (0x0)
#define LBBP_FOREGROUND (0x1)
@@ -48,21 +50,23 @@
#define LBBP_WORDS_PER_LINE (4)
#define LBBP_PIXELS_PER_WORD (16)
-/* shift required to locate pixel into the correct position in a cursor LBBP word,
- * indexed by x mod 16.*/
+/* shift required to locate pixel into the correct position in
+ * a cursor LBBP word, indexed by x mod 16.
+ */
const unsigned char x_mod_16_to_value_shift[LBBP_PIXELS_PER_WORD] = {
- 6,4,2,0,14,12,10,8,22,20,18,16,30,28,26,24
+ 6, 4, 2, 0, 14, 12, 10, 8, 22, 20, 18, 16, 30, 28, 26, 24
};
/* Pack the pixel value into its correct position in the buffer as specified
* for LBBP */
static inline void
-set_lbbp_pixel(uint32_t * buffer, unsigned int x, unsigned int y, uint32_t value )
+set_lbbp_pixel(uint32_t *buffer, unsigned int x, unsigned int y,
+ uint32_t value)
{
- uint32_t * p;
+ uint32_t *p;
uint32_t shift;
- assert( (x < CURSORW) && (y < CURSORH) );
+ assert((x < CURSORW) && (y < CURSORH));
shift = x_mod_16_to_value_shift[x % LBBP_PIXELS_PER_WORD];
@@ -75,14 +79,16 @@ set_lbbp_pixel(uint32_t * buffer, unsigned int x, unsigned int y, uint32_t value
}
/*
- * The PL111 hardware cursor supports only LBBP which is a 2bpp format but there are
- * no drm fourcc formats that are compatible with this so instead the PL111 DRM
- * reports (to DRM core) that it supports only DRM_FORMAT_ARGB8888 and expects the
- * DDX to supply an LBPP image in the first 1/16th of the buffer, the rest being unused.
- * Ideally we would want to receive the image in this format from X, but currently the
- * X cursor image is 32bpp ARGB so we need to convert to LBBP here.
+ * The PL111 hardware cursor supports only LBBP which is a 2bpp format but
+ * there are no drm fourcc formats that are compatible with this so instead
+ * the PL111 DRM reports (to DRM core) that it supports only
+ * DRM_FORMAT_ARGB8888 and expects the DDX to supply an LBPP image in the
+ * first 1/16th of the buffer, the rest being unused.
+ * Ideally we would want to receive the image in this format from X, but
+ * currently the X cursor image is 32bpp ARGB so we need to convert
+ * to LBBP here.
*/
-static void set_cursor_image( xf86CrtcPtr crtc, uint32_t * d, CARD32 *s )
+static void set_cursor_image(xf86CrtcPtr crtc, uint32_t *d, CARD32 *s)
{
#ifdef ARGB_LBBP_CONVERSION_DEBUG
/* Add 1 on width to insert trailing NULL */
@@ -91,34 +97,37 @@ static void set_cursor_image( xf86CrtcPtr crtc, uint32_t * d, CARD32 *s )
unsigned int x;
unsigned int y;
- for ( y = 0; y < CURSORH ; y++) {
- for ( x = 0; x < CURSORW ; x++) {
+ for (y = 0; y < CURSORH ; y++) {
+ for (x = 0; x < CURSORW ; x++) {
uint32_t value = LBBP_TRANSPARENT;
/* If pixel visible foreground/background */
- if ( ( *s & ARGB_ALPHA ) != 0 ) {
- /* Any color set then just convert to foreground for now */
- if ( ( *s & ARGB_RGB ) != 0 )
+ if ((*s & ARGB_ALPHA) != 0) {
+ /* Any color set then just convert to
+ * foreground for now
+ */
+ if ((*s & ARGB_RGB) != 0)
value = LBBP_FOREGROUND;
else
value = LBBP_BACKGROUND;
}
#ifdef ARGB_LBBP_CONVERSION_DEBUG
- if ( value == LBBP_TRANSPARENT ) {
+ if (value == LBBP_TRANSPARENT)
string_cursor[x] = 'T';
- } else if ( value == LBBP_FOREGROUND ) {
+ else if (value == LBBP_FOREGROUND)
string_cursor[x] = 'F';
- } else if ( value == LBBP_INVERSE ) {
+ else if (value == LBBP_INVERSE)
string_cursor[x] = 'I';
- } else {
+ else
string_cursor[x] = 'B';
- }
+
#endif /* ARGB_LBBP_CONVERSION_DEBUG */
- set_lbbp_pixel( d, x, y, value );
+ set_lbbp_pixel(d, x, y, value);
++s;
}
#ifdef ARGB_LBBP_CONVERSION_DEBUG
string_cursor[CURSORW] = '\0';
- xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO, "%s\n", string_cursor );
+ xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO, "%s\n",
+ string_cursor);
#endif /* ARGB_LBBP_CONVERSION_DEBUG */
}
}
diff --git a/src/drmmode_template/drmmode_template.c b/src/drmmode_template/drmmode_template.c
index 7f94d91..d8cdafe 100644
--- a/src/drmmode_template/drmmode_template.c
+++ b/src/drmmode_template/drmmode_template.c
@@ -30,9 +30,12 @@
* cursor images in the max size, so don't use width/height values
* that are too big
*/
-#define CURSORW (64) /* width */
-#define CURSORH (64) /* height */
-#define CURSORPAD (0) /* Padding added down each side of cursor image */
+/* width */
+#define CURSORW (64)
+/* height */
+#define CURSORH (64)
+/* Padding added down each side of cursor image */
+#define CURSORPAD (0)
/* Optional function */
static int init_plane_for_cursor(int drm_fd, uint32_t plane_id)
@@ -40,7 +43,7 @@ static int init_plane_for_cursor(int drm_fd, uint32_t plane_id)
return 0;
}
-static void set_cursor_image( xf86CrtcPtr crtc, uint32_t * d, CARD32 *s )
+static void set_cursor_image(xf86CrtcPtr crtc, uint32_t *d, CARD32 *s)
{
/* provide a method of setting the cursor image here */
}