VirtualBox

Changeset 67169 in vbox for trunk


Ignore:
Timestamp:
May 31, 2017 12:43:59 PM (8 years ago)
Author:
vboxsync
Message:

bugref:8524: Additions/linux: play nicely with distribution-installed Additions
Use the functions from linux/genalloc.h instead of the vbox custom
HGSMIMalloc implementation.

Signed-off-by: Hans de Goede <hdegoede@…>
Adjusted to apply to current trunk and to build on Linux 3.11 and 3.12.

Location:
trunk/src/VBox/Additions/linux/drm
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/drm/Makefile.module.kms

    r67148 r67169  
    3535MOD_NAME   = vboxvideo
    3636
    37 MOD_OBJS   = HGSMIBase.o HGSMIBuffers.o HGSMICommon.o HGSMIMemAlloc.o \
     37MOD_OBJS   = HGSMIBase.o \
    3838             Modesetting.o vbox_drv.o vbox_fb.o vbox_irq.o vbox_main.o \
    39              vbox_mode.o vbox_ttm.o VBVABase.o vbox_prime.o
     39             vbox_mode.o vbox_ttm.o VBVABase.o vbox_prime.o vbox_hgsmi.o
    4040
    4141MOD_CFLAGS = -Wno-declaration-after-statement -fshort-wchar -fno-pie
  • trunk/src/VBox/Additions/linux/drm/VBoxVideoIPRT.h

    r66707 r67169  
    2929#define ___VBox_VBoxVideoIPRT_h
    3030
    31 #include <asm/atomic.h>
    3231#include <asm/io.h>
    3332#include <iprt/cdefs.h>
    34 #include <iprt/list.h>
    3533#include <iprt/stdarg.h>
    3634#include <iprt/stdint.h>
     35#include <iprt/types.h>
    3736
    3837#include <linux/string.h>
     
    6362 * @{ */
    6463
    65 #define RT_ZERO(x) memset(&(x), 0, sizeof(x))
    66 #define ASMAtomicCmpXchgBool(b, new_val, old_val) \
    67         (cmpxchg(b, old_val, new_val) == old_val)
    68 #define ASMAtomicWriteBool(b, val) xchg(b, val)
    6964#define ASMCompilerBarrier() mb()
    7065
     
    113108/** @}  */
    114109
     110/** @name types for VirtualBox OS-independent code
     111 * @{ */
     112
     113/* HGSMI uses 32 bit offsets and sizes. */
     114typedef uint32_t HGSMISIZE;
     115typedef uint32_t HGSMIOFFSET;
     116
     117/** @}  */
     118
    115119#endif /* ___VBox_VBoxVideoIPRT_h */
  • trunk/src/VBox/Additions/linux/drm/files_vboxvideo_drv

    r67145 r67169  
    2222    ${PATH_OUT}/product-generated.h=>product-generated.h \
    2323    ${PATH_ROOT}/include/iprt/cdefs.h=>include/iprt/cdefs.h \
    24     ${PATH_ROOT}/include/iprt/list.h=>include/iprt/list.h \
    2524    ${PATH_ROOT}/include/iprt/stdarg.h=>include/iprt/stdarg.h \
    2625    ${PATH_ROOT}/include/iprt/stdint.h=>include/iprt/stdint.h \
     
    2827    ${PATH_ROOT}/include/VBox/Graphics/VBoxVideo.h=>include/VBoxVideo.h \
    2928    ${PATH_ROOT}/include/VBox/Graphics/VBoxVideoGuest.h=>include/VBoxVideoGuest.h \
    30     ${PATH_ROOT}/include/VBox/Graphics/HGSMI.h=>include/HGSMI.h \
    31     ${PATH_ROOT}/include/VBox/Graphics/HGSMIBase.h=>include/HGSMIBase.h \
    3229    ${PATH_ROOT}/include/VBox/Graphics/HGSMIChannels.h=>include/HGSMIChannels.h \
    3330    ${PATH_ROOT}/include/VBox/Graphics/HGSMIChSetup.h=>include/HGSMIChSetup.h \
    3431    ${PATH_ROOT}/include/VBox/Graphics/HGSMIContext.h=>include/HGSMIContext.h \
    3532    ${PATH_ROOT}/include/VBox/Graphics/HGSMIDefs.h=>include/HGSMIDefs.h \
    36     ${PATH_ROOT}/include/VBox/Graphics/HGSMIMemAlloc.h=>include/HGSMIMemAlloc.h \
    3733    ${PATH_ROOT}/include/VBox/Graphics/VBoxVideoVBE.h=>include/VBoxVideoVBE.h \
    3834    ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp=>HGSMIBase.c \
     
    4036    ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp=>Modesetting.c \
    4137    ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp=>VBVABase.c \
     38    ${PATH_ROOT}/src/VBox/Additions/linux/drm/HGSMIBase.h=>include/HGSMIBase.h \
    4239    ${PATH_ROOT}/src/VBox/Additions/linux/drm/VBoxVideoIPRT.h=>include/VBoxVideoIPRT.h \
    4340    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.c=>vbox_drv.c \
     
    4946    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_prime.c=>vbox_prime.c \
    5047    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_ttm.c=>vbox_ttm.c \
    51     ${PATH_ROOT}/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp=>HGSMICommon.c \
    52     ${PATH_ROOT}/src/VBox/GuestHost/HGSMI/HGSMIMemAlloc.cpp=>HGSMIMemAlloc.c \
     48    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_hgsmi.c=>vbox_hgsmi.c \
    5349    ${PATH_ROOT}/src/VBox/Installer/linux/Makefile.include.header=>Makefile.include.header \
    5450    ${PATH_ROOT}/src/VBox/Installer/linux/Makefile.include.footer=>Makefile.include.footer \
  • trunk/src/VBox/Additions/linux/drm/vbox_main.c

    r66544 r67169  
    259259}
    260260
    261 /** Allocation function for the HGSMI heap and data. */
    262 static DECLCALLBACK(void *) alloc_hgsmi_environ(void *environ, HGSMISIZE size)
    263 {
    264     NOREF(environ);
    265     return kmalloc(size, GFP_KERNEL);
    266 }
    267 
    268 
    269 /** Free function for the HGSMI heap and data. */
    270 static DECLCALLBACK(void) free_hgsmi_environ(void *environ, void *ptr)
    271 {
    272     NOREF(environ);
    273     kfree(ptr);
    274 }
    275 
    276 
    277 /** Pointers to the HGSMI heap and data manipulation functions. */
    278 static HGSMIENV hgsmi_environ =
    279 {
    280     NULL,
    281     alloc_hgsmi_environ,
    282     free_hgsmi_environ
    283 };
    284 
    285 
    286261/** Do we support the 4.3 plus mode hint reporting interface? */
    287262static bool have_hgsmi_mode_hints(struct vbox_private *vbox)
     
    301276    vbox->full_vram_size = VBoxVideoGetVRAMSize();
    302277    vbox->any_pitch = VBoxVideoAnyWidthAllowed();
     278    int ret;
     279
    303280    DRM_INFO("VRAM %08x\n", vbox->full_vram_size);
    304281
     
    309286        return -ENOMEM;
    310287
    311     if (RT_FAILURE(VBoxHGSMISetupGuestContext(&vbox->submit_info, vbox->guest_heap,
    312                                               GUEST_HEAP_USABLE_SIZE, GUEST_HEAP_OFFSET(vbox),
    313                                               &hgsmi_environ)))
     288    /* Create guest-heap mem-pool use 2^4 = 16 byte chunks */
     289    vbox->submit_info.guest_pool = gen_pool_create(4, -1);
     290    if (!vbox->submit_info.guest_pool)
    314291        return -ENOMEM;
     292
     293    ret = gen_pool_add_virt(vbox->submit_info.guest_pool,
     294                            (unsigned long)vbox->guest_heap,
     295                            GUEST_HEAP_OFFSET(vbox),
     296                            GUEST_HEAP_USABLE_SIZE, -1);
     297    if (ret)
     298        return ret;
     299
    315300    /* Reduce available VRAM size to reflect the guest heap. */
    316301    vbox->available_vram_size = GUEST_HEAP_OFFSET(vbox);
     
    400385    vbox_hw_fini(vbox);
    401386    vbox_mm_fini(vbox);
     387    if (vbox->submit_info.guest_pool)
     388        gen_pool_destroy(vbox->submit_info.guest_pool);
    402389    if (vbox->guest_heap)
    403390        pci_iounmap(dev->pdev, vbox->guest_heap);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette