Revert "Hold client buffers till KMS stops using them"

This reverts commit c9e11ebdbf.
This commit is contained in:
Pierre-Loup A. Griffais 2020-07-24 15:01:28 -07:00
parent a39fddf909
commit fb2fd1127a
4 changed files with 4 additions and 27 deletions

View file

@ -13,14 +13,9 @@
#include <sys/select.h> #include <sys/select.h>
#include <signal.h> #include <signal.h>
extern "C" {
#include <wlr/types/wlr_buffer.h>
}
#include "drm.hpp" #include "drm.hpp"
#include "main.hpp" #include "main.hpp"
#include "vblankmanager.hpp" #include "vblankmanager.hpp"
#include "wlserver.hpp"
#include "gpuvis_trace_utils.h" #include "gpuvis_trace_utils.h"
@ -636,7 +631,7 @@ out:
return ret; return ret;
} }
uint32_t drm_fbid_from_dmabuf( struct drm_t *drm, struct wlr_buffer *buf, struct wlr_dmabuf_attributes *dma_buf ) uint32_t drm_fbid_from_dmabuf( struct drm_t *drm, struct wlr_dmabuf_attributes *dma_buf )
{ {
assert( dma_buf->n_planes == 1); assert( dma_buf->n_planes == 1);
@ -660,15 +655,7 @@ uint32_t drm_fbid_from_dmabuf( struct drm_t *drm, struct wlr_buffer *buf, struct
} }
assert( drm->map_fbid_inflightflips[ fb_id ].held == false ); assert( drm->map_fbid_inflightflips[ fb_id ].held == false );
if ( buf != nullptr )
{
wlserver_lock();
buf = wlr_buffer_lock( buf );
wlserver_unlock();
}
drm->map_fbid_inflightflips[ fb_id ].id = fb_id; drm->map_fbid_inflightflips[ fb_id ].id = fb_id;
drm->map_fbid_inflightflips[ fb_id ].buf = buf;
drm->map_fbid_inflightflips[ fb_id ].held = true; drm->map_fbid_inflightflips[ fb_id ].held = true;
drm->map_fbid_inflightflips[ fb_id ].n_refs = 0; drm->map_fbid_inflightflips[ fb_id ].n_refs = 0;
@ -685,13 +672,6 @@ static void drm_free_fb( struct drm_t *drm, struct fb *fb )
perror( "drmModeRmFB failed" ); perror( "drmModeRmFB failed" );
} }
if ( fb->buf != nullptr )
{
wlserver_lock();
wlr_buffer_unlock( fb->buf );
wlserver_unlock();
}
fb = {}; fb = {};
} }

View file

@ -40,8 +40,6 @@ struct connector {
struct fb { struct fb {
uint32_t id; uint32_t id;
/* Client buffer, if any */
struct wlr_buffer *buf;
/* A FB is held if it's being used by steamcompmgr */ /* A FB is held if it's being used by steamcompmgr */
bool held; bool held;
/* Number of page-flips using the FB */ /* Number of page-flips using the FB */
@ -99,6 +97,6 @@ extern bool g_bDebugLayers;
int init_drm(struct drm_t *drm, const char *device, const char *mode_str, unsigned int vrefresh); int init_drm(struct drm_t *drm, const char *device, const char *mode_str, unsigned int vrefresh);
int drm_atomic_commit(struct drm_t *drm, struct Composite_t *pComposite, struct VulkanPipeline_t *pPipeline ); int drm_atomic_commit(struct drm_t *drm, struct Composite_t *pComposite, struct VulkanPipeline_t *pPipeline );
uint32_t drm_fbid_from_dmabuf( struct drm_t *drm, struct wlr_buffer *buf, struct wlr_dmabuf_attributes *dma_buf ); uint32_t drm_fbid_from_dmabuf( struct drm_t *drm, struct wlr_dmabuf_attributes *dma_buf );
void drm_drop_fbid( struct drm_t *drm, uint32_t fbid ); void drm_drop_fbid( struct drm_t *drm, uint32_t fbid );
bool drm_can_avoid_composite( struct drm_t *drm, struct Composite_t *pComposite, struct VulkanPipeline_t *pPipeline ); bool drm_can_avoid_composite( struct drm_t *drm, struct Composite_t *pComposite, struct VulkanPipeline_t *pPipeline );

View file

@ -346,7 +346,6 @@ bool CVulkanTexture::BInit( uint32_t width, uint32_t height, VkFormat format, bo
// We assume we own the memory when doing this right now. // We assume we own the memory when doing this right now.
// We could support the import scenario as well if needed // We could support the import scenario as well if needed
// assert( bTextureable == false ); // assert( bTextureable == false );
assert( pDMA == nullptr );
m_DMA.modifier = DRM_FORMAT_MOD_INVALID; m_DMA.modifier = DRM_FORMAT_MOD_INVALID;
m_DMA.n_planes = 1; m_DMA.n_planes = 1;
@ -376,7 +375,7 @@ bool CVulkanTexture::BInit( uint32_t width, uint32_t height, VkFormat format, bo
m_DMA.stride[0] = image_layout.rowPitch; m_DMA.stride[0] = image_layout.rowPitch;
m_FBID = drm_fbid_from_dmabuf( &g_DRM, nullptr, &m_DMA ); m_FBID = drm_fbid_from_dmabuf( &g_DRM, &m_DMA );
if ( m_FBID == 0 ) if ( m_FBID == 0 )
return false; return false;

View file

@ -529,7 +529,7 @@ import_commit ( struct wlr_buffer *buf, struct wlr_dmabuf_attributes *dmabuf, co
if ( BIsNested() == False ) if ( BIsNested() == False )
{ {
commit.fb_id = drm_fbid_from_dmabuf( &g_DRM, buf, dmabuf ); commit.fb_id = drm_fbid_from_dmabuf( &g_DRM, dmabuf );
assert( commit.fb_id != 0 ); assert( commit.fb_id != 0 );
} }