Add config.h macro HAVE_NOUVEAU
PATCH 1/6 Add config.h macro HAVE_NOUVEAU
--- configure.ac | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
configure.ac +3 -0
@@ -154,6 +154,9 @@ if test "x$VMWGFX" = xyes; then fi AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" = xyes]) +if test "x$NOUVEAU" = xyes; then + AC_DEFINE(HAVE_NOUVEAU, 1, [Have nouveau (nvidia) support]) +fi AM_CONDITIONAL(HAVE_RADEON, [test "x$RADEON" = xyes])
Signature · 10 lines
1.6.4.4 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 2/6 libkms/intel: Throw out unused intel_bo fields.
--- libkms/intel.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
libkms/intel.c +0 -2
@@ -44,9 +44,7 @@struct intel_bo {struct kms_bo base; -unsigned handle;unsigned map_count; -int mapped; }; static int
Signature · 10 lines
1.6.4.4 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 3/6 libkms: Add nouveau support.
--- libkms/Makefile.am | 4 + libkms/internal.h | 2 + libkms/linux.c | 4 + libkms/nouveau.c | 221 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 231 insertions(+), 0 deletions(-) create mode 100644 libkms/nouveau.c
libkms/Makefile.am +4 -0
@@ -21,6 +21,10 @@ if HAVE_VMWGFX libkms_la_SOURCES += vmwgfx.c endif +if HAVE_NOUVEAU +libkms_la_SOURCES += nouveau.c +endif + libkmsincludedir = ${includedir}/libkms libkmsinclude_HEADERS = libkms.h
libkms/internal.h +2 -0
@@ -68,4 +68,6 @@ int vmwgfx_create(int fd, struct kms_driver **out);int intel_create (int fd,struct kms_driver **out); +int nouveau_create (int fd,struct kms_driver **out); +#endif
libkms/linux.c +4 -0
@@ -107,6 +107,10 @@ linux_from_sysfs(int fd, struct kms_driver **out) else if (!strcmp(name, "vmwgfx")) ret =vmwgfx_create (fd, out);#endif +#ifdef HAVE_NOUVEAU + else if (!strcmp(name, "nouveau")) + ret =nouveau_create (fd, out); +#endif else ret = -ENOSYS ;
libkms/nouveau.c new file +221 -0
221 lines not on this page · raw message
Signature · 1 line
1.6.4.4
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel
PATCH 4/6 tests/modetest: Don't get_props on a connector after freeing it.
--- tests/modetest/modetest.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
tests/modetest/modetest.c +2 -2
@@ -206,10 +206,10 @@ void dump_connectors(void)for (j =0 ; j < connector->count_modes; j++)dump_mode (&connector->modes[j]); -drmModeFreeConnector (connector); -printf (" props:\n" );dump_props (connector); + +drmModeFreeConnector (connector); }printf ("\n" ); }
Signature · 10 lines
1.6.4.4 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 5/6 tests: Add nouveau to list of supported modules.
--- tests/kmstest/main.c | 1 + tests/modetest/modetest.c | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
tests/kmstest/main.c +1 -0
@@ -59,6 +59,7 @@ int test_bo(struct kms_driver *kms)char *drivers[] = {"i915" ,"radeon" , +"nouveau" ,"vmwgfx" ,NULL };
tests/modetest/modetest.c +1 -1
@@ -680,7 +680,7 @@ int main(int argc, char **argv)int c;int encoders =0 , connectors =0 , crtcs =0 , framebuffers =0 ;int test_vsync =0 ; -char *modules[] = {"i915" ,"radeon" }; +char *modules[] = {"i915" ,"radeon" ,"nouveau" };char *modeset =NULL ;int i, count =0 ;struct connector con_args[2 ];
Signature · 10 lines
1.6.4.4 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 6/6 modes: vrefresh is actually not * 1000.
--- tests/modeprint/modeprint.c | 4 ++-- tests/modetest/modetest.c | 4 ++-- xf86drmMode.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
tests/modeprint/modeprint.c +2 -2
@@ -81,8 +81,8 @@ int printMode(struct drm_mode_modeinfo *mode)printf ("\tvrefresh : %i\n" , mode->vrefresh);printf ("\tflags : %i\n" , mode->flags); }else { -printf ("Mode: \"%s\" %ix%i %.0f\n" , mode->name, - mode->hdisplay, mode->vdisplay, mode->vrefresh /1000.0 ); +printf ("Mode: \"%s\" %ix%i %i\n" , mode->name, + mode->hdisplay, mode->vdisplay, mode->vrefresh); }return 0 ; }
tests/modetest/modetest.c +2 -2
@@ -143,9 +143,9 @@ void dump_encoders(void)void dump_mode (drmModeModeInfo *mode) { - printf(" %s %.02f %d %d %d %d %d %d %d %d\n", + printf(" %s %d %d %d %d %d %d %d %d %d\n", mode->name, - (float)mode->vrefresh / 1000, + mode->vrefresh, mode->hdisplay, mode->hsync_start, mode->hsync_end,
xf86drmMode.h +1 -1
@@ -181,7 +181,7 @@ typedef struct _drmModeModeInfo {uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew;uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan; -uint32_t vrefresh;/* vertical refresh * 1000 */ +uint32_t vrefresh;uint32_t flags;uint32_t type;
Signature · 10 lines
1.6.4.4 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
Re: [PATCH 3/6] libkms: Add nouveau support.
In reply to Marcin KościelnickiHi Marcin,
I have some minor comments inlined below.
Best regards,
Erik
Quoted 22 lines
libkms/nouveau.c new file +22
-0+static int +nouveau_bo_create (struct kms_driver *kms, + const unsigned width, const unsigned height, + const enum kms_bo_type type, const unsigned *attr, + struct kms_bo **out) +{ + struct drm_nouveau_gem_new arg; + unsigned size, pitch; + struct nouveau_bo *bo; + int i, ret; + + for (i = 0; attr[i]; i += 2) { + switch (attr[i]) { + case KMS_WIDTH: + case KMS_HEIGHT: + case KMS_BO_TYPE: + break; + default: + return -EINVAL; + } + } +
libkms/nouveau.c line 102
Quoted 10 lines
libkms/nouveau.c new file +10
-0+ bo = calloc(1, sizeof(*bo)); + if (!bo) + return -ENOMEM; + + if (type == KMS_BO_TYPE_CURSOR_64X64_ARGB) { + pitch = 64 * 4; + size = 64 * 64 * 4; + } else if (type == KMS_BO_TYPE_SCANOUT) { + pitch = width * 4; + pitch = (pitch + 512 - 1) & ~(512 - 1);
What is 512 derived from?
Would a #define explain this better?
Quoted 38 lines
+ size = pitch * height;
+ } else {
+ return-EINVAL;
+ }libkms/nouveau.c new file +34
-0+ + memset(&arg, 0, sizeof(arg)); + arg.info.size = size; + arg.info.domain = NOUVEAU_GEM_DOMAIN_MAPPABLE | NOUVEAU_GEM_DOMAIN_VRAM; + arg.info.tile_mode = 0; + arg.info.tile_flags = 0; + arg.align = 512; + arg.channel_hint = 0; + + ret = drmCommandWriteRead(kms->fd, DRM_NOUVEAU_GEM_NEW, &arg, sizeof(arg)); + if (ret) + goto err_free; + + bo->base.kms = kms; + bo->base.handle = arg.info.handle; + bo->base.size = size; + bo->base.pitch = pitch; + bo->map_handle = arg.info.map_handle; + + *out = &bo->base; + + return 0; + +err_free: + free(bo); + return ret; +} + +static int +nouveau_bo_get_prop (struct kms_bo *bo,unsigned key,unsigned *out) +{ + switch (key) { + default: + return -EINVAL;
libkms/nouveau.c line 150
Quoted 10 lines
libkms/nouveau.c new file +10
-0+ } +} + +static int +nouveau_bo_map (struct kms_bo *_bo,void **out) +{ + struct nouveau_bo *bo = (struct nouveau_bo *)_bo; + void *map = NULL; + int ret; +
ret is unused.
Quoted 76 lines
+ if (
bo->base.ptr) {
+ bo->map_count++;
+ *out =bo->base.ptr;
+ return 0;
+ }libkms/nouveau.c new file +66
-1+ + map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, bo->map_handle); + if (map == MAP_FAILED) + return -errno; + + bo->base.ptr = map; + bo->map_count++; + *out = bo->base.ptr; + + return 0; +} + +static int +nouveau_bo_unmap (struct kms_bo *_bo) +{ + struct nouveau_bo *bo = (struct nouveau_bo *)_bo; + bo->map_count--; + return 0; +} + +static int +nouveau_bo_destroy (struct kms_bo *_bo) +{ + struct nouveau_bo *bo = (struct nouveau_bo *)_bo; + struct drm_gem_close arg; + int ret; + + if (bo->base.ptr) { + /* XXX Sanity check map_count */ + munmap(bo->base.ptr, bo->base.size); + bo->base.ptr = NULL; + } + + memset(&arg, 0, sizeof(arg)); + arg.handle = bo->base.handle; + + ret = drmIoctl(bo->base.kms->fd, DRM_IOCTL_GEM_CLOSE, &arg); + if (ret) + return -errno; + + free(bo); + return 0; +} + +int +nouveau_create (int fd,struct kms_driver **out) +{ + struct kms_driver *kms; + + kms = calloc(1, sizeof(*kms)); + if (!kms) + return -ENOMEM; + + kms->fd = fd; + + kms->bo_create = nouveau_bo_create; + kms->bo_map = nouveau_bo_map; + kms->bo_unmap = nouveau_bo_unmap; + kms->bo_get_prop = nouveau_bo_get_prop; + kms->bo_destroy = nouveau_bo_destroy; +// kms->get_prop = nouveau_get_prop; + kms->destroy = nouveau_destroy; + *out = kms; + + return 0; +} --1.6.4.4
Quoted 13 lines
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--