~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/frontends/omx/vid_omx_common.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#define Display void
38
38
#endif
39
39
 
 
40
#include "util/simple_mtx.h"
40
41
#include "util/u_thread.h"
41
42
#include "util/u_memory.h"
42
43
#include "loader/loader.h"
43
44
 
44
45
#include "vid_omx_common.h"
45
46
 
46
 
static mtx_t omx_lock = _MTX_INITIALIZER_NP;
 
47
static simple_mtx_t omx_lock = SIMPLE_MTX_INITIALIZER;
47
48
static Display *omx_display = NULL;
48
49
static struct vl_screen *omx_screen = NULL;
49
50
static unsigned omx_usecount = 0;
53
54
struct vl_screen *omx_get_screen(void)
54
55
{
55
56
   static bool first_time = true;
56
 
   mtx_lock(&omx_lock);
 
57
   simple_mtx_lock(&omx_lock);
57
58
 
58
59
   if (!omx_screen) {
59
60
      if (first_time) {
87
88
 
88
89
   ++omx_usecount;
89
90
 
90
 
   mtx_unlock(&omx_lock);
 
91
   simple_mtx_unlock(&omx_lock);
91
92
   return omx_screen;
92
93
 
93
94
error:
94
 
   mtx_unlock(&omx_lock);
 
95
   simple_mtx_unlock(&omx_lock);
95
96
   return NULL;
96
97
}
97
98
 
98
99
void omx_put_screen(void)
99
100
{
100
 
   mtx_lock(&omx_lock);
 
101
   simple_mtx_lock(&omx_lock);
101
102
   if ((--omx_usecount) == 0) {
102
103
      omx_screen->destroy(omx_screen);
103
104
      omx_screen = NULL;
107
108
      else
108
109
         XCloseDisplay(omx_display);
109
110
   }
110
 
   mtx_unlock(&omx_lock);
 
111
   simple_mtx_unlock(&omx_lock);
111
112
}