xf86-video-modesetting: 2 commits - src/compat-api.h src/driver.c src/drmmode_display.c
Dave Airlie
airlied at kemper.freedesktop.org
Wed May 23 03:22:47 PDT 2012
src/compat-api.h | 41 +++++++++++++++++++++++++++++++++++++++++
src/driver.c | 11 ++++++-----
src/drmmode_display.c | 5 +++--
3 files changed, 50 insertions(+), 7 deletions(-)
New commits:
commit 93f59c6eb5d3bbacdde8676eb016329644005596
Author: Dave Airlie <airlied at redhat.com>
Date: Wed May 23 11:21:55 2012 +0100
modesetting: convert to new scrn conversion APIs.
Generated with util/modular/x-driver-screen-scrn-conv.sh
Signed-off-by: Dave Airlie <airlied at redhat.com>
diff --git a/src/driver.c b/src/driver.c
index ce4cdec..61e0615 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -348,7 +348,7 @@ GetRec(ScrnInfoPtr pScrn)
static void dispatch_dirty(ScreenPtr pScreen)
{
- ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
modesettingPtr ms = modesettingPTR(scrn);
RegionPtr dirty = DamageRegion(ms->damage);
unsigned num_cliprects = REGION_NUM_RECTS(dirty);
@@ -393,7 +393,7 @@ static void msBlockHandler(int i, pointer blockData, pointer pTimeout,
pointer pReadmask)
{
ScreenPtr pScreen = screenInfo.screens[i];
- modesettingPtr ms = modesettingPTR(xf86Screens[pScreen->myNum]);
+ modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen));
pScreen->BlockHandler = ms->BlockHandler;
pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
@@ -586,7 +586,7 @@ static void *
msShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset, int mode,
CARD32 *size, void *closure)
{
- ScrnInfoPtr pScrn = xf86Screens[screen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
modesettingPtr ms = modesettingPTR(pScrn);
int stride;
@@ -599,7 +599,7 @@ msShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset, int mode,
static Bool
CreateScreenResources(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
modesettingPtr ms = modesettingPTR(pScrn);
PixmapPtr rootPixmap;
Bool ret;
@@ -660,7 +660,7 @@ msShadowInit(ScreenPtr pScreen)
static Bool
ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
modesettingPtr ms = modesettingPTR(pScrn);
VisualPtr visual;
int ret;
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 22fc66a..c0cc06b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -938,7 +938,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
drmmode_ptr drmmode = drmmode_crtc->drmmode;
struct dumb_bo *old_front = NULL;
Bool ret;
- ScreenPtr screen = screenInfo.screens[scrn->scrnIndex];
+ ScreenPtr screen = xf86ScrnToScreen(scrn);
uint32_t old_fb_id;
int i, pitch, old_width, old_height, old_pitch;
int cpp = (scrn->bitsPerPixel + 7) / 8;
@@ -1229,7 +1229,7 @@ drmmode_handle_uevents(int fd, void *closure)
if (!dev)
return;
- RRGetInfo(screenInfo.screens[scrn->scrnIndex], TRUE);
+ RRGetInfo(xf86ScrnToScreen(scrn), TRUE);
udev_device_unref(dev);
}
#endif
commit 5a8b7966729f114b354dd6606cfb340035cd82f5
Author: Dave Airlie <airlied at redhat.com>
Date: Wed May 23 11:21:39 2012 +0100
modesetting: add compat header file
Signed-off-by: Dave Airlie <airlied at redhat.com>
diff --git a/src/compat-api.h b/src/compat-api.h
new file mode 100644
index 0000000..1bb7724
--- /dev/null
+++ b/src/compat-api.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Dave Airlie <airlied at redhat.com>
+ */
+
+/* this file provides API compat between server post 1.13 and pre it,
+ it should be reused inside as many drivers as possible */
+#ifndef COMPAT_API_H
+#define COMPAT_API_H
+
+#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
+#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
+#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
+#endif
+
+#ifndef XF86_HAS_SCRN_CONV
+#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
+#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
+#endif
+
+#endif
diff --git a/src/driver.c b/src/driver.c
index e977150..ce4cdec 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -57,6 +57,7 @@
#include <pciaccess.h>
#endif
+#include "compat-api.h"
#include "driver.h"
static void AdjustFrame(int scrnIndex, int x, int y, int flags);
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 71f2e02..22fc66a 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -49,6 +49,7 @@
#define DPMS_SERVER
#include <X11/extensions/dpms.h>
#endif
+#include "compat-api.h"
static struct dumb_bo *dumb_bo_create(int fd,
const unsigned width, const unsigned height,
More information about the xorg-commit
mailing list