SlideShare a Scribd company logo
1 of 16
Download to read offline
X Window / Direct Rendering
                                        Architectural Diagram
       Xclient (w/GL)
                        OpenGL I/F
Xlib I/F                                                               Filesystem
                                       libdrm I/F      IOCTL / mmap
                                                                       Driver I/F


                        Mesa                 libdrm
                                                                                               PCI
                                                                                   Direct
 Xlib       Xlib I/F
                                                                                               Driver
                                                                                 Rendering
                                                                                               I/F
                                                                                  Manager
                                                             Filesystem
                                             sockets         Abstraction
                                                                                  AGP GART
                                                                                  Manager
              X protocol                                               Filesystem I/F
                                                                       Driver I/F                          Hard-
                                                              Kernel
                                             sockets
  X Server (device-independent tier)                                                                       ware
                                                                                 AGP GART
                                       libdrm I/F
                XFree86 Tier
                                                                                  Manager
 DIX                                                    IOCTL / Memory
                                             libdrm
 I/F             DGA           DRI                      mmap Manager    MM
                                                                                           PCI
                                                              Subsystem I/F
                                                                                           Driver
              vidmode
                                                                                           I/F
                             Video
           XFree86                           IOCTL /
                                                                IRQ
                 XAA
                                                                              PCI Device
           Extension                         mmap
                             Driver                          Abstraction IRQM
  MI       I/F
                                                                                    Manager
                                                                           I/F
                  Xv
                                                                         2007 © Moriyoshi Koizumi. All Rights Reserved.
X Window / Indirect Rendering
                           Architectural Diagram
       Xclient (w/GL)
                        OpenGL I/F
Xlib I/F                                                             Filesystem
                                                                     Driver I/F


                        Mesa
                                                                                              PCI
                                                                                  Direct
 Xlib       Xlib I/F
                                                                                              Driver
                                                                                Rendering
                                                                                              I/F
                                                                                 Manager
                                                           Filesystem
                                             sockets       Abstraction
                                                                                AGP GART
                                                                                Manager
              X protocol                                             Filesystem I/F
                                                                     Driver I/F                           Hard-
                                                            Kernel
                                             sockets
  X Server (DIX)                                                                                          ware
                        GLX     Mesa
                                                                                AGP GART
       XFree86 Tier                    libdrm I/F
                                                                                 Manager
 DIX                                                   IOCTL / Memory
                                             libdrm
 I/F             DGA           DRI                     mmap Manager   MM
                                                                                          PCI
                                                            Subsystem I/F
                                                                                          Driver
              vidmode
                                                                                          I/F
                              Video
           XFree86                           IOCTL /
                                                              IRQ
                 XAA
                                                                            PCI Device
           Extension                         mmap
                              Driver                       Abstraction IRQM
  MI       I/F
                                                                                   Manager
                                                                          I/F
                  Xv
                                                                        2007 © Moriyoshi Koizumi. All Rights Reserved.
Address Space Layout

                                      Kernel Space
                    Graphics
           MMIO     Aperture
           Space




Physical
                                      User Space
Address
Space
           Actual
           RAM
           Space
                     GART




                                     2007 © Moriyoshi Koizumi. All Rights Reserved.
Direct Memory Access
                            1. Queueing
              Kernel Space               Graphic Controller
               Instruction
                 Buffer          DMA                                FIFO
                                 Transfer



 Marked
Consistent   IOCTL (BLIT etc.)
              User Space

                  Some
                 Process




                                    2007 © Moriyoshi Koizumi. All Rights Reserved.
Direct Memory Access
         2. Bitmap Block Transfer (Blit)
               Kernel Space          Graphic Controller
                                         Active Entry
                              FIFO




                                                   Parse &
               User Space                          Dispatch

                  Some
 Marked
                 Process                Blit Engine
Consistent

                              DMA Transfer
                 Another
                 Process

                               2007 © Moriyoshi Koizumi. All Rights Reserved.
DRM IOCTL I/F

    AUTH (GET_MAGIC / AUTH_MAGIC)
●


    VERSION (GET / SET)
●


    BUSID (GET / SET)
●


    MAP (ADD / RM)
