Revert "After the previous revert fix libdrm to start at minor 1"
This reverts commit f51dc37d75
.
Conflicts:
tests/modedemo/demo.c
main
parent
f276c845bd
commit
db85ed25af
|
@ -355,7 +355,7 @@ static int drmOpenMinor(int minor, int create, int type)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
||||||
if (create)
|
if (create)
|
||||||
return drmOpenDevice(makedev(DRM_MAJOR, minor), minor, type);
|
return drmOpenDevice(makedev(DRM_MAJOR, minor), minor, type);
|
||||||
|
|
||||||
|
@ -421,15 +421,8 @@ static int drmOpenByBusid(const char *busid)
|
||||||
const char *buf;
|
const char *buf;
|
||||||
drmSetVersion sv;
|
drmSetVersion sv;
|
||||||
|
|
||||||
/*
|
|
||||||
* Open the first minor number that matches the driver name and isn't
|
|
||||||
* already in use. If it's in use it will have a busid assigned already.
|
|
||||||
*
|
|
||||||
* start at 1, as 0 is the control node, and we should use drmOpenControl
|
|
||||||
* for that.
|
|
||||||
*/
|
|
||||||
drmMsg("drmOpenByBusid: Searching for BusID %s\n", busid);
|
drmMsg("drmOpenByBusid: Searching for BusID %s\n", busid);
|
||||||
for (i = 1; i < DRM_MAX_MINOR; i++) {
|
for (i = 0; i < DRM_MAX_MINOR; i++) {
|
||||||
fd = drmOpenMinor(i, 1, DRM_NODE_RENDER);
|
fd = drmOpenMinor(i, 1, DRM_NODE_RENDER);
|
||||||
drmMsg("drmOpenByBusid: drmOpenMinor returns %d\n", fd);
|
drmMsg("drmOpenByBusid: drmOpenMinor returns %d\n", fd);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
|
@ -474,14 +467,24 @@ static int drmOpenByName(const char *name)
|
||||||
drmVersionPtr version;
|
drmVersionPtr version;
|
||||||
char * id;
|
char * id;
|
||||||
|
|
||||||
|
if (!drmAvailable()) {
|
||||||
|
if (!drm_server_info) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* try to load the kernel module now */
|
||||||
|
if (!drm_server_info->load_module(name)) {
|
||||||
|
drmMsg("[drm] failed to load kernel module \"%s\"\n", name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the first minor number that matches the driver name and isn't
|
* Open the first minor number that matches the driver name and isn't
|
||||||
* already in use. If it's in use it will have a busid assigned already.
|
* already in use. If it's in use it will have a busid assigned already.
|
||||||
*
|
|
||||||
* start at 1, as 0 is the control node, and we should use drmOpenControl
|
|
||||||
* for that.
|
|
||||||
*/
|
*/
|
||||||
for (i = 1; i < DRM_MAX_MINOR; i++) {
|
for (i = 0; i < DRM_MAX_MINOR; i++) {
|
||||||
if ((fd = drmOpenMinor(i, 1, DRM_NODE_RENDER)) >= 0) {
|
if ((fd = drmOpenMinor(i, 1, DRM_NODE_RENDER)) >= 0) {
|
||||||
if ((version = drmGetVersion(fd))) {
|
if ((version = drmGetVersion(fd))) {
|
||||||
if (!strcmp(version->name, name)) {
|
if (!strcmp(version->name, name)) {
|
||||||
|
|
|
@ -351,7 +351,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
printf("Starting test\n");
|
printf("Starting test\n");
|
||||||
|
|
||||||
fd = drmOpen("i915", NULL);
|
fd = drmOpenControl(0);
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
printf("Failed to open the card fb (%d)\n",fd);
|
printf("Failed to open the card fb (%d)\n",fd);
|
||||||
|
|
|
@ -10,19 +10,13 @@
|
||||||
/* Pitch needs to be power of two */
|
/* Pitch needs to be power of two */
|
||||||
#define PITCH 2048
|
#define PITCH 2048
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef CLEAN_FBDEV
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <linux/fb.h>
|
|
||||||
#endif
|
|
||||||
#include "xf86drm.h"
|
#include "xf86drm.h"
|
||||||
#include "xf86drmMode.h"
|
#include "xf86drmMode.h"
|
||||||
|
|
||||||
|
@ -32,11 +26,6 @@ void testCursor(int fd, uint32_t crtc);
|
||||||
void prettyColors(int fd, unsigned int handle);
|
void prettyColors(int fd, unsigned int handle);
|
||||||
void prettyCursor(int fd, unsigned int handle, unsigned int color);
|
void prettyCursor(int fd, unsigned int handle, unsigned int color);
|
||||||
|
|
||||||
#ifdef CLEAN_FBDEV
|
|
||||||
struct fb_var_screeninfo var;
|
|
||||||
struct fb_fix_screeninfo fix;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* structs for the demo_driver */
|
/* structs for the demo_driver */
|
||||||
|
|
||||||
struct demo_driver;
|
struct demo_driver;
|
||||||
|
@ -111,19 +100,6 @@ int main(int argc, char **argv)
|
||||||
struct demo_driver *driver;
|
struct demo_driver *driver;
|
||||||
int num;
|
int num;
|
||||||
int i;
|
int i;
|
||||||
#ifdef CLEAN_FBDEV
|
|
||||||
int fbdev_fd;
|
|
||||||
|
|
||||||
fbdev_fd = open("/dev/fb0", O_RDWR);
|
|
||||||
|
|
||||||
memset(&var, 0, sizeof(struct fb_var_screeninfo));
|
|
||||||
memset(&fix, 0, sizeof(struct fb_fix_screeninfo));
|
|
||||||
|
|
||||||
if (ioctl(fbdev_fd, FBIOGET_VSCREENINFO, &var))
|
|
||||||
printf("var %s\n", strerror(errno));
|
|
||||||
if (ioctl(fbdev_fd, FBIOGET_FSCREENINFO, &fix))
|
|
||||||
printf("fix %s\n", strerror(errno));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
printf("starting demo\n");
|
printf("starting demo\n");
|
||||||
|
|
||||||
|
@ -378,7 +354,7 @@ struct demo_driver* demoCreateDriver(void)
|
||||||
|
|
||||||
memset(driver, 0, sizeof(struct demo_driver));
|
memset(driver, 0, sizeof(struct demo_driver));
|
||||||
|
|
||||||
driver->fd = drmOpen("i915", NULL);
|
driver->fd = drmOpenControl(0);
|
||||||
|
|
||||||
if (driver->fd < 0) {
|
if (driver->fd < 0) {
|
||||||
printf("Failed to open the card fb\n");
|
printf("Failed to open the card fb\n");
|
||||||
|
|
|
@ -26,7 +26,7 @@ int main(int argc, char **argv)
|
||||||
char name[100];
|
char name[100];
|
||||||
int i,d;
|
int i,d;
|
||||||
int fd;
|
int fd;
|
||||||
int drmfd = drmOpen("i915", NULL);
|
int drmfd = drmOpenControl(0);
|
||||||
|
|
||||||
/* try four devices */
|
/* try four devices */
|
||||||
for (d = 0; d < 4; d++) {
|
for (d = 0; d < 4; d++) {
|
||||||
|
|
Loading…
Reference in New Issue