[Nouveau] [Bug 92032] NV34: WARNING: CPU: 0 PID: 290 at lib/dma-debug.c:1205 check_sync+0x169/0x6e0()

2015-12-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=92032

--- Comment #6 from poma  ---
Created attachment 120544
  --> https://bugs.freedesktop.org/attachment.cgi?id=120544&action=edit
4.4.0-0.rc5.git0.1.fc24.i686+debug nouveau sync DMA memory not allocated


WARNING: CPU: 0 PID: 340 at lib/dma-debug.c:1205 check_sync+0x16b/0x7d0()
nouveau :01:00.0: DMA-API: device driver tries to sync DMA memory it has
not allocated [device address=0xc0c09508] [size=4096 bytes]
Modules linked in: nouveau(+) mxm_wmi wmi video i2c_algo_bit ttm drm_kms_helper
drm ...
CPU: 0 PID: 340 Comm: systemd-udevd Not tainted
4.4.0-0.rc5.git0.1.fc24.i686+debug #1

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] nouveau sync DMA memory not allocated

2015-12-16 Thread poma
On 12.11.2015 14:48, Thierry Reding wrote:
> On Wed, Nov 11, 2015 at 09:12:33PM +0100, poma wrote:
>> On 10.11.2015 17:25, Mario Kleiner wrote:
>>> On 11/10/2015 05:00 PM, Thierry Reding wrote:
 On Tue, Nov 10, 2015 at 03:54:52PM +0100, Mario Kleiner wrote:
> From: Daniel Vetter 
>
> Apparently pre-nv50 pageflip events happen before the actual vblank
> period. Therefore that functionality got semi-disabled in
>
> commit af4870e406126b7ac0ae7c7ce5751f25ebe60f28
> Author: Mario Kleiner 
> Date:   Tue May 13 00:42:08 2014 +0200
>
>  drm/nouveau/kms/nv04-nv40: fix pageflip events via special case.
>
> Unfortunately that hack got uprooted in
>
> commit cc1ef118fc099295ae6aabbacc8af94d8d8885eb
> Author: Thierry Reding 
> Date:   Wed Aug 12 17:00:31 2015 +0200
>
>  drm/irq: Make pipe unsigned and name consistent
>
> Trigering a warning when trying to sample the vblank timestamp for a
> non-existing pipe. There's a few ways to fix this:
>
> - Open-code the old behaviour, which just enshrines this slight
>breakage of the userspace ABI.
>
> - Revert Mario's commit and again inflict broken timestamps, again not
>pretty.
>
> - Fix this for real by delaying the pageflip TS until the next vblank
>interrupt, thereby making it accurate.
>
> This patch implements the third option. Since having a page flip
> interrupt that happens when the pageflip gets armed and not when it
> completes in the next vblank seems to be fairly common (older i915 hw
> works very similarly) create a new helper to arm vblank events for
> such drivers.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=106431
> Cc: Thierry Reding 
> Cc: Mario Kleiner 
> Cc: Ben Skeggs 
> Cc: Ilia Mirkin 
>
> v2 (mario): Integrate my own review comments into Daniels patch.
> - Fix function prototypes in drmP.h
> - Add missing vblank_put() for pageflip completion without
>   pageflip event.
> - Initialize sequence number for queued pageflip event to avoidng
>   trouble in drm_handle_vblank_events().
> - Remove dead code and spelling fix.
>
> v3 (mario): Add a signed-off-by and cc stable tag per Ilja's advice.
>
> Signed-off-by: Daniel Vetter 
> (v1) Reviewed-by: Mario Kleiner 
> (v2/v3) Signed-off-by: Mario Kleiner 
>
> Cc: sta...@vger.kernel.org # v4.3
> ---
>   drivers/gpu/drm/drm_irq.c | 54 
> ++-
>   drivers/gpu/drm/nouveau/nouveau_display.c | 19 ++-
>   include/drm/drmP.h|  4 +++
>   3 files changed, 68 insertions(+), 9 deletions(-)

 This looks good to me. Let me clean this up a little and submit it to
 Dave.

 Thierry

>>>
>>> Btw., if somebody has a functional old card for testing this, it should 
>>> be easy to verify if it works on pre-nv50. If it would not work it would 
>>> deliver the pageflip event 1 frame delayed, so at least on standard 
>>> nouveau + default DRI2 + default double-buffering the rate for a tight 
>>> loop of page-flipped swaps should go down to 30 fps on a 60 Hz display, 
>>> quite noticeable. Afaik we also have Piglit tests for OML_sync_control 
>>> which would likely fail if this would be broken.
>>>
>>> Oh and if someone has tips on how to resurrect an old nv-40 PC (booted 
>>> with BIOS only) graphics card in a MacPro (EFI boot), i wouldn't mind 
>>> hearing them. It would be nice to still be able to use that card for 
>>> testing.
>>>
>>> thanks,
>>> -mario
>>
>>
>> [ cut here ]
>> WARNING: CPU: 0 PID: 313 at lib/dma-debug.c:1205 check_sync+0x169/0x6e0()
>> nouveau :01:00.0: DMA-API: device driver tries to sync DMA memory it has 
>> not allocated [device address=0xc0bf6468] [size=4096 bytes]
>> Modules linked in: nouveau(+) ...
>> CPU: 0 PID: 313 Comm: systemd-udevd Not tainted 4.3.0-3.fc22.i686+debug #1
>> ...
>> Call Trace:
>>  [] dump_stack+0x48/0x69
>>  [] warn_slowpath_common+0x87/0xc0
>>  [] ? check_sync+0x169/0x6e0
>>  [] ? check_sync+0x169/0x6e0
>>  [] warn_slowpath_fmt+0x3e/0x60
>>  [] check_sync+0x169/0x6e0
>>  [] debug_dma_sync_single_for_device+0x7d/0x90
>>  [] ? ttm_bo_del_sub_from_lru+0x18/0x50 [ttm]
>>  [] ? text_poke_bp+0xd0/0xd0
>>  [] nouveau_bo_sync_for_device+0x8b/0xa0 [nouveau]
>>  [] nouveau_bo_validate+0x34/0x40 [nouveau]
>>  [] nouveau_bo_pin+0x188/0x290 [nouveau]
>>  [] ? nv10_bo_put_tile_region+0x80/0x80 [nouveau]
>>  [] nouveau_channel_prep+0xfd/0x2c0 [nouveau]
>>  [] nouveau_channel_new+0x57/0x7a0 [nouveau]
>>  [] ? kfree+0xdc/0x280
>>  [] ? nvif_object_sclass_put+0x12/0x20 [nouveau]
>>  [] nouveau_drm_load+0x596/0x8d0 [nouveau]
>>  [] ? trace_hardirqs_on_caller+0x12c/0x1d0
>>  [] ? drm_minor_register+0x89/0x120 [drm]
>>  [] drm_dev_register+0x96/0xa0 [drm]
>>  []

[Nouveau] [Bug 93405] New: nouveau: Xorg crashes sooner or later in 3840x2160 mode

2015-12-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=93405

Bug ID: 93405
   Summary: nouveau: Xorg crashes sooner or later in 3840x2160
mode
   Product: xorg
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: major
  Priority: medium
 Component: Driver/nouveau
  Assignee: nouveau@lists.freedesktop.org
  Reporter: estel...@elstel.org
QA Contact: xorg-t...@lists.x.org

Created attachment 120545
  --> https://bugs.freedesktop.org/attachment.cgi?id=120545&action=edit
first crash: Xorg.0.log

As soon as I set 3840x2160 for the external monitor next to my integrated
display Xorg will crash soooner or later. This reminds me of Bug 70510 which is
about much elder hardware. Nontheless I would suspect this to be a memory
allocation issue as well.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [Bug 93405] nouveau: Xorg crashes sooner or later in 3840x2160 mode

2015-12-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=93405

--- Comment #1 from Elmar Stellnberger  ---
Created attachment 120546
  --> https://bugs.freedesktop.org/attachment.cgi?id=120546&action=edit
first crash: journal

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [Bug 93405] nouveau: Xorg crashes sooner or later in 3840x2160 mode

2015-12-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=93405

--- Comment #2 from Elmar Stellnberger  ---
Created attachment 120547
  --> https://bugs.freedesktop.org/attachment.cgi?id=120547&action=edit
second crash: Xorg.0.log

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [Bug 93405] nouveau: Xorg crashes sooner or later in 3840x2160 mode

2015-12-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=93405

--- Comment #3 from Elmar Stellnberger  ---
Created attachment 120548
  --> https://bugs.freedesktop.org/attachment.cgi?id=120548&action=edit
second crash: journal

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] Debugging INVALID_OPCODE / MULTIPLE_WARP_ERRORS ?

2015-12-16 Thread Hans de Goede

Hi,

On 15-12-15 20:04, Ilia Mirkin wrote:

Also, where's the exit op? Perhaps what's happening is that you don't
have an exit and it just goes off executing into the ether?


Sorry I only included a small bit of the program in my original mail
because I found the use of "MOV" instructions to load constants
suspicious, is that normal ?

I've put a log with NV50_PROG_DEBUG=1 output here:

https://fedorapeople.org/~jwrdegoede/nbody.log

nvdisasm -b SM30 for the generated binary code is here:

https://fedorapeople.org/~jwrdegoede/nbody.disasm

There are already .tgsi, .hex and .bin files there if
you find those easier to use then the
NV50_PROG_DEBUG=1 output.




On Tue, Dec 15, 2015 at 12:00 PM, Ilia Mirkin  wrote:

A few things that stand out:

   0: ld u32 %r219 c0[0x+0x0] (0)

wtf is that 0x0 thing doing there? Was it a %rX which got
constant-folded into 0? That indirectness should have then been
removed... that said, the final encoding looks fine.


I don't know, maybe there is a hint in the log file?

Regards,

Hans




I believe that kepler has this launch descriptor thing too... is that
being set correctly? Please generate a mmt trace, and we can see if
anything stands out compared to a blob trace that also does compute.

Cheers,

   -ilia

On Tue, Dec 15, 2015 at 9:15 AM, Hans de Goede  wrote:

Hi all,

As part of my compute work I'm trying to get some TGSI compute
code to work. The code from mesa/src/gallium/tests/trivial.c
works.

So now I'm trying to get a "native" tgsi kernel to run via
clover, I'm using Francisco's nbody.c example for this:

https://fedorapeople.org/~jwrdegoede/nbody.c

Which does not work, at first I thought there was an issue
with the setup of the input / output buffers, but that seems to
work fine, and moreover I finally got the smart idea to look
in dmesg, which says:

[ 9920.802435] nouveau :01:00.0: gr: TRAP ch 6 [007f7fa000 nbody[31881]]
[ 9920.802449] nouveau :01:00.0: gr: GPC0/TPC0/MP trap: global 
[] warp 10009 [INVALID_OPCODE]
[ 9920.802456] nouveau :01:00.0: gr: GPC0/TPC1/MP trap: global 0004
[MULTIPLE_WARP_ERRORS] warp 20009 [INVALID_OPCODE]

and repeats that for every "step" in the nobody simulation, this is on a
gk107 card.

So that seems to be the real problem, since the
error says "INVALID_OPCODE", I've put the tgsi code from nbody.c
through "nouveau_compiler -a e4" and then run "nvdisasm -b SM30"
on it, but the output looks ok. There is a 8 byte sequence which does
not get decoded every 64 bytes but AFAIK that is the scheduling info,
so that should be fine.

One thing which does stand out is that this:

   0: ld u32 %r219 c0[0x+0x0] (0)
   1: ld u32 %r222 c0[0x4] (0)
   2: ld u64 { %r225 %r228 } c0[0x8] (0)
   3: ld u32 %r234 c0[0x10] (0)

Gets translated into (nvdisasm output) :

 /*0008*/   LDC R4, c[0x0][0x0];
/* 0x140003f11c86 */
 /*0010*/   MOV R2, c[0x0][0x4];
/* 0x2800400010009de4 */
 /*0018*/   LDC.64 R0, c[0x0][0x8];
/* 0x140023f01ca6 */
 /*0020*/   MOV R3, c[0x0][0x10];
/* 0x280040004000dde4 */

Where I would expect for LDC instructions, could that be the problem ?

If that is not the problem, then hints how to debug this further would be
greatly appreciated.

Regards,

Hans
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] Debugging INVALID_OPCODE / MULTIPLE_WARP_ERRORS ?

2015-12-16 Thread Ilia Mirkin
I believe that your problem is this:

/*01a0*/   LD R8, [R8];
   /* 0x80821c85 */

