Re: graphics acceleration, DRI2, DRM problem

2016-08-20 Thread Lampshade
I think that actual, real job is done by:

aml_evalname(sc, node, "_OFF", 0, NULL,
)
or
aml_evalinteger(sc, node, "_OFF", 0,
NULL, )

inside acpi.c file.

The only good thing about this patch is
that it works for me.



Re: graphics acceleration, DRI2, DRM problem

2016-08-19 Thread Lampshade
> > +filedev/pci/nvdsbl.c
>
> can you include this file? and any new .h files as well?

I think that this was just for registering a dummy driver
for that Nvidia device. It does nothing useful itself.

# cat /usr/src/sys/dev/pci/nvdsbl.c
/*  $OpenBSD: nvdsbl.c,v 0.1 2015/07/28 12:00:01 somebody Exp $ */


/*
 * Driver changes power state / disables Nvidia GPU
 */

#include 
#include 
#include 

#include 
#include 
#include 

struct nvdsbl_softc {
struct device dev;
struct pci_attach_args nvdsbl_pa;
};

int nvdsbl_probe(struct device *, void *, void *);
void nvdsbl_attach(struct device *, struct device *, void *);

struct cfattach nvdsbl_ca = {
sizeof(struct nvdsbl_softc), nvdsbl_probe, nvdsbl_attach, NULL, NULL
};

struct cfdriver nvdsbl_cd = {
NULL, "nvdsbl", DV_DULL
};

static const struct pci_matchid nvdsbl_devices[] = {
{ 0x10de, 0x1140 }
};


int
nvdsbl_probe(struct device *parent, void *match, void *aux)
{
pci_matchbyid((struct pci_attach_args
*)aux,nvdsbl_devices,nitems(nvdsbl_devices));
}

void
nvdsbl_attach(struct device *parent, struct device *self, void *aux)
{
printf("inside pci nvdsbl attach\n");
}



Re: graphics acceleration, DRI2, DRM problem

2016-08-19 Thread Ted Unangst
Lampshade wrote:
> This is totally fucked up code, but if you like hazard...
> I mean that I really just called some random ACPI (aml) methods 
> not knowing what they should do.


> +#Acer Optimus nvdsbl disable nvidia gpu PCI
> +device  nvdsbl
> +attach  nvdsbl at pci
> +filedev/pci/nvdsbl.c

can you include this file? and any new .h files as well?



Re: graphics acceleration, DRI2, DRM problem

2016-08-19 Thread Lampshade
This is totally fucked up code, but if you like hazard...
I mean that I really just called some random ACPI (aml) methods 
not knowing what they should do.
Additionally this code is for my laptop. I have GEFORCE 620M
GPU, so I added this to pcidevs. Another thing is that patched
code recognizes my GPU device through ACPI name
"\\_SB_.PCI0.PEG0.PEGP". I have discovered name when I was
using Linux kernel's module called acpi_call. Other laptops
may have differently named GPUs.

You use this at your own risk and you must *not* report bugs
to Project when using patched kernel.



File: GENERIC  Status: Locally Modified

   Working revision:1.427
   Repository revision: 1.427   /cvs/src/sys/arch/amd64/conf/GENERIC,v
   Commit Identifier:   xNzAQvg5oqM2b0pn
File: acpi.cStatus: Locally Modified

   Working revision:1.313
   Repository revision: 1.313   /cvs/src/sys/dev/acpi/acpi.c,v
   Commit Identifier:   h0GHFDGWnEdswfbK
File: dsdt.cStatus: Locally Modified

   Working revision:1.223
   Repository revision: 1.223   /cvs/src/sys/dev/acpi/dsdt.c,v
   Commit Identifier:   SBTJg3diM8lXHXRE
File: files.pci Status: Locally Modified

   Working revision:1.324
   Repository revision: 1.324   /cvs/src/sys/dev/pci/files.pci,v
   Commit Identifier:   aeD3LK9Qomrjecge
File: pcidevs   Status: Locally Modified

   Working revision:1.1802
   Repository revision: 1.1802  /cvs/src/sys/dev/pci/pcidevs,v
   Commit Identifier:   ZupaPoe9OBu6iKll
File: pcidevs.h Status: Locally Modified

   Working revision:1.1796
   Repository revision: 1.1796  /cvs/src/sys/dev/pci/pcidevs.h,v
   Commit Identifier:   Z3aUcOQiFLoINK6d
File: pcidevs_data.hStatus: Locally Modified

   Working revision:1.1791
   Repository revision: 1.1791  /cvs/src/sys/dev/pci/pcidevs_data.h,v
   Commit Identifier:   Z3aUcOQiFLoINK6d



Index: sys/arch/amd64/conf/GENERIC
===
RCS file: /cvs/src/sys/arch/amd64/conf/GENERIC,v
retrieving revision 1.427
diff -u -p -r1.427 GENERIC
--- sys/arch/amd64/conf/GENERIC 3 Aug 2016 17:23:38 -   1.427
+++ sys/arch/amd64/conf/GENERIC 19 Aug 2016 21:31:07 -
@@ -11,7 +11,7 @@
 
 machineamd64
 include"../../../conf/GENERIC"
-maxusers   80  # estimated number of users
+maxusers   100 # estimated number of users
 
 option USER_PCICONF# user-space PCI configuration
 
@@ -22,10 +22,14 @@ option  MTRR# CPU memory range 
attribu
 #optionKGDB# Remote debugger support; exclusive of 
DDB
 #option"KGDB_DEVNAME=\"com\"",KGDBADDR=0x2f8,KGDBRATE=9600
 
-option NTFS# NTFS support
+#optionNTFS# NTFS support
 option HIBERNATE   # Hibernate support
 
+
+option HZ=300
+
 config bsd swap generic
+#optionDEBUG
 
 mainbus0 at root
 
@@ -399,6 +403,7 @@ adw*at pci? # AdvanSys 
ULTRA WIDE SC
 pcscp* at pci? # AMD 53c974 PCscsi-PCI SCSI
 #trm*  at pci? # Tekram DC-3x5U SCSI Controllers
 vmwpvs*at pci? # VMware ParaVirtual SCSI
+nvdsbl* at pci? # Nvidia PCI Driver for disabling
 nvme*  at pci? # NVMe controllers
 
 scsibus* at scsi?



Index: sys/dev/acpi/acpi.c
===
RCS file: /cvs/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.313
diff -u -p -r1.313 acpi.c
--- sys/dev/acpi/acpi.c 28 Jul 2016 21:57:56 -  1.313
+++ sys/dev/acpi/acpi.c 19 Aug 2016 21:31:44 -
@@ -562,11 +562,11 @@ acpi_getpci(struct aml_node *node, void 
 {
const char *pcihid[] = { ACPI_DEV_PCIB, ACPI_DEV_PCIEB, "HWP0002", 0 };
struct acpi_pci *pci, *ppci;
-   struct aml_value res;
+   struct aml_value res,res2;
struct acpi_softc *sc = arg;
pci_chipset_tag_t pc = NULL;
pcitag_t tag;
-   uint64_t val;
+   uint64_t val,val2;
uint32_t reg;
 
if (!node->value || node->value->type != AML_OBJTYPE_DEVICE)
@@ -620,6 +620,35 @@ acpi_getpci(struct aml_node *node, void 
pci->bus, pci->dev, pci->fun,
aml_nodename(node));
 
+
+   bool czyNvidiaGPU = false;
+if (!(strcmp("\\_SB_.PCI0.PEG0.PEGP",aml_nodename(node
+czyNvidiaGPU = true;
+
+if (czyNvidiaGPU) {
+printf("bedzie evalname na GPU\n");
+bool czyPoprawnieName = false;
+if(aml_evalname(sc, node, "_OFF", 0, NULL, )){
+printf("evalname na GPU true\n");
+czyPoprawnieName = true;
+aml_freevalue();
+} else {
+

Re: graphics acceleration, DRI2, DRM problem

2016-08-16 Thread EdaSky

A year ago I have written ugly hack to disable Nvidia GPU year ago
for power saving.


Is this patch available somewhere?



Re: graphics acceleration, DRI2, DRM problem

2016-08-14 Thread L.R. D.S.
Not a dev, but it may have something to do with pledge. Try to change your 
aperture driver (check man xf86) and reboot. Also, try ffplay instead of mpv 
just to check if it's not a software specific problem.



Re: graphics acceleration, DRI2, DRM problem

2016-08-14 Thread Lampshade
I have trimmed lspci output, but actually it was important.
I have not only Intel GPU but also Nvidia GPU.

A year ago I have written ugly hack to disable Nvidia GPU year ago
for power saving.
I am sure that is too ugly to commit to repository and
I am not programming professional so I need a lot of time to
write even ugly and tiny patch.

Actually DRI2 works if I recompile the kernel with my patch.

Following is printed by mpv with working graphics acceleration:

$ EGL_LOG_LEVEL=debug LIBGL_DEBUG=verbose MESA_DEBUG=1 mpv movie.avi   
Playing: movie.avi
 (+) Video --vid=1 (mpeg4)
 (+) Audio --aid=1 (ac3)
 (+) Subs  --sid=1 'movie.srt' (subrip) (external)
libGL: OpenDriver: trying /usr/X11R6/lib/modules/dri/i965_dri.so
libGL: Using DRI2 for screen 0
libEGL debug: Native platform type: x11 (autodetected)
libEGL debug: added egl_dri2 to module array
libEGL debug: DRI2: dlopen(/usr/X11R6/lib/modules/dri/i965_dri.so)
libEGL debug: found extension `DRI_Core'
libEGL info: found extension DRI_Core version 1
libEGL debug: found extension `DRI_IMAGE_DRIVER'
libEGL debug: found extension `DRI_DRI2'
libEGL info: found extension DRI_DRI2 version 4
libEGL debug: found extension `DRI_DriverVtable'
libEGL debug: found extension `DRI_ConfigOptions'
libEGL debug: found extension `DRI_TexBuffer'
libEGL info: found extension DRI_TexBuffer version 3
libEGL debug: found extension `DRI2_Fence'
libEGL debug: found extension `DRI2_Flush'
libEGL info: found extension DRI2_Flush version 4
libEGL debug: found extension `DRI_IMAGE'
libEGL info: found extension DRI_IMAGE version 11
libEGL debug: found extension `DRI_RENDERER_QUERY'
libEGL debug: found extension `DRI_CONFIG_QUERY'
libEGL debug: found extension `DRI_Robustness'
libEGL info: Using DRI2
libEGL debug: the best driver is DRI2
[ffmpeg/audio] ac3: Channel layout '5.1(side)' with 6 channels
does not match specified number of channels 2: ignoring specified channel
layout
AO: [sdl] 48000Hz stereo 2ch s32
VO: [opengl] 720x304 yuv420p
AV: 00:29:00 / 02:14:49 (21%) A-V:  0.000 Cache:  0s+1MB
[ffmpeg/audio] ac3: frame sync error
Error decoding audio.
AV: 00:41:39 / 02:14:49 (30%) A-V:  0.000 Cache:  0s+8MB
[ffmpeg/audio] ac3: frame sync error
Error decoding audio.
AV: 00:41:42 / 02:14:49 (30%) A-V:  0.000 Cache:  9s+8MB


Exiting... (Quit)
pthread_mutex_destroy on mutex with waiters!
libEGL debug: Display 0x1728778c8800 is destroyed with resources