summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-06-07 15:26:30 +0100
committerDave Airlie <airlied@redhat.com>2012-06-07 15:26:30 +0100
commitd6243012c441a21d11f6a285f907c73be99e456b (patch)
tree97b66f75641a9e695270854696151b0f501fd528
parentc8ff63337a8b1f552c801050283f62d92d997ae6 (diff)
modesetting: update for new API
-rw-r--r--src/driver.c78
-rw-r--r--src/drmmode_display.c13
2 files changed, 50 insertions, 41 deletions
diff --git a/src/driver.c b/src/driver.c
index e26b19e..4e2cfa0 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -51,7 +51,7 @@
#include "dixstruct.h"
#include "shadow.h"
#include "xf86xv.h"
-#include "xf86udev.h"
+#include "xf86platformBus.h"
#include <X11/extensions/Xv.h>
#include <xorg-server.h>
#if XSERVER_LIBPCIACCESS
@@ -66,16 +66,16 @@
DevPrivateKeyRec msPixmapPrivateKeyRec;
-static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags);
+static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y);
static Bool CloseScreen(ScreenPtr pScreen);
-static Bool EnterVT(ScrnInfoPtr pScrn, int flags);
+static Bool EnterVT(ScrnInfoPtr pScrn);
static void Identify(int flags);
static const OptionInfoRec *AvailableOptions(int chipid, int busid);
static ModeStatus ValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose,
int flags);
-static void FreeScreen(ScrnInfoPtr pScrn, int flags);
-static void LeaveVT(ScrnInfoPtr pScrn, int flags);
-static Bool SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int flags);
+static void FreeScreen(ScrnInfoPtr pScrn);
+static void LeaveVT(ScrnInfoPtr pScrn);
+static Bool SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
static Bool ScreenInit(ScreenPtr pScreen, int argc,
char **argv);
static Bool PreInit(ScrnInfoPtr pScrn, int flags);
@@ -97,8 +97,9 @@ static const struct pci_id_match ms_device_match[] = {
};
#endif
-static Bool ms_udev_probe(DriverPtr driver,
- int entity_num, struct xf86_udev_device *device);
+static Bool ms_platform_probe(DriverPtr driver,
+ int entity_num, int flags, struct xf86_platform_device *device,
+ intptr_t match_data);
_X_EXPORT DriverRec modesetting = {
1,
@@ -110,8 +111,8 @@ _X_EXPORT DriverRec modesetting = {
0,
DriverFunc,
ms_device_match,
- NULL,//ms_pci_probe,
- ms_udev_probe,
+ ms_pci_probe,
+ ms_platform_probe,
};
static SymTabRec Chipsets[] = {
@@ -178,8 +179,8 @@ Setup(pointer module, pointer opts, int *errmaj, int *errmin)
static Bool DriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr)
{
switch(op) {
- case GET_DRV_MODEL_V2_SUPPORT:
- return TRUE;
+ // case GET_DRV_MODEL_V2_SUPPORT:
+ // return TRUE;
default:
return FALSE;
}
@@ -268,13 +269,18 @@ ms_pci_probe(DriverPtr driver,
#endif
static Bool
-ms_udev_probe(DriverPtr driver,
- int entity_num, struct xf86_udev_device *dev)
+ms_platform_probe(DriverPtr driver,
+ int entity_num, int flags, struct xf86_platform_device *dev, intptr_t match_data)
{
ScrnInfoPtr scrn = NULL;
-
- if (probe_hw(dev->path)) {
- scrn = xf86AllocateGPUScreen(driver, 0);
+ char *path = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_PATH);
+ int scr_flags = 0;
+
+ if (flags & PLATFORM_PROBE_GPU_SCREEN)
+ scr_flags = XF86_ALLOCATE_GPU_SCREEN;
+
+ if (probe_hw(path)) {
+ scrn = xf86AllocateScreen(driver, scr_flags);
xf86AddEntityToScreen(scrn, entity_num);
scrn->driverName = "modesetting";
@@ -290,8 +296,9 @@ ms_udev_probe(DriverPtr driver,
scrn->roles = RR_Role_Slave_Output;
scrn->abilities = 0;
xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "using drv %s\n", dev ? dev->path : "default device");
+ "using drv %s\n", path ? path : "default device");
}
+
return scrn != NULL;
}
@@ -418,7 +425,7 @@ static void dispatch_dirty_crtc(ScrnInfoPtr scrn, xf86CrtcPtr crtc)
{
modesettingPtr ms = modesettingPTR(scrn);
ScreenPtr pScreen = scrn->pScreen;
- PixmapPtr pixmap = crtc->randr_crtc->slave_pixmap;
+ PixmapPtr pixmap = crtc->randr_crtc->scanout_pixmap;
msPixmapPrivPtr ppriv = msGetPixmapPriv(pixmap);
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
DamagePtr damage = drmmode_crtc->slave_damage;
@@ -443,20 +450,20 @@ static void dispatch_slave_dirty(ScreenPtr pScreen)
if (!crtc->randr_crtc)
continue;
- if (!crtc->randr_crtc->slave_pixmap)
+ if (!crtc->randr_crtc->scanout_pixmap)
continue;
dispatch_dirty_crtc(scrn, crtc);
}
}
-static void msBlockHandler(ScreenPtr pScreen, pointer blockData, pointer pTimeout,
+static void msBlockHandler(ScreenPtr pScreen, pointer pTimeout,
pointer pReadmask)
{
modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen));
pScreen->BlockHandler = ms->BlockHandler;
- pScreen->BlockHandler(pScreen, blockData, pTimeout, pReadmask);
+ pScreen->BlockHandler(pScreen, pTimeout, pReadmask);
pScreen->BlockHandler = msBlockHandler;
if (pScreen->isGPU) {
@@ -557,9 +564,9 @@ PreInit(ScrnInfoPtr pScrn, int flags)
memcpy(ms->Options, Options, sizeof(Options));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options);
- if (pEnt->location.type == BUS_UDEV) {
- devicename = pEnt->location.id.udev->path;
- ms->fd = open_hw(devicename);
+ if (pEnt->location.type == BUS_PLATFORM) {
+ char *path = xf86_get_platform_device_attrib(pEnt->location.id.plat, ODEV_ATTRIB_PATH);
+ ms->fd = open_hw(path);
} else if (pEnt->location.type == BUS_PCI) {
ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
if (ms->PciInfo) {
@@ -674,8 +681,6 @@ CreateScreenResources(ScreenPtr pScreen)
drmmode_uevent_init(pScrn, &ms->drmmode);
- if (!ms->SWCursor)
- drmmode_map_cursor_bos(pScrn, &ms->drmmode);
pixels = drmmode_map_front_bo(&ms->drmmode);
if (!pixels)
return FALSE;
@@ -821,10 +826,13 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
/* Need to extend HWcursor support to handle mask interleave */
- if (!ms->drmmode.sw_cursor)
+ if (!ms->drmmode.sw_cursor) {
+ drmmode_map_cursor_bos(pScrn, &ms->drmmode);
+
xf86_cursors_init(pScreen, 64, 64,
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
HARDWARE_CURSOR_ARGB);
+ }
/* Must force it before EnterVT, so we are in control of VT and
* later memory should be bound when allocating, e.g rotate_mem */
@@ -850,11 +858,11 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
if (serverGeneration == 1)
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
- return EnterVT(pScrn, 1);
+ return EnterVT(pScrn);
}
static void
-AdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags)
+AdjustFrame(ScrnInfoPtr pScrn, int x, int y)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86OutputPtr output = config->output[config->compat_output];
@@ -869,13 +877,13 @@ AdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags)
}
static void
-FreeScreen(ScrnInfoPtr pScrn, int flags)
+FreeScreen(ScrnInfoPtr pScrn)
{
FreeRec(pScrn);
}
static void
-LeaveVT(ScrnInfoPtr pScrn, int flags)
+LeaveVT(ScrnInfoPtr pScrn)
{
pScrn->vtSema = FALSE;
}
@@ -884,7 +892,7 @@ LeaveVT(ScrnInfoPtr pScrn, int flags)
* This gets called when gaining control of the VT, and from ScreenInit().
*/
static Bool
-EnterVT(ScrnInfoPtr pScrn, int flags)
+EnterVT(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
@@ -897,7 +905,7 @@ EnterVT(ScrnInfoPtr pScrn, int flags)
}
static Bool
-SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int flags)
+SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
return xf86SetSingleMode(pScrn, mode, RR_Rotate_0);
@@ -925,7 +933,7 @@ CloseScreen(ScreenPtr pScreen)
drmmode_free_bos(pScrn, &ms->drmmode);
if (pScrn->vtSema) {
- LeaveVT(pScrn, 0);
+ LeaveVT(pScrn);
}
pScreen->CreateScreenResources = ms->createScreenResources;
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 78e3168..7769514 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -374,8 +374,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
drmmode_ConvertToKMode(crtc->scrn, &kmode, mode);
fb_id = drmmode->fb_id;
- if (crtc->randr_crtc->slave_pixmap) {
- msPixmapPrivPtr ppriv = msGetPixmapPriv(crtc->randr_crtc->slave_pixmap);
+ if (crtc->randr_crtc->scanout_pixmap) {
+ msPixmapPrivPtr ppriv = msGetPixmapPriv(crtc->randr_crtc->scanout_pixmap);
fb_id = ppriv->fb_id;
x = y = 0;
} else if (drmmode_crtc->rotate_fb_id) {
@@ -504,12 +504,12 @@ drmmode_set_slave_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
void *ptr;
if (!ppix) {
- if (crtc->randr_crtc->slave_pixmap) {
- ppriv = msGetPixmapPriv(crtc->randr_crtc->slave_pixmap);
+ if (crtc->randr_crtc->scanout_pixmap) {
+ ppriv = msGetPixmapPriv(crtc->randr_crtc->scanout_pixmap);
drmModeRmFB(drmmode->fd, ppriv->fb_id);
}
if (drmmode_crtc->slave_damage) {
- DamageUnregister(&crtc->randr_crtc->slave_pixmap->drawable,
+ DamageUnregister(&crtc->randr_crtc->scanout_pixmap->drawable,
drmmode_crtc->slave_damage);
drmmode_crtc->slave_damage = NULL;
}
@@ -1144,7 +1144,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
xf86CrtcSetSizeRange(pScrn, 320, 200, drmmode->mode_res->max_width, drmmode->mode_res->max_height);
for (i = 0; i < drmmode->mode_res->count_crtcs; i++)
- if (!xf86IsEntityShared(pScrn->entityList[0]) || pScrn->confScreen->devices[0]->screen == i)
+ if (!xf86IsEntityShared(pScrn->entityList[0]) || pScrn->confScreen->device->screen == i)
drmmode_crtc_init(pScrn, drmmode, i);
for (i = 0; i < drmmode->mode_res->count_connectors; i++)
@@ -1157,6 +1157,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
provider = xf86ProviderCreate(pScrn);
if (provider == NULL)
return FALSE;
+
xf86InitialConfiguration(pScrn, TRUE);
return TRUE;