●


    CTX (ADD / RM / GET / SWITCH / NEW /
●


    RESERVE)
    LOCK (LOCK / UNLOCK)
●


    AGP operations
●


    Device-specific operations
●
                                 2007 © Moriyoshi Koizumi. All Rights Reserved.
DRM Authentication

                               1. Retrieve Magic Cookie (drmGetMagic())

                                                              Cookie Manager
                Mesa             libdrm
                                                                              2. Generate
                                                              Direct
Xlib
                                                                              Magic
                                                            Rendering
                                                             Manager          Cookie

                        3. Send Magic
       X protocol       (XF86DRIAuthConnection())     4. Authenticate Cookie
                                                      (drmAuthMagic())
                                             Kernel
       X Server

         XFree86 Tier
                                 libdrm
                        DRI




                                                      2007 © Moriyoshi Koizumi. All Rights Reserved.
DRM Authentication
                                                                (Userland Wrappers)

libdrm/xf86drm.c:
(formally: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c)
int drmGetMagic(int fd, drm_magic_t * magic)
{
     drm_auth_t auth;


    *magic = 0;
    if (ioctl(fd, DRM_IOCTL_GET_MAGIC, &auth)) return -errno;
    *magic = auth.magic;
    return 0;
}




                                                          2007 © Moriyoshi Koizumi. All Rights Reserved.
DRM Authentication
                                                             (Userland Wrappers)

xc/programs/Xserver/hw/xfree86/dri/dri.c:
Bool
DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic)
{
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);


    if (drmAuthMagic(pDRIPriv->drmFD, magic)) return FALSE;
    return TRUE;
}


libdrm/xf86drm.c:
(formally: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c)
  int drmAuthMagic(int fd, drm_magic_t magic)
  {
      drm_auth_t auth;
      auth.magic = magic;
      if (ioctl(fd, DRM_IOCTL_AUTH_MAGIC, &auth)) return -errno;
      return 0;
  }



                                                       2007 © Moriyoshi Koizumi. All Rights Reserved.
DRM Authentication
       (linux/drivers/char/drm/drm_drv.c: IOCTL Dispatch Table)