That needs to be LD.E (and your ST's need to be ST.E). You're using a
32-bit gmem address, but you need to be using a 64-bit one. I believe
the 32-bit ones work on fermi, but afaik not on Kepler.

Cheers,

  -ilia



On Wed, Dec 16, 2015 at 12:06 PM, Hans de Goede  wrote:
> Hi,
>
> On 15-12-15 20:04, Ilia Mirkin wrote:
>>
>> Also, where's the exit op? Perhaps what's happening is that you don't
>> have an exit and it just goes off executing into the ether?
>
>
> Sorry I only included a small bit of the program in my original mail
> because I found the use of "MOV" instructions to load constants
> suspicious, is that normal ?
>
> I've put a log with NV50_PROG_DEBUG=1 output here:
>
> https://fedorapeople.org/~jwrdegoede/nbody.log
>
> nvdisasm -b SM30 for the generated binary code is here:
>
> https://fedorapeople.org/~jwrdegoede/nbody.disasm
>
> There are already .tgsi, .hex and .bin files there if
> you find those easier to use then the
> NV50_PROG_DEBUG=1 output.
>
>
>>
>> On Tue, Dec 15, 2015 at 12:00 PM, Ilia Mirkin 
>> wrote:
>>>
>>> A few things that stand out:
>>>
>>>0: ld u32 %r219 c0[0x+0x0] (0)
>>>
>>> wtf is that 0x0 thing doing there? Was it a %rX which got
>>> constant-folded into 0? That indirectness should have then been
>>> removed... that said, the final encoding looks fine.
>
>
> I don't know, maybe there is a hint in the log file?
>
> Regards,
>
> Hans
>
>
>
>>>
>>> I believe that kepler has this launch descriptor thing too... is that
>>> being set correctly? Please generate a mmt trace, and we can see if
>>> anything stands out compared to a blob trace that also does compute.
>>>
>>> Cheers,
>>>
>>>-ilia
>>>
>>> On Tue, Dec 15, 2015 at 9:15 AM, Hans de Goede 
>>> wrote:

 Hi all,

 As part of my compute work I'm trying to get some TGSI compute
 code to work. The code from mesa/src/gallium/tests/trivial.c
 works.

 So now I'm trying to get a "native" tgsi kernel to run via
 clover, I'm using Francisco's nbody.c example for this:

 https://fedorapeople.org/~jwrdegoede/nbody.c

 Which does not work, at first I thought there was an issue
 with the setup of the input / output buffers, but that seems to
 work fine, and moreover I finally got the smart idea to look
 in dmesg, which says:

 [ 9920.802435] nouveau :01:00.0: gr: TRAP ch 6 [007f7fa000
 nbody[31881]]
 [ 9920.802449] nouveau :01:00.0: gr: GPC0/TPC0/MP trap: global
 
 [] warp 10009 [INVALID_OPCODE]
 [ 9920.802456] nouveau :01:00.0: gr: GPC0/TPC1/MP trap: global
 0004
 [MULTIPLE_WARP_ERRORS] warp 20009 [INVALID_OPCODE]

 and repeats that for every "step" in the nobody simulation, this is on a
 gk107 card.

 So that seems to be the real problem, since the
 error says "INVALID_OPCODE", I've put the tgsi code from nbody.c
 through "nouveau_compiler -a e4" and then run "nvdisasm -b SM30"
 on it, but the output looks ok. There is a 8 byte sequence which does
 not get decoded every 64 bytes but AFAIK that is the scheduling info,
 so that should be fine.

 One thing which does stand out is that this:

0: ld u32 %r219 c0[0x+0x0] (0)
1: ld u32 %r222 c0[0x4] (0)
2: ld u64 { %r225 %r228 } c0[0x8] (0)
3: ld u32 %r234 c0[0x10] (0)

 Gets translated into (nvdisasm output) :

  /*0008*/   LDC R4, c[0x0][0x0];
 /* 0x140003f11c86 */
  /*0010*/   MOV R2, c[0x0][0x4];
 /* 0x2800400010009de4 */
  /*0018*/   LDC.64 R0, c[0x0][0x8];
 /* 0x140023f01ca6 */
  /*0020*/   MOV R3, c[0x0][0x10];
 /* 0x280040004000dde4 */

 Where I would expect for LDC instructions, could that be the problem ?

 If that is not the problem, then hints how to debug this further would
 be
 greatly appreciated.

 Regards,

 Hans
 ___
 Nouveau mailing list
 Nouveau@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/nouveau
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] Debugging INVALID_OPCODE / MULTIPLE_WARP_ERRORS ?

2015-12-16 Thread Ilia Mirkin
BTW, you may be interested in
https://github.com/imirkin/mesa/commits/atomic3 which has working
ARB_shader_atomic_counters and ARB_shader_storage_buffer_object
support (while ripping out things like TGSI_FILE_RESOURCE). Still
working on proper memory qualifier support, and obviously need to do
some cleanup before upstreaming. Should be getting into a pushable
state probably early January.

Cheers,

  -ilia

On Wed, Dec 16, 2015 at 12:24 PM, Ilia Mirkin  wrote:
> I believe that your problem is this:
>
> /*01a0*/   LD R8, [R8];
>/* 0x80821c85 */
>
> That needs to be LD.E (and your ST's need to be ST.E). You're using a
> 32-bit gmem address, but you need to be using a 64-bit one. I believe
> the 32-bit ones work on fermi, but afaik not on Kepler.
>
> Cheers,
>
>   -ilia
>
>
>
> On Wed, Dec 16, 2015 at 12:06 PM, Hans de Goede  wrote:
>> Hi,
>>
>> On 15-12-15 20:04, Ilia Mirkin wrote:
>>>
>>> Also, where's the exit op? Perhaps what's happening is that you don't
>>> have an exit and it just goes off executing into the ether?
>>
>>
>> Sorry I only included a small bit of the program in my original mail
>> because I found the use of "MOV" instructions to load constants
>> suspicious, is that normal ?
>>
>> I've put a log with NV50_PROG_DEBUG=1 output here:
>>
>> https://fedorapeople.org/~jwrdegoede/nbody.log
>>
>> nvdisasm -b SM30 for the generated binary code is here:
>>
>> https://fedorapeople.org/~jwrdegoede/nbody.disasm
>>
>> There are already .tgsi, .hex and .bin files there if
>> you find those easier to use then the
>> NV50_PROG_DEBUG=1 output.
>>
>>
>>>
>>> On Tue, Dec 15, 2015 at 12:00 PM, Ilia Mirkin 
>>> wrote:

 A few things that stand out:

0: ld u32 %r219 c0[0x+0x0] (0)

 wtf is that 0x0 thing doing there? Was it a %rX which got
 constant-folded into 0? That indirectness should have then been
 removed... that said, the final encoding looks fine.
>>
>>
>> I don't know, maybe there is a hint in the log file?
>>
>> Regards,
>>
>> Hans
>>
>>
>>

 I believe that kepler has this launch descriptor thing too... is that
 being set correctly? Please generate a mmt trace, and we can see if
 anything stands out compared to a blob trace that also does compute.

 Cheers,

-ilia

 On Tue, Dec 15, 2015 at 9:15 AM, Hans de Goede 
 wrote:
>
> Hi all,
>
> As part of my compute work I'm trying to get some TGSI compute
> code to work. The code from mesa/src/gallium/tests/trivial.c
> works.
>
> So now I'm trying to get a "native" tgsi kernel to run via
> clover, I'm using Francisco's nbody.c example for this:
>
> https://fedorapeople.org/~jwrdegoede/nbody.c
>
> Which does not work, at first I thought there was an issue
> with the setup of the input / output buffers, but that seems to
> work fine, and moreover I finally got the smart idea to look
> in dmesg, which says:
>
> [ 9920.802435] nouveau :01:00.0: gr: TRAP ch 6 [007f7fa000
> nbody[31881]]
> [ 9920.802449] nouveau :01:00.0: gr: GPC0/TPC0/MP trap: global
> 
> [] warp 10009 [INVALID_OPCODE]
> [ 9920.802456] nouveau :01:00.0: gr: GPC0/TPC1/MP trap: global
> 0004
> [MULTIPLE_WARP_ERRORS] warp 20009 [INVALID_OPCODE]
>
> and repeats that for every "step" in the nobody simulation, this is on a
> gk107 card.
>
> So that seems to be the real problem, since the
> error says "INVALID_OPCODE", I've put the tgsi code from nbody.c
> through "nouveau_compiler -a e4" and then run "nvdisasm -b SM30"
> on it, but the output looks ok. There is a 8 byte sequence which does
> not get decoded every 64 bytes but AFAIK that is the scheduling info,
> so that should be fine.
>
> One thing which does stand out is that this:
>
>0: ld u32 %r219 c0[0x+0x0] (0)
>1: ld u32 %r222 c0[0x4] (0)
>2: ld u64 { %r225 %r228 } c0[0x8] (0)
>3: ld u32 %r234 c0[0x10] (0)
>
> Gets translated into (nvdisasm output) :
>
>  /*0008*/   LDC R4, c[0x0][0x0];
> /* 0x140003f11c86 */
>  /*0010*/   MOV R2, c[0x0][0x4];
> /* 0x2800400010009de4 */
>  /*0018*/   LDC.64 R0, c[0x0][0x8];
> /* 0x140023f01ca6 */
>  /*0020*/   MOV R3, c[0x0][0x10];
> /* 0x280040004000dde4 */
>
> Where I would expect for LDC instructions, could that be the problem ?
>
> If that is not the problem, then hints how to debug this further would
> be
> greatly appreciated.
>
> Regards,
>
> Hans
> ___
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau
__

[Nouveau] [libdrm v3 05/14] nouveau: add interface to call an object's methods

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

This will expose functionality supported by newer kernel interfaces,
giving access to things such as ZBC controls, perfmon, etc.

Signed-off-by: Ben Skeggs 
---
 nouveau/nouveau-symbol-check | 1 +
 nouveau/nouveau.c| 7 +++
 nouveau/nouveau.h| 2 ++
 3 files changed, 10 insertions(+)

diff --git a/nouveau/nouveau-symbol-check b/nouveau/nouveau-symbol-check
index 0fef563..7330170 100755
--- a/nouveau/nouveau-symbol-check
+++ b/nouveau/nouveau-symbol-check
@@ -33,6 +33,7 @@ nouveau_device_wrap
 nouveau_getparam
 nouveau_object_del
 nouveau_object_find
+nouveau_object_mthd
 nouveau_object_new
 nouveau_pushbuf_bufctx
 nouveau_pushbuf_data
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index eb741c7..1871e8c 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -59,6 +59,13 @@ debug_init(char *args)
 }
 #endif
 
