OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Sep 24, 2019 3:37 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to read Command Reference Instructions from Intel PRM
PostPosted: Thu Jan 03, 2019 5:11 am 
Offline

Joined: Sat Dec 29, 2018 3:09 am
Posts: 10
Hey all, I am trying to program the integrated graphics on my Intel Chip, which is of the Skylake series. If any of you have a skylake processor then I have saved you a good amount of time because I was not able to find a Programmer's Reference Manual on any official intel site. I found the below manual on 01.org after spending a good amount of time digging around google.

https://01.org/linuxgraphics/documentat ... e-platform

As you can see, there are about 21 seperate volumes, and my questions lies in intel-gfx-prm-osrc-skl-vol02a-commandreference-instructions.pdf. I'm not entirely sure what to do with the information given, but after more research I have 2 theories. For example I will use the 3DSTATE_WM_HZ_OP instruction [image 1]. So my first theory:

Given the information I assumed that Intel has given enough information for one to program the integrated graphics by directly writing the binary instruction (or to write an assembler). However after mroe digging around I found the following [image 2] on Intel's github (https://github.com/intel/external-mesa/ ... _defines.h) which led me to my second theory.

My second theory is a user would be able to use the given instruction by utilizing Intel's mesa library (I'm assuming its precompiled and the #define statement points to the address in memory were the function resides).

However I'm not entirely to sure, and after googling a variety of the instructions I figured I post on here, go to bed, and wake up to hopefully someone answering my question.

Thanks,
bigboyav


Attachments:
3dstate_wm_hz_op_github.PNG
3dstate_wm_hz_op_github.PNG [ 1.89 KiB | Viewed 447 times ]
3dstate_wm_hz_op_prm.PNG
3dstate_wm_hz_op_prm.PNG [ 126.21 KiB | Viewed 447 times ]
Top
 Profile  
 
 Post subject: Re: How to read Command Reference Instructions from Intel PR
PostPosted: Fri Jan 04, 2019 3:13 pm 
Offline
User avatar

Joined: Thu Dec 29, 2016 2:06 am
Posts: 5
Quote:
Given the information I assumed that Intel has given enough information for one to program the integrated graphics by directly writing the binary instruction (or to write an assembler).

I assume that would be possible, although I have never attempted to write a graphics driver myself.

Quote:
My second theory is a user would be able to use the given instruction by utilizing Intel's mesa library (I'm assuming its precompiled and the #define statement points to the address in memory were the function resides).


Mesa/Mesa3D is a graphics library providing an implementation of OpenGL, Vulkan, and other graphics apis, and provides an interface between the graphics apis and vendor specific drivers. The Mesa library provides an abstraction for interfacing with the GPU, so whatever Mesa can do, you can most likely do.

Now, on to specifics. 3DSTATE_WM_HZ_OP is a GPU command, and has a specific opcode. Mesa defines the opcode value inside _3DSTATE_WM_HZ_OP, and the value (0x7852) is just upper half of the 1st dword of the command. Here it is broken up:
Code:
Binary Parts: 011 11 000 01010010
   Hex Parts:     7|   8|      52


Referencing the command reference, you can see those same values inside of the command table under "Programming Notes".
Code:
Command Type:          011      (03h)
Command SubType:       11       (3h)
3D Command Opcode:     000      (0h)
3D Command Sub Opcode: 01010010 (52h)


The code where this define is used is inside of the brw_upload_initial_gpu_state function which sets up an initial state for the GPU. I don't know the specifics of what this function actually does, but that is what I gathered from a quick glance.

I suggest that you also look at the subsystems of the GPU in volume 3 of the PRM (here) to gain an understanding of each and better understand what each command is doing. However, you may do as you wish.

_________________
Developing K4


Top
 Profile  
 
 Post subject: Re: How to read Command Reference Instructions from Intel PR
PostPosted: Fri Jan 04, 2019 4:12 pm 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 607
In general Linux' model works as follows: Mesa implements a compiler that takes shaders (i.e. GLSL) as input and produces GPU-specific binary code (possibly via the intermediate languages TGSI and NIR). It might also generate GPU-specific binary code to implement other OpenGL commands. The kernel driver in the Linux kernel "just" performs memory management and uploads the commands to the GPU (see, for example, i915_gem_do_execbuffer). Mesa communicates with the kernel over ioctls on /dev/dri/card0. For an overview of those ioctls, you can take a look at the libdrm headers.

_________________
managarm: A microkernel-based OS that is capable of running a Wayland desktop


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: FusT, snijj and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group