static drm_ioctl_desc_t drm_ioctls[] = {
   [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = {drm_version, 0},
   [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = {drm_getunique,
0},
   [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = {drm_getmagic, 0},
   [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = {drm_irq_by_busid,
DRM_MASTER|DRM_ROOT_ONLY},
   [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = {drm_getmap, 0},
   [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = {drm_getclient,
0},
   [DRM_IOCTL_NR(DRM_IOCTL_SET_VERSION)] = {drm_setversion,
DRM_MASTER|DRM_ROOT_ONLY},
   [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = {drm_authmagic,
DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
   [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = {drm_addctx,
DRM_AUTH|DRM_ROOT_ONLY},
   [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = {drm_getctx,
DRM_AUTH},
...

                                       2007 © Moriyoshi Koizumi. All Rights Reserved.
DRM Authentication
             (linux/drivers/char/drm/drm_drv.c: IOCTL Dispatcher)
if (nr < DRIVER_IOCTL_COUNT)
    ioctl = &drm_ioctls[nr];
else if ((nr >= DRM_COMMAND_BASE)
           && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls))
    ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE];
else
    goto err_i1;


func = ioctl->func;


/* is there a local override? */
if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl)
        func = dev->driver->dma_ioctl;
if (!func) {
    DRM_DEBUG(quot;no functionnquot;);
    retcode = -EINVAL;
} else if (((ioctl->flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN)) ||
       ((ioctl->flags & DRM_AUTH) && !priv->authenticated) ||
       ((ioctl->flags & DRM_MASTER) && !priv->master)) {
    retcode = -EACCES;
} else {
    retcode = func(inode, filp, cmd, arg);
}

                                               2007 © Moriyoshi Koizumi. All Rights Reserved.
DRM Authentication
                (linux/drivers/char/drm/drm_auth.c: Cookie Issuer)

int drm_getmagic(struct inode *inode, struct file *filp,
            unsigned int cmd, unsigned long arg)
{
       ...
                                        typedef unsigned int drm_magic_t;
       /* Find unique magic */
       if (priv->magic) {
                                        typedef struct drm_auth {
           auth.magic = priv->magic;
                                           drm_magic_t magic;
       } else {
           do {                         } drm_auth_t;
               spin_lock(&lock);
               if (!sequence)
                   ++sequence;/* reserve 0 */
               auth.magic = sequence++;
               spin_unlock(&lock);
           } while (drm_find_file(dev, auth.magic));
           priv->magic = auth.magic;
           drm_add_magic(dev, priv, auth.magic);
       }


       DRM_DEBUG(quot;%unquot;, auth.magic);
       if (copy_to_user((drm_auth_t __user *) arg, &auth, sizeof(auth)))
           return -EFAULT;
       return 0;
}

                                               2007 © Moriyoshi Koizumi. All Rights Reserved.
DRM Authentication
                (linux/drivers/char/drm/drm_auth.c: Cookie Verifier)


int drm_authmagic(struct inode *inode, struct file *filp,
          unsigned int cmd, unsigned long arg)
{
    drm_file_t *priv = filp->private_data;
    drm_device_t *dev = priv->head->dev;
    drm_auth_t auth;
    drm_file_t *file;


    if (copy_from_user(&auth, (drm_auth_t __user *) arg, sizeof(auth)))
        return -EFAULT;
    DRM_DEBUG(quot;%unquot;, auth.magic);
    if ((file = drm_find_file(dev, auth.magic))) {
        file->authenticated = 1;
        drm_remove_magic(dev, auth.magic);
        return 0;
    }
    return -EINVAL;
}




                                                2007 © Moriyoshi Koizumi. All Rights Reserved.
DRM Authentication
                (linux/drivers/char/drm/drm_auth.c: Cookie Keeper)



static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic)
{
    drm_file_t *retval = NULL;
    drm_magic_entry_t *pt;
    int hash = drm_hash_magic(magic);


    mutex_lock(&dev->struct_mutex);
    for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
        if (pt->magic == magic) {
            retval = pt->priv;
            break;
        }
    }
    mutex_unlock(&dev->struct_mutex);
    return retval;
}




                                                2007 © Moriyoshi Koizumi. All Rights Reserved.
Graphic Address Remapping Table
                          (GART)
   SAREA
  Frame Buffer       Phy-Phy Address Translation
 Texture Buffer                                    Process #1
                         (by AGP controller)
                       Graphics
            MMIO       Aperture                                               Virtual
            Space                                                             Memory
                                                                              Space


Physical
                                                   Process #2
Address
Space
            Actual                                                            Virtual
            RAM                                                               Memory
            Space                                                             Space
                         GART


                                              Phy-Virt Address
                                              Translation (by MMU)

                                                   2007 © Moriyoshi Koizumi. All Rights Reserved.
AGPGART IOCTL I/F

    ACQUIRE
●



    SETUP
●



    RESERVE
●



    PROTECT
●



    ALLOCATE / DEALLOCATE
●



    BIND / UNBIND
●




                            2007 © Moriyoshi Koizumi. All Rights Reserved.

More Related Content

What's hot

The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421Linaro
 
Memory Mapping Implementation (mmap) in Linux Kernel
Memory Mapping Implementation (mmap) in Linux KernelMemory Mapping Implementation (mmap) in Linux Kernel
Memory Mapping Implementation (mmap) in Linux KernelAdrian Huang
 
Yocto Project introduction
Yocto Project introductionYocto Project introduction
Yocto Project introductionYi-Hsiu Hsu
 
Fun with Network Interfaces
Fun with Network InterfacesFun with Network Interfaces
Fun with Network InterfacesKernel TLV
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013Wave Digitech
 
Linux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPFLinux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPFBrendan Gregg
 
Continguous Memory Allocator in the Linux Kernel
Continguous Memory Allocator in the Linux KernelContinguous Memory Allocator in the Linux Kernel
Continguous Memory Allocator in the Linux KernelKernel TLV
 
Understanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panicUnderstanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panicJoseph Lu
 
Slab Allocator in Linux Kernel
Slab Allocator in Linux KernelSlab Allocator in Linux Kernel
Slab Allocator in Linux KernelAdrian Huang
 
The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageKernel TLV
 
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析Mr. Vengineer
 
Linux Locking Mechanisms
Linux Locking MechanismsLinux Locking Mechanisms
Linux Locking MechanismsKernel TLV
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)shimosawa
 
The Yocto Project
The Yocto ProjectThe Yocto Project
The Yocto Projectrossburton
 
DMA Survival Guide
DMA Survival GuideDMA Survival Guide
DMA Survival GuideKernel TLV
 

What's hot (20)

Introduction to Modern U-Boot
Introduction to Modern U-BootIntroduction to Modern U-Boot
Introduction to Modern U-Boot
 
The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421
 
Memory Mapping Implementation (mmap) in Linux Kernel
Memory Mapping Implementation (mmap) in Linux KernelMemory Mapping Implementation (mmap) in Linux Kernel
Memory Mapping Implementation (mmap) in Linux Kernel
 
Yocto Project introduction
Yocto Project introductionYocto Project introduction
Yocto Project introduction
 
Fun with Network Interfaces
Fun with Network InterfacesFun with Network Interfaces
Fun with Network Interfaces
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
 
Linux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPFLinux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPF
 
USB Drivers
USB DriversUSB Drivers
USB Drivers
 
Continguous Memory Allocator in the Linux Kernel
Continguous Memory Allocator in the Linux KernelContinguous Memory Allocator in the Linux Kernel
Continguous Memory Allocator in the Linux Kernel
 
Understanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panicUnderstanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panic
 
Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
 
Slab Allocator in Linux Kernel
Slab Allocator in Linux KernelSlab Allocator in Linux Kernel
Slab Allocator in Linux Kernel
 
The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast Storage
 
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
 
Linux Locking Mechanisms
Linux Locking MechanismsLinux Locking Mechanisms
Linux Locking Mechanisms
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
 
The Yocto Project
The Yocto ProjectThe Yocto Project
The Yocto Project
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 
DMA Survival Guide
DMA Survival GuideDMA Survival Guide
DMA Survival Guide
 

Similar to X Window Direct Rendering Architectural Diagram

20111130 hardware-monitoring-with-the-new-ipmi-plugin-v2
20111130 hardware-monitoring-with-the-new-ipmi-plugin-v220111130 hardware-monitoring-with-the-new-ipmi-plugin-v2
20111130 hardware-monitoring-with-the-new-ipmi-plugin-v2Werner Fischer
 
Raise your Uptime - How to monitor heterogeneous server environments with Linux
Raise your Uptime - How to monitor heterogeneous server environments with LinuxRaise your Uptime - How to monitor heterogeneous server environments with Linux
Raise your Uptime - How to monitor heterogeneous server environments with LinuxWerner Fischer
 
Open Storage Sun Intel European Business Technology Tour
Open Storage Sun Intel European Business Technology TourOpen Storage Sun Intel European Business Technology Tour
Open Storage Sun Intel European Business Technology TourWalter Moriconi
 
Benefits of Using FPGAs for Embedded Processing: Embedded World 2010
Benefits of Using FPGAs for Embedded Processing: Embedded World 2010Benefits of Using FPGAs for Embedded Processing: Embedded World 2010
Benefits of Using FPGAs for Embedded Processing: Embedded World 2010Altera Corporation
 
FPGA Camp - Intellitech Presentation
FPGA Camp - Intellitech PresentationFPGA Camp - Intellitech Presentation
FPGA Camp - Intellitech PresentationFPGA Central
 
Unified workflow review (gen)
Unified workflow review (gen)Unified workflow review (gen)
Unified workflow review (gen)Baiju Gujarathi
 
Jaguar x86 Core Functional Verification
Jaguar x86 Core Functional VerificationJaguar x86 Core Functional Verification
Jaguar x86 Core Functional VerificationDVClub
 
Sears Point Racetrack
Sears Point RacetrackSears Point Racetrack
Sears Point RacetrackDino, llc
 
Lte Latam 2012 Alberto Boaventura V6
Lte Latam 2012 Alberto Boaventura V6Lte Latam 2012 Alberto Boaventura V6
Lte Latam 2012 Alberto Boaventura V6Alberto Boaventura
 
Mpc5121 econfs
Mpc5121 econfsMpc5121 econfs
Mpc5121 econfsDino, llc
 
Ap nr5000 pt file
Ap nr5000 pt fileAp nr5000 pt file
Ap nr5000 pt fileAddPac1999
 
Linux-without-a-bootloader
Linux-without-a-bootloaderLinux-without-a-bootloader
Linux-without-a-bootloaderNishanth Menon
 
Презентация команды "Обыватели"
Презентация команды "Обыватели"Презентация команды "Обыватели"
Презентация команды "Обыватели"Tatyana Savchyk
 
9800301 04 8080-8085_assembly_language_programming_manual_may81
9800301 04 8080-8085_assembly_language_programming_manual_may819800301 04 8080-8085_assembly_language_programming_manual_may81
9800301 04 8080-8085_assembly_language_programming_manual_may81satolina
 
PA Develops an LTE PHY for Catapult
PA Develops an LTE PHY for CatapultPA Develops an LTE PHY for Catapult
PA Develops an LTE PHY for Catapultgrahambell
 
LF_DPDK17_mediated devices: better userland IO
LF_DPDK17_mediated devices: better userland IOLF_DPDK17_mediated devices: better userland IO
LF_DPDK17_mediated devices: better userland IOLF_DPDK
 

Similar to X Window Direct Rendering Architectural Diagram (20)

20111130 hardware-monitoring-with-the-new-ipmi-plugin-v2
20111130 hardware-monitoring-with-the-new-ipmi-plugin-v220111130 hardware-monitoring-with-the-new-ipmi-plugin-v2
20111130 hardware-monitoring-with-the-new-ipmi-plugin-v2
 
Raise your Uptime - How to monitor heterogeneous server environments with Linux
Raise your Uptime - How to monitor heterogeneous server environments with LinuxRaise your Uptime - How to monitor heterogeneous server environments with Linux
Raise your Uptime - How to monitor heterogeneous server environments with Linux
 
Thesis Donato Slides EN
Thesis Donato Slides ENThesis Donato Slides EN
Thesis Donato Slides EN
 
Hybrid Programmable Forwarding Planes: BoF Session
Hybrid Programmable Forwarding Planes: BoF SessionHybrid Programmable Forwarding Planes: BoF Session
Hybrid Programmable Forwarding Planes: BoF Session
 
z/VM Platform Update
z/VM Platform Updatez/VM Platform Update
z/VM Platform Update
 
Open Storage Sun Intel European Business Technology Tour
Open Storage Sun Intel European Business Technology TourOpen Storage Sun Intel European Business Technology Tour
Open Storage Sun Intel European Business Technology Tour
 
Benefits of Using FPGAs for Embedded Processing: Embedded World 2010
Benefits of Using FPGAs for Embedded Processing: Embedded World 2010Benefits of Using FPGAs for Embedded Processing: Embedded World 2010
Benefits of Using FPGAs for Embedded Processing: Embedded World 2010
 
FPGA Camp - Intellitech Presentation
FPGA Camp - Intellitech PresentationFPGA Camp - Intellitech Presentation
FPGA Camp - Intellitech Presentation
 
Unified workflow review (gen)
Unified workflow review (gen)Unified workflow review (gen)
Unified workflow review (gen)
 
Jaguar x86 Core Functional Verification
Jaguar x86 Core Functional VerificationJaguar x86 Core Functional Verification
Jaguar x86 Core Functional Verification
 
Sears Point Racetrack
Sears Point RacetrackSears Point Racetrack
Sears Point Racetrack
 
Lte Latam 2012 Alberto Boaventura V6
Lte Latam 2012 Alberto Boaventura V6Lte Latam 2012 Alberto Boaventura V6
Lte Latam 2012 Alberto Boaventura V6
 
Mpc5121 econfs
Mpc5121 econfsMpc5121 econfs
Mpc5121 econfs
 
Ap nr5000 pt file
Ap nr5000 pt fileAp nr5000 pt file
Ap nr5000 pt file
 
Linux-without-a-bootloader
Linux-without-a-bootloaderLinux-without-a-bootloader
Linux-without-a-bootloader
 
Презентация команды "Обыватели"
Презентация команды "Обыватели"Презентация команды "Обыватели"
Презентация команды "Обыватели"
 
Linux on System z disk I/O performance
Linux on System z disk I/O performanceLinux on System z disk I/O performance
Linux on System z disk I/O performance
 
9800301 04 8080-8085_assembly_language_programming_manual_may81
9800301 04 8080-8085_assembly_language_programming_manual_may819800301 04 8080-8085_assembly_language_programming_manual_may81
9800301 04 8080-8085_assembly_language_programming_manual_may81
 
PA Develops an LTE PHY for Catapult
PA Develops an LTE PHY for CatapultPA Develops an LTE PHY for Catapult
PA Develops an LTE PHY for Catapult
 
LF_DPDK17_mediated devices: better userland IO
LF_DPDK17_mediated devices: better userland IOLF_DPDK17_mediated devices: better userland IO
LF_DPDK17_mediated devices: better userland IO
 

More from Moriyoshi Koizumi

Goをカンストさせる話
Goをカンストさせる話Goをカンストさせる話
Goをカンストさせる話Moriyoshi Koizumi
 
Authentication, Authorization, OAuth, OpenID Connect and Pyramid
Authentication, Authorization, OAuth, OpenID Connect and PyramidAuthentication, Authorization, OAuth, OpenID Connect and Pyramid
Authentication, Authorization, OAuth, OpenID Connect and PyramidMoriyoshi Koizumi
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2goMoriyoshi Koizumi
 
HLSについて知っていることを話します
HLSについて知っていることを話しますHLSについて知っていることを話します
HLSについて知っていることを話しますMoriyoshi Koizumi
 
Pyramidのrendererをカスタマイズする
PyramidのrendererをカスタマイズするPyramidのrendererをカスタマイズする
PyramidのrendererをカスタマイズするMoriyoshi Koizumi
 
Hacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 AutumnHacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 AutumnMoriyoshi Koizumi
 
よいことも悪いこともぜんぶPHPが教えてくれた
よいことも悪いこともぜんぶPHPが教えてくれたよいことも悪いこともぜんぶPHPが教えてくれた
よいことも悪いこともぜんぶPHPが教えてくれたMoriyoshi Koizumi
 
mod_himoteからはじめよう
mod_himoteからはじめようmod_himoteからはじめよう
mod_himoteからはじめようMoriyoshi Koizumi
 
HPHPは約束の地なのか
HPHPは約束の地なのかHPHPは約束の地なのか
HPHPは約束の地なのかMoriyoshi Koizumi
 
Phjosh(仮)プロジェクト
Phjosh(仮)プロジェクトPhjosh(仮)プロジェクト
Phjosh(仮)プロジェクトMoriyoshi Koizumi
 

More from Moriyoshi Koizumi (20)

Goをカンストさせる話
Goをカンストさせる話Goをカンストさせる話
Goをカンストさせる話
 
PHP7を魔改造した話
PHP7を魔改造した話PHP7を魔改造した話
PHP7を魔改造した話
 
Authentication, Authorization, OAuth, OpenID Connect and Pyramid
Authentication, Authorization, OAuth, OpenID Connect and PyramidAuthentication, Authorization, OAuth, OpenID Connect and Pyramid
Authentication, Authorization, OAuth, OpenID Connect and Pyramid
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
HLSについて知っていることを話します
HLSについて知っていることを話しますHLSについて知っていることを話します
HLSについて知っていることを話します
 
Pyramidのrendererをカスタマイズする
PyramidのrendererをカスタマイズするPyramidのrendererをカスタマイズする
Pyramidのrendererをカスタマイズする
 
Hacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 AutumnHacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 Autumn
 
Uguisudani
UguisudaniUguisudani
Uguisudani
 
よいことも悪いこともぜんぶPHPが教えてくれた
よいことも悪いこともぜんぶPHPが教えてくれたよいことも悪いこともぜんぶPHPが教えてくれた
よいことも悪いこともぜんぶPHPが教えてくれた
 
Ik in action
Ik in actionIk in action
Ik in action
 
Nginx lua
Nginx luaNginx lua
Nginx lua
 
Haxeについて
HaxeについてHaxeについて
Haxeについて
 
Gocon2013
Gocon2013Gocon2013
Gocon2013
 
PHP language update 201211
PHP language update 201211PHP language update 201211
PHP language update 201211
 
mod_himoteからはじめよう
mod_himoteからはじめようmod_himoteからはじめよう
mod_himoteからはじめよう
 
HPHPは約束の地なのか
HPHPは約束の地なのかHPHPは約束の地なのか
HPHPは約束の地なのか
 
Pyfes201110
Pyfes201110Pyfes201110
Pyfes201110
 
Phjosh(仮)プロジェクト
Phjosh(仮)プロジェクトPhjosh(仮)プロジェクト
Phjosh(仮)プロジェクト
 
Aaなゲームをjsで
AaなゲームをjsでAaなゲームをjsで
Aaなゲームをjsで
 
Aaなゲームをjsで
AaなゲームをjsでAaなゲームをjsで
Aaなゲームをjsで
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central BankingThe Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central BankingSelcen Ozturkcan
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central BankingThe Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central Banking
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

X Window Direct Rendering Architectural Diagram

  • 1. X Window / Direct Rendering Architectural Diagram Xclient (w/GL) OpenGL I/F Xlib I/F Filesystem libdrm I/F IOCTL / mmap Driver I/F Mesa libdrm PCI Direct Xlib Xlib I/F Driver Rendering I/F Manager Filesystem sockets Abstraction AGP GART Manager X protocol Filesystem I/F Driver I/F Hard- Kernel sockets X Server (device-independent tier) ware AGP GART libdrm I/F XFree86 Tier Manager DIX IOCTL / Memory libdrm I/F DGA DRI mmap Manager MM PCI Subsystem I/F Driver vidmode I/F Video XFree86 IOCTL / IRQ XAA PCI Device Extension mmap Driver Abstraction IRQM MI I/F Manager I/F Xv 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 2. X Window / Indirect Rendering Architectural Diagram Xclient (w/GL) OpenGL I/F Xlib I/F Filesystem Driver I/F Mesa PCI Direct Xlib Xlib I/F Driver Rendering I/F Manager Filesystem sockets Abstraction AGP GART Manager X protocol Filesystem I/F Driver I/F Hard- Kernel sockets X Server (DIX) ware GLX Mesa AGP GART XFree86 Tier libdrm I/F Manager DIX IOCTL / Memory libdrm I/F DGA DRI mmap Manager MM PCI Subsystem I/F Driver vidmode I/F Video XFree86 IOCTL / IRQ XAA PCI Device Extension mmap Driver Abstraction IRQM MI I/F Manager I/F Xv 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 3. Address Space Layout Kernel Space Graphics MMIO Aperture Space Physical User Space Address Space Actual RAM Space GART 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 4. Direct Memory Access 1. Queueing Kernel Space Graphic Controller Instruction Buffer DMA FIFO Transfer Marked Consistent IOCTL (BLIT etc.) User Space Some Process 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 5. Direct Memory Access 2. Bitmap Block Transfer (Blit) Kernel Space Graphic Controller Active Entry FIFO Parse & User Space Dispatch Some Marked Process Blit Engine Consistent DMA Transfer Another Process 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 6. DRM IOCTL I/F AUTH (GET_MAGIC / AUTH_MAGIC) ● VERSION (GET / SET) ● BUSID (GET / SET) ● MAP (ADD / RM) ● CTX (ADD / RM / GET / SWITCH / NEW / ● RESERVE) LOCK (LOCK / UNLOCK) ● AGP operations ● Device-specific operations ● 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 7. DRM Authentication 1. Retrieve Magic Cookie (drmGetMagic()) Cookie Manager Mesa libdrm 2. Generate Direct Xlib Magic Rendering Manager Cookie 3. Send Magic X protocol (XF86DRIAuthConnection()) 4. Authenticate Cookie (drmAuthMagic()) Kernel X Server XFree86 Tier libdrm DRI 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 8. DRM Authentication (Userland Wrappers) libdrm/xf86drm.c: (formally: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c) int drmGetMagic(int fd, drm_magic_t * magic) { drm_auth_t auth; *magic = 0; if (ioctl(fd, DRM_IOCTL_GET_MAGIC, &auth)) return -errno; *magic = auth.magic; return 0; } 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 9. DRM Authentication (Userland Wrappers) xc/programs/Xserver/hw/xfree86/dri/dri.c: Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (drmAuthMagic(pDRIPriv->drmFD, magic)) return FALSE; return TRUE; } libdrm/xf86drm.c: (formally: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c) int drmAuthMagic(int fd, drm_magic_t magic) { drm_auth_t auth; auth.magic = magic; if (ioctl(fd, DRM_IOCTL_AUTH_MAGIC, &auth)) return -errno; return 0; } 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 10. DRM Authentication (linux/drivers/char/drm/drm_drv.c: IOCTL Dispatch Table) static drm_ioctl_desc_t drm_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = {drm_version, 0}, [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = {drm_getunique, 0}, [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = {drm_getmagic, 0}, [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = {drm_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY}, [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = {drm_getmap, 0}, [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = {drm_getclient, 0}, [DRM_IOCTL_NR(DRM_IOCTL_SET_VERSION)] = {drm_setversion, DRM_MASTER|DRM_ROOT_ONLY}, [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = {drm_authmagic, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = {drm_addctx, DRM_AUTH|DRM_ROOT_ONLY}, [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = {drm_getctx, DRM_AUTH}, ... 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 11. DRM Authentication (linux/drivers/char/drm/drm_drv.c: IOCTL Dispatcher) if (nr < DRIVER_IOCTL_COUNT) ioctl = &drm_ioctls[nr]; else if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls)) ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE]; else goto err_i1; func = ioctl->func; /* is there a local override? */ if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl) func = dev->driver->dma_ioctl; if (!func) { DRM_DEBUG(quot;no functionnquot;); retcode = -EINVAL; } else if (((ioctl->flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN)) || ((ioctl->flags & DRM_AUTH) && !priv->authenticated) || ((ioctl->flags & DRM_MASTER) && !priv->master)) { retcode = -EACCES; } else { retcode = func(inode, filp, cmd, arg); } 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 12. DRM Authentication (linux/drivers/char/drm/drm_auth.c: Cookie Issuer) int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { ... typedef unsigned int drm_magic_t; /* Find unique magic */ if (priv->magic) { typedef struct drm_auth { auth.magic = priv->magic; drm_magic_t magic; } else { do { } drm_auth_t; spin_lock(&lock); if (!sequence) ++sequence;/* reserve 0 */ auth.magic = sequence++; spin_unlock(&lock); } while (drm_find_file(dev, auth.magic)); priv->magic = auth.magic; drm_add_magic(dev, priv, auth.magic); } DRM_DEBUG(quot;%unquot;, auth.magic); if (copy_to_user((drm_auth_t __user *) arg, &auth, sizeof(auth))) return -EFAULT; return 0; } 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 13. DRM Authentication (linux/drivers/char/drm/drm_auth.c: Cookie Verifier) int drm_authmagic(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->head->dev; drm_auth_t auth; drm_file_t *file; if (copy_from_user(&auth, (drm_auth_t __user *) arg, sizeof(auth))) return -EFAULT; DRM_DEBUG(quot;%unquot;, auth.magic); if ((file = drm_find_file(dev, auth.magic))) { file->authenticated = 1; drm_remove_magic(dev, auth.magic); return 0; } return -EINVAL; } 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 14. DRM Authentication (linux/drivers/char/drm/drm_auth.c: Cookie Keeper) static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) { drm_file_t *retval = NULL; drm_magic_entry_t *pt; int hash = drm_hash_magic(magic); mutex_lock(&dev->struct_mutex); for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { if (pt->magic == magic) { retval = pt->priv; break; } } mutex_unlock(&dev->struct_mutex); return retval; } 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 15. Graphic Address Remapping Table (GART) SAREA Frame Buffer Phy-Phy Address Translation Texture Buffer Process #1 (by AGP controller) Graphics MMIO Aperture Virtual Space Memory Space Physical Process #2 Address Space Actual Virtual RAM Memory Space Space GART Phy-Virt Address Translation (by MMU) 2007 © Moriyoshi Koizumi. All Rights Reserved.
  • 16. AGPGART IOCTL I/F ACQUIRE ● SETUP ● RESERVE ● PROTECT ● ALLOCATE / DEALLOCATE ● BIND / UNBIND ● 2007 © Moriyoshi Koizumi. All Rights Reserved.