+int
+nouveau_object_mthd(struct nouveau_object *obj,
+   uint32_t mthd, void *data, uint32_t size)
+{
+   return -ENODEV;
+}
+
 static void
 nouveau_object_fini(struct nouveau_object *obj)
 {
diff --git a/nouveau/nouveau.h b/nouveau/nouveau.h
index 4adda0e..4c95409 100644
--- a/nouveau/nouveau.h
+++ b/nouveau/nouveau.h
@@ -67,6 +67,8 @@ int  nouveau_object_new(struct nouveau_object *parent, 
uint64_t handle,
uint32_t oclass, void *data, uint32_t length,
struct nouveau_object **);
 void nouveau_object_del(struct nouveau_object **);
+int  nouveau_object_mthd(struct nouveau_object *, uint32_t mthd,
+void *data, uint32_t size);
 void *nouveau_object_find(struct nouveau_object *, uint32_t parent_class);
 
 struct nouveau_device {
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [libdrm v3 02/14] nouveau: move more abi16-specific logic into abi16.c

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

v2.
- add a comment about the (ab)use of nouveau_object::length
- add a comment about abi16_object() return values
v3.
- handle new client + old kernel for sw classes

Signed-off-by: Ben Skeggs 
---
 nouveau/abi16.c   | 88 +++
 nouveau/nouveau.c | 56 +--
 nouveau/private.h |  7 ++---
 3 files changed, 93 insertions(+), 58 deletions(-)

diff --git a/nouveau/abi16.c b/nouveau/abi16.c
index 59bc436..44fda64 100644
--- a/nouveau/abi16.c
+++ b/nouveau/abi16.c
@@ -32,8 +32,10 @@
 
 #include "private.h"
 
+#include "nvif/class.h"
 
-drm_private int
+
+static int
 abi16_chan_nv04(struct nouveau_object *obj)
 {
struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
@@ -57,7 +59,7 @@ abi16_chan_nv04(struct nouveau_object *obj)
return 0;
 }
 
-drm_private int
+static int
 abi16_chan_nvc0(struct nouveau_object *obj)
 {
struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
@@ -78,7 +80,7 @@ abi16_chan_nvc0(struct nouveau_object *obj)
return 0;
 }
 
-drm_private int
+static int
 abi16_chan_nve0(struct nouveau_object *obj)
 {
struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
@@ -104,7 +106,7 @@ abi16_chan_nve0(struct nouveau_object *obj)
return 0;
 }
 
-drm_private int
+static int
 abi16_engobj(struct nouveau_object *obj)
 {
struct drm_nouveau_grobj_alloc req = {
@@ -115,6 +117,27 @@ abi16_engobj(struct nouveau_object *obj)
struct nouveau_device *dev;
int ret;
 
+   /* Older kernel versions did not have the concept of nouveau-
+* specific classes and abused some NVIDIA-assigned ones for
+* a SW class.  The ABI16 layer has compatibility in place to
+* translate these older identifiers to the newer ones.
+*
+* Clients that have been updated to use NVIF are required to
+* use the newer class identifiers, which means that they'll
+* break if running on an older kernel.
+*
+* To handle this case, when using ABI16, we translate to the
+* older values which work on any kernel.
+*/
+   switch (req.class) {
+   case NVIF_CLASS_SW_NV04 : req.class = 0x006e; break;
+   case NVIF_CLASS_SW_NV10 : req.class = 0x016e; break;
+   case NVIF_CLASS_SW_NV50 : req.class = 0x506e; break;
+   case NVIF_CLASS_SW_GF100: req.class = 0x906e; break;
+   default:
+   break;
+   }
+
dev = nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS);
ret = drmCommandWrite(dev->fd, DRM_NOUVEAU_GROBJ_ALLOC,
  &req, sizeof(req));
@@ -125,7 +148,7 @@ abi16_engobj(struct nouveau_object *obj)
return 0;
 }
 
-drm_private int
+static int
 abi16_ntfy(struct nouveau_object *obj)
 {
struct nv04_notify *ntfy = obj->data;
@@ -149,6 +172,61 @@ abi16_ntfy(struct nouveau_object *obj)
 }
 
 drm_private void
+abi16_delete(struct nouveau_object *obj)
+{
+   struct nouveau_device *dev =
+   nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS);
+   if (obj->oclass == NOUVEAU_FIFO_CHANNEL_CLASS) {
+   struct drm_nouveau_channel_free req;
+   req.channel = obj->handle;
+   drmCommandWrite(dev->fd, DRM_NOUVEAU_CHANNEL_FREE,
+   &req, sizeof(req));
+   } else {
+   struct drm_nouveau_gpuobj_free req;
+   req.channel = obj->parent->handle;
+   req.handle  = obj->handle;
+   drmCommandWrite(dev->fd, DRM_NOUVEAU_GPUOBJ_FREE,
+   &req, sizeof(req));
+   }
+}
+
+drm_private bool
+abi16_object(struct nouveau_object *obj, int (**func)(struct nouveau_object *))
+{
+   struct nouveau_object *parent = obj->parent;
+
+   /* nouveau_object::length is (ab)used to determine whether the
+* object is a legacy object (!=0), or a real NVIF object.
+*/
+   if ((parent->length != 0 && parent->oclass == NOUVEAU_DEVICE_CLASS)) {
+   if (obj->oclass == NOUVEAU_FIFO_CHANNEL_CLASS) {
+   struct nouveau_device *dev = (void *)parent;
+   if (dev->chipset < 0xc0)
+   *func = abi16_chan_nv04;
+   else
+   if (dev->chipset < 0xe0)
+   *func = abi16_chan_nvc0;
+   else
+   *func = abi16_chan_nve0;
+   return true;
+   }
+   } else
+   if ((parent->length != 0 &&
+parent->oclass == NOUVEAU_FIFO_CHANNEL_CLASS)) {
+   if (obj->oclass == NOUVEAU_NOTIFIER_CLASS) {
+   *func = abi16_ntfy;
+   return true;
+   }
+
+   *func = abi16_engobj;
+   return false; /* try NVIF, if supported, before calling func */
+  

[Nouveau] [libdrm v3 03/14] nouveau: move object functions up, to avoid future foward decls

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Signed-off-by: Ben Skeggs 
---
 nouveau/nouveau.c | 112 +++---
 1 file changed, 56 insertions(+), 56 deletions(-)

diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 8a0be2f..8035c6a 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -59,6 +59,62 @@ debug_init(char *args)
 }
 #endif
 
+int
+nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
+  uint32_t oclass, void *data, uint32_t length,
+  struct nouveau_object **pobj)
+{
+   struct nouveau_object *obj;
+   int (*func)(struct nouveau_object *);
+   int ret = -EINVAL;
+
+   if (length == 0)
+   length = sizeof(struct nouveau_object *);
+   obj = malloc(sizeof(*obj) + length);
+   obj->parent = parent;
+   obj->handle = handle;
+   obj->oclass = oclass;
+   obj->length = length;
+   obj->data = obj + 1;
+   if (data)
+   memcpy(obj->data, data, length);
+   *(struct nouveau_object **)obj->data = obj;
+
+   abi16_object(obj, &func);
+   if (func)
+   ret = func(obj);
+
+   if (ret) {
+   free(obj);
+   return ret;
+   }
+
+   *pobj = obj;
+   return 0;
+}
+
+void
+nouveau_object_del(struct nouveau_object **pobj)
+{
+   struct nouveau_object *obj = *pobj;
+   if (obj) {
+   abi16_delete(obj);
+   free(obj);
+   *pobj = NULL;
+   }
+}
+
+void *
+nouveau_object_find(struct nouveau_object *obj, uint32_t pclass)
+{
+   while (obj && obj->oclass != pclass) {
+   obj = obj->parent;
+   if (pclass == NOUVEAU_PARENT_CLASS)
+   break;
+   }
+   return obj;
+}
+
 /* this is the old libdrm's version of nouveau_device_wrap(), the symbol
  * is kept here to prevent AIGLX from crashing if the DDX is linked against
  * the new libdrm, but the DRI driver against the old
@@ -247,62 +303,6 @@ nouveau_client_del(struct nouveau_client **pclient)
}
 }
 
-int
-nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
-  uint32_t oclass, void *data, uint32_t length,
-  struct nouveau_object **pobj)
-{
-   struct nouveau_object *obj;
-   int (*func)(struct nouveau_object *);
-   int ret = -EINVAL;
-
-   if (length == 0)
-   length = sizeof(struct nouveau_object *);
-   obj = malloc(sizeof(*obj) + length);
-   obj->parent = parent;
-   obj->handle = handle;
-   obj->oclass = oclass;
-   obj->length = length;
-   obj->data = obj + 1;
-   if (data)
-   memcpy(obj->data, data, length);
-   *(struct nouveau_object **)obj->data = obj;
-
-   abi16_object(obj, &func);
-   if (func)
-   ret = func(obj);
-
-   if (ret) {
-   free(obj);
-   return ret;
-   }
-
-   *pobj = obj;
-   return 0;
-}
-
-void
-nouveau_object_del(struct nouveau_object **pobj)
-{
-   struct nouveau_object *obj = *pobj;
-   if (obj) {
-   abi16_delete(obj);
-   free(obj);
-   *pobj = NULL;
-   }
-}
-
-void *
-nouveau_object_find(struct nouveau_object *obj, uint32_t pclass)
-{
-   while (obj && obj->oclass != pclass) {
-   obj = obj->parent;
-   if (pclass == NOUVEAU_PARENT_CLASS)
-   break;
-   }
-   return obj;
-}
-
 static void
 nouveau_bo_del(struct nouveau_bo *bo)
 {
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [libdrm v3 01/14] nouveau: import and install a selection of nvif headers from the kernel

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

This commit also modifies the install path of the main libdrm_nouveau
header to be under a nouveau/ subdirectory.

Signed-off-by: Ben Skeggs 
---
 include/drm/nouveau_drm.h|   1 +
 nouveau/Makefile.am  |  11 +++-
 nouveau/libdrm_nouveau.pc.in |   2 +-
 nouveau/nvif/cl0080.h|  45 ++
 nouveau/nvif/cl9097.h|  44 ++
 nouveau/nvif/class.h | 141 +++
 nouveau/nvif/if0002.h|  38 
 nouveau/nvif/if0003.h|  33 ++
 nouveau/nvif/ioctl.h | 132 
 nouveau/nvif/unpack.h|  28 +
 10 files changed, 473 insertions(+), 2 deletions(-)
 create mode 100644 nouveau/nvif/cl0080.h
 create mode 100644 nouveau/nvif/cl9097.h
 create mode 100644 nouveau/nvif/class.h
 create mode 100644 nouveau/nvif/if0002.h
 create mode 100644 nouveau/nvif/if0003.h
 create mode 100644 nouveau/nvif/ioctl.h
 create mode 100644 nouveau/nvif/unpack.h

diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h
index 87aefc5..e418f9f 100644
--- a/include/drm/nouveau_drm.h
+++ b/include/drm/nouveau_drm.h
@@ -200,6 +200,7 @@ struct drm_nouveau_sarea {
 #define DRM_NOUVEAU_GROBJ_ALLOC0x04
 #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC  0x05
 #define DRM_NOUVEAU_GPUOBJ_FREE0x06
+#define DRM_NOUVEAU_NVIF   0x07
 #define DRM_NOUVEAU_GEM_NEW0x40
 #define DRM_NOUVEAU_GEM_PUSHBUF0x41
 #define DRM_NOUVEAU_GEM_CPU_PREP   0x42
diff --git a/nouveau/Makefile.am b/nouveau/Makefile.am
index 25ea6dc..76cdeca 100644
--- a/nouveau/Makefile.am
+++ b/nouveau/Makefile.am
@@ -14,9 +14,18 @@ libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
 
 libdrm_nouveau_la_SOURCES = $(LIBDRM_NOUVEAU_FILES)
 
-libdrm_nouveauincludedir = ${includedir}/libdrm
+libdrm_nouveauincludedir = ${includedir}/libdrm/nouveau
 libdrm_nouveauinclude_HEADERS = $(LIBDRM_NOUVEAU_H_FILES)
 
+libdrm_nouveaunvifincludedir = ${includedir}/libdrm/nouveau/nvif
+libdrm_nouveaunvifinclude_HEADERS = nvif/class.h \
+   nvif/cl0080.h \
+   nvif/cl9097.h \
+   nvif/if0002.h \
+   nvif/if0003.h \
+   nvif/ioctl.h \
+   nvif/unpack.h
+
 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm_nouveau.pc
 
diff --git a/nouveau/libdrm_nouveau.pc.in b/nouveau/libdrm_nouveau.pc.in
index 9abfd81..7d0622e 100644
--- a/nouveau/libdrm_nouveau.pc.in
+++ b/nouveau/libdrm_nouveau.pc.in
@@ -7,5 +7,5 @@ Name: libdrm_nouveau
 Description: Userspace interface to nouveau kernel DRM services
 Version: @PACKAGE_VERSION@
 Libs: -L${libdir} -ldrm_nouveau
-Cflags: -I${includedir} -I${includedir}/libdrm
+Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/libdrm/nouveau
 Requires.private: libdrm
diff --git a/nouveau/nvif/cl0080.h b/nouveau/nvif/cl0080.h
new file mode 100644
index 000..331620a
--- /dev/null
+++ b/nouveau/nvif/cl0080.h
@@ -0,0 +1,45 @@
+#ifndef __NVIF_CL0080_H__
+#define __NVIF_CL0080_H__
+
+struct nv_device_v0 {
+   __u8  version;
+   __u8  pad01[7];
+   __u64 device;   /* device identifier, ~0 for client default */
+};
+
+#define NV_DEVICE_V0_INFO  0x00
+#define NV_DEVICE_V0_TIME  0x01
+
+struct nv_device_info_v0 {
+   __u8  version;
+#define NV_DEVICE_INFO_V0_IGP  0x00
+#define NV_DEVICE_INFO_V0_PCI  0x01
+#define NV_DEVICE_INFO_V0_AGP  0x02
+#define NV_DEVICE_INFO_V0_PCIE 0x03
+#define NV_DEVICE_INFO_V0_SOC  0x04
+   __u8  platform;
+   __u16 chipset;  /* from NV_PMC_BOOT_0 */
+   __u8  revision; /* from NV_PMC_BOOT_0 */
+#define NV_DEVICE_INFO_V0_TNT  0x01
+#define NV_DEVICE_INFO_V0_CELSIUS  0x02
+#define NV_DEVICE_INFO_V0_KELVIN   0x03
+#define NV_DEVICE_INFO_V0_RANKINE  0x04
+#define NV_DEVICE_INFO_V0_CURIE0x05
+#define NV_DEVICE_INFO_V0_TESLA0x06
+#define NV_DEVICE_INFO_V0_FERMI0x07
+#define NV_DEVICE_INFO_V0_KEPLER   0x08
+#define NV_DEVICE_INFO_V0_MAXWELL  0x09
+   __u8  family;
+   __u8  pad06[2];
+   __u64 ram_size;
+   __u64 ram_user;
+   char  chip[16];
+   char  name[64];
+};
+
+struct nv_device_time_v0 {
+  

[Nouveau] [libdrm v3 10/14] nouveau: remove nouveau_object_find()

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

No more internal users, and there's never been external users.

Signed-off-by: Ben Skeggs 
---
 nouveau/nouveau-symbol-check |  1 -
 nouveau/nouveau.c| 11 ---
 nouveau/nouveau.h|  1 -
 3 files changed, 13 deletions(-)

diff --git a/nouveau/nouveau-symbol-check b/nouveau/nouveau-symbol-check
index e360b92..275b6e7 100755
--- a/nouveau/nouveau-symbol-check
+++ b/nouveau/nouveau-symbol-check
@@ -34,7 +34,6 @@ nouveau_drm_del
 nouveau_drm_new
 nouveau_getparam
 nouveau_object_del
-nouveau_object_find
 nouveau_object_mclass
 nouveau_object_mthd
 nouveau_object_new
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index b474c77..56e00ac 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -184,17 +184,6 @@ nouveau_object_del(struct nouveau_object **pobj)
}
 }
 
