VirtualBox

Changeset 68848 in vbox for trunk/src/VBox/Additions/linux


Ignore:
Timestamp:
Sep 24, 2017 4:58:46 PM (7 years ago)
Author:
vboxsync
Message:

Additions/linux/drm: lots of formatting changes to match kernel style.
bugref:8524: Additions/linux: play nicely with distribution-installed Additions

This change makes a lot of formatting changes to the Linux Additions drm
driver, with no intended changes to functionality, and much of the
formatting change done using the sed script which installs the driver
sources to the Additions archive. Hans de Goede's clean-up of the driver for
submission to staging is the base for these changes.

Location:
trunk/src/VBox/Additions/linux/drm
Files:
1 deleted
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/drm/files_vboxvideo_drv

    r68769 r68848  
    3131    ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp=>modesetting.c \
    3232    ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp=>vbva_base.c \
    33     ${PATH_ROOT}/src/VBox/Additions/linux/drm/HGSMIBase.h=>hgsmi_base.h \
    34     ${PATH_ROOT}/src/VBox/Additions/linux/drm/VBoxVideoIPRT.h=>vboxvideo_iprt.h \
    3533    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.c=>vbox_drv.c \
    3634    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.h=>vbox_drv.h \
     35    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_err.h=>vbox_err.h \
    3736    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_fb.c=>vbox_fb.c \
    3837    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_irq.c=>vbox_irq.c \
  • trunk/src/VBox/Additions/linux/drm/indent.sed

    r68769 r68848  
    2323
    2424# Replace up to six leading groups of four spaces with tabs.
    25 s/^                        /\t\t\t\t\t\t/g
     25s/^                         */\t\t\t\t\t\t/g
    2626s/^                    /\t\t\t\t\t/g
    2727s/^                /\t\t\t\t/g
     
    2929s/^        /\t\t/g
    3030s/^    /\t/g
    31 # Remove any spaces left after the tabs.  This also limits maximum indentation.
    32 s/^\(\t\t*\) */\1/g
    3331
    3432# Change various symbols and file names to fit kernel conventions.
    3533
     34# Miscellaneous:
     35# Remove @file headers.
     36\|/\*\* @file| {
     37:start
     38  N
     39  s|\*/|\*/|g
     40  T start
     41  N
     42  d
     43}
     44/^\/\* \$Id:.*\*\/$/d
     45/^typedef .* HGSMIOFFSET;$/d
     46s/^#\( *\)include <\([^/]*\)>$/#\1include "\2"/g
     47
    3648# File names:
    37 s/\bHGSMIBase\.h\b/hgsmi_base.h/g
     49s/\bHGSMIBase\.h\b/vbox_drv.h/g
    3850s/\bHGSMIChannels\.h\b/hgsmi_channels.h/g
    3951s/\bHGSMIChSetup\.h\b/hgsmi_ch_setup.h/g
     
    4254s/\bVBoxVideoGuest\.h\b/vboxvideo_guest.h/g
    4355s/\bVBoxVideo\.h\b/vboxvideo.h/g
    44 s/\bVBoxVideoIPRT\.h\b/vboxvideo_iprt.h/g
     56s/\bVBoxVideoIPRT\.h\b/vbox_err.h/g
    4557s/\bVBoxVideoVBE\.h\b/vboxvideo_vbe.h/g
    4658
     
    6981s/\bvboxVBVAInformHost\b/vbva_inform_host/g
    7082s/\bvboxVBVASetupBufferContext\b/vbva_setup_buffer_context/g
     83s/\bVBVO_PORT_READ_U8\b/inb/g
     84s/\bVBVO_PORT_READ_U16\b/inw/g
     85s/\bVBVO_PORT_READ_U32\b/inl/g
     86s/\bVBVO_PORT_WRITE_U8\b/outb/g
     87s/\bVBVO_PORT_WRITE_U16\b/outw/g
     88s/\bVBVO_PORT_WRITE_U32\b/outl/g
    7189
    7290# Macros:
     91s/\b_1K\b/1024/g
     92s/\b_4M\b/4*1024*1024/g
     93s/\bAssert\b\([^;]*\);$/WARN_ON_ONCE(!(\1));/g
     94s/\bAssertCompile\b/assert_compile/g
     95s/\bAssertCompileSize\b/assert_compile_size/g
     96s/\bAssertPtr\b\([^;]*\);$/WARN_ON_ONCE(!(\1));/g
     97/AssertPtrNullReturnVoid/d
     98s/\bAssertRC\b\([^;]*\);$/WARN_ON_ONCE(RT_FAILURE\1);/g
     99s/\bDECLCALLBACK\b(\([^)]*\))/\1/g
     100s/\bDECLCALLBACKMEMBER\b(\([^,)]*\), *\([^,)]*\))/\1 (*\2)/g
     101s/^\bDECLHIDDEN\b(\([^)]*\))/\1/g
     102s/\bDECLINLINE\b(\([^)]*\))/static inline \1/g
     103s/\bRT_BIT\b/BIT/g
     104s/\bRT_BOOL\b(\([^)]*\))/(!!(\1))/g
     105/RT_C_DECLS/d
     106s/\bUINT16_MAX\b/U16_MAX/g
     107s/\bUINT32_MAX\b/U32_MAX/g
     108s/\bUINT32_C\b(\(.*\))/\1u/g
    73109s/!VALID_PTR(/WARN_ON(!/g
    74110
    75111# Type names:
    76112s/\bint32_t\b/s32/g
     113s/\buint8_t\b/u8/g
    77114s/\buint16_t\b/u16/g
    78115s/\buint32_t\b/u32/g
     116s/(HGSMIBUFFERLOCATION \*)//g  # Remove C++ casts from void.
     117s/typedef struct HGSMIBUFFERLOCATION/struct hgsmi_buffer_location/g
    79118s/struct HGSMIBUFFERLOCATION/struct hgsmi_buffer_location/g
    80 s/} HGSMIBUFFERLOCATION/} hgsmi_buffer_location/g
     119s/} HGSMIBUFFERLOCATION/}/g
    81120s/\bHGSMIBUFFERLOCATION\b/struct hgsmi_buffer_location/g
     121s/\([^*] *\)\bPHGSMIGUESTCOMMANDCONTEXT\b/\1struct gen_pool */g
     122s/(HGSMIHOSTFLAGS \*)//g  # Remove C++ casts from void.
     123s/typedef struct HGSMIHOSTFLAGS/struct hgsmi_host_flags/g
     124s/struct HGSMIHOSTFLAGS/struct hgsmi_host_flags/g
     125s/} HGSMIHOSTFLAGS/}/g
     126s/\bHGSMIHOSTFLAGS\b/struct hgsmi_host_flags/g
     127s/\bHGSMIOFFSET\b/u32/g
     128s/\bHGSMISIZE\b/u32/g
     129s/\bRTRECT\b/void/g
     130s/(VBVABUFFERCONTEXT \*)//g  # Remove C++ casts from void.
    82131s/struct VBVABUFFERCONTEXT/struct vbva_buf_context/g
    83132s/} VBVABUFFERCONTEXT/} vbva_buf_context/g
    84133s/\bVBVABUFFERCONTEXT\b/struct vbva_buf_context/g
    85134s/\([^*] *\)\bPVBVABUFFERCONTEXT\b/\1struct vbva_buf_context */g
     135s/(VBVACAPS \*)//g  # Remove C++ casts from void.
     136s/struct VBVACAPS/struct vbva_caps/g
     137s/} VBVACAPS/} vbva_caps/g
     138s/\bVBVACAPS\b/struct vbva_caps/g
     139s/(VBVACONF32 \*)//g  # Remove C++ casts from void.
    86140s/struct VBVACONF32/struct vbva_conf32/g
    87141s/} VBVACONF32/} vbva_conf32/g
    88142s/\bVBVACONF32\b/struct vbva_conf32/g
     143s/(VBVACURSORPOSITION \*)//g  # Remove C++ casts from void.
    89144s/struct VBVACURSORPOSITION/struct vbva_cursor_position/g
    90145s/} VBVACURSORPOSITION/} vbva_cursor_position/g
    91146s/\bVBVACURSORPOSITION\b/struct vbva_cursor_position/g
     147s/(VBVAENABLE_EX \*)//g  # Remove C++ casts from void.
    92148s/struct VBVAENABLE_EX/struct vbva_enable_ex/g
    93149s/} VBVAENABLE_EX/} vbva_enable_ex/g
    94150s/\bVBVAENABLE_EX\b/struct vbva_enable_ex/g
     151s/(VBVAMOUSEPOINTERSHAPE \*)//g  # Remove C++ casts from void.
    95152s/struct VBVAMOUSEPOINTERSHAPE/struct vbva_mouse_pointer_shape/g
    96153s/} VBVAMOUSEPOINTERSHAPE/} vbva_mouse_pointer_shape/g
    97154s/\bVBVAMOUSEPOINTERSHAPE\b/struct vbva_mouse_pointer_shape/g
     155s/(VBVAMODEHINT \*)//g  # Remove C++ casts from void.
    98156s/struct VBVAMODEHINT/struct vbva_modehint/g
    99157s/} VBVAMODEHINT/} vbva_modehint/g
    100158s/\bVBVAMODEHINT\b/struct vbva_modehint/g
     159s/(VBVAQUERYMODEHINTS \*)//g  # Remove C++ casts from void.
    101160s/struct VBVAQUERYMODEHINTS/struct vbva_query_mode_hints/g
    102161s/} VBVAQUERYMODEHINTS/} vbva_query_mode_hints/g
    103162s/\bVBVAQUERYMODEHINTS\b/struct vbva_query_mode_hints/g
     163s/(VBVAREPORTINPUTMAPPING \*)//g  # Remove C++ casts from void.
    104164s/struct VBVAREPORTINPUTMAPPING/struct vbva_report_input_mapping/g
    105165s/} VBVAREPORTINPUTMAPPING/} vbva_report_input_mapping/g
     
    109169s/\baRecords\b/records/g
    110170s/\bau8Data\b/data/g
     171s/\bau32Reserved\b/reserved/g
    111172s/\bBase\b/base/g
    112173s/\bbEnable\b/enable/g
     
    119180s/\bcbHwBufferAvail\b/available/g
    120181s/\bcbLength\b/len/g
     182s/\bcbLocation\b/buf_len/g
    121183s/\bcbPartialWriteThreshold\b/partial_write_tresh/g  ## @todo fix this?
    122184s/\bcbPitch\b/pitch/g
     185s/\bcbPixels\b/pixel_len/g
    123186s/\bcBPP\b/bpp/g
    124187s/\bcbRecord\b/len_and_flags/g  ## @todo fix this?
     
    165228s/\bu32Height\b/height/g
    166229s/\bu32HostEvents\b/host_events/g
     230s/\bu32HostFlags\b/host_flags/g
    167231s/\bu32HotX\b/hot_x/g
    168232s/\bu32HotY\b/hot_y/g
     
    179243s/\bulValue\b/value/g
    180244
     245# Header file guard:
     246s/__HGSMIChannels_h__/__HGSMI_CHANNELS_H__/g
     247s/___VBox_Graphics_HGSMIChSetup_h/__HGSMI_CH_SETUP_H__/g
     248
    181249# And move braces.  This must be the last expression as it jumps to the next
    182250# line.
     
    190258:try_brace
    191259  s/^\([\t ].*\)\n[\t ][\t ]*{/\1 {/g
     260  s/^\([^#()]*\)\n[\t ]*{/\1 {/g
    192261  t done_brace
    193262  P
  • trunk/src/VBox/Additions/linux/drm/vbox_drv.h

    r68337 r68848  
    3838#define LOG_GROUP LOG_GROUP_DEV_VGA
    3939
    40 #include <VBoxVideoGuest.h>
    41 
    42 #include <drm/drmP.h>
    43 #include <drm/drm_fb_helper.h>
    44 
    45 #include <drm/ttm/ttm_bo_api.h>
    46 #include <drm/ttm/ttm_bo_driver.h>
    47 #include <drm/ttm/ttm_placement.h>
    48 #include <drm/ttm/ttm_memory.h>
    49 #include <drm/ttm/ttm_module.h>
     40#include <linux/version.h>
     41
     42#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
     43# include <linux/types.h>
     44# include <linux/spinlock_types.h>
     45#endif
     46
     47#include <linux/genalloc.h>
     48#include <linux/io.h>
     49#include <linux/string.h>
    5050
    5151#if defined(RHEL_MAJOR) && defined(RHEL_MINOR)
     
    5858#endif
    5959
     60#include <drm/drmP.h>
    6061#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_73)
    6162#include <drm/drm_gem.h>
    6263#endif
     64#include <drm/drm_fb_helper.h>
    6365#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
    6466#include <drm/drm_encoder.h>
    6567#endif
     68
     69#include <drm/ttm/ttm_bo_api.h>
     70#include <drm/ttm/ttm_bo_driver.h>
     71#include <drm/ttm/ttm_placement.h>
     72#include <drm/ttm/ttm_memory.h>
     73#include <drm/ttm/ttm_module.h>
     74
     75#include "vboxvideo_guest.h"
     76#include "vboxvideo_vbe.h"
     77#include "hgsmi_ch_setup.h"
    6678
    6779#include "product-generated.h"
     
    341353irqreturn_t vbox_irq_handler(int irq, void *arg);
    342354
    343 #endif
     355/* vbox_hgsmi.c */
     356void *hgsmi_buffer_alloc(struct gen_pool *guest_pool, size_t size,
     357                         u8 channel, u16 channel_info);
     358void hgsmi_buffer_free(struct gen_pool *guest_pool, void *buf);
     359int hgsmi_buffer_submit(struct gen_pool *guest_pool, void *buf);
     360
     361static inline void vbox_write_ioport(u16 index, u16 data)
     362{
     363        outw(index, VBE_DISPI_IOPORT_INDEX);
     364        outw(data, VBE_DISPI_IOPORT_DATA);
     365}
     366
     367#endif
  • trunk/src/VBox/Additions/linux/drm/vbox_err.h

    r68847 r68848  
    2626 */
    2727
    28 #ifndef ___VBox_Graphic_VBoxVideoIPRT_h
    29 #define ___VBox_Graphic_VBoxVideoIPRT_h
    30 
    31 #include <asm/io.h>
    32 #include <linux/string.h>
    33 #include <linux/version.h>
     28#ifndef __VBOX_ERR_H__
     29#define __VBOX_ERR_H__
    3430
    3531/** @name VirtualBox error macros
     
    5551/** @}  */
    5652
    57 /** @name VirtualBox helper functions
     53/** @name VirtualBox assertions
    5854 * @{ */
    5955
    60 #define ASMCompilerBarrier() mb()
     56/* Unlike BUILD_BUG_ON(), these can be used outside of functions. */
     57extern int vbox_assert_var[1];
     58#define assert_compile(expr) \
     59    extern int vbox_assert_var[1] __attribute__((__unused__)), \
     60    vbox_assert_var[(expr) ? 1 : 0] __attribute__((__unused__))
     61#define assert_compile_size(type, size) \
     62    assert_compile(sizeof(type) == (size))
    6163
    6264/** @}  */
    6365
    64 /** @name VirtualBox assertions
    65  * @{ */
    66 
    67 #define Assert(a) WARN_ON_ONCE(!(a))
    68 #define AssertPtr(a) WARN_ON_ONCE(!(a))
    69 #define AssertReturnVoid(a) do { if (WARN_ON_ONCE(!(a))) return; } while(0)
    70 #define AssertRC(a) WARN_ON_ONCE(RT_FAILURE(a))
    71 #define AssertPtrNullReturnVoid(a) do {} while(0)
    72 #define AssertPtrReturnVoid(a) do { if (WARN_ON_ONCE(!(a))) return; } while(0)
    73 
    74 extern int RTASSERTVAR[1];
    75 #define AssertCompile(expr) \
    76     extern int RTASSERTVAR[1] __attribute__((__unused__)), \
    77     RTASSERTVAR[(expr) ? 1 : 0] __attribute__((__unused__))
    78 #define AssertCompileSize(type, size) \
    79     AssertCompile(sizeof(type) == (size))
    80 
    81 #define VALID_PTR(p) ((p) != NULL)
    82 
    83 /** @}  */
    84 
    85 /** @name Port I/O helpers
    86  * @{ */
    87 /** Write an 8-bit value to an I/O port. */
    88 #define VBVO_PORT_WRITE_U8(Port, Value) \
    89     outb(Value, Port)
    90 /** Write a 16-bit value to an I/O port. */
    91 #define VBVO_PORT_WRITE_U16(Port, Value) \
    92     outw(Value, Port)
    93 /** Write a 32-bit value to an I/O port. */
    94 #define VBVO_PORT_WRITE_U32(Port, Value) \
    95     outl(Value, Port)
    96 /** Read an 8-bit value from an I/O port. */
    97 #define VBVO_PORT_READ_U8(Port) \
    98     inb(Port)
    99 /** Read a 16-bit value from an I/O port. */
    100 #define VBVO_PORT_READ_U16(Port) \
    101     inw(Port)
    102 /** Read a 32-bit value from an I/O port. */
    103 #define VBVO_PORT_READ_U32(Port) \
    104     inl(Port)
    105 
    106 /** @}  */
    107 
    108 /** @name types for VirtualBox OS-independent code
    109  * @{ */
    110 
    111 typedef void RTRECT;
    112 
    113 #define UINT32_C(val)           (val ## U)
    114 #define UINT32_MAX              UINT32_C(0xffffffff)
    115 
    116 /** @}  */
    117 
    118 /** @name iprt/desc.h replacement macros
    119  * @{ */
    120 
    121 #define RT_C_DECLS_BEGIN
    122 #define RT_C_DECLS_END
    123 #define DECLCALLBACK(type) type
    124 #define DECLCALLBACKMEMBER(type, name) type (*name)
    125 #define DECLHIDDEN(type) __attribute__((visibility("hidden"))) type
    126 #define DECLINLINE(type) static __inline__ type
    127 #define RT_BOOL(val) (!!(val))
    128 #define RT_BIT BIT
    129 #define _1K 0x00000400
    130 
    131 /** @}  */
    132 
    133 #endif /* !___VBox_Graphic_VBoxVideoIPRT_h */
    134 
     66#endif
  • trunk/src/VBox/Additions/linux/drm/vbox_mode.c

    r68334 r68848  
    3838 */
    3939#include "vbox_drv.h"
    40 
    41 #include <VBoxVideo.h>
    42 
    4340#include <linux/export.h>
    4441#include <drm/drm_crtc_helper.h>
     
    4643#include <drm/drm_plane_helper.h>
    4744#endif
     45
     46#include "VBoxVideo.h"
     47#include "hgsmi_channels.h"
    4848
    4949static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
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