ubuntu 黑屏和分辨率不能改变的问题

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。

vim /etc/default/grub
将 GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” 修改为
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash nomodeset”
sudo update-grub
sudo reboot

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'
# vim /etc/default/grub
GRUB_DEFAULT=0 #->设置默认启动项(0:第一个菜单),按menuentry顺序。比如要默认从第2个菜单项启动,数字改为1。
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"   #默认的

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"  #黑屏
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash text" #无GUI界面,文本行显示
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)

# Uncomment to disable graphical terminal (grub-pc only)

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'

GRUB_GFXMODE=1920x1080 #修改显示分辨率
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux

# Uncomment to disable generation of recovery mode menu entries

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

ubuntu14.04 用了不就终端黑屏了,全黑色,输入文字啥也看不到,其他的程序边框黑色。 GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash nomodeset” #黑屏
GRUB_GFXMODE=1920x1080 #修改显示分辨率

These are instructions passed to the kernel during the boot time. In Ubuntu, they are managed by the GNU GRUB (GRand Unified Bootloader).

. quiet - this option tells the kernel to NOT produce any output (a.k.a. Non verbose mode). If you boot without this option, you’ll see lots of kernel messages such as drivers/modules activations, filesystem checks and errors. Not having the quiet parameter may be useful when you need to find an error.
. splash - this option is used to start an eye-candy “loading” screen while all the core parts of the system are loaded in the background. If you disable it and have quiet enable you’ll get a blank screen.
. nomodeset - tells the kernel to not start video drivers until the system is up and running.




代码如下,但pConfig根本没有获取到数据,为什么没有获取数据呢?請赐教rn我是设置了断点测试的!rnrnrn length_24bit = 0L;rn length_8bit = 0L;rn data_24bit=NULL;rn data_8bit=NULL;rnrn HRESULT hr;rn //initialize datarn hr = InitCaptureGraphBuilder();rn if (FAILED(hr))rn rn AfxMessageBox(L"Failed to get video interfaces!");rn return hr;rn rnrn //bind object devicern if(!BindFilter(iDeviceID, &m_pBF))rn return S_FALSE;rnrn hr = m_pGB->AddFilter(m_pBF, L"Capture Filter");rnrn //create ISampleGrabber modulern hr = CoCreateInstance( CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, IID_ISampleGrabber, (void**)&m_pGrabber );rn if(FAILED(hr))rn rn AfxMessageBox(L"Fail to create SampleGrabber, maybe qedit.dll is not registered?");rn return hr;rn rnrn //add Grabber Filerrn CComQIPtr< IBaseFilter, &IID_IBaseFilter > pGrabBase(m_pGrabber);rn hr = m_pGB->AddFilter( pGrabBase, L"Grabber" );rn if(FAILED(hr))rn rn AfxMessageBox(L"Fail to put sample grabber in graph");rn return hr;rn rnrn //configure video formatrn AM_MEDIA_TYPE * AMT = new AM_MEDIA_TYPE; rn ZeroMemory(AMT, sizeof(AM_MEDIA_TYPE));rnrn m_pCapture->FindInterface(&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Interleaved,m_pBF, IID_IAMStreamConfig, (void **)&pConfig); <-问题出在这?????????????pConfig没获得数据rn pConfig->GetFormat(&AMT);rnrn AMT->majortype = MEDIATYPE_Video;rn AMT->subtype = MEDIASUBTYPE_RGB24; rn hr = m_pGrabber->SetMediaType(AMT);rn if(FAILED(hr))rn rn AfxMessageBox(L"set media type error");rn return hr;rn rnrn //capture instant imagern hr = m_pCapture->RenderStream(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video,m_pVW,pGrabBase,NULL);rnrnrn if( FAILED(hr))rn rn AfxMessageBox(L"Can't build the graph");rn return hr;rn rnrn //load video formatrn hr = m_pGrabber->GetConnectedMediaType(AMT);rn if (FAILED(hr))rn rn AfxMessageBox(L"connect media type error");rn return hr;rn rnrn VIDEOINFOHEADER * vih = (VIDEOINFOHEADER*) AMT->pbFormat;rnrn //rn //vih->bmiHeader.biWidth=960;rn //vih->bmiHeader.biHeight=720;rnrnrn m_pSampleGrabberCB->SetWidth(vih->bmiHeader.biWidth);rn m_pSampleGrabberCB->SetHeight(vih->bmiHeader.biHeight);rnrnrnrn m_pSampleGrabberCB->SetbGrabVideo(TRUE);rnrn if (AMT->cbFormat != 0)rn rn //Free Media Typern CoTaskMemFree((PVOID)AMT->pbFormat);rn AMT->cbFormat = 0;rn AMT->pbFormat = NULL;rn if (AMT->pUnk != NULL)rn rn AMT->pUnk->Release();rn AMT->pUnk = NULL;rn rn rnrn //using call-back modulern hr = m_pGrabber->SetBufferSamples(FALSE);rn hr = m_pGrabber->SetOneShot(FALSE);rn hr = m_pGrabber->SetCallback(m_pSampleGrabberCB,1);rnrn //configure Video Window rn m_hWnd = hWnd ;rn m_pVW->put_Owner((OAHWND)m_hWnd);rn m_pVW->put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN);rn if (m_pVW)rn rn CRect rc;rn ::GetClientRect(m_hWnd,&rc);rn m_pVW->SetWindowPosition(0, 0, rc.right, rc.bottom);rn rnrn //begin to capture video framern hr = m_pMC->Run();rn if(FAILED(hr))rn rn AfxMessageBox(L"Couldn't run the graph!");rn return hr;rn rn 论坛