-void *
-nouveau_object_find(struct nouveau_object *obj, uint32_t pclass)
-{
-   while (obj && obj->oclass != pclass) {
-   obj = obj->parent;
-   if (pclass == NOUVEAU_PARENT_CLASS)
-   break;
-   }
-   return obj;
-}
-
 void
 nouveau_drm_del(struct nouveau_drm **pdrm)
 {
diff --git a/nouveau/nouveau.h b/nouveau/nouveau.h
index 2287eba..a693acf 100644
--- a/nouveau/nouveau.h
+++ b/nouveau/nouveau.h
@@ -109,7 +109,6 @@ int  nouveau_object_sclass_get(struct nouveau_object *,
 void nouveau_object_sclass_put(struct nouveau_sclass **);
 int  nouveau_object_mclass(struct nouveau_object *,
   const struct nouveau_mclass *);
-void *nouveau_object_find(struct nouveau_object *, uint32_t parent_class);
 
 struct nouveau_device {
struct nouveau_object object;
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [libdrm v3 04/14] nouveau: make it possible to init object in pre-allocated memory

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Required for an upcoming patch, not exposed to library clients.

Signed-off-by: Ben Skeggs 
---
 nouveau/nouveau.c | 64 +--
 1 file changed, 48 insertions(+), 16 deletions(-)

diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 8035c6a..eb741c7 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -59,31 +59,63 @@ debug_init(char *args)
 }
 #endif
 
-int
-nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
-  uint32_t oclass, void *data, uint32_t length,
-  struct nouveau_object **pobj)
+static void
+nouveau_object_fini(struct nouveau_object *obj)
+{
+   if (obj->data) {
+   abi16_delete(obj);
+   free(obj->data);
+   obj->data = NULL;
+   return;
+   }
+}
+
+static int
+nouveau_object_init(struct nouveau_object *parent, uint32_t handle,
+   int32_t oclass, void *data, uint32_t size,
+   struct nouveau_object *obj)
 {
-   struct nouveau_object *obj;
int (*func)(struct nouveau_object *);
-   int ret = -EINVAL;
+   int ret = -ENOSYS;
 
-   if (length == 0)
-   length = sizeof(struct nouveau_object *);
-   obj = malloc(sizeof(*obj) + length);
obj->parent = parent;
obj->handle = handle;
obj->oclass = oclass;
-   obj->length = length;
-   obj->data = obj + 1;
-   if (data)
-   memcpy(obj->data, data, length);
-   *(struct nouveau_object **)obj->data = obj;
+   obj->length = 0;
+   obj->data = NULL;
 
abi16_object(obj, &func);
-   if (func)
+   if (func) {
+   obj->length = size ? size : sizeof(struct nouveau_object *);
+   if (!(obj->data = malloc(obj->length)))
+   return -ENOMEM;
+   if (data)
+   memcpy(obj->data, data, obj->length);
+   *(struct nouveau_object **)obj->data = obj;
+
ret = func(obj);
+   }
+
+   if (ret) {
+   nouveau_object_fini(obj);
+   return ret;
+   }
+
+   return 0;
+}
+
+int
+nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
+  uint32_t oclass, void *data, uint32_t length,
+  struct nouveau_object **pobj)
+{
+   struct nouveau_object *obj;
+   int ret;
+
+   if (!(obj = malloc(sizeof(*obj
+   return -ENOMEM;
 
+   ret = nouveau_object_init(parent, handle, oclass, data, length, obj);
if (ret) {
free(obj);
return ret;
@@ -98,7 +130,7 @@ nouveau_object_del(struct nouveau_object **pobj)
 {
struct nouveau_object *obj = *pobj;
if (obj) {
-   abi16_delete(obj);
+   nouveau_object_fini(obj);
free(obj);
*pobj = NULL;
}
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [libdrm v3 08/14] nouveau: stack legacy nouveau_device on top of nouveau_drm

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Signed-off-by: Ben Skeggs 
---
 nouveau/nouveau.c | 46 +-
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 2b16351..d129ae8 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -244,39 +244,36 @@ nouveau_device_open_existing(struct nouveau_device 
**pdev, int close, int fd,
 int
 nouveau_device_wrap(int fd, int close, struct nouveau_device **pdev)
 {
-   struct nouveau_device_priv *nvdev = calloc(1, sizeof(*nvdev));
-   struct nouveau_device *dev = &nvdev->base;
+   struct nouveau_drm *drm;
+   struct nouveau_device_priv *nvdev;
+   struct nouveau_device *dev;
uint64_t chipset, vram, gart, bousage;
-   drmVersionPtr ver;
int ret;
char *tmp;
 
-#ifdef DEBUG
-   debug_init(getenv("NOUVEAU_LIBDRM_DEBUG"));
-#endif
-
-   if (!nvdev)
+   if (!(nvdev = calloc(1, sizeof(*nvdev
return -ENOMEM;
+   dev = &nvdev->base;
+
ret = pthread_mutex_init(&nvdev->lock, NULL);
if (ret) {
free(nvdev);
return ret;
}
 
-   nvdev->base.fd = fd;
-
-   ver = drmGetVersion(fd);
-   if (ver) dev->drm_version = (ver->version_major << 24) |
-   (ver->version_minor << 8) |
-ver->version_patchlevel;
-   drmFreeVersion(ver);
-
-   if ( dev->drm_version != 0x0010 &&
-   (dev->drm_version <  0x0100 ||
-dev->drm_version >= 0x0200)) {
+   ret = nouveau_drm_new(fd, &drm);
+   if (ret) {
nouveau_device_del(&dev);
-   return -EINVAL;
+   return ret;
}
+   drm->nvif = false;
+
+   nvdev->base.object.parent = &drm->client;
+   nvdev->base.object.oclass = NOUVEAU_DEVICE_CLASS;
+   nvdev->base.object.length = ~0;
+   nvdev->base.fd = drm->fd;
+   nvdev->base.drm_version = drm->drm_version;
+   nvdev->base.lib_version = drm->lib_version;
 
ret = nouveau_getparam(dev, NOUVEAU_GETPARAM_CHIPSET_ID, &chipset);
if (ret == 0)
@@ -305,9 +302,6 @@ nouveau_device_wrap(int fd, int close, struct 
nouveau_device **pdev)
else
nvdev->gart_limit_percent = 80;
DRMINITLISTHEAD(&nvdev->bo_list);
-   nvdev->base.object.oclass = NOUVEAU_DEVICE_CLASS;
-   nvdev->base.object.length = ~0;
-   nvdev->base.lib_version = 0x0100;
nvdev->base.chipset = chipset;
nvdev->base.vram_size = vram;
nvdev->base.gart_size = gart;
@@ -337,10 +331,12 @@ nouveau_device_del(struct nouveau_device **pdev)
 {
struct nouveau_device_priv *nvdev = nouveau_device(*pdev);
if (nvdev) {
-   if (nvdev->close)
-   drmClose(nvdev->base.fd);
+   struct nouveau_drm *drm = nouveau_drm(&nvdev->base.object);
free(nvdev->client);
+   nouveau_drm_del(&drm);
pthread_mutex_destroy(&nvdev->lock);
+   if (nvdev->close)
+   drmClose(nvdev->base.fd);
free(nvdev);
*pdev = NULL;
}
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [libdrm v3 11/14] nouveau: add new interface to create a nouveau_device

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Signed-off-by: Ben Skeggs 
---
 nouveau/nouveau-symbol-check |   1 +
 nouveau/nouveau.c| 133 ---
 nouveau/nouveau.h|   2 +
 3 files changed, 89 insertions(+), 47 deletions(-)

diff --git a/nouveau/nouveau-symbol-check b/nouveau/nouveau-symbol-check
index 275b6e7..b265cea 100755
--- a/nouveau/nouveau-symbol-check
+++ b/nouveau/nouveau-symbol-check
@@ -27,6 +27,7 @@ nouveau_bufctx_reset
 nouveau_client_del
 nouveau_client_new
 nouveau_device_del
+nouveau_device_new
 nouveau_device_open
 nouveau_device_open_existing
 nouveau_device_wrap
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 56e00ac..fef338b 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -45,6 +45,10 @@
 #include "nouveau.h"
 #include "private.h"
 
+#include "nvif/class.h"
+#include "nvif/cl0080.h"
+#include "nvif/unpack.h"
+
 #ifdef DEBUG
 drm_private uint32_t nouveau_debug = 0;
 
@@ -231,75 +235,107 @@ nouveau_device_open_existing(struct nouveau_device 
**pdev, int close, int fd,
 }
 
 int
-nouveau_device_wrap(int fd, int close, struct nouveau_device **pdev)
+nouveau_device_new(struct nouveau_object *parent, int32_t oclass,
+  void *data, uint32_t size, struct nouveau_device **pdev)
 {
-   struct nouveau_drm *drm;
+   union {
+   struct nv_device_v0 v0;
+   } *args = data;
+   struct nouveau_drm *drm = nouveau_drm(parent);
struct nouveau_device_priv *nvdev;
struct nouveau_device *dev;
-   uint64_t chipset, vram, gart, bousage;
-   int ret;
+   uint64_t v;
char *tmp;
+   int ret = -ENOSYS;
+
+   if (oclass != NV_DEVICE ||
+   nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))
+   return ret;
 
if (!(nvdev = calloc(1, sizeof(*nvdev
return -ENOMEM;
-   dev = &nvdev->base;
+   dev = *pdev = &nvdev->base;
+   dev->fd = -1;
 
-   ret = pthread_mutex_init(&nvdev->lock, NULL);
-   if (ret) {
-   free(nvdev);
-   return ret;
-   }
-
-   ret = nouveau_drm_new(fd, &drm);
-   if (ret) {
-   nouveau_device_del(&dev);
-   return ret;
-   }
-   drm->nvif = false;
+   if (args->v0.device == ~0ULL) {
+   nvdev->base.object.parent = &drm->client;
+   nvdev->base.object.handle = ~0ULL;
+   nvdev->base.object.oclass = NOUVEAU_DEVICE_CLASS;
+   nvdev->base.object.length = ~0;
 
-   nvdev->base.object.parent = &drm->client;
-   nvdev->base.object.oclass = NOUVEAU_DEVICE_CLASS;
-   nvdev->base.object.length = ~0;
-   nvdev->base.fd = drm->fd;
-   nvdev->base.drm_version = drm->drm_version;
-   nvdev->base.lib_version = drm->lib_version;
+   ret = nouveau_getparam(dev, NOUVEAU_GETPARAM_CHIPSET_ID, &v);
+   if (ret)
+   goto done;
+   nvdev->base.chipset = v;
 
-   ret = nouveau_getparam(dev, NOUVEAU_GETPARAM_CHIPSET_ID, &chipset);
-   if (ret == 0)
-   ret = nouveau_getparam(dev, NOUVEAU_GETPARAM_FB_SIZE, &vram);
-   if (ret == 0)
-   ret = nouveau_getparam(dev, NOUVEAU_GETPARAM_AGP_SIZE, &gart);
-   if (ret) {
-   nouveau_device_del(&dev);
-   return ret;
-   }
+   ret = nouveau_getparam(dev, NOUVEAU_GETPARAM_HAS_BO_USAGE, &v);
+   if (ret == 0)
+   nvdev->have_bo_usage = (v != 0);
+   } else
+   return -ENOSYS;
 
-   ret = nouveau_getparam(dev, NOUVEAU_GETPARAM_HAS_BO_USAGE, &bousage);
-   if (ret == 0)
-   nvdev->have_bo_usage = (bousage != 0);
+   ret = nouveau_getparam(dev, NOUVEAU_GETPARAM_FB_SIZE, &v);
+   if (ret)
+   goto done;
+   nvdev->base.vram_size = v;
 
-   nvdev->close = close;
+   ret = nouveau_getparam(dev, NOUVEAU_GETPARAM_AGP_SIZE, &v);
+   if (ret)
+   goto done;
+   nvdev->base.gart_size = v;
 
tmp = getenv("NOUVEAU_LIBDRM_VRAM_LIMIT_PERCENT");
if (tmp)
nvdev->vram_limit_percent = atoi(tmp);
else
nvdev->vram_limit_percent = 80;
+
+   nvdev->base.vram_limit =
+   (nvdev->base.vram_size * nvdev->vram_limit_percent) / 100;
+
tmp = getenv("NOUVEAU_LIBDRM_GART_LIMIT_PERCENT");
if (tmp)
nvdev->gart_limit_percent = atoi(tmp);
else
nvdev->gart_limit_percent = 80;
-   DRMINITLISTHEAD(&nvdev->bo_list);
-   nvdev->base.chipset = chipset;
-   nvdev->base.vram_size = vram;
-   nvdev->base.gart_size = gart;
-   nvdev->base.vram_limit =
-   (nvdev->base.vram_size * nvdev->vram_limit_percent) / 100;
+
nvdev->base.gart_limit =
(nvdev->base.gart_size * nvdev->gart_limit_percent) / 100;
 
-   *pdev = &nvdev->base;
+   ret = pthread_mutex_init(&n

[Nouveau] [libdrm v3 12/14] nouveau: add support for newer kernel interfaces

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

v2.
- leave client-provided pointer unmodified on sclass_get() failure

Signed-off-by: Ben Skeggs 
---
 nouveau/abi16.c   |   3 +-
 nouveau/nouveau.c | 159 +++---
 2 files changed, 155 insertions(+), 7 deletions(-)

diff --git a/nouveau/abi16.c b/nouveau/abi16.c
index 46350b1..ee38c0c 100644
--- a/nouveau/abi16.c
+++ b/nouveau/abi16.c
@@ -244,7 +244,8 @@ abi16_object(struct nouveau_object *obj, int 
(**func)(struct nouveau_object *))
/* nouveau_object::length is (ab)used to determine whether the
 * object is a legacy object (!=0), or a real NVIF object.
 */
-   if ((parent->length != 0 && parent->oclass == NOUVEAU_DEVICE_CLASS)) {
+   if ((parent->length != 0 && parent->oclass == NOUVEAU_DEVICE_CLASS) ||
+   (parent->length == 0 && parent->oclass == NV_DEVICE)) {
if (obj->oclass == NOUVEAU_FIFO_CHANNEL_CLASS) {
struct nouveau_device *dev = (void *)parent;
if (dev->chipset < 0xc0)
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index fef338b..e113a8f 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -47,6 +47,7 @@
 
 #include "nvif/class.h"
 #include "nvif/cl0080.h"
+#include "nvif/ioctl.h"
 #include "nvif/unpack.h"
 
 #ifdef DEBUG
@@ -63,11 +64,67 @@ debug_init(char *args)
 }
 #endif
 
+static int
+nouveau_object_ioctl(struct nouveau_object *obj, void *data, uint32_t size)
+{
+   struct nouveau_drm *drm = nouveau_drm(obj);
+   union {
+   struct nvif_ioctl_v0 v0;
+   } *args = data;
+   uint32_t argc = size;
+   int ret = -ENOSYS;
+
+   if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
+   if (!obj->length) {
+   if (obj != &drm->client)
+   args->v0.object = (unsigned long)(void *)obj;
+   else
+   args->v0.object = 0;
+   args->v0.owner = NVIF_IOCTL_V0_OWNER_ANY;
+   args->v0.route = 0x00;
+   } else {
+   args->v0.route = 0xff;
+   args->v0.token = obj->handle;
+   }
+   } else
+   return ret;
+
+   return drmCommandWriteRead(drm->fd, DRM_NOUVEAU_NVIF, args, argc);
+}
+
 int
 nouveau_object_mthd(struct nouveau_object *obj,
uint32_t mthd, void *data, uint32_t size)
 {
-   return -ENODEV;
+   struct nouveau_drm *drm = nouveau_drm(obj);
+   struct {
+   struct nvif_ioctl_v0 ioctl;
+   struct nvif_ioctl_mthd_v0 mthd;
+   } *args;
+   uint32_t argc = sizeof(*args) + size;
+   uint8_t stack[128];
+   int ret;
+
+   if (!drm->nvif)
+   return -ENOSYS;
+
+   if (argc > sizeof(stack)) {
+   if (!(args = malloc(argc)))
+   return -ENOMEM;
+   } else {
+   args = (void *)stack;
+   }
+   args->ioctl.version = 0;
+   args->ioctl.type = NVIF_IOCTL_V0_MTHD;
+   args->mthd.version = 0;
+   args->mthd.method = mthd;
+
+   memcpy(args->mthd.data, data, size);
+   ret = nouveau_object_ioctl(obj, args, argc);
+   memcpy(data, args->mthd.data, size);
+   if (args != (void *)stack)
+   free(args);
+   return ret;
 }
 
 void
@@ -81,7 +138,50 @@ int
 nouveau_object_sclass_get(struct nouveau_object *obj,
  struct nouveau_sclass **psclass)
 {
-   return abi16_sclass(obj, psclass);
+   struct nouveau_drm *drm = nouveau_drm(obj);
+   struct {
+   struct nvif_ioctl_v0 ioctl;
+   struct nvif_ioctl_sclass_v0 sclass;
+   } *args = NULL;
+   struct nouveau_sclass *sclass;
+   int ret, cnt = 0, i;
+   uint32_t size;
+
+   if (!drm->nvif)
+   return abi16_sclass(obj, psclass);
+
+   while (1) {
+   size = sizeof(*args) + cnt * sizeof(args->sclass.oclass[0]);
+   if (!(args = malloc(size)))
+   return -ENOMEM;
+   args->ioctl.version = 0;
+   args->ioctl.type = NVIF_IOCTL_V0_SCLASS;
+   args->sclass.version = 0;
+   args->sclass.count = cnt;
+
+   ret = nouveau_object_ioctl(obj, args, size);
+   if (ret == 0 && args->sclass.count <= cnt)
+   break;
+   cnt = args->sclass.count;
+   free(args);
+   if (ret != 0)
+   return ret;
+   }
+
+   if ((sclass = calloc(args->sclass.count, sizeof(*sclass {
+   for (i = 0; i < args->sclass.count; i++) {
+   sclass[i].oclass = args->sclass.oclass[i].oclass;
+   sclass[i].minver = args->sclass.oclass[i].minver;
+   sclass[i].maxver = args->sclass.oclass[i].maxver;
+   }
+ 

[Nouveau] [libdrm v3 09/14] nouveau: make use of nouveau_drm::fd instead of nouveau_device::fd

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

The latter is deprecated, and will not be valid for newer clients.

v2.
- split out nouveau_object_find removal

Signed-off-by: Ben Skeggs 
---
 nouveau/abi16.c   | 32 +++-
 nouveau/nouveau.c | 32 +---
 nouveau/pushbuf.c |  7 ---
 3 files changed, 40 insertions(+), 31 deletions(-)

diff --git a/nouveau/abi16.c b/nouveau/abi16.c
index f260bf9..46350b1 100644
--- a/nouveau/abi16.c
+++ b/nouveau/abi16.c
@@ -38,7 +38,7 @@
 static int
 abi16_chan_nv04(struct nouveau_object *obj)
 {
-   struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
+   struct nouveau_drm *drm = nouveau_drm(obj);
struct nv04_fifo *nv04 = obj->data;
struct drm_nouveau_channel_alloc req = {
.fb_ctxdma_handle = nv04->vram,
@@ -46,7 +46,7 @@ abi16_chan_nv04(struct nouveau_object *obj)
};
int ret;
 
-   ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
+   ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
  &req, sizeof(req));
if (ret)
return ret;
@@ -62,12 +62,12 @@ abi16_chan_nv04(struct nouveau_object *obj)
 static int
 abi16_chan_nvc0(struct nouveau_object *obj)
 {
-   struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
+   struct nouveau_drm *drm = nouveau_drm(obj);
struct drm_nouveau_channel_alloc req = {};
struct nvc0_fifo *nvc0 = obj->data;
int ret;
 
-   ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
+   ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
  &req, sizeof(req));
if (ret)
return ret;
@@ -83,7 +83,7 @@ abi16_chan_nvc0(struct nouveau_object *obj)
 static int
 abi16_chan_nve0(struct nouveau_object *obj)
 {
-   struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
+   struct nouveau_drm *drm = nouveau_drm(obj);
struct drm_nouveau_channel_alloc req = {};
struct nve0_fifo *nve0 = obj->data;
int ret;
@@ -93,7 +93,7 @@ abi16_chan_nve0(struct nouveau_object *obj)
req.tt_ctxdma_handle = nve0->engine;
}
 
-   ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
+   ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
  &req, sizeof(req));
if (ret)
return ret;
@@ -109,12 +109,12 @@ abi16_chan_nve0(struct nouveau_object *obj)
 static int
 abi16_engobj(struct nouveau_object *obj)
 {
+   struct nouveau_drm *drm = nouveau_drm(obj);
struct drm_nouveau_grobj_alloc req = {
.channel = obj->parent->handle,
.handle = obj->handle,
.class = obj->oclass,
};
-   struct nouveau_device *dev;
int ret;
 
/* Older kernel versions did not have the concept of nouveau-
@@ -138,8 +138,7 @@ abi16_engobj(struct nouveau_object *obj)
break;
}
 
-   dev = nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS);
-   ret = drmCommandWrite(dev->fd, DRM_NOUVEAU_GROBJ_ALLOC,
+   ret = drmCommandWrite(drm->fd, DRM_NOUVEAU_GROBJ_ALLOC,
  &req, sizeof(req));
if (ret)
return ret;
@@ -151,17 +150,16 @@ abi16_engobj(struct nouveau_object *obj)
 static int
 abi16_ntfy(struct nouveau_object *obj)
 {
+   struct nouveau_drm *drm = nouveau_drm(obj);
struct nv04_notify *ntfy = obj->data;
struct drm_nouveau_notifierobj_alloc req = {
.channel = obj->parent->handle,
.handle = ntfy->object->handle,
.size = ntfy->length,
};
-   struct nouveau_device *dev;
int ret;
 
-   dev = nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS);
-   ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_NOTIFIEROBJ_ALLOC,
+   ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_NOTIFIEROBJ_ALLOC,
  &req, sizeof(req));
if (ret)
return ret;
@@ -223,18 +221,17 @@ abi16_sclass(struct nouveau_object *obj, struct 
nouveau_sclass **psclass)
 drm_private void
 abi16_delete(struct nouveau_object *obj)
 {
-   struct nouveau_device *dev =
-   nouveau_object_find(obj, NOUVEAU_DEVICE_CLASS);
+   struct nouveau_drm *drm = nouveau_drm(obj);
if (obj->oclass == NOUVEAU_FIFO_CHANNEL_CLASS) {
struct drm_nouveau_channel_free req;
req.channel = obj->handle;
-   drmCommandWrite(dev->fd, DRM_NOUVEAU_CHANNEL_FREE,
+   drmCommandWrite(drm->fd, DRM_NOUVEAU_CHANNEL_FREE,
&req, sizeof(req));
} else {
struct drm_nouveau_gpuobj_free req;
req.channel = obj->parent->handle;
req.handle  = obj->handle;
-   drmCommandWrite(dev->fd, DRM_NOUVEA

[Nouveau] [libdrm v3 07/14] nouveau: introduce object to represent the kernel client

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Because NVIF intentionally lacks some of the paths necessary to be
compatible with various mistakes we've made over the years, libdrm
needs to know whether a client has been updated and that it's safe
to make use of the new kernel interfaces.

Clients still using nouveau_device_open()/wrap() will be forced to
make use of ABI16 instead of NVIF.

v2.
- remove lib_version, nothing used it
- leave client-provided pointer unmodified on failure

Signed-off-by: Ben Skeggs 
---
 nouveau/nouveau-symbol-check |  2 ++
 nouveau/nouveau.c| 35 +++
 nouveau/nouveau.h| 18 ++
 3 files changed, 55 insertions(+)

diff --git a/nouveau/nouveau-symbol-check b/nouveau/nouveau-symbol-check
index 38b6ec5..e360b92 100755
--- a/nouveau/nouveau-symbol-check
+++ b/nouveau/nouveau-symbol-check
@@ -30,6 +30,8 @@ nouveau_device_del
 nouveau_device_open
 nouveau_device_open_existing
 nouveau_device_wrap
+nouveau_drm_del
+nouveau_drm_new
 nouveau_getparam
 nouveau_object_del
 nouveau_object_find
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 0017303..2b16351 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -195,6 +195,41 @@ nouveau_object_find(struct nouveau_object *obj, uint32_t 
pclass)
return obj;
 }
 
+void
+nouveau_drm_del(struct nouveau_drm **pdrm)
+{
+   free(*pdrm);
+   *pdrm = NULL;
+}
+
+int
+nouveau_drm_new(int fd, struct nouveau_drm **pdrm)
+{
+   struct nouveau_drm *drm;
+   drmVersionPtr ver;
+
+#ifdef DEBUG
+   debug_init(getenv("NOUVEAU_LIBDRM_DEBUG"));
+#endif
+
+   if (!(drm = calloc(1, sizeof(*drm
+   return -ENOMEM;
+   drm->fd = fd;
+
+   if (!(ver = drmGetVersion(fd))) {
+   nouveau_drm_del(&drm);
+   return -EINVAL;
+   }
+   *pdrm = drm;
+
+   drm->version = (ver->version_major << 24) |
+  (ver->version_minor << 8) |
+   ver->version_patchlevel;
+   drm->nvif = false;
+   drmFreeVersion(ver);
+   return 0;
+}
+
 /* this is the old libdrm's version of nouveau_device_wrap(), the symbol
  * is kept here to prevent AIGLX from crashing if the DDX is linked against
  * the new libdrm, but the DRI driver against the old
diff --git a/nouveau/nouveau.h b/nouveau/nouveau.h
index 24cda6f..2287eba 100644
--- a/nouveau/nouveau.h
+++ b/nouveau/nouveau.h
@@ -22,6 +22,24 @@ struct nouveau_object {
void *data;
 };
 
+struct nouveau_drm {
+   struct nouveau_object client;
+   int fd;
+   uint32_t version;
+   bool nvif;
+};
+
+static inline struct nouveau_drm *
+nouveau_drm(struct nouveau_object *obj)
+{
+   while (obj && obj->parent)
+   obj = obj->parent;
+   return (struct nouveau_drm *)obj;
+}
+
+int nouveau_drm_new(int fd, struct nouveau_drm **);
+void nouveau_drm_del(struct nouveau_drm **);
+
 struct nouveau_fifo {
struct nouveau_object *object;
uint32_t channel;
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [libdrm v3 06/14] nouveau: add interfaces to query information about supported classes

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

This will expose functionality supported by newer kernel interfaces.

Current userspace uses the chipset to determine which classes are likely
exposed, which generally works pretty well, but isn't as flexible as it
could be.

Unfortunately, the G98:GF100 video code in Mesa is still relying on the
kernel exposing incorrect vdec classes on some chipsets.  The ABI16
kernel interfaces have a workaround for this in place, but that will no
longer be available once libdrm supports NVIF.

To prevent a regression when NVIF support is added, if there's no kernel
support for NVIF, libdrm will magic up a class list containing correct
vdec classes anyway instead of failing with -ENODEV.

v2.
- add description of abi16/vdec workaround
- add description of sclass/mclass
- leave client-provided pointer unmodified on abi16_sclass() failure

Signed-off-by: Ben Skeggs 

sclassmod
---
 nouveau/abi16.c  | 51 +++-
 nouveau/nouveau-symbol-check |  3 +++
 nouveau/nouveau.c| 41 +++
 nouveau/nouveau.h| 22 +++
 nouveau/private.h|  1 +
 5 files changed, 117 insertions(+), 1 deletion(-)

diff --git a/nouveau/abi16.c b/nouveau/abi16.c
index 44fda64..f260bf9 100644
--- a/nouveau/abi16.c
+++ b/nouveau/abi16.c
@@ -29,12 +29,12 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "private.h"
 
 #include "nvif/class.h"
 
-
 static int
 abi16_chan_nv04(struct nouveau_object *obj)
 {
@@ -171,6 +171,55 @@ abi16_ntfy(struct nouveau_object *obj)
return 0;
 }
 
+drm_private int
+abi16_sclass(struct nouveau_object *obj, struct nouveau_sclass **psclass)
+{
+   struct nouveau_sclass *sclass;
+   struct nouveau_device *dev;
+
+   if (!(sclass = calloc(8, sizeof(*sclass
+   return -ENOMEM;
+   *psclass = sclass;
+
+   switch (obj->oclass) {
+   case NOUVEAU_FIFO_CHANNEL_CLASS:
+   /* Older kernel versions were exposing the wrong video engine
+* classes on certain G98:GF100 boards.  This has since been
+* corrected, but ABI16 has compatibility in place to avoid
+* breaking older userspace.
+*
+* Clients that have been updated to use NVIF are required to
+* use the correct classes, which means that they'll break if
+* running on an older kernel.
+*
+* To handle this issue, if using the older kernel interfaces,
+* we'll magic up a list containing the vdec classes that the
+* kernel will accept for these boards.  Clients should make
+* use of this information instead of hardcoding classes for
+* specific chipsets.
+*/
+   dev = (struct nouveau_device *)obj->parent;
+   if (dev->chipset >= 0x98 &&
+   dev->chipset != 0xa0 &&
+   dev->chipset <  0xc0) {
+   *sclass++ = (struct nouveau_sclass){
+   GT212_MSVLD, -1, -1
+   };
+   *sclass++ = (struct nouveau_sclass){
+   GT212_MSPDEC, -1, -1
+   };
+   *sclass++ = (struct nouveau_sclass){
+   GT212_MSPPP, -1, -1
+   };
+   }
+   break;
+   default:
+   break;
+   }
+
+   return sclass - *psclass;
+}
+
 drm_private void
 abi16_delete(struct nouveau_object *obj)
 {
diff --git a/nouveau/nouveau-symbol-check b/nouveau/nouveau-symbol-check
index 7330170..38b6ec5 100755
--- a/nouveau/nouveau-symbol-check
+++ b/nouveau/nouveau-symbol-check
@@ -33,8 +33,11 @@ nouveau_device_wrap
 nouveau_getparam
 nouveau_object_del
 nouveau_object_find
+nouveau_object_mclass
 nouveau_object_mthd
 nouveau_object_new
+nouveau_object_sclass_get
+nouveau_object_sclass_put
 nouveau_pushbuf_bufctx
 nouveau_pushbuf_data
 nouveau_pushbuf_del
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 1871e8c..0017303 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -66,6 +66,47 @@ nouveau_object_mthd(struct nouveau_object *obj,
return -ENODEV;
 }
 
+void
+nouveau_object_sclass_put(struct nouveau_sclass **psclass)
+{
+   free(*psclass);
+   *psclass = NULL;
+}
+
+int
+nouveau_object_sclass_get(struct nouveau_object *obj,
+ struct nouveau_sclass **psclass)
+{
+   return abi16_sclass(obj, psclass);
+}
+
+int
+nouveau_object_mclass(struct nouveau_object *obj,
+ const struct nouveau_mclass *mclass)
+{
+   struct nouveau_sclass *sclass;
+   int ret = -ENODEV;
+   int cnt, i, j;
+
+   cnt = nouveau_object_sclass_get(obj, &sclass);
+   if (cnt < 0)
+   return cnt;
+
+   for (i = 0; ret < 0 && mclass[i].ocla

[Nouveau] [mesa v3 9/9] nouveau: enable use of new kernel interfaces

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Signed-off-by: Ben Skeggs 
---
 src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 2 --
 src/mesa/drivers/dri/nouveau/nouveau_screen.c   | 2 --
 2 files changed, 4 deletions(-)

diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c 
b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
index ff017e4..c44424f 100644
--- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
@@ -97,8 +97,6 @@ nouveau_drm_screen_create(int fd)
if (ret)
goto err;
 
-   drm->nvif = false;
-
ret = nouveau_device_new(&drm->client, NV_DEVICE,
 &(struct nv_device_v0) {
.device = ~0ULL,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c 
b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 1a74ae2..6f61f66 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -108,8 +108,6 @@ nouveau_init_screen2(__DRIscreen *dri_screen)
goto fail;
}
 
-   screen->drm->nvif = false;
-
ret = nouveau_device_new(&screen->drm->client, NV_DEVICE,
 &(struct nv_device_v0) {
.device = ~0ULL,
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [mesa v3 2/9] nouveau: remove use of deprecated nouveau_device::fd

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Signed-off-by: Ben Skeggs 
---
 src/gallium/drivers/nouveau/nouveau_screen.c| 1 +
 src/gallium/drivers/nouveau/nouveau_screen.h| 1 +
 src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index a6065e4..a012579 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -175,6 +175,7 @@ nouveau_screen_init(struct nouveau_screen *screen, struct 
nouveau_device *dev)
 data, size, &screen->channel);
if (ret)
   return ret;
+   screen->drm = nouveau_drm(&dev->object);
screen->device = dev;
 
ret = nouveau_client_new(screen->device, &screen->client);
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h 
b/src/gallium/drivers/nouveau/nouveau_screen.h
index 328646f..28c4760 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -17,6 +17,7 @@ struct nouveau_bo;
 
 struct nouveau_screen {
struct pipe_screen base;
+   struct nouveau_drm *drm;
struct nouveau_device *device;
struct nouveau_object *channel;
struct nouveau_client *client;
diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c 
b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
index c6603e3..3ed644e 100644
--- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
@@ -27,7 +27,7 @@ bool nouveau_drm_screen_unref(struct nouveau_screen *screen)
ret = --screen->refcount;
assert(ret >= 0);
if (ret == 0)
-   util_hash_table_remove(fd_tab, 
intptr_to_pointer(screen->device->fd));
+   util_hash_table_remove(fd_tab, 
intptr_to_pointer(screen->drm->fd));
pipe_mutex_unlock(nouveau_screen_mutex);
return ret == 0;
 }
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [mesa v3 8/9] nvc0: remove use of deprecated sw class identifier

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Also emits a method to properly bind the class to a subchannel, which
was missing previously.  The kernel currently doesn't care, but this
will break if it ever decides to (ie. to support multiple sw classes).

Signed-off-by: Ben Skeggs 
---
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index b5d0830..3995446 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include "util/u_format.h"
 #include "util/u_format_s3tc.h"
 #include "pipe/p_screen.h"
@@ -699,12 +700,13 @@ nvc0_screen_create(struct nouveau_device *dev)
screen->base.fence.update = nvc0_screen_fence_update;
 
 
-   ret = nouveau_object_new(chan,
-(dev->chipset < 0xe0) ? 0x1f906e : 0x906e, 0x906e,
-NULL, 0, &screen->nvsw);
+   ret = nouveau_object_new(chan, (dev->chipset < 0xe0) ? 0x1f906e : 0x906e,
+NVIF_CLASS_SW_GF100, NULL, 0, &screen->nvsw);
if (ret)
   FAIL_SCREEN_INIT("Error creating SW object: %d\n", ret);
 
+   BEGIN_NVC0(push, SUBC_SW(NV01_SUBCHAN_OBJECT), 1);
+   PUSH_DATA (push, screen->nvsw->handle);
 
switch (dev->chipset & ~0xf) {
case 0x110:
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [libdrm v3 13/14] nouveau: clean up nouveau.h, noting deprecated members/functions

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Signed-off-by: Ben Skeggs 
---
 nouveau/nouveau.h | 227 +++---
 1 file changed, 114 insertions(+), 113 deletions(-)

diff --git a/nouveau/nouveau.h b/nouveau/nouveau.h
index f3cf8f5..335ce77 100644
--- a/nouveau/nouveau.h
+++ b/nouveau/nouveau.h
@@ -4,24 +4,43 @@
 #include 
 #include 
 
-#define NOUVEAU_DEVICE_CLASS   0x8000
-#define NOUVEAU_FIFO_CHANNEL_CLASS 0x8001
-#define NOUVEAU_NOTIFIER_CLASS 0x8002
-#define NOUVEAU_PARENT_CLASS   0x
+/* Supported class information, provided by the kernel */
+struct nouveau_sclass {
+   int32_t oclass;
+   int minver;
+   int maxver;
+};
 
-struct nouveau_list {
-   struct nouveau_list *prev;
-   struct nouveau_list *next;
+/* Client-provided array describing class versions that are desired.
+ *
+ * These are used to match against the kernel's list of supported classes.
+ */
+struct nouveau_mclass {
+   int32_t oclass;
+   int version;
+   void *data;
 };
 
 struct nouveau_object {
struct nouveau_object *parent;
uint64_t handle;
uint32_t oclass;
-   uint32_t length;
-   void *data;
+   uint32_t length;/* deprecated */
+   void *data; /* deprecated */
 };
 
+int nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
+  uint32_t oclass, void *data, uint32_t length,
+  struct nouveau_object **);
+void nouveau_object_del(struct nouveau_object **);
+int nouveau_object_mthd(struct nouveau_object *, uint32_t mthd,
+   void *data, uint32_t size);
+int nouveau_object_sclass_get(struct nouveau_object *,
+ struct nouveau_sclass **);
+void nouveau_object_sclass_put(struct nouveau_sclass **);
+int nouveau_object_mclass(struct nouveau_object *,
+ const struct nouveau_mclass *);
+
 struct nouveau_drm {
struct nouveau_object client;
int fd;
@@ -40,81 +59,11 @@ nouveau_drm(struct nouveau_object *obj)
 int nouveau_drm_new(int fd, struct nouveau_drm **);
 void nouveau_drm_del(struct nouveau_drm **);
 
-struct nouveau_fifo {
-   struct nouveau_object *object;
-   uint32_t channel;
-   uint32_t pushbuf;
-   uint64_t unused1[3];
-};
-
-struct nv04_fifo {
-   struct nouveau_fifo base;
-   uint32_t vram;
-   uint32_t gart;
-   uint32_t notify;
-};
-
-struct nvc0_fifo {
-   struct nouveau_fifo base;
-   uint32_t notify;
-};
-
-#define NVE0_FIFO_ENGINE_GR  0x0001
-#define NVE0_FIFO_ENGINE_VP  0x0002
-#define NVE0_FIFO_ENGINE_PPP 0x0004
-#define NVE0_FIFO_ENGINE_BSP 0x0008
-#define NVE0_FIFO_ENGINE_CE0 0x0010
-#define NVE0_FIFO_ENGINE_CE1 0x0020
-#define NVE0_FIFO_ENGINE_ENC 0x0040
-
-struct nve0_fifo {
-   struct {
-   struct nouveau_fifo base;
-   uint32_t notify;
-   };
-   uint32_t engine;
-};
-
-struct nv04_notify {
-   struct nouveau_object *object;
-   uint32_t offset;
-   uint32_t length;
-};
-
-/* Supported class information, provided by the kernel */
-struct nouveau_sclass {
-   int32_t oclass;
-   int minver;
-   int maxver;
-};
-
-/* Client-provided array describing class versions that are desired.
- *
- * These are used to match against the kernel's list of supported classes.
- */
-struct nouveau_mclass {
-   int32_t oclass; /* 0 == EOL */
-   int version;
-   void *data;
-};
-
-int  nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
-   uint32_t oclass, void *data, uint32_t length,
-   struct nouveau_object **);
-void nouveau_object_del(struct nouveau_object **);
-int  nouveau_object_mthd(struct nouveau_object *, uint32_t mthd,
-void *data, uint32_t size);
-int  nouveau_object_sclass_get(struct nouveau_object *,
-  struct nouveau_sclass **);
-void nouveau_object_sclass_put(struct nouveau_sclass **);
-int  nouveau_object_mclass(struct nouveau_object *,
-  const struct nouveau_mclass *);
-
 struct nouveau_device {
struct nouveau_object object;
-   int fd;
-   uint32_t lib_version;
-   uint32_t drm_version;
+   int fd; /* deprecated */
+   uint32_t lib_version;   /* deprecated */
+   uint32_t drm_version;   /* deprecated */
uint32_t chipset;
uint64_t vram_size;
uint64_t gart_size;
@@ -122,20 +71,23 @@ struct nouveau_device {
uint64_t gart_limit;
 };
 
-int  nouveau_device_new(struct nouveau_object *parent, int32_t oclass,
-   void *data, uint32_t size, struct nouveau_device **);
-int  nouveau_device_wrap(int fd, int close, struct nouveau_device **);
-int  nouveau_device_open(const char *busid, struct nouveau_device **);
+int nouveau_device_new(struct nouveau_object *parent, int32_t oclass,
+  

[Nouveau] [mesa v3 6/9] nouveau: remove use of deprecated nouveau_device_wrap()

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Switching to the newer libdrm entry-points tells libdrm that it's OK to
make use of newer kernel interfaces.

We want to be able to isolate any bugs to either the interfaces changes,
or the use of NVIF itself.  As such, this commit has a slight hack which
forces libdrm to continue using the older kernel interfaces.

Signed-off-by: Ben Skeggs 
---
 src/gallium/drivers/nouveau/nouveau_screen.c   |  4 +++
 src/gallium/drivers/nouveau/nouveau_winsys.h   |  1 +
 .../winsys/nouveau/drm/nouveau_drm_winsys.c| 31 --
 src/mesa/drivers/dri/nouveau/nouveau_screen.c  | 18 -
 src/mesa/drivers/dri/nouveau/nouveau_screen.h  |  1 +
 5 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index 3cdcc20..4ca9e5c 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -234,6 +234,8 @@ nouveau_screen_init(struct nouveau_screen *screen, struct 
nouveau_device *dev)
 void
 nouveau_screen_fini(struct nouveau_screen *screen)
 {
+   int fd = screen->drm->fd;
+
nouveau_mm_destroy(screen->mm_GART);
nouveau_mm_destroy(screen->mm_VRAM);
 
@@ -243,6 +245,8 @@ nouveau_screen_fini(struct nouveau_screen *screen)
nouveau_object_del(&screen->channel);
 
nouveau_device_del(&screen->device);
+   nouveau_drm_del(&screen->drm);
+   close(fd);
 }
 
 static void
diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h 
b/src/gallium/drivers/nouveau/nouveau_winsys.h
index 3a686bd..f13988e 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -6,6 +6,7 @@
 
 #include "pipe/p_defines.h"
 
+#include 
 #include 
 
 #ifndef NV04_PFIFO_MAX_PACKET_LEN
diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c 
b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
index 456530d..ff017e4 100644
--- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
@@ -13,6 +13,9 @@
 #include "nouveau/nouveau_winsys.h"
 #include "nouveau/nouveau_screen.h"
 
+#include 
+#include 
+
 static struct util_hash_table *fd_tab = NULL;
 
 pipe_static_mutex(nouveau_screen_mutex);
@@ -57,16 +60,19 @@ static int compare_fd(void *key1, void *key2)
 PUBLIC struct pipe_screen *
 nouveau_drm_screen_create(int fd)
 {
+   struct nouveau_drm *drm = NULL;
struct nouveau_device *dev = NULL;
struct nouveau_screen *(*init)(struct nouveau_device *);
struct nouveau_screen *screen = NULL;
-   int ret, dupfd = -1;
+   int ret, dupfd;
 
pipe_mutex_lock(nouveau_screen_mutex);
if (!fd_tab) {
fd_tab = util_hash_table_create(hash_fd, compare_fd);
-   if (!fd_tab)
-   goto err;
+   if (!fd_tab) {
+   pipe_mutex_unlock(nouveau_screen_mutex);
+   return NULL;
+   }
}
 
screen = util_hash_table_get(fd_tab, intptr_to_pointer(fd));
@@ -86,7 +92,17 @@ nouveau_drm_screen_create(int fd)
 * creation error.
 */
dupfd = dup(fd);
-   ret = nouveau_device_wrap(dupfd, 1, &dev);
+
+   ret = nouveau_drm_new(dupfd, &drm);
+   if (ret)
+   goto err;
+
+   drm->nvif = false;
+
+   ret = nouveau_device_new(&drm->client, NV_DEVICE,
+&(struct nv_device_v0) {
+   .device = ~0ULL,
+}, sizeof(struct nv_device_v0), &dev);
if (ret)
goto err;
 
@@ -133,10 +149,9 @@ err:
if (screen) {
screen->base.destroy(&screen->base);
} else {
-   if (dev)
-   nouveau_device_del(&dev);
-   else if (dupfd >= 0)
-   close(dupfd);
+   nouveau_device_del(&dev);
+   nouveau_drm_del(&drm);
+   close(dupfd);
}
pipe_mutex_unlock(nouveau_screen_mutex);
return NULL;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c 
b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 153f18e..1a74ae2 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -40,6 +40,9 @@
 #include "main/renderbuffer.h"
 #include "swrast/s_renderbuffer.h"
 
+#include 
+#include 
+
 static const __DRIextension *nouveau_screen_extensions[];
 
 static void
@@ -99,12 +102,24 @@ nouveau_init_screen2(__DRIscreen *dri_screen)
dri_screen->driverPrivate = screen;
 
/* Open the DRM device. */
-   ret = nouveau_device_wrap(dri_screen->fd, 0, &screen->device);
+   ret = nouveau_drm_new(dri_screen->fd, &screen->drm);
if (ret) {
nouveau_error("Error opening the DRM device.\n");
goto fail;
}
 
+  

[Nouveau] [mesa v3 7/9] nv50: fix g98+ vdec class allocation

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

The kernel previously exposed incorrect classes for some of the chipsets
that this code supports.  It no longer does, but the older object ioctls
have compatibility to avoid breaking userspace.

This needs to be fixed before switching over to the newer interfaces.

Rather than hardcoding chipset->class like the rest of the driver does,
this makes use of (new) sclass queries to determine what's available.

v2.
- update to use symbolic class identifier from 

Signed-off-by: Ben Skeggs 
---
 src/gallium/drivers/nouveau/nv50/nv98_video.c | 57 ---
 1 file changed, 51 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv98_video.c 
b/src/gallium/drivers/nouveau/nv50/nv98_video.c
index 20ea547..177a7e0 100644
--- a/src/gallium/drivers/nouveau/nv50/nv98_video.c
+++ b/src/gallium/drivers/nouveau/nv50/nv98_video.c
@@ -25,6 +25,8 @@
 #include "util/u_sampler.h"
 #include "util/u_format.h"
 
+#include 
+
 static void
 nv98_decoder_decode_bitstream(struct pipe_video_codec *decoder,
   struct pipe_video_buffer *video_target,
@@ -56,6 +58,28 @@ nv98_decoder_decode_bitstream(struct pipe_video_codec 
*decoder,
nv98_decoder_ppp(dec, desc, target, comm_seq);
 }
 
+static const struct nouveau_mclass
+nv98_decoder_msvld[] = {
+   { G98_MSVLD, -1 },
+   { IGT21A_MSVLD, -1 },
+   { GT212_MSVLD, -1 },
+   {}
+};
+
+static const struct nouveau_mclass
+nv98_decoder_mspdec[] = {
+   { G98_MSPDEC, -1 },
+   { GT212_MSPDEC, -1 },
+   {}
+};
+
+static const struct nouveau_mclass
+nv98_decoder_msppp[] = {
+   { G98_MSPPP, -1 },
+   { GT212_MSPPP, -1 },
+   {}
+};
+
 struct pipe_video_codec *
 nv98_create_decoder(struct pipe_context *context,
 const struct pipe_video_codec *templ)
@@ -103,12 +127,33 @@ nv98_create_decoder(struct pipe_context *context,
}
push = dec->pushbuf;
 
-   if (!ret)
-  ret = nouveau_object_new(dec->channel[0], 0x390b1, 0x85b1, NULL, 0, 
&dec->bsp);
-   if (!ret)
-  ret = nouveau_object_new(dec->channel[1], 0x190b2, 0x85b2, NULL, 0, 
&dec->vp);
-   if (!ret)
-  ret = nouveau_object_new(dec->channel[2], 0x290b3, 0x85b3, NULL, 0, 
&dec->ppp);
+   if (!ret) {
+  ret = nouveau_object_mclass(dec->channel[0], nv98_decoder_msvld);
+  if (ret >= 0) {
+ ret = nouveau_object_new(dec->channel[0], 0xbeef85b1,
+  nv98_decoder_msvld[ret].oclass, NULL, 0,
+  &dec->bsp);
+  }
+   }
+
+   if (!ret) {
+  ret = nouveau_object_mclass(dec->channel[1], nv98_decoder_mspdec);
+  if (ret >= 0) {
+ ret = nouveau_object_new(dec->channel[1], 0xbeef85b2,
+  nv98_decoder_mspdec[ret].oclass, NULL, 0,
+  &dec->vp);
+  }
+   }
+
+   if (!ret) {
+  ret = nouveau_object_mclass(dec->channel[2], nv98_decoder_msppp);
+  if (ret >= 0) {
+ ret = nouveau_object_new(dec->channel[2], 0xbeef85b3,
+  nv98_decoder_msppp[ret].oclass, NULL, 0,
+  &dec->ppp);
+  }
+   }
+
if (ret)
   goto fail;
 
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [mesa v3 1/9] nouveau: bump required libdrm version to 2.4.66

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

v2. forgot bump for non-gallium driver

Signed-off-by: Ben Skeggs 
---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index b6680d0..965c6f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,8 +72,8 @@ LIBDRM_REQUIRED=2.4.60
 LIBDRM_RADEON_REQUIRED=2.4.56
 LIBDRM_AMDGPU_REQUIRED=2.4.63
 LIBDRM_INTEL_REQUIRED=2.4.61
-LIBDRM_NVVIEUX_REQUIRED=2.4.33
-LIBDRM_NOUVEAU_REQUIRED=2.4.62
+LIBDRM_NVVIEUX_REQUIRED=2.4.66
+LIBDRM_NOUVEAU_REQUIRED=2.4.66
 LIBDRM_FREEDRENO_REQUIRED=2.4.65
 DRI2PROTO_REQUIRED=2.6
 DRI3PROTO_REQUIRED=1.0
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [mesa v3 3/9] nouveau: remove use of deprecated nouveau_device::drm_version

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

v2. update for libdrm nouveau_drm::lib_version removal

Signed-off-by: Ben Skeggs 
---
 src/gallium/drivers/nouveau/nv50/nv50_miptree.c | 3 ++-
 src/gallium/drivers/nouveau/nv50/nv50_screen.c  | 4 ++--
 src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c | 3 ++-
 src/gallium/drivers/nouveau/nvc0/nvc0_query.c   | 2 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_metric.c | 2 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c | 4 ++--
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c  | 9 +
 7 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c 
b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
index 812d10c..7450119 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
@@ -336,9 +336,10 @@ nv50_miptree_create(struct pipe_screen *pscreen,
 const struct pipe_resource *templ)
 {
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
+   struct nouveau_drm *drm = nouveau_screen(pscreen)->drm;
struct nv50_miptree *mt = CALLOC_STRUCT(nv50_miptree);
struct pipe_resource *pt = &mt->base.base;
-   bool compressed = dev->drm_version >= 0x01000101;
+   bool compressed = drm->version >= 0x01000101;
int ret;
union nouveau_bo_config bo_config;
uint32_t bo_flags;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c 
b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index 1e4b75f..87a3576 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -518,11 +518,11 @@ nv50_screen_init_hwctx(struct nv50_screen *screen)
}
 
BEGIN_NV04(push, NV50_3D(ZETA_COMP_ENABLE), 1);
-   PUSH_DATA(push, screen->base.device->drm_version >= 0x01000101);
+   PUSH_DATA(push, screen->base.drm->version >= 0x01000101);
 
BEGIN_NV04(push, NV50_3D(RT_COMP_ENABLE(0)), 8);
for (i = 0; i < 8; ++i)
-  PUSH_DATA(push, screen->base.device->drm_version >= 0x01000101);
+  PUSH_DATA(push, screen->base.drm->version >= 0x01000101);
 
BEGIN_NV04(push, NV50_3D(RT_CONTROL), 1);
PUSH_DATA (push, 1);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
index 15991c3..ed1ac48 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
@@ -248,9 +248,10 @@ nvc0_miptree_create(struct pipe_screen *pscreen,
 const struct pipe_resource *templ)
 {
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
+   struct nouveau_drm *drm = nouveau_screen(pscreen)->drm;
struct nv50_miptree *mt = CALLOC_STRUCT(nv50_miptree);
struct pipe_resource *pt = &mt->base.base;
-   bool compressed = dev->drm_version >= 0x01000101;
+   bool compressed = drm->version >= 0x01000101;
int ret;
union nouveau_bo_config bo_config;
uint32_t bo_flags;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
index 3845d61..7497317 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
@@ -184,7 +184,7 @@ nvc0_screen_get_driver_query_group_info(struct pipe_screen 
*pscreen,
count++;
 #endif
 
-   if (screen->base.device->drm_version >= 0x01000101) {
+   if (screen->base.drm->version >= 0x01000101) {
   if (screen->compute) {
  if (screen->base.class_3d == NVE4_3D_CLASS) {
 count += 2;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_metric.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_metric.c
index f020d0d..7a64b69 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_metric.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_metric.c
@@ -565,7 +565,7 @@ nvc0_hw_metric_get_driver_query_info(struct nvc0_screen 
*screen, unsigned id,
uint16_t class_3d = screen->base.class_3d;
int count = 0;
 
-   if (screen->base.device->drm_version >= 0x01000101) {
+   if (screen->base.drm->version >= 0x01000101) {
   if (screen->compute) {
  if (screen->base.class_3d == NVE4_3D_CLASS) {
 count += NVE4_HW_METRIC_QUERY_COUNT;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
index 3f5a876..721857e 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
@@ -1121,7 +1121,7 @@ nvc0_hw_sm_create_query(struct nvc0_context *nvc0, 
unsigned type)
struct nvc0_hw_query *hq;
unsigned space;
 
-   if (nvc0->screen->base.device->drm_version < 0x01000101)
+   if (nvc0->screen->base.drm->version < 0x01000101)
   return NULL;
 
if ((type < NVE4_HW_SM_QUERY(0) || type > NVE4_HW_SM_QUERY_LAST) &&
@@ -1216,7 +1216,7 @@ nvc0_hw_sm_get_driver_query_info(struct nvc0_screen 
*screen, unsigned id,
 {
int cou

[Nouveau] [mesa v3 4/9] nouveau: return nouveau_screen from hw-specific creation functions

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Kills off a void cast.

Signed-off-by: Ben Skeggs 
---
 src/gallium/drivers/nouveau/nouveau_winsys.h| 6 +++---
 src/gallium/drivers/nouveau/nv30/nv30_screen.c  | 4 ++--
 src/gallium/drivers/nouveau/nv50/nv50_screen.c  | 4 ++--
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c  | 4 ++--
 src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h 
b/src/gallium/drivers/nouveau/nouveau_winsys.h
index 1319c32..3a686bd 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -79,13 +79,13 @@ nouveau_screen_transfer_flags(unsigned pipe)
return flags;
 }
 
-extern struct pipe_screen *
+extern struct nouveau_screen *
 nv30_screen_create(struct nouveau_device *);
 
-extern struct pipe_screen *
+extern struct nouveau_screen *
 nv50_screen_create(struct nouveau_device *);
 
-extern struct pipe_screen *
+extern struct nouveau_screen *
 nvc0_screen_create(struct nouveau_device *);
 
 #endif
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c 
b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index 154c3d3..ea29811 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -417,7 +417,7 @@ nv30_screen_destroy(struct pipe_screen *pscreen)
   return NULL;\
} while(0)
 
-struct pipe_screen *
+struct nouveau_screen *
 nv30_screen_create(struct nouveau_device *dev)
 {
struct nv30_screen *screen = CALLOC_STRUCT(nv30_screen);
@@ -693,5 +693,5 @@ nv30_screen_create(struct nouveau_device *dev)
nouveau_pushbuf_kick(push, push->channel);
 
nouveau_fence_new(&screen->base, &screen->base.fence.current, false);
-   return pscreen;
+   return &screen->base;
 }
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c 
b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index 87a3576..82b9e93 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -747,7 +747,7 @@ int nv50_tls_realloc(struct nv50_screen *screen, unsigned 
tls_space)
return 1;
 }
 
-struct pipe_screen *
+struct nouveau_screen *
 nv50_screen_create(struct nouveau_device *dev)
 {
struct nv50_screen *screen;
@@ -961,7 +961,7 @@ nv50_screen_create(struct nouveau_device *dev)
 
nouveau_fence_new(&screen->base, &screen->base.fence.current, false);
 
-   return pscreen;
+   return &screen->base;
 
 fail:
nv50_screen_destroy(pscreen);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index c3bf399..b573ada 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -622,7 +622,7 @@ nvc0_screen_resize_tls_area(struct nvc0_screen *screen,
   return NULL;\
} while(0)
 
-struct pipe_screen *
+struct nouveau_screen *
 nvc0_screen_create(struct nouveau_device *dev)
 {
struct nvc0_screen *screen;
@@ -1063,7 +1063,7 @@ nvc0_screen_create(struct nouveau_device *dev)
 
nouveau_fence_new(&screen->base, &screen->base.fence.current, false);
 
-   return pscreen;
+   return &screen->base;
 
 fail:
nvc0_screen_destroy(pscreen);
diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c 
b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
index 3ed644e..e117dfc 100644
--- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
@@ -58,7 +58,7 @@ PUBLIC struct pipe_screen *
 nouveau_drm_screen_create(int fd)
 {
struct nouveau_device *dev = NULL;
-   struct pipe_screen *(*init)(struct nouveau_device *);
+   struct nouveau_screen *(*init)(struct nouveau_device *);
struct nouveau_screen *screen;
int ret, dupfd = -1;
 
@@ -116,7 +116,7 @@ nouveau_drm_screen_create(int fd)
goto err;
}
 
-   screen = (struct nouveau_screen*)init(dev);
+   screen = init(dev);
if (!screen)
goto err;
 
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [mesa v3 5/9] nouveau: fix screen creation failure paths

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

The winsys layer would attempt to cleanup the nouveau_device if screen
init failed, however, in most paths the pipe driver would have already
destroyed it, resulting in accesses to freed memory etc.

This commit fixes the problem by allowing the winsys to detect whether
the pipe driver's destroy function needs to be called or not.

Signed-off-by: Ben Skeggs 
---
 src/gallium/drivers/nouveau/nouveau_screen.c|  8 ++--
 src/gallium/drivers/nouveau/nv30/nv30_screen.c  | 19 ++-
 src/gallium/drivers/nouveau/nv50/nv50_screen.c  |  6 +++---
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c  |  9 -
 src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 16 ++--
 5 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index a012579..3cdcc20 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -147,6 +147,12 @@ nouveau_screen_init(struct nouveau_screen *screen, struct 
nouveau_device *dev)
if (nv_dbg)
   nouveau_mesa_debug = atoi(nv_dbg);
 
+   /* These must be set before any failure is possible, as the cleanup
+* paths assume they're responsible for deleting them.
+*/
+   screen->drm = nouveau_drm(&dev->object);
+   screen->device = dev;
+
/*
 * this is initialized to 1 in nouveau_drm_screen_create after screen
 * is fully constructed and added to the global screen list.
@@ -175,8 +181,6 @@ nouveau_screen_init(struct nouveau_screen *screen, struct 
nouveau_device *dev)
 data, size, &screen->channel);
if (ret)
   return ret;
-   screen->drm = nouveau_drm(&dev->object);
-   screen->device = dev;
 
ret = nouveau_client_new(screen->device, &screen->client);
if (ret)
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c 
b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index ea29811..854f70c 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -413,23 +413,20 @@ nv30_screen_destroy(struct pipe_screen *pscreen)
 #define FAIL_SCREEN_INIT(str, err)\
do {   \
   NOUVEAU_ERR(str, err);  \
-  nv30_screen_destroy(pscreen);   \
-  return NULL;\
+  screen->base.base.context_create = NULL;\
+  return &screen->base;   \
} while(0)
 
 struct nouveau_screen *
 nv30_screen_create(struct nouveau_device *dev)
 {
-   struct nv30_screen *screen = CALLOC_STRUCT(nv30_screen);
+   struct nv30_screen *screen;
struct pipe_screen *pscreen;
struct nouveau_pushbuf *push;
struct nv04_fifo *fifo;
unsigned oclass = 0;
int ret, i;
 
-   if (!screen)
-  return NULL;
-
switch (dev->chipset & 0xf0) {
case 0x30:
   if (RANKINE_0397_CHIPSET & (1 << (dev->chipset & 0x0f)))
@@ -458,10 +455,16 @@ nv30_screen_create(struct nouveau_device *dev)
 
if (!oclass) {
   NOUVEAU_ERR("unknown 3d class for 0x%02x\n", dev->chipset);
-  FREE(screen);
   return NULL;
}
 
+   screen = CALLOC_STRUCT(nv30_screen);
+   if (!screen)
+  return NULL;
+
+   pscreen = &screen->base.base;
+   pscreen->destroy = nv30_screen_destroy;
+
/*
 * Some modern apps try to use msaa without keeping in mind the
 * restrictions on videomem of older cards. Resulting in dmesg saying:
@@ -479,8 +482,6 @@ nv30_screen_create(struct nouveau_device *dev)
if (screen->max_sample_count > 4)
   screen->max_sample_count = 4;
 
-   pscreen = &screen->base.base;
-   pscreen->destroy = nv30_screen_destroy;
pscreen->get_param = nv30_screen_get_param;
pscreen->get_paramf = nv30_screen_get_paramf;
pscreen->get_shader_param = nv30_screen_get_shader_param;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c 
b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index 82b9e93..46c812b 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -762,6 +762,7 @@ nv50_screen_create(struct nouveau_device *dev)
if (!screen)
   return NULL;
pscreen = &screen->base.base;
+   pscreen->destroy = nv50_screen_destroy;
 
ret = nouveau_screen_init(&screen->base, dev);
if (ret) {
@@ -782,7 +783,6 @@ nv50_screen_create(struct nouveau_device *dev)
 
chan = screen->base.channel;
 
-   pscreen->destroy = nv50_screen_destroy;
pscreen->context_create = nv50_create;
pscreen->is_format_supported = nv50_screen_is_format_supported;
pscreen->get_param = nv50_screen_get_param;
@@ -964,8 +964,8 @@ nv50_screen_create(struct nouveau_device *dev)
return &screen->base;
 
 fail:
-   nv50_screen_destroy(pscreen);
-   return NULL;
+   screen->base.base.context_create = NULL;
+   return &screen-

[Nouveau] [libdrm v3 14/14] Bump version for release

2015-12-16 Thread Ben Skeggs
From: Ben Skeggs 

Signed-off-by: Ben Skeggs 
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index b929d36..7678572 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
 
 AC_PREREQ([2.63])
 AC_INIT([libdrm],
-[2.4.65],
+[2.4.66],
 [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
 [libdrm])
 
-- 
2.6.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [libdrm v3 01/14] nouveau: import and install a selection of nvif headers from the kernel

2015-12-16 Thread Ben Skeggs
On 12/17/2015 09:20 AM, Ben Skeggs wrote:
> From: Ben Skeggs 
> 
> This commit also modifies the install path of the main libdrm_nouveau
> header to be under a nouveau/ subdirectory.
Hey Emil, Ilia, Samuel,

You guys have all done various bits of review on the libdrm/mesa series,
would I be able to get you guys to have a final look-over to make sure
everything has been addressed, and give your R-b's?

Thanks,
Ben.

> 
> Signed-off-by: Ben Skeggs 
> ---
>  include/drm/nouveau_drm.h|   1 +
>  nouveau/Makefile.am  |  11 +++-
>  nouveau/libdrm_nouveau.pc.in |   2 +-
>  nouveau/nvif/cl0080.h|  45 ++
>  nouveau/nvif/cl9097.h|  44 ++
>  nouveau/nvif/class.h | 141 
> +++
>  nouveau/nvif/if0002.h|  38 
>  nouveau/nvif/if0003.h|  33 ++
>  nouveau/nvif/ioctl.h | 132 
>  nouveau/nvif/unpack.h|  28 +
>  10 files changed, 473 insertions(+), 2 deletions(-)
>  create mode 100644 nouveau/nvif/cl0080.h
>  create mode 100644 nouveau/nvif/cl9097.h
>  create mode 100644 nouveau/nvif/class.h
>  create mode 100644 nouveau/nvif/if0002.h
>  create mode 100644 nouveau/nvif/if0003.h
>  create mode 100644 nouveau/nvif/ioctl.h
>  create mode 100644 nouveau/nvif/unpack.h
> 
> diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h
> index 87aefc5..e418f9f 100644
> --- a/include/drm/nouveau_drm.h
> +++ b/include/drm/nouveau_drm.h
> @@ -200,6 +200,7 @@ struct drm_nouveau_sarea {
>  #define DRM_NOUVEAU_GROBJ_ALLOC0x04
>  #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC  0x05
>  #define DRM_NOUVEAU_GPUOBJ_FREE0x06
> +#define DRM_NOUVEAU_NVIF   0x07
>  #define DRM_NOUVEAU_GEM_NEW0x40
>  #define DRM_NOUVEAU_GEM_PUSHBUF0x41
>  #define DRM_NOUVEAU_GEM_CPU_PREP   0x42
> diff --git a/nouveau/Makefile.am b/nouveau/Makefile.am
> index 25ea6dc..76cdeca 100644
> --- a/nouveau/Makefile.am
> +++ b/nouveau/Makefile.am
> @@ -14,9 +14,18 @@ libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
>  
>  libdrm_nouveau_la_SOURCES = $(LIBDRM_NOUVEAU_FILES)
>  
> -libdrm_nouveauincludedir = ${includedir}/libdrm
> +libdrm_nouveauincludedir = ${includedir}/libdrm/nouveau
>  libdrm_nouveauinclude_HEADERS = $(LIBDRM_NOUVEAU_H_FILES)
>  
> +libdrm_nouveaunvifincludedir = ${includedir}/libdrm/nouveau/nvif
> +libdrm_nouveaunvifinclude_HEADERS = nvif/class.h \
> + nvif/cl0080.h \
> + nvif/cl9097.h \
> + nvif/if0002.h \
> + nvif/if0003.h \
> + nvif/ioctl.h \
> + nvif/unpack.h
> +
>  pkgconfigdir = @pkgconfigdir@
>  pkgconfig_DATA = libdrm_nouveau.pc
>  
> diff --git a/nouveau/libdrm_nouveau.pc.in b/nouveau/libdrm_nouveau.pc.in
> index 9abfd81..7d0622e 100644
> --- a/nouveau/libdrm_nouveau.pc.in
> +++ b/nouveau/libdrm_nouveau.pc.in
> @@ -7,5 +7,5 @@ Name: libdrm_nouveau
>  Description: Userspace interface to nouveau kernel DRM services
>  Version: @PACKAGE_VERSION@
>  Libs: -L${libdir} -ldrm_nouveau
> -Cflags: -I${includedir} -I${includedir}/libdrm
> +Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/libdrm/nouveau
>  Requires.private: libdrm
> diff --git a/nouveau/nvif/cl0080.h b/nouveau/nvif/cl0080.h
> new file mode 100644
> index 000..331620a
> --- /dev/null
> +++ b/nouveau/nvif/cl0080.h
> @@ -0,0 +1,45 @@
> +#ifndef __NVIF_CL0080_H__
> +#define __NVIF_CL0080_H__
> +
> +struct nv_device_v0 {
> + __u8  version;
> + __u8  pad01[7];
> + __u64 device;   /* device identifier, ~0 for client default */
> +};
> +
> +#define NV_DEVICE_V0_INFO  
> 0x00
> +#define NV_DEVICE_V0_TIME  
> 0x01
> +
> +struct nv_device_info_v0 {
> + __u8  version;
> +#define NV_DEVICE_INFO_V0_IGP  
> 0x00
> +#define NV_DEVICE_INFO_V0_PCI  
> 0x01
> +#define NV_DEVICE_INFO_V0_AGP  
> 0x02
> +#define NV_DEVICE_INFO_V0_PCIE 
> 0x03
> +#define NV_DEVICE_INFO_V0_SOC  
> 0x04
> + __u8  platform;
> + __u16 chipset;  /* from NV_PMC_BOOT_0 */
> + __u8  revision; /* from NV_PMC_BOOT_0 */
> +#define NV_DEVICE_INFO_V0_TNT  
> 0x01
> +#define NV_DEVICE_INFO_V0_CELSIUS  
> 0x02
> +#define NV_DEVICE_INFO_V0_KELVIN   
> 0x03
> +#define NV_DEVICE_INFO_V0_RANKINE  
> 0x04
> +#define NV_DEVICE_INFO_V0_CURIE
> 0x05
> +#

[Nouveau] [Bug 59069] nouveau E[ DRM] fail ttm_validate

2015-12-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59069

--- Comment #33 from peter swain  ---
my issue was resolved by update yesterday, to a version which I can't confirm
at the moment.
Twice gone thru the once-fatal screen-blank/resume sequence on same
dual-monitor setup

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [Bug 92126] [NVE4] GTX 760 Auto fan speed stays at 10% until temp hits 90C

2015-12-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=92126

--- Comment #2 from daemon32  ---
http://lists.freedesktop.org/archives/nouveau/2015-November/023401.html

This patch fixes the problem (sort of), now, however the fan will spin up to be
obnoxiously loud. As in: 4000 RPM at 50C!

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [Bug 59069] nouveau E[ DRM] fail ttm_validate

2015-12-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59069

--- Comment #34 from peter swain  ---
(In reply to peter swain from comment #33)
> my issue was resolved by update yesterday,
by xserver-xorg-video-nouveau   
1:1.0.12+git1512080732.b18bc0~gd~w
from
deb http://ppa.launchpad.net/oibaf/graphics-drivers/ubuntu wily main


Peeking into logs, it looks like this commit was responsible,
as the issue looks similar ...
authorMario Kleiner 2015-06-28 00:33:49
(GMT)
committerBen Skeggs 2015-11-17 05:55:42 (GMT)
commit6e6d8ac1c7b4ee047a7b40b95dea1e65a7c3211a
  "Take shift in crtc positions for ZaphodHeads configs into account